This helps you build queries to download custom datatables from Statistics Canada. Ideal for use in data pipelines.
Project description
ShinySC
A straight-forward wrapper to build customized table links to Statistics Canada data tables.
If you already know the productId and filters for the table you want, simply call:
url = ShinySC.make_url(id={productId},filters={...})
You can also specify date ranges or number of recent data periods:
url = ShinySC.make_url(periods=5)
url = ShinySC.make_url(start='2020-01-01',end='2022-01-01')
The returned custom URL that can be used to download a CSV file would be:
"https://www150.statcan.gc.ca/t1/tbl1/en/dtl!downloadDbLoadingData-nonTraduit.action?pid=3410029201&latestN=&startDate=&endDate=&csvLocale=en&selectedMembers=%5B%5B10%5D%2C%5B1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%2C44%2C45%2C46%2C47%2C48%2C49%2C50%2C51%2C52%2C53%2C54%2C55%2C56%2C57%2C58%2C59%2C60%2C61%2C62%2C63%2C64%2C65%2C66%2C67%2C68%2C69%2C70%2C71%2C72%2C73%2C74%2C75%2C76%2C77%2C78%2C79%2C80%2C81%2C82%2C83%2C84%2C85%2C86%2C87%2C88%2C89%5D%2C%5B1%2C3%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%5D%2C%5B1%2C2%2C3%2C4%2C5%5D%2C%5B1%2C2%2C3%2C4%5D%5D&checkedLevels="
If you don't know what table you want, you can programmatically search for tables that match your criteria using:
ShinySC.search(query,last_updated,data_dates,status)
query: comma-delimited terms to search for in table names, descriptions, and surveys
last_updated: Only return tables updated after this date (YYYY-MM-DD)
data_dates: Only return tables with data in this date range (YYYY-MM-DD,YYYY-MM-DD)
status: 'active' (default) or 'archived' tables
Call ShinySC.describe(productId) to see available dimensions that can be used for filtering.
Call ShinySC.update_list(date='YYYY-MM-DD') to see recently updated tables for a specfiic date. Add in a productId to see if that specific table was updated on that date. ShinySC.update_list(id=35100003,date='2023-01-01')
This library makes use of these endpoints:
https://www150.statcan.gc.ca/t1/wds/rest/getCodeSets
https://www150.statcan.gc.ca/t1/wds/rest/getAllCubesList
https://www150.statcan.gc.ca/t1/wds/rest/getCubeMetadata
https://www150.statcan.gc.ca/t1/wds/rest/getChangedCubeList
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shinysc-0.7.1.tar.gz.
File metadata
- Download URL: shinysc-0.7.1.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b31b336ae8440c21c7505c1eb3543e0c39fcfba187964007b57485fc1a1e3d22
|
|
| MD5 |
514a243f1df5c872cb758d638b891aff
|
|
| BLAKE2b-256 |
9b9d73ca792ed361aa5d9b05fe45948a016425779853c61b221ebf33eec89a01
|
File details
Details for the file shinysc-0.7.1-py3-none-any.whl.
File metadata
- Download URL: shinysc-0.7.1-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0cd6596140a17b15e2c996c967b659259a77f8c5ebb9cce66c313fb24765e9b
|
|
| MD5 |
c09712ea3935d0983a7cbfcaecbb505e
|
|
| BLAKE2b-256 |
a489876ab6fcbada7949a2fc9fe4f823a0708ff8c9705c89d7355382f186e570
|