facile_rs.utils.metadata.codemeta¶
Module Contents¶
Classes¶
A class for storing and manipulating metadata in the CodeMeta format |
Data¶
API¶
- logger = 'getLogger(...)'¶
- class CodemetaMetadata¶
A class for storing and manipulating metadata in the CodeMeta format
Initialization
Initialize metadata set as an empty dictionary.
- fetch(location)¶
Update metadata set with data fetched from a CodeMeta file
- Parameters:
location (str) – URL or path to the CodeMeta JSON file
- fetch_authors(locations)¶
Fetch authors from CodeMeta files and update metadata set
- Parameters:
locations – list of URL or paths to CodeMeta files
locations – list
- fetch_contributors(locations)¶
Fetch contributors from CodeMeta files and update metadata set
- Parameters:
locations – list of URL or paths to CodeMeta files
locations – list
- compute_names()¶
Add full name of authors and contributors in metadata set from given name and family name, under the dictionary key ‘name’.
- remove_doubles()¶
Remove duplicates in authors and contributors lists, comparing names (key: name), concatenation of keys givenName and familyName, and ids (key: @id).
- sort_persons()¶
Sort authors and contributors alphabetically based on family name.
- update_identifier(new_doi, new_archive_id='', archive_type=None, keep_previous_doi=False)¶
Update the id field and identifier list with a new DOI and archive ID (optional).
If keep_previous_doi is True, the previous DOI is kept in the Codemeta metadata in the field “isBasedOn”.
- Parameters:
new_doi (str) – new DOI to add (e.g., ‘10.5281/zenodo.1234567’)
new_archive_id (str) – new archive ID to add (e.g., RADAR ID or Zenodo ID)
archive_type (str or None) – type of the archive, e.g., ‘RADAR’ or ‘Zenodo’. If None, no archive ID is added.
keep_previous_doi (bool) – whether to keep previous DOI in the Codemeta metadata
- to_json()¶
Dump metadata set as JSON-formatted string.
- Returns:
metadata set as JSON-formatted string
- Return type:
str