Code reference¶
Handle TDC-structured metadata.
Submodules
Generate reports about TDC-structured metadata. |
|
Non-standard TDC Excel file format for collecting metadata. |
Functions
|
Return |
|
Return the ID of the dataflow targeted by mdr. |
Create a shared concept scheme for the concepts referenced by dimensions. |
|
|
Generate and return the TDC metadata structure definition. |
|
Group metadata reports in mds according to a key function. |
|
Generate a ReportedAttribute for mda_id with the given value. |
|
Generate a |
|
Return a mapping from unique concept IDs used for dimensions to data flow IDs. |
|
Return a mapping from unique reported attribute values to data flow IDs. |
|
Extend mds with metadata reports for ATO/ATO data flows. |
|
Generate a unique DSD ID for mdr. |
- transport_data.org.metadata.contains_data_for(mdr: MetadataReport, ref_area: str) bool[source]¶
Return
Trueif mdr contains data for ref_area.Trueis returned if any of the following:The referenced data flow definition has an ID that starts with ref_area.
The country’s ISO 3166 alpha-2 code, alpha-3 code, official name, or common name appears in the value of the
DATA_DESCRmetadata attribute.
- Parameters:
ref_area (
str) – ISO 3166 alpha-2 code for a country. Passed topycountry.countries.lookup().
- transport_data.org.metadata.dfd_id(mdr: MetadataReport) str[source]¶
Return the ID of the dataflow targeted by mdr.
- transport_data.org.metadata.get_cs_common() ConceptScheme[source]¶
Create a shared concept scheme for the concepts referenced by dimensions.
Concepts in this scheme have an annotation
tdc-aka, which is a list of alternate IDs recognized for the concept.
- transport_data.org.metadata.get_msd() MetadataStructureDefinition[source]¶
Generate and return the TDC metadata structure definition.
- transport_data.org.metadata.groupby(mds: MetadataSet, key=typing.Callable[[ForwardRef('v21.MetadataReport')], typing.Hashable]) dict[Hashable, list[MetadataReport]][source]¶
Group metadata reports in mds according to a key function.
Similar to
itertools.groupby().
- transport_data.org.metadata.make_ra(mda_id: str, value: Any) OtherNonEnumeratedAttributeValue[source]¶
Generate a ReportedAttribute for mda_id with the given value.
- transport_data.org.metadata.make_tok(dfd: BaseDataflow) TargetObjectKey[source]¶
Generate a
TargetObjectKeythat refers to dfd.
- transport_data.org.metadata.map_dims_to_ids(mds: MetadataSet) dict[str, set[str]][source]¶
Return a mapping from unique concept IDs used for dimensions to data flow IDs.
- transport_data.org.metadata.map_values_to_ids(mds: MetadataSet, mda_id: str) dict[str, set[str]][source]¶
Return a mapping from unique reported attribute values to data flow IDs.
- transport_data.org.metadata.merge_ato(mds: MetadataSet) None[source]¶
Extend mds with metadata reports for ATO/ATO data flows.
- transport_data.org.metadata.unique_dfd_id(mdr: MetadataReport, existing: set[str]) str[source]¶
Generate a unique DSD ID for mdr.
Classes
|
Concepts and metadata attributes in the TDC metadata structure. |