mex.common.types package¶
Submodules¶
mex.common.types.email module¶
- class mex.common.types.email.Email¶
Bases:
str
Email address of a person, organization or other entity.
mex.common.types.identifier module¶
- class mex.common.types.identifier.ExtractedAccessPlatformIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted access platforms.
- class mex.common.types.identifier.ExtractedActivityIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted activities.
- class mex.common.types.identifier.ExtractedBibliographicResourceIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted bibliographic resources.
- class mex.common.types.identifier.ExtractedConsentIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted consents.
- class mex.common.types.identifier.ExtractedContactPointIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted contact points.
- class mex.common.types.identifier.ExtractedDistributionIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted distributions.
- class mex.common.types.identifier.ExtractedIdentifier¶
Bases:
Identifier
Base class for all extracted identifiers.
- class mex.common.types.identifier.ExtractedOrganizationIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted organizations.
- class mex.common.types.identifier.ExtractedOrganizationalUnitIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted organizational units.
- class mex.common.types.identifier.ExtractedPersonIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted persons.
- class mex.common.types.identifier.ExtractedPrimarySourceIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted primary sources.
- class mex.common.types.identifier.ExtractedResourceIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted resources.
- class mex.common.types.identifier.ExtractedVariableGroupIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted variable groups.
- class mex.common.types.identifier.ExtractedVariableIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted variables.
- class mex.common.types.identifier.Identifier¶
Bases:
str
Common identifier class based on UUID version 4.
- classmethod generate(seed: int | None = None) Self ¶
Generate a new identifier from a seed or random UUID version 4.
- class mex.common.types.identifier.MergedAccessPlatformIdentifier¶
Bases:
MergedIdentifier
Identifier for merged access platforms.
- class mex.common.types.identifier.MergedActivityIdentifier¶
Bases:
MergedIdentifier
Identifier for merged activities.
- class mex.common.types.identifier.MergedBibliographicResourceIdentifier¶
Bases:
MergedIdentifier
Identifier for merged bibliographic resources.
- class mex.common.types.identifier.MergedConsentIdentifier¶
Bases:
MergedIdentifier
Identifier for merged consents.
- class mex.common.types.identifier.MergedContactPointIdentifier¶
Bases:
MergedIdentifier
Identifier for merged contact points.
- class mex.common.types.identifier.MergedDistributionIdentifier¶
Bases:
MergedIdentifier
Identifier for merged distributions.
- class mex.common.types.identifier.MergedIdentifier¶
Bases:
Identifier
Base class for all merged identifiers.
- class mex.common.types.identifier.MergedOrganizationIdentifier¶
Bases:
MergedIdentifier
Identifier for merged organizations.
- class mex.common.types.identifier.MergedOrganizationalUnitIdentifier¶
Bases:
MergedIdentifier
Identifier for merged organizational units.
- class mex.common.types.identifier.MergedPersonIdentifier¶
Bases:
MergedIdentifier
Identifier for merged persons.
- class mex.common.types.identifier.MergedPrimarySourceIdentifier¶
Bases:
MergedIdentifier
Identifier for merged primary sources.
- class mex.common.types.identifier.MergedResourceIdentifier¶
Bases:
MergedIdentifier
Identifier for merged resources.
- class mex.common.types.identifier.MergedVariableGroupIdentifier¶
Bases:
MergedIdentifier
Identifier for merged variable groups.
- class mex.common.types.identifier.MergedVariableIdentifier¶
Bases:
MergedIdentifier
Identifier for merged variables.
mex.common.types.identity module¶
mex.common.types.link module¶
- class mex.common.types.link.Link(*, language: LinkLanguage | None = None, title: str | None = None, url: Annotated[str, MinLen(min_length=1), _PydanticGeneralMetadata(pattern='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?')])¶
Bases:
BaseModel
Type class for Link objects.
Links can be parsed from nested JSON objects or from raw strings.
Example
Link(url=”http://foo.bar”) == Link.model_validate(”http://foo.bar”)
- language: LinkLanguage | None¶
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'language': FieldInfo(annotation=Union[LinkLanguage, NoneType], required=False, default=None), 'title': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'url': FieldInfo(annotation=str, required=True, examples=['https://hello-world.org', 'file://S:/OE/MF4/Projekte/MEx'], json_schema_extra={'format': 'uri'}, metadata=[MinLen(min_length=1), _PydanticGeneralMetadata(pattern='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?')])}¶
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.
- title: str | None¶
- url: *))?')])]¶
- classmethod validate_strings(value: Any) dict[str, Any] ¶
Convert string input to dictionary.
- class mex.common.types.link.LinkLanguage(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
StrEnum
Possible language tags for Link values.
- DE = 'de'¶
- EN = 'en'¶
- _generate_next_value_(start, count, last_values)¶
Return the lower-cased version of the member name.
mex.common.types.path module¶
- class mex.common.types.path.AssetsPath(path: str | Path | PathWrapper)¶
Bases:
PathWrapper
Custom path for settings that can be absolute or relative to assets_dir.
- class mex.common.types.path.PathWrapper(path: str | Path | PathWrapper)¶
Bases:
PathLike
[str
]Custom path for settings that can be absolute or relative to another setting.
- __init__(path: str | Path | PathWrapper) None ¶
Create a new resolved path instance.
- is_absolute() bool ¶
True if the underlying path is absolute.
- is_relative() bool ¶
True if the underlying path is relative.
- class mex.common.types.path.WorkPath(path: str | Path | PathWrapper)¶
Bases:
PathWrapper
Custom path for settings that can be absolute or relative to work_dir.
mex.common.types.sink module¶
mex.common.types.temporal_entity module¶
- class mex.common.types.temporal_entity.TemporalEntity(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.temporal_entity.TemporalEntity(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
object
Custom temporal entity with precision detection and timezone normalization.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.YEAR, TemporalEntityPrecision.MONTH, TemporalEntityPrecision.DAY, TemporalEntityPrecision.HOUR, TemporalEntityPrecision.MINUTE, TemporalEntityPrecision.SECOND, TemporalEntityPrecision.MICROSECOND]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2011', '2019-03', '2014-08-24', '2022-09-30T20:48:35Z']}¶
- STR_SCHEMA_PATTERN = '.*'¶
- __init__(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None) None ¶
- __init__(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None) None
Create a new temporal entity instance.
Can parse strings, dates, datetimes, other temporal entity objects or 0-7 integers for (year, month, day, hour, minute, second, ms).
For any argument, a precision level is derived. When a time component is given, tzinfo keyword with timezone information is accepted. When no timezone is given, “CET” is assumed. If the timezone is not “UTC”, the datetime is converted to “UTC”.
Examples
TemporalEntity(“May 2005”) TemporalEntity(“2002-04-01T23:59”) TemporalEntity(2009, 1) TemporalEntity(date(2009, 9, 30)) TemporalEntity(datetime(2009, 9, 30, 23, 59, 5, tzinfo=timezone(“CET”))) TemporalEntity(2009, 9, 30, 23, 59, 5, tzinfo=timezone(“CET”)) TemporalEntity(TemporalEntity(2000))
- static _parse_date(value: date) tuple[datetime, TemporalEntityPrecision] ¶
Parse a date and assume the precision is days.
- static _parse_datetime(value: datetime) tuple[datetime, TemporalEntityPrecision] ¶
Parse a datetime and assume the precision is microseconds.
- static _parse_integers(*args: int, tzinfo: tzinfo | None = None) tuple[datetime, TemporalEntityPrecision] ¶
Parse 0-7 integer arguments into a timestamp and deduct the precision.
- static _parse_string(value: str) tuple[datetime, TemporalEntityPrecision] ¶
Parse a string containing a temporal entity using pandas’ tslibs.
- static _parse_temporal_entity(value: TemporalEntity) tuple[datetime, TemporalEntityPrecision] ¶
Parse a temporal entity into a new one by copying its attributes.
- classmethod _validate_precision(precision: TemporalEntityPrecision) None ¶
Confirm that the temporal entity can handle the given precision.
- Parameters:
precision – a temporal entity precision
- Raises:
ValueError – If the given precision is not covered by the temporal entity.
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.temporal_entity.TemporalEntityPrecision(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Precision levels that are allowed for temporal entity fields.
- DAY = 'day'¶
- HOUR = 'hour'¶
- MICROSECOND = 'microsecond'¶
- MINUTE = 'minute'¶
- MONTH = 'month'¶
- SECOND = 'second'¶
- YEAR = 'year'¶
- class mex.common.types.temporal_entity.Year(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.temporal_entity.Year(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with year-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.YEAR]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2024']}¶
- STR_SCHEMA_PATTERN = '^\\d{4}$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.temporal_entity.YearMonth(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.temporal_entity.YearMonth(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with month-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.MONTH]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2019-03']}¶
- STR_SCHEMA_PATTERN = '\\d{4}-(?:0[1-9]|1[0-2])$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.temporal_entity.YearMonthDay(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.temporal_entity.YearMonthDay(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with day-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.DAY]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2014-08-24']}¶
- STR_SCHEMA_PATTERN = '^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.temporal_entity.YearMonthDayTime(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.temporal_entity.YearMonthDayTime(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with time-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.HOUR, TemporalEntityPrecision.MINUTE, TemporalEntityPrecision.SECOND, TemporalEntityPrecision.MICROSECOND]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2022-09-30T20:48:35Z']}¶
- STR_SCHEMA_PATTERN = '^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]Z$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
mex.common.types.text module¶
- class mex.common.types.text.Text(*, value: Annotated[str, MinLen(min_length=1)], language: TextLanguage | None = None)¶
Bases:
BaseModel
Type class for text objects.
Texts can be parsed from nested JSON objects or from raw strings.
Example
Text(value=”foo”) == Text.model_validate(“foo”)
- classmethod detect_language(values: dict[str, Any]) dict[str, Any] ¶
Detect the language of the text if not explicitly given.
- language: TextLanguage | None¶
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'language': FieldInfo(annotation=Union[TextLanguage, NoneType], required=False, default=None), 'value': FieldInfo(annotation=str, required=True, metadata=[MinLen(min_length=1)])}¶
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.
- classmethod validate_strings(value: Any) dict[str, Any] ¶
Convert string input to dictionary.
- value: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]¶
- class mex.common.types.text.TextLanguage(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
StrEnum
Possible language tags for Text values.
- DE = 'de'¶
- EN = 'en'¶
- _generate_next_value_(start, count, last_values)¶
Return the lower-cased version of the member name.
mex.common.types.vocabulary module¶
- class mex.common.types.vocabulary.APIType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Technical standard or style of a network API.
- GRAPHQL = 'https://mex.rki.de/item/api-type-6'¶
- OTHER = 'https://mex.rki.de/item/api-type-7'¶
- PROPRIETARY = 'https://mex.rki.de/item/api-type-4'¶
- REST = 'https://mex.rki.de/item/api-type-1'¶
- RPC = 'https://mex.rki.de/item/api-type-5'¶
- SOAP = 'https://mex.rki.de/item/api-type-2'¶
- SPARQL_ENDPOINT = 'https://mex.rki.de/item/api-type-3'¶
- class mex.common.types.vocabulary.AccessRestriction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The access restriction type.
- OPEN = 'https://mex.rki.de/item/access-restriction-1'¶
- RESTRICTED = 'https://mex.rki.de/item/access-restriction-2'¶
- class mex.common.types.vocabulary.ActivityType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The activity type.
- INTERNAL_PROJECT_ENDEAVOR = 'https://mex.rki.de/item/activity-type-3'¶
- OTHER = 'https://mex.rki.de/item/activity-type-6'¶
- THIRD_PARTY_FUNDED_PROJECT = 'https://mex.rki.de/item/activity-type-1'¶
- class mex.common.types.vocabulary.AnonymizationPseudonymization(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Whether the resource is anonymized/pseudonymized.
- ANONYMIZED = 'https://mex.rki.de/item/anonymization-pseudonymization-1'¶
- PSEUDONYMIZED = 'https://mex.rki.de/item/anonymization-pseudonymization-2'¶
- class mex.common.types.vocabulary.BibliographicResourceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The type of a bibliographic resource.
- BERICHT = 'https://mex.rki.de/item/bibliographic-resource-type-12'¶
- BOOK = 'https://mex.rki.de/item/bibliographic-resource-type-1'¶
- BOOK_CHAPTER = 'https://mex.rki.de/item/bibliographic-resource-type-2'¶
- CONFERENCE_PAPER = 'https://mex.rki.de/item/bibliographic-resource-type-3'¶
- DOCTORAL_THESIS = 'https://mex.rki.de/item/bibliographic-resource-type-4'¶
- HABILITATION_THESIS = 'https://mex.rki.de/item/bibliographic-resource-type-5'¶
- JOURNAL = 'https://mex.rki.de/item/bibliographic-resource-type-6'¶
- JOURNAL_ARTICLE = 'https://mex.rki.de/item/bibliographic-resource-type-7'¶
- OTHER = 'https://mex.rki.de/item/bibliographic-resource-type-8'¶
- POSTER = 'https://mex.rki.de/item/bibliographic-resource-type-9'¶
- PREPRINT = 'https://mex.rki.de/item/bibliographic-resource-type-10'¶
- PRESENTATION = 'https://mex.rki.de/item/bibliographic-resource-type-11'¶
- SEMINAR_PAPER = 'https://mex.rki.de/item/bibliographic-resource-type-13'¶
- THESIS = 'https://mex.rki.de/item/bibliographic-resource-type-14'¶
- class mex.common.types.vocabulary.BilingualText(*, de: str | None = None, en: str | None = None)¶
Bases:
BaseModel
String-field translated in German and English.
- de: str | None¶
- en: str | None¶
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'de': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'en': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}¶
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.
- class mex.common.types.vocabulary.Concept(*, identifier: Url, inScheme: Url, prefLabel: BilingualText, altLabel: BilingualText | None = None, definition: BilingualText | None = None)¶
Bases:
BaseModel
Single entry in a vocabulary with stable ID, labels and definition.
- altLabel: BilingualText | None¶
- definition: BilingualText | None¶
- identifier: Url¶
- inScheme: Url¶
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'altLabel': FieldInfo(annotation=Union[BilingualText, NoneType], required=False, default=None), 'definition': FieldInfo(annotation=Union[BilingualText, NoneType], required=False, default=None), 'identifier': FieldInfo(annotation=Url, required=True), 'inScheme': FieldInfo(annotation=Url, required=True), 'prefLabel': FieldInfo(annotation=BilingualText, required=True)}¶
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.
- prefLabel: BilingualText¶
- class mex.common.types.vocabulary.ConsentStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The status of a consent.
- INVALID_FOR_PROCESSING = 'https://mex.rki.de/item/consent-status-1'¶
- VALID_FOR_PROCESSING = 'https://mex.rki.de/item/consent-status-2'¶
- class mex.common.types.vocabulary.ConsentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The type of a consent.
- EXPRESSED_CONSENT = 'https://mex.rki.de/item/consent-type-2'¶
- IMPLIED_CONSENT = 'https://mex.rki.de/item/consent-type-1'¶
- class mex.common.types.vocabulary.DataProcessingState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Type for state of data processing.
- AGGREGATED = 'https://mex.rki.de/item/data-processing-state-3'¶
- NORMALIZED = 'https://mex.rki.de/item/data-processing-state-5'¶
- PLAUSIBILITY_CHECKED = 'https://mex.rki.de/item/data-processing-state-4'¶
- RAW_DATA = 'https://mex.rki.de/item/data-processing-state-1'¶
- SECONDARY_DATA = 'https://mex.rki.de/item/data-processing-state-2'¶
- class mex.common.types.vocabulary.Frequency(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Frequency type.
- ANNUAL = 'https://mex.rki.de/item/frequency-3'¶
- BIENNIAL = 'https://mex.rki.de/item/frequency-2'¶
- BIMONTHLY = 'https://mex.rki.de/item/frequency-7'¶
- BIWEEKLY = 'https://mex.rki.de/item/frequency-10'¶
- CONTINUOUS = 'https://mex.rki.de/item/frequency-16'¶
- DAILY = 'https://mex.rki.de/item/frequency-15'¶
- IRREGULAR = 'https://mex.rki.de/item/frequency-17'¶
- MONTHLY = 'https://mex.rki.de/item/frequency-8'¶
- QUARTERLY = 'https://mex.rki.de/item/frequency-6'¶
- SEMIANNUAL = 'https://mex.rki.de/item/frequency-4'¶
- SEMIMONTHLY = 'https://mex.rki.de/item/frequency-9'¶
- SEMIWEEKLY = 'https://mex.rki.de/item/frequency-13'¶
- THREE_TIMES_A_MONTH = 'https://mex.rki.de/item/frequency-11'¶
- THREE_TIMES_A_YEAR = 'https://mex.rki.de/item/frequency-5'¶
- THREE_TIME_A_WEEK = 'https://mex.rki.de/item/frequency-14'¶
- TRIENNIAL = 'https://mex.rki.de/item/frequency-1'¶
- WEEKLY = 'https://mex.rki.de/item/frequency-12'¶
- class mex.common.types.vocabulary.Language(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Language type.
- ENGLISH = 'https://mex.rki.de/item/language-2'¶
- FRENCH = 'https://mex.rki.de/item/language-3'¶
- GERMAN = 'https://mex.rki.de/item/language-1'¶
- class mex.common.types.vocabulary.License(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
License type.
- CREATIVE_COMMONS_ATTRIBUTION_INTERNATIONAL = 'https://mex.rki.de/item/license-1'¶
- class mex.common.types.vocabulary.MIMEType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The mime type.
- ATOM = 'https://mex.rki.de/item/mime-type-9'¶
- CSV = 'https://mex.rki.de/item/mime-type-7'¶
- DOCX = 'https://mex.rki.de/item/mime-type-1'¶
- FASTQ = 'https://mex.rki.de/item/mime-type-12'¶
- MHTML = 'https://mex.rki.de/item/mime-type-6'¶
- PDF = 'https://mex.rki.de/item/mime-type-4'¶
- PPTX = 'https://mex.rki.de/item/mime-type-3'¶
- SAS = 'https://mex.rki.de/item/mime-type-10'¶
- STATA = 'https://mex.rki.de/item/mime-type-11'¶
- TIFF = 'https://mex.rki.de/item/mime-type-5'¶
- XLSX = 'https://mex.rki.de/item/mime-type-2'¶
- XML = 'https://mex.rki.de/item/mime-type-8'¶
- class mex.common.types.vocabulary.PersonalData(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Classification of personal data.
- NO_PERSONAL_DATA = 'https://mex.rki.de/item/personal-data-2'¶
- PERSONAL_DATA = 'https://mex.rki.de/item/personal-data-1'¶
- class mex.common.types.vocabulary.ResourceCreationMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The creation method of a resource.
- LABORATORY_TESTS = 'https://mex.rki.de/item/resource-creation-method-4'¶
- MODELS_AND_SIMULATIONS = 'https://mex.rki.de/item/resource-creation-method-7'¶
- OTHER = 'https://mex.rki.de/item/resource-creation-method-1'¶
- REGISTRY = 'https://mex.rki.de/item/resource-creation-method-6'¶
- SEQUENCING = 'https://mex.rki.de/item/resource-creation-method-5'¶
- STUDIES_SURVEYS_AND_INTERVIEWS = 'https://mex.rki.de/item/resource-creation-method-2'¶
- SURVEILLANCE = 'https://mex.rki.de/item/resource-creation-method-3'¶
- class mex.common.types.vocabulary.ResourceTypeGeneral(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The general type of a resource.
- DATASET = 'https://mex.rki.de/item/resource-type-general-14'¶
- DATA_COLLECTION = 'https://mex.rki.de/item/resource-type-general-13'¶
- IMAGE = 'https://mex.rki.de/item/resource-type-general-16'¶
- OTHER = 'https://mex.rki.de/item/resource-type-general-18'¶
- SAMPLES = 'https://mex.rki.de/item/resource-type-general-2'¶
- SOFTWARE_CODE = 'https://mex.rki.de/item/resource-type-general-17'¶
- TEXT = 'https://mex.rki.de/item/resource-type-general-15'¶
- class mex.common.types.vocabulary.TechnicalAccessibility(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Technical accessibility within RKI and outside of RKI.
- EXTERNAL = 'https://mex.rki.de/item/technical-accessibility-2'¶
- INTERNAL = 'https://mex.rki.de/item/technical-accessibility-1'¶
- class mex.common.types.vocabulary.Theme(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The theme type.
- ANIMAL_EXPERIMENTAL_RESEARCH_AND_R = 'https://mex.rki.de/item/theme-24'¶
- ARTIFICIAL_INTELLIGENCE_AND_MACHINE_LEARNING = 'https://mex.rki.de/item/theme-25'¶
- BIOINFORMATICS_AND_SYSTEMS_BIOLOGY = 'https://mex.rki.de/item/theme-23'¶
- BIOLOGICAL_TOXIN_RESEARCH_AND_DIAGNOSTICS = 'https://mex.rki.de/item/theme-22'¶
- GENERAL_MICROBIOLOGY_AND_MOLECULAR_BIOLOGY = 'https://mex.rki.de/item/theme-21'¶
- INFECTIOUS_DISEASES_AND_EPIDEMIOLOGY = 'https://mex.rki.de/item/theme-11'¶
- INTERNATIONAL_HEALTH_PROTECTION = 'https://mex.rki.de/item/theme-37'¶
- NON_COMMUNICABLE_DISEASES_AND_HEALTH_SURVEILLANCE = 'https://mex.rki.de/item/theme-36'¶
- PATHOGENESIS_RESEARCH_AND_DIAGNOSTIC_DEVELOPMENT = 'https://mex.rki.de/item/theme-20'¶
- PUBLIC_HEALTH = 'https://mex.rki.de/item/theme-1'¶
- class mex.common.types.vocabulary.VocabularyEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Base class for vocabulary enums that sets the correct metaclass.
- classmethod find(search_term: str | Text) Self | None ¶
Get the enum instance that matches a label of the underlying concepts.
The given search_term can be string or a Text with an optional language setting to narrow down the search fields. The prefLabel and altLabel of the concepts which were used to create this vocabulary are searched for exact matches to the search_term.
- Parameters:
search_term – String or Text to look for
- Returns:
Enum instance for the found concept or None
- class mex.common.types.vocabulary.VocabularyLoader(name: str, bases: tuple[type], dct: _EnumDict)¶
Bases:
EnumType
Metaclass to load names and values from a JSON file and create a dynamic enum.
- mex.common.types.vocabulary.split_to_caps(string: str) str ¶
Convert the given string from Split case into CAPS_CASE.
Module contents¶
- class mex.common.types.APIType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Technical standard or style of a network API.
- GRAPHQL = 'https://mex.rki.de/item/api-type-6'¶
- OTHER = 'https://mex.rki.de/item/api-type-7'¶
- PROPRIETARY = 'https://mex.rki.de/item/api-type-4'¶
- REST = 'https://mex.rki.de/item/api-type-1'¶
- RPC = 'https://mex.rki.de/item/api-type-5'¶
- SOAP = 'https://mex.rki.de/item/api-type-2'¶
- SPARQL_ENDPOINT = 'https://mex.rki.de/item/api-type-3'¶
- class mex.common.types.AccessRestriction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The access restriction type.
- OPEN = 'https://mex.rki.de/item/access-restriction-1'¶
- RESTRICTED = 'https://mex.rki.de/item/access-restriction-2'¶
- class mex.common.types.ActivityType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The activity type.
- INTERNAL_PROJECT_ENDEAVOR = 'https://mex.rki.de/item/activity-type-3'¶
- OTHER = 'https://mex.rki.de/item/activity-type-6'¶
- THIRD_PARTY_FUNDED_PROJECT = 'https://mex.rki.de/item/activity-type-1'¶
- class mex.common.types.AnonymizationPseudonymization(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Whether the resource is anonymized/pseudonymized.
- ANONYMIZED = 'https://mex.rki.de/item/anonymization-pseudonymization-1'¶
- PSEUDONYMIZED = 'https://mex.rki.de/item/anonymization-pseudonymization-2'¶
- class mex.common.types.AssetsPath(path: str | Path | PathWrapper)¶
Bases:
PathWrapper
Custom path for settings that can be absolute or relative to assets_dir.
- class mex.common.types.BibliographicResourceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The type of a bibliographic resource.
- BERICHT = 'https://mex.rki.de/item/bibliographic-resource-type-12'¶
- BOOK = 'https://mex.rki.de/item/bibliographic-resource-type-1'¶
- BOOK_CHAPTER = 'https://mex.rki.de/item/bibliographic-resource-type-2'¶
- CONFERENCE_PAPER = 'https://mex.rki.de/item/bibliographic-resource-type-3'¶
- DOCTORAL_THESIS = 'https://mex.rki.de/item/bibliographic-resource-type-4'¶
- HABILITATION_THESIS = 'https://mex.rki.de/item/bibliographic-resource-type-5'¶
- JOURNAL = 'https://mex.rki.de/item/bibliographic-resource-type-6'¶
- JOURNAL_ARTICLE = 'https://mex.rki.de/item/bibliographic-resource-type-7'¶
- OTHER = 'https://mex.rki.de/item/bibliographic-resource-type-8'¶
- POSTER = 'https://mex.rki.de/item/bibliographic-resource-type-9'¶
- PREPRINT = 'https://mex.rki.de/item/bibliographic-resource-type-10'¶
- PRESENTATION = 'https://mex.rki.de/item/bibliographic-resource-type-11'¶
- SEMINAR_PAPER = 'https://mex.rki.de/item/bibliographic-resource-type-13'¶
- THESIS = 'https://mex.rki.de/item/bibliographic-resource-type-14'¶
- class mex.common.types.ConsentStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The status of a consent.
- INVALID_FOR_PROCESSING = 'https://mex.rki.de/item/consent-status-1'¶
- VALID_FOR_PROCESSING = 'https://mex.rki.de/item/consent-status-2'¶
- class mex.common.types.ConsentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The type of a consent.
- EXPRESSED_CONSENT = 'https://mex.rki.de/item/consent-type-2'¶
- IMPLIED_CONSENT = 'https://mex.rki.de/item/consent-type-1'¶
- class mex.common.types.DataProcessingState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Type for state of data processing.
- AGGREGATED = 'https://mex.rki.de/item/data-processing-state-3'¶
- NORMALIZED = 'https://mex.rki.de/item/data-processing-state-5'¶
- PLAUSIBILITY_CHECKED = 'https://mex.rki.de/item/data-processing-state-4'¶
- RAW_DATA = 'https://mex.rki.de/item/data-processing-state-1'¶
- SECONDARY_DATA = 'https://mex.rki.de/item/data-processing-state-2'¶
- class mex.common.types.Email¶
Bases:
str
Email address of a person, organization or other entity.
- class mex.common.types.ExtractedAccessPlatformIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted access platforms.
- class mex.common.types.ExtractedActivityIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted activities.
- class mex.common.types.ExtractedBibliographicResourceIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted bibliographic resources.
- class mex.common.types.ExtractedConsentIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted consents.
- class mex.common.types.ExtractedContactPointIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted contact points.
- class mex.common.types.ExtractedDistributionIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted distributions.
- class mex.common.types.ExtractedIdentifier¶
Bases:
Identifier
Base class for all extracted identifiers.
- class mex.common.types.ExtractedOrganizationIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted organizations.
- class mex.common.types.ExtractedOrganizationalUnitIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted organizational units.
- class mex.common.types.ExtractedPersonIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted persons.
- class mex.common.types.ExtractedPrimarySourceIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted primary sources.
- class mex.common.types.ExtractedResourceIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted resources.
- class mex.common.types.ExtractedVariableGroupIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted variable groups.
- class mex.common.types.ExtractedVariableIdentifier¶
Bases:
ExtractedIdentifier
Identifier for extracted variables.
- class mex.common.types.Frequency(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Frequency type.
- ANNUAL = 'https://mex.rki.de/item/frequency-3'¶
- BIENNIAL = 'https://mex.rki.de/item/frequency-2'¶
- BIMONTHLY = 'https://mex.rki.de/item/frequency-7'¶
- BIWEEKLY = 'https://mex.rki.de/item/frequency-10'¶
- CONTINUOUS = 'https://mex.rki.de/item/frequency-16'¶
- DAILY = 'https://mex.rki.de/item/frequency-15'¶
- IRREGULAR = 'https://mex.rki.de/item/frequency-17'¶
- MONTHLY = 'https://mex.rki.de/item/frequency-8'¶
- QUARTERLY = 'https://mex.rki.de/item/frequency-6'¶
- SEMIANNUAL = 'https://mex.rki.de/item/frequency-4'¶
- SEMIMONTHLY = 'https://mex.rki.de/item/frequency-9'¶
- SEMIWEEKLY = 'https://mex.rki.de/item/frequency-13'¶
- THREE_TIMES_A_MONTH = 'https://mex.rki.de/item/frequency-11'¶
- THREE_TIMES_A_YEAR = 'https://mex.rki.de/item/frequency-5'¶
- THREE_TIME_A_WEEK = 'https://mex.rki.de/item/frequency-14'¶
- TRIENNIAL = 'https://mex.rki.de/item/frequency-1'¶
- WEEKLY = 'https://mex.rki.de/item/frequency-12'¶
- class mex.common.types.Identifier¶
Bases:
str
Common identifier class based on UUID version 4.
- classmethod generate(seed: int | None = None) Self ¶
Generate a new identifier from a seed or random UUID version 4.
- class mex.common.types.IdentityProvider(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Choice of available identity providers.
- MEMORY = 'memory'¶
- class mex.common.types.Language(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Language type.
- ENGLISH = 'https://mex.rki.de/item/language-2'¶
- FRENCH = 'https://mex.rki.de/item/language-3'¶
- GERMAN = 'https://mex.rki.de/item/language-1'¶
- class mex.common.types.License(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
License type.
- CREATIVE_COMMONS_ATTRIBUTION_INTERNATIONAL = 'https://mex.rki.de/item/license-1'¶
- class mex.common.types.Link(*, language: LinkLanguage | None = None, title: str | None = None, url: Annotated[str, MinLen(min_length=1), _PydanticGeneralMetadata(pattern='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?')])¶
Bases:
BaseModel
Type class for Link objects.
Links can be parsed from nested JSON objects or from raw strings.
Example
Link(url=”http://foo.bar”) == Link.model_validate(”http://foo.bar”)
- language: LinkLanguage | None¶
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'language': FieldInfo(annotation=Union[LinkLanguage, NoneType], required=False, default=None), 'title': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'url': FieldInfo(annotation=str, required=True, examples=['https://hello-world.org', 'file://S:/OE/MF4/Projekte/MEx'], json_schema_extra={'format': 'uri'}, metadata=[MinLen(min_length=1), _PydanticGeneralMetadata(pattern='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?')])}¶
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.
- title: str | None¶
- url: *))?')])]¶
- classmethod validate_strings(value: Any) dict[str, Any] ¶
Convert string input to dictionary.
- class mex.common.types.LinkLanguage(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
StrEnum
Possible language tags for Link values.
- DE = 'de'¶
- EN = 'en'¶
- _generate_next_value_(start, count, last_values)¶
Return the lower-cased version of the member name.
- mex.common.types.LiteralStringType¶
alias of
_LiteralGenericAlias
- class mex.common.types.MIMEType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The mime type.
- ATOM = 'https://mex.rki.de/item/mime-type-9'¶
- CSV = 'https://mex.rki.de/item/mime-type-7'¶
- DOCX = 'https://mex.rki.de/item/mime-type-1'¶
- FASTQ = 'https://mex.rki.de/item/mime-type-12'¶
- MHTML = 'https://mex.rki.de/item/mime-type-6'¶
- PDF = 'https://mex.rki.de/item/mime-type-4'¶
- PPTX = 'https://mex.rki.de/item/mime-type-3'¶
- SAS = 'https://mex.rki.de/item/mime-type-10'¶
- STATA = 'https://mex.rki.de/item/mime-type-11'¶
- TIFF = 'https://mex.rki.de/item/mime-type-5'¶
- XLSX = 'https://mex.rki.de/item/mime-type-2'¶
- XML = 'https://mex.rki.de/item/mime-type-8'¶
- class mex.common.types.MergedAccessPlatformIdentifier¶
Bases:
MergedIdentifier
Identifier for merged access platforms.
- class mex.common.types.MergedActivityIdentifier¶
Bases:
MergedIdentifier
Identifier for merged activities.
- class mex.common.types.MergedBibliographicResourceIdentifier¶
Bases:
MergedIdentifier
Identifier for merged bibliographic resources.
- class mex.common.types.MergedConsentIdentifier¶
Bases:
MergedIdentifier
Identifier for merged consents.
- class mex.common.types.MergedContactPointIdentifier¶
Bases:
MergedIdentifier
Identifier for merged contact points.
- class mex.common.types.MergedDistributionIdentifier¶
Bases:
MergedIdentifier
Identifier for merged distributions.
- class mex.common.types.MergedIdentifier¶
Bases:
Identifier
Base class for all merged identifiers.
- class mex.common.types.MergedOrganizationIdentifier¶
Bases:
MergedIdentifier
Identifier for merged organizations.
- class mex.common.types.MergedOrganizationalUnitIdentifier¶
Bases:
MergedIdentifier
Identifier for merged organizational units.
- class mex.common.types.MergedPersonIdentifier¶
Bases:
MergedIdentifier
Identifier for merged persons.
- class mex.common.types.MergedPrimarySourceIdentifier¶
Bases:
MergedIdentifier
Identifier for merged primary sources.
- class mex.common.types.MergedResourceIdentifier¶
Bases:
MergedIdentifier
Identifier for merged resources.
- class mex.common.types.MergedVariableGroupIdentifier¶
Bases:
MergedIdentifier
Identifier for merged variable groups.
- class mex.common.types.MergedVariableIdentifier¶
Bases:
MergedIdentifier
Identifier for merged variables.
- class mex.common.types.PathWrapper(path: str | Path | PathWrapper)¶
Bases:
PathLike
[str
]Custom path for settings that can be absolute or relative to another setting.
- __init__(path: str | Path | PathWrapper) None ¶
Create a new resolved path instance.
- is_absolute() bool ¶
True if the underlying path is absolute.
- is_relative() bool ¶
True if the underlying path is relative.
- class mex.common.types.PersonalData(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Classification of personal data.
- NO_PERSONAL_DATA = 'https://mex.rki.de/item/personal-data-2'¶
- PERSONAL_DATA = 'https://mex.rki.de/item/personal-data-1'¶
- class mex.common.types.ResourceCreationMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The creation method of a resource.
- LABORATORY_TESTS = 'https://mex.rki.de/item/resource-creation-method-4'¶
- MODELS_AND_SIMULATIONS = 'https://mex.rki.de/item/resource-creation-method-7'¶
- OTHER = 'https://mex.rki.de/item/resource-creation-method-1'¶
- REGISTRY = 'https://mex.rki.de/item/resource-creation-method-6'¶
- SEQUENCING = 'https://mex.rki.de/item/resource-creation-method-5'¶
- STUDIES_SURVEYS_AND_INTERVIEWS = 'https://mex.rki.de/item/resource-creation-method-2'¶
- SURVEILLANCE = 'https://mex.rki.de/item/resource-creation-method-3'¶
- class mex.common.types.ResourceTypeGeneral(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The general type of a resource.
- DATASET = 'https://mex.rki.de/item/resource-type-general-14'¶
- DATA_COLLECTION = 'https://mex.rki.de/item/resource-type-general-13'¶
- IMAGE = 'https://mex.rki.de/item/resource-type-general-16'¶
- OTHER = 'https://mex.rki.de/item/resource-type-general-18'¶
- SAMPLES = 'https://mex.rki.de/item/resource-type-general-2'¶
- SOFTWARE_CODE = 'https://mex.rki.de/item/resource-type-general-17'¶
- TEXT = 'https://mex.rki.de/item/resource-type-general-15'¶
- class mex.common.types.Sink(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Configuration to choose where to send outbound data.
- BACKEND = 'backend'¶
- GRAPH = 'graph'¶
- NDJSON = 'ndjson'¶
- class mex.common.types.TechnicalAccessibility(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
Technical accessibility within RKI and outside of RKI.
- EXTERNAL = 'https://mex.rki.de/item/technical-accessibility-2'¶
- INTERNAL = 'https://mex.rki.de/item/technical-accessibility-1'¶
- class mex.common.types.TemporalEntity(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.TemporalEntity(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
object
Custom temporal entity with precision detection and timezone normalization.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.YEAR, TemporalEntityPrecision.MONTH, TemporalEntityPrecision.DAY, TemporalEntityPrecision.HOUR, TemporalEntityPrecision.MINUTE, TemporalEntityPrecision.SECOND, TemporalEntityPrecision.MICROSECOND]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2011', '2019-03', '2014-08-24', '2022-09-30T20:48:35Z']}¶
- STR_SCHEMA_PATTERN = '.*'¶
- __init__(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None) None ¶
- __init__(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None) None
Create a new temporal entity instance.
Can parse strings, dates, datetimes, other temporal entity objects or 0-7 integers for (year, month, day, hour, minute, second, ms).
For any argument, a precision level is derived. When a time component is given, tzinfo keyword with timezone information is accepted. When no timezone is given, “CET” is assumed. If the timezone is not “UTC”, the datetime is converted to “UTC”.
Examples
TemporalEntity(“May 2005”) TemporalEntity(“2002-04-01T23:59”) TemporalEntity(2009, 1) TemporalEntity(date(2009, 9, 30)) TemporalEntity(datetime(2009, 9, 30, 23, 59, 5, tzinfo=timezone(“CET”))) TemporalEntity(2009, 9, 30, 23, 59, 5, tzinfo=timezone(“CET”)) TemporalEntity(TemporalEntity(2000))
- static _parse_date(value: date) tuple[datetime, TemporalEntityPrecision] ¶
Parse a date and assume the precision is days.
- static _parse_datetime(value: datetime) tuple[datetime, TemporalEntityPrecision] ¶
Parse a datetime and assume the precision is microseconds.
- static _parse_integers(*args: int, tzinfo: tzinfo | None = None) tuple[datetime, TemporalEntityPrecision] ¶
Parse 0-7 integer arguments into a timestamp and deduct the precision.
- static _parse_string(value: str) tuple[datetime, TemporalEntityPrecision] ¶
Parse a string containing a temporal entity using pandas’ tslibs.
- static _parse_temporal_entity(value: TemporalEntity) tuple[datetime, TemporalEntityPrecision] ¶
Parse a temporal entity into a new one by copying its attributes.
- classmethod _validate_precision(precision: TemporalEntityPrecision) None ¶
Confirm that the temporal entity can handle the given precision.
- Parameters:
precision – a temporal entity precision
- Raises:
ValueError – If the given precision is not covered by the temporal entity.
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.TemporalEntityPrecision(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Precision levels that are allowed for temporal entity fields.
- DAY = 'day'¶
- HOUR = 'hour'¶
- MICROSECOND = 'microsecond'¶
- MINUTE = 'minute'¶
- MONTH = 'month'¶
- SECOND = 'second'¶
- YEAR = 'year'¶
- class mex.common.types.Text(*, value: Annotated[str, MinLen(min_length=1)], language: TextLanguage | None = None)¶
Bases:
BaseModel
Type class for text objects.
Texts can be parsed from nested JSON objects or from raw strings.
Example
Text(value=”foo”) == Text.model_validate(“foo”)
- classmethod detect_language(values: dict[str, Any]) dict[str, Any] ¶
Detect the language of the text if not explicitly given.
- language: TextLanguage | None¶
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'language': FieldInfo(annotation=Union[TextLanguage, NoneType], required=False, default=None), 'value': FieldInfo(annotation=str, required=True, metadata=[MinLen(min_length=1)])}¶
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.
- classmethod validate_strings(value: Any) dict[str, Any] ¶
Convert string input to dictionary.
- value: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]¶
- class mex.common.types.TextLanguage(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
StrEnum
Possible language tags for Text values.
- DE = 'de'¶
- EN = 'en'¶
- _generate_next_value_(start, count, last_values)¶
Return the lower-cased version of the member name.
- class mex.common.types.Theme(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
VocabularyEnum
The theme type.
- ANIMAL_EXPERIMENTAL_RESEARCH_AND_R = 'https://mex.rki.de/item/theme-24'¶
- ARTIFICIAL_INTELLIGENCE_AND_MACHINE_LEARNING = 'https://mex.rki.de/item/theme-25'¶
- BIOINFORMATICS_AND_SYSTEMS_BIOLOGY = 'https://mex.rki.de/item/theme-23'¶
- BIOLOGICAL_TOXIN_RESEARCH_AND_DIAGNOSTICS = 'https://mex.rki.de/item/theme-22'¶
- GENERAL_MICROBIOLOGY_AND_MOLECULAR_BIOLOGY = 'https://mex.rki.de/item/theme-21'¶
- INFECTIOUS_DISEASES_AND_EPIDEMIOLOGY = 'https://mex.rki.de/item/theme-11'¶
- INTERNATIONAL_HEALTH_PROTECTION = 'https://mex.rki.de/item/theme-37'¶
- NON_COMMUNICABLE_DISEASES_AND_HEALTH_SURVEILLANCE = 'https://mex.rki.de/item/theme-36'¶
- PATHOGENESIS_RESEARCH_AND_DIAGNOSTIC_DEVELOPMENT = 'https://mex.rki.de/item/theme-20'¶
- PUBLIC_HEALTH = 'https://mex.rki.de/item/theme-1'¶
- class mex.common.types.VocabularyEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Base class for vocabulary enums that sets the correct metaclass.
- classmethod find(search_term: str | Text) Self | None ¶
Get the enum instance that matches a label of the underlying concepts.
The given search_term can be string or a Text with an optional language setting to narrow down the search fields. The prefLabel and altLabel of the concepts which were used to create this vocabulary are searched for exact matches to the search_term.
- Parameters:
search_term – String or Text to look for
- Returns:
Enum instance for the found concept or None
- class mex.common.types.VocabularyLoader(name: str, bases: tuple[type], dct: _EnumDict)¶
Bases:
EnumType
Metaclass to load names and values from a JSON file and create a dynamic enum.
- class mex.common.types.WorkPath(path: str | Path | PathWrapper)¶
Bases:
PathWrapper
Custom path for settings that can be absolute or relative to work_dir.
- class mex.common.types.Year(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.Year(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with year-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.YEAR]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2024']}¶
- STR_SCHEMA_PATTERN = '^\\d{4}$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.YearMonth(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.YearMonth(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with month-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.MONTH]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2019-03']}¶
- STR_SCHEMA_PATTERN = '\\d{4}-(?:0[1-9]|1[0-2])$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.YearMonthDay(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.YearMonthDay(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with day-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.DAY]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2014-08-24']}¶
- STR_SCHEMA_PATTERN = '^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- class mex.common.types.YearMonthDayTime(*args: str | date | datetime | TemporalEntity, precision: TemporalEntityPrecision | None = None, tzinfo: Literal[None] = None)¶
- class mex.common.types.YearMonthDayTime(*args: int, precision: TemporalEntityPrecision | None = None, tzinfo: tzinfo | None = None)
Bases:
TemporalEntity
Parser for temporal entities with time-precision.
- ALLOWED_PRECISION_LEVELS = [TemporalEntityPrecision.HOUR, TemporalEntityPrecision.MINUTE, TemporalEntityPrecision.SECOND, TemporalEntityPrecision.MICROSECOND]¶
- JSON_SCHEMA_CONFIG: dict[str, str | list[str]] = {'examples': ['2022-09-30T20:48:35Z']}¶
- STR_SCHEMA_PATTERN = '^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]Z$'¶
- date_time: datetime¶
- precision: TemporalEntityPrecision¶
- mex.common.types.split_to_caps(string: str) str ¶
Convert the given string from Split case into CAPS_CASE.