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
Module data
Base URL for data files. |
|
Pooch instance with registry populated from the file |
- transport_data.oica.BASE_URL = 'https://www.oica.net/wp-content/uploads/'[source]¶
Base URL for data files.
- transport_data.oica.POOCH = <transport_data.util.pooch.Pooch object>[source]¶
Pooch instance with registry populated from the file
REGISTRY_FILE
.
Functions
|
Convert OICA spreadsheets to SDMX. |
|
Convert single OICA data spreadsheet to SDMX. |
|
Identify values for 4 concepts using column labels melted into TIME_PERIOD. |
|
Fetch all known OICA data files. |
|
Yield OICA's file names for individual files in dfd. |
Return the OICA Agency. |
|
Retrieve or create the |
|
Return a concept scheme with OICA concepts. |
|
|
Create a data flow and data structure definitions for a given OICA measure. |
|
|
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 specifiedTIME_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.filenames_for_dfd(dfd: sdmx.model.v21.DataflowDefinition, fetch: bool = True) Iterator[Path] [source]¶
Yield OICA’s file names for individual files in dfd.
- 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
, andprimary measure with ID
OBS_VALUE
.
- transport_data.oica.update_registry() None [source]¶
Update the registry.
This function crawls
BASE_URL
for file names matching certain patterns. Files that exist are downloaded, hashed, and added to theREGISTRY_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)