Add Person#

Person#

metacatalog.api.add_person(session: Session, first_name: str, last_name: str, organisation_name: str = None, organisation_abbrev: str = None, affiliation: str = None, attribution: str = None, uuid: str = None) Person#

Add a new Person to the database. A person can be a real Person or an institution. Then, the institution name goes into the last_name column and first_name can actively be set to None. An affiliation can be added to both as a single string.

Parameters:
  • session (sqlalchemy.Session) – SQLAlchemy session connected to the database.

  • uuid (str) –

    An UUID version 4 to globally identify the person list. If you add a new person, do not set the UUID as a new UUID will be set.

  • first_name (str) – A real persons first name. If omitted, the ‘Person’ is assumed to be an institution

  • last_name (str) – A real persons last name. If first_name is NULL, last_name is assumed to be an institution.

  • organisation_name (str) –

    New in version 0.1.10.

    Optional, but highly_recommended if applicable. Name of the head institution, whithout department.

  • organisation_abbrev (str) –

    New in version 0.2.6.

    Optional, abbreviated version of the Institution. I.e. the famous Karlsruhe Institute of Technology is better known as ‘KIT’

  • affiliation (str) – Affiliation if applicable. Has to go into a single string of 1024 bytes. Full attribution including department and group name.

  • attribution (str.) – Optional. Attribution recommondation for all datasets this Person is associated to as a first author.

Returns:

entry – Entry instance of the added Person entity

Return type:

metacatalog.Person

See also

add_organisation

Add persons to entries#

metacatalog.api.add_persons_to_entries(session: Session, entries: List[Union[int, str, Entry]], persons: List[Union[int, str, Person]], roles: List[Union[int, str, PersonRole]], order: List[int]) None#

Add person(s) to entrie(s)

Adds associations between entries and persons. The Entry and Person instances have to already exist in the database. Each association has to further define the role of the person for the respective entry.

Parameters:
  • session (sqlalchemy.Session) – SQLAlchemy session connected to the database.

  • entries (list) – List of identifier or single identifier to load entries. If int, the Entry.id is assumed. If str, title is assumed. Can also pass a metacatalog.Entry object.

  • persons (list) – List of identifier or single identifier to load persons. If int, Person.id is assumed, If str, Person.last_name is assumed. Can also pass a metacatalog.Person object.

  • roles (list) – List of, or single role. The shape has to match the persons parameter. The role has to be identifies by id (int) or role name (str).

  • order (list) – List of, or single order. The shape has to match the persons parameter. The order gives the ascending order of contributors on the respecive entry (after the author).

Return type:

void

See also

metacatalog.Entry, metacatalog.Person, metacatalog.PersonRole