list_cubes
Search Statistics Canada datasets by keyword.
Returns a list of cubes (datasets) from StatsCan. If a keyword is provided,
filters results by searching in the English dataset titles. Results are limited
to prevent overwhelming responses.
:param keyword: Optional search term to filter datasets by title (case-insensitive)
:type keyword: Optional[str]
:param default_limit: Maximum number of results to return (default: 50)
:type default_limit: Optional[int]
:return: Dictionary with 'cubes' (list of datasets), 'total_count' (total matches),
and 'returned_count' (number of items returned after limit)
:rtype: dict
list_cubes_full
Search Statistics Canada datasets by keyword (full metadata).
Returns a list of cubes with complete metadata including dimensions,
frequencies, and survey information. Use list_cubes for a lightweight
version with minimal fields.
:param keyword: Optional search term to filter datasets by title (case-insensitive)
:type keyword: Optional[str]
:param default_limit: Maximum number of results to return (default: 50)
:type default_limit: Optional[int]
:return: Dictionary with 'cubes' (list of datasets), 'total_count' (total matches),
and 'returned_count' (number of items returned after limit)
:rtype: dict
get_cube_metadata
Get detailed metadata for a Statistics Canada dataset.
Returns structure information including dimensions, members, and date ranges.
:param product_id: The StatsCan product/cube ID (e.g., 18100004)
:type product_id: int
:return: Dictionary with cube metadata or error details
:rtype: dict
get_vector_data_by_range
Fetch time series data for a specific Statistics Canada vector.
Returns actual data values over time for the specified vector.
:param vector_id: The vector ID number (e.g., 41690973)
:type vector_id: int
:param start_date: Start date in YYYY-MM-DD format (e.g., 2020-01-01)
:type start_date: str
:param end_date: End date in YYYY-MM-DD format (e.g., 2024-01-01)
:type end_date: str
:return: Dictionary with time series data or error details
:rtype: dict
get_table
Get rectangular data slice from a Statistics Canada dataset.
Fetches the latest N periods of data for specific dimension coordinates.
:param product_id: The StatsCan product/cube ID (e.g., 35100003)
:param coordinate: Dimension coordinate string (e.g., "1.12.0.0.0.0.0.0.0.0")
:param latest_n: Number of latest periods to retrieve
:return: Dictionary with table data or error details
get_vector_info
Get metadata for a specific Statistics Canada vector.
Returns information about the vector including its parent cube,
coordinates, frequency, title, and other metadata (not the actual data).
:param vector_id: The vector ID number (e.g., 41690973)
:type vector_id: int
:return: Dictionary with vector metadata or error details
:rtype: dict
get_series_info
Get metadata for a specific series within a Statistics Canada dataset.
Returns series information based on cube product ID and dimension coordinates.
:param product_id: The StatsCan product/cube ID (e.g., 35100003)
:param coordinate: Dimension coordinate string (e.g., "1.12.0.0.0.0.0.0.0.0")
:return: Dictionary with series metadata or error details
get_changed_cubes
Get list of Statistics Canada cubes/datasets changed on a specific date.
Returns cubes that were updated or released on the specified date.
:param date: Date to check for changes in YYYY-MM-DD format (e.g., "2024-01-15")
:return: Dictionary with list of changed cubes or error details
get_changed_series
Get list of Statistics Canada series updated today.
Returns all series that have been updated on the current day.
This endpoint has no parameters - it always returns today's changes.
:return: Dictionary with list of changed series or error details
get_changed_vector_data
Get changed/updated data for a specific Statistics Canada vector.
Returns the latest changes for a vector if it was updated today.
:param vector_id: The vector ID number (e.g., 32164132)
:return: Dictionary with changed vector data or error details
get_changed_series_data
Get changed/updated data for a specific series within a Statistics Canada dataset.
Returns the latest changes for a series identified by cube ID and coordinates,
if it was updated today.
:param product_id: The StatsCan product/cube ID (e.g., 35100003)
:param coordinate: Dimension coordinate string (e.g., "1.12.0.0.0.0.0.0.0.0")
:return: Dictionary with changed series data or error details
get_vectors_latest
Get latest N periods of data for multiple Statistics Canada vectors.
Fetches the most recent data points for one or more vectors in a single request.
:param vector_ids: List of vector ID numbers (e.g., [32164132, 41690973])
:param latest_n: Number of latest periods to retrieve (must be > 0)
:return: Dictionary with vector data or error details
get_bulk_vectors
Get bulk vector data by release date range for multiple Statistics Canada vectors.
Fetches data for multiple vectors based on when the data points were released.
:param vector_ids: List of vector ID numbers (e.g., [74804, 1])
:param start_release_date: Start datetime in ISO format (e.g., "2015-12-01T08:30")
:param end_release_date: End datetime in ISO format (e.g., "2018-03-31T19:00")
:return: Dictionary with bulk vector data or error details
get_full_table_csv
Get download URL for full Statistics Canada table in CSV format.
Returns a URL to a downloadable ZIP file containing the complete table data.
:param product_id: The StatsCan product/cube ID (e.g., 14100287)
:param language: Language code - "en" for English or "fr" for French (default: "en")
:return: Dictionary with download URL or error details
get_full_table_sdmx
Get download URL for full Statistics Canada table in SDMX format.
Returns a URL to a downloadable ZIP file containing the complete table data
in SDMX (Statistical Data and Metadata eXchange) format. This is a bilingual
XML format used for international statistical data exchange.
:param product_id: The StatsCan product/cube ID (e.g., 14100287)
:return: Dictionary with download URL or error details