Asian Development Bank#

Code reference#

Asian Development Bank (ADB) provider.

Submodules

transport_data.adb.cli

CLI for adb.

Module data

CL_ECONOMY

List of all "ECONOMY" codes appearing in processed data.

CS_MEASURE

List of all measures (indicators) appearing in processed data.

FILES

Mapping from short codes for ATO data categories to file names.

transport_data.adb.CL_ECONOMY = <Codelist ECONOMY (0 items): Asian Transport Outlook subject economy>[source]#

List of all “ECONOMY” codes appearing in processed data.

transport_data.adb.CS_MEASURE = <ConceptScheme MEASURE (0 items): Asian Transport Outlook measures (indicators)>[source]#

List of all measures (indicators) appearing in processed data.

Todo

Validate against the master list of indicators; or read from that file and validate IDs appearing in data files.

transport_data.adb.FILES = {'ACC': 'ATO Workbook (ACCESS & CONNECTIVITY (ACC)).xlsx', 'APH': 'ATO Workbook (AIR POLLUTION & HEALTH (APH)).xlsx', 'CLC': 'ATO Workbook (CLIMATE CHANGE (CLC)).xlsx', 'INF': 'ATO Workbook (INFRASTRUCTURE (INF)).xlsx', 'MIS': 'ATO Workbook (MISCELLANEOUS (MIS)).xlsx', 'POL': 'ATO Workbook (TRANSPORT POLICY (POL)).xlsx', 'RSA': 'ATO Workbook (ROAD SAFETY (RSA)).xlsx', 'SEC': 'ATO Workbook (SOCIO-ECONOMIC (SEC)).xlsx', 'TAS': 'ATO Workbook (TRANSPORT ACTIVITY & SERVICES (TAS)).xlsx'}[source]#

Mapping from short codes for ATO data categories to file names.

Functions

convert(part)

convert_sheet(df, aa)

Convert df and aa from read_sheet() into SDMX data structures.

expand(fname)

fetch(*parts[, dry_run])

get_agency()

prepare(aa)

Prepare an empty data set and associated structures.

read_sheet(ef, sheet_name)

Read a single sheet.

validate_economy(df)

Validate codes for the "ECONOMY" dimension of df against CL_ECONOMY.

transport_data.adb.convert(part)[source]#
transport_data.adb.convert_sheet(df: DataFrame, aa: AnnotableArtefact)[source]#

Convert df and aa from read_sheet() into SDMX data structures.

transport_data.adb.expand(fname: str) str[source]#
transport_data.adb.fetch(*parts, dry_run: bool = False)[source]#
transport_data.adb.get_agency() Agency[source]#
transport_data.adb.prepare(aa: AnnotableArtefact) Tuple[DataSet, Callable][source]#

Prepare an empty data set and associated structures.

transport_data.adb.read_sheet(ef: ExcelFile, sheet_name: str) Tuple[DataFrame, AnnotableArtefact][source]#

Read a single sheet.

This function handles the particular layout of sheets in files like those listed in FILES. These combine data and metadata.

  • Row 1 is a title row.

  • Cell range A2:B10 contain a set of metadata fields, with the field name in column A and the value in column B.

  • Rows 11:13 contain no data or metadata; only a link back to a table of contents sheet.

  • Row 14 contains a label “Series” centre-spanned across

  • Row 15 contains column labels, described below.

  • Row 16 and onwards contain data, followed by two blank rows, and two rows with attribution/acknowledgements.

  • Columns labeled (i.e. in row 15) “Economy Code” and “Economy Name” contain codes and names, respectively, for the geographic units.

  • Columns with numeric labels describe time periods, specifically years, that are part of observation keys.

  • Some sheets have additional columns with non-numeric labels like “Remarks”, “Source (2022-04)”, etc.; these give annotations applying to the observations on the same row (i.e. for a single “Economy Code” and 1 or more time periods).

transport_data.adb.validate_economy(df: DataFrame) DataFrame[source]#

Validate codes for the “ECONOMY” dimension of df against CL_ECONOMY.

  • Every unique pair of (Economy Code, Economy Name) is converted to a Code.

  • These are added to CL_ECONOMY. If a Code with the same ID already exists, it is checked for an exact match (name, description, etc.)

  • The “Economy Code” column of df is renamed “ECONOMY”, and contains only values from CL_ECONOMY. The “Economy Name” column is dropped.