mex.extractors.wikidata package

Submodules

mex.extractors.wikidata.helpers module

mex.extractors.wikidata.helpers.get_wikidata_extracted_organization_id_by_name(name: str) MergedOrganizationIdentifier | None

Use helper function to look up an organization and return its stableTargetId.

An organization searched by its Wikidata id on Wikidata and loaded into the configured sink. Also it’s stable target id is returned.

Returns:

ExtractedOrganization stableTargetId if one matching organization is found. None if multiple matches / no match is found

mex.extractors.wikidata.helpers.get_wikidata_organization_by_id(wikidata_id: str) ExtractedOrganization | None

Get and load a wikidata item details by its ID.

Parameters:

wikidata_id – wikidata ID of organization

Returns:

extracted organization if found in wikidata

mex.extractors.wikidata.helpers.get_wikidata_organization_ids_by_label() dict[str, str]

Extract and transform synopse resource default values.

mex.extractors.wikidata.settings module

class mex.extractors.wikidata.settings.WikidataSettings(*, mapping_path: AssetsPath = AssetsPath('mappings/wikidata'))

Bases: BaseModel

Wikidata settings submodel definition for the Wikidata extractor.

mapping_path: AssetsPath
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]] = {'mapping_path': FieldInfo(annotation=AssetsPath, required=False, default=AssetsPath("mappings/wikidata"), description='Path to the directory with the wikidata mapping filesvalues, absolute path or relative to `assets_dir`.')}

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.

Module contents