International Organization of Motor Vehicle Manufacturers#

Code reference#

International Organization of Motor Vehicle Manufacturers (OICA) provider.

This module handles data from the OICA website. “Handle” includes:

  • Fetch data files.

  • Parse the native spreadsheet layout. This layout differs across data flows and years; currently only the most recent formats are supported.

  • Convert to SDMX following TDCI conventions.

Submodules

cli

CLI for oica.

Module data

BASE_URL

Base URL for data files.

REGISTRY_FILE

Package data file containing pooch registry information (file names and hashes).

transport_data.oica.BASE_URL = 'https://www.oica.net/wp-content/uploads/'[source]#

Base URL for data files.

transport_data.oica.REGISTRY_FILE = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/transport-data/envs/latest/lib/python3.13/site-packages/transport_data/oica/registry.json')[source]#

Package data file containing pooch registry information (file names and hashes).

Functions

convert(measure)

Convert OICA spreadsheets to SDMX.

convert_single_file(path, dfd)

Convert single OICA data spreadsheet to SDMX.

convert_tp(time_period, units, vehicle_type)

Identify values for 4 concepts using column labels melted into TIME_PERIOD.

fetch([dry_run])

Fetch all known OICA data files.

filenames_for_dfd(dfd[, fetch])

Yield OICA's file names for individual files in dfd.

get_agencies()

Return the OICA Agency.

get_cl_geo()

Retrieve or create the Codelist=TDCI:OICA_GEO.

get_conceptscheme()

Return a concept scheme with OICA concepts.

get_structures(measure)

Create a data flow and data structure definitions for a given OICA measure.

provides()

update_registry()

Update the registry.

transport_data.oica.convert(measure: str) Dict[str, sdmx.model.v21.DataSet][source]#

Convert OICA spreadsheets to SDMX.

This method handles OICA’s particular arrangement of data from a single data flow across multiple Microsoft Excel files, each with a single sheet. The individual files/sheets are processed by convert_single_file().

The OICA files each mix data for multiple data flows or measures: for instance, each of the “Vehicles in use” files contains data for up to 3 different measures:

  • STOCK: Number of vehicles in use.

  • STOCK_AAGR: Average annual growth rate across a specified TIME_PERIOD.

  • (in some cases) STOCK_CAP: Number of vehicles in use per 1000 capita population.

This function returns a dictionary in which data flow IDs for each measure are keys, and values are SDMX data sets, each for a single measure.

transport_data.oica.convert_single_file(path: Path, dfd: sdmx.model.v21.DataflowDefinition) Dict[str, List[sdmx.model.v21.DataSet]][source]#

Convert single OICA data spreadsheet to SDMX.

This function currently handles the 2020 and later file format used for sales and stock data.

transport_data.oica.convert_tp(time_period: str, units: str, vehicle_type: str)[source]#

Identify values for 4 concepts using column labels melted into TIME_PERIOD.

transport_data.oica.fetch(dry_run: bool = False)[source]#

Fetch all known OICA data files.

transport_data.oica.filenames_for_dfd(dfd: sdmx.model.v21.DataflowDefinition, fetch: bool = True) Iterator[Path][source]#

Yield OICA’s file names for individual files in dfd.

Parameters:

fetch (bool, optional) – If True (the default), yield only files that are fetched and available locally. Otherwise, yield all possible names conforming to a known pattern.

transport_data.oica.get_agencies()[source]#

Return the OICA Agency.

transport_data.oica.get_cl_geo() sdmx.model.common.Codelist[source]#

Retrieve or create the Codelist=TDCI:OICA_GEO.

transport_data.oica.get_conceptscheme() sdmx.model.common.ConceptScheme[source]#

Return a concept scheme with OICA concepts.

transport_data.oica.get_structures(measure: str) Tuple[sdmx.model.v21.DataflowDefinition, sdmx.model.v21.DataStructureDefinition][source]#

Create a data flow and data structure definitions for a given OICA measure.

The DFD and DSD have URNs like TDCI:DF_OICA_{MEASURE}(0.1). The DSD has:

  • dimensions GEO, VEHICLE_TYPE, TIME_PERIOD,

  • attributes UNIT_MEASURE, and

  • primary measure with ID OBS_VALUE.

transport_data.oica.provides()[source]#
transport_data.oica.update_registry()[source]#

Update the registry.

This function crawls BASE_URL for file names matching certain patterns. Files that exist are downloaded, hashed, and added to the REGISTRY_FILE.

As of 2024-02-05, about 40 distinct files can be retrieved with POOCH. To view the list of files, use:

from transport_data import oica
print(oica.POOCH.registry)