Code reference¶
Non-standard TDC Excel file format for collecting metadata.
Module data
README text for the TDC metadata file format. |
- transport_data.org.metadata.spreadsheet.README_TEXT = 'This file is an unofficial, prototype TDC format for metadata.\nloosely imitates the Eurostat format. These files contain metadata (information\n*about* data) based on the SDMX information model, but their layout (sheet\nnames, columns, etc.) is not specified by the SDMX standard, hence ‘unofficial’.\n\nThis file has the following sheets.\n\nREADME\n======\n\nThis sheet.\n\nAttributes\n==========\n\n- One row per metadata attribute (or \'field\').\n- Columns for the name; description; and ID (short and machine-readable) of each\n attribute. See these descriptions to learn what to write for each attribute.\n\nOne or more additional sheets\n=============================\n\n- The name (or title) of each sheet corresponds to the identity (ID) of the data\n flow that is described by the metadata in that sheet.\n- In Column A, the name of the metadata attribute. Each name MUST exactly\n match one appearing in the "Attributes" sheet. Some names MAY be omitted.\n- In Column B, the actual metadata. These may be empty.\n\nTEMPLATE\n========\n\nTo add information about additional data flows not included in existing sheets\n(above), you can copy and rename this sheet.\n'[source]¶
README text for the TDC metadata file format.
Functions
|
Add an "Attributes" sheet to wb listing the metadata attributes from msd. |
|
Add a "README" sheet to wb. |
|
Add a "TEMPLATE" sheet to wb with a metadata template. |
|
Return an item from is_ matching other. |
|
Generate a |
|
Parse the description of a dimension from value. |
|
Read a metadata set from the workbook at path. |
|
Read a metadata report from the worksheet ws. |
|
Update the DimensionDescriptor of dsd with concepts. |
- transport_data.org.metadata.spreadsheet.add_attributes(wb: Workbook, msd: v21.MetadataStructureDefinition)[source]¶
Add an “Attributes” sheet to wb listing the metadata attributes from msd.
- transport_data.org.metadata.spreadsheet.add_readme(wb: Workbook) None [source]¶
Add a “README” sheet to wb.
- transport_data.org.metadata.spreadsheet.add_template(wb: Workbook, msd: v21.MetadataStructureDefinition)[source]¶
Add a “TEMPLATE” sheet to wb with a metadata template.
- transport_data.org.metadata.spreadsheet.getdefault(is_: ItemScheme, other: Item) Item [source]¶
Return an item from is_ matching other.
Several methods are attempted to match other with an existing item:
ID of other is identical to that of an existing item.
Transformed ID of other—in upper case, “ “ replaced with “_” is identical to that of an existing item.
ID of other is in the annotation
tdc-aka
- transport_data.org.metadata.spreadsheet.make_workbook(name='sample.xlsx') None [source]¶
Generate a
openpyxl.Workbook
for exchange of metadata.
- transport_data.org.metadata.spreadsheet.parse_dimension(value: str) List[Concept] [source]¶
Parse the description of a dimension from value.
Supported values include:
Multiple lines, with each line beginning “- “.
A single line, with dimensions separated by “, “.
A single dimension ID.
- transport_data.org.metadata.spreadsheet.read_workbook(path: pathlib.Path) tuple[v21.MetadataSet, v21.ConceptScheme] [source]¶
Read a metadata set from the workbook at path.
- transport_data.org.metadata.spreadsheet.read_worksheet(ws: Worksheet, msd: v21.MetadataStructureDefinition, cs_dims: v21.ConceptScheme) v21.MetadataReport | None [source]¶
Read a metadata report from the worksheet ws.
- Parameters:
msd – Metadata structure definition.
- transport_data.org.metadata.spreadsheet.update_dimension_descriptor(dsd: DataStructureDefinition, cs_dims: ConceptScheme, *concepts) None [source]¶
Update the DimensionDescriptor of dsd with concepts.