mex.extractors.open_data package¶
Subpackages¶
- mex.extractors.open_data.models package
- Submodules
- mex.extractors.open_data.models.source module
OpenDataCreatorsOrContributors
OpenDataFiles
OpenDataLicense
OpenDataMetadata
OpenDataMetadata.contributors
OpenDataMetadata.creators
OpenDataMetadata.description
OpenDataMetadata.keywords
OpenDataMetadata.language
OpenDataMetadata.license
OpenDataMetadata.model_computed_fields
OpenDataMetadata.model_config
OpenDataMetadata.model_fields
OpenDataMetadata.related_identifiers
OpenDataMetadata.title
OpenDataParentResource
OpenDataRelateditdentifiers
OpenDataResourceVersion
OpenDataResourceVersion.conceptrecid
OpenDataResourceVersion.created
OpenDataResourceVersion.doi_url
OpenDataResourceVersion.files
OpenDataResourceVersion.id
OpenDataResourceVersion.metadata
OpenDataResourceVersion.model_computed_fields
OpenDataResourceVersion.model_config
OpenDataResourceVersion.model_fields
OpenDataResourceVersion.modified
- Module contents
Submodules¶
mex.extractors.open_data.connector module¶
- class mex.extractors.open_data.connector.OpenDataConnector¶
Bases:
HTTPConnector
Connector class to handle requesting the Zenodo API.
- _set_url() None ¶
Set url of the host.
- get_oldest_resource_version(resource_id: int) OpenDataResourceVersion ¶
Load oldest (first) version of a resource by querying the Zenodo API.
- Parameters:
resource_id – id of any resource version
- Returns:
Zenodo resource version (oldest)
- get_parent_resources() Generator[OpenDataParentResource, None, None] ¶
Load parent resources by querying the Zenodo API.
Gets the parent resources (~ latest version) of all the resources of the configured Zenodo community.
- Returns:
Generator for parent resources
- get_resource_versions(resource_id: int) Generator[OpenDataResourceVersion, None, None] ¶
Load versions of different parent resources by querying the Zenodo API.
For a specific parent resource get all the versions of this resource. The Zenodo API doesn’t work by giving it the parent resource id (“conceptrecid”) but call it with the id (“id”) of any version of that parent resource and then ‘ask’ for the versions in general.
- Parameters:
resource_id – id of any resource version
- Returns:
Generator for Zenodo resource versions
mex.extractors.open_data.extract module¶
- mex.extractors.open_data.extract.extract_oldest_record_version(record_id: int) OpenDataResourceVersion ¶
Fetch only the oldest version of a parent resource.
- Returns:
OpenDataResourceVersion
- mex.extractors.open_data.extract.extract_parent_resources() Generator[OpenDataParentResource, None, None] ¶
Load Open Data resources by querying the Zenodo API.
Get all resources of the configured Zenodo community. These are called ‘parent resources’.
- Returns:
Generator for parent resources
- mex.extractors.open_data.extract.extract_resource_versions() Generator[OpenDataResourceVersion, None, None] ¶
Fetch all the versions of a parent resource.
- Returns:
Generator for OpenDataResourceVersion items
mex.extractors.open_data.main module¶
mex.extractors.open_data.settings module¶
- class mex.extractors.open_data.settings.OpenDataSettings(*, url: str = 'https://zenodo', community_rki: str = 'robertkochinstitut')¶
Bases:
BaseModel
Zenodo settings submodel definition for the Open Data extractor.
- community_rki: str¶
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'str_max_length': 100000, 'str_min_length': 1, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'community_rki': FieldInfo(annotation=str, required=False, default='robertkochinstitut', description='Zenodo communitiy of rki'), 'url': FieldInfo(annotation=str, required=False, default='https://zenodo', description='Zenodo instance URL')}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- url: str¶