U.S. Bureau of Labor Statistics connector for the parsimony framework
Project description
parsimony-bls
US Bureau of Labor Statistics connector — CPI, PPI, employment (CES/CPS/QCEW), unemployment (LAUS), JOLTS, ECI, productivity, import/export prices, and more, as numeric time series.
Part of the parsimony-connectors monorepo. Distributed standalone on PyPI as parsimony-bls.
Connectors
| Name | Kind | Description |
|---|---|---|
bls_fetch |
connector | Fetch observations for any series_id via the BLS Public Data API. Reaches the entire universe by id. |
enumerate_bls_surveys |
enumerator | Tier-1 feed: one row per BLS survey (program). |
enumerate_bls_series |
connector | Tier-2 feed: one row per series in one survey, from its authoritative .series flat file. |
bls_surveys_search |
connector | Discover surveys and read their dimension manifests. |
bls_series_search |
connector | Search one survey's series (lexical title or structured dimension clauses). |
Why two tiers
BLS's full universe is far too large to embed — the per-survey .series flat
files total ~15.6 GB (tens of millions of series; the injury/illness demographic
microdata surveys alone are ~12 GB). So discovery is two-tier, mirroring
parsimony-sdmx (survey ≈ SDMX dataflow; a survey's dimension code tables ≈ a
DSD's codelists; a BLS series_id ≈ a composed series key):
- Tier 1 —
bls_surveys(always built, complete): one entity per survey, with a compactdimensionsmanifest (each dimension's codes + labels) for the surveys that have a series catalog. - Tier 2 —
bls_series_<survey>(built for the headline surveys, lazy-buildable for any indexable survey): one entity per series with a resolved title and per-dimension metadata for structured search.
Every series stays fetchable by id via bls_fetch regardless of catalog
coverage — the boundary is discovery, not access. The GB-scale microdata tail is
reachable by constructing an id from the tier-1 manifest and fetching it.
Note on structured search. Each series carries its dimension codes plus a resolved label. For most surveys every label resolves (CU/CE/JT/SM = 100%), but a few have irregular code-table naming where some codes fall back to the raw code (e.g. LA ≈ 60%, WP ≈ 70%). Lexical
series_titlesearch andbls_fetchare unaffected; only structuredFIELD: valueclauses on those specific dimensions degrade to code-equality.
Install
pip install parsimony-bls
Pulls in parsimony-core>=0.7,<0.8 and curl_cffi automatically. curl_cffi is a
hard dependency: the bulk flat-file host (download.bls.gov) is Akamai
bot-managed and only a real Chrome TLS handshake passes — the data API host
(api.bls.gov) uses plain HTTPS.
Configuration
No key required. An optional registrationkey raises the daily quota (25 → 500
queries/day) and request size; set it via the BLS_API_KEY environment variable
or bind it: load(api_key=...).
bls_surveys_search / bls_series_search read published catalog snapshots
(default root hf://parsimony-dev/bls). Override with PARSIMONY_BLS_CATALOG_URL
or catalog_root= at call time; missing snapshots are built on demand from the
live flat files and cached in an LRU.
Quick start
from parsimony_bls import CONNECTORS
# 1. find the survey + read its dimension manifest
surveys = CONNECTORS["bls_surveys_search"](query="consumer price index")
# 2. search that survey's series (lexical or structured FIELD: value)
hits = CONNECTORS["bls_series_search"](survey="CU", query="gasoline all types")
series_id = hits.data.iloc[0]["series_id"] # e.g. "CUUR0000SETB01"
# 3. fetch observations
result = CONNECTORS["bls_fetch"](
series_id=series_id, start_year="2020", end_year="2026"
)
print(result.data.head())
For multi-plugin composition (autoloads everything installed):
from parsimony import discover
connectors = discover.load_all()
Catalog building
scripts/build_catalog.py builds tier-2 series catalogs for the headline surveys,
collects their dimension manifests, then builds the tier-1 surveys catalog with
those manifests attached:
# headline allowlist → local + remote, per-namespace subdirs
uv run python packages/bls/scripts/build_catalog.py \
--save-root /tmp/parsimony-catalogs/bls --push-root hf://parsimony-dev/bls
# one survey only
uv run python packages/bls/scripts/build_catalog.py --survey CU --save-root /tmp/bls
Provider
- Homepage: https://www.bls.gov
- API docs: https://www.bls.gov/developers/
- Bulk flat files: https://download.bls.gov/pub/time.series/
License
See LICENSE.
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 parsimony_bls-0.0.1.tar.gz.
File metadata
- Download URL: parsimony_bls-0.0.1.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06e9a5ae8411f459c05795960c0fc493879f500b650a2cf9e03d210a378cf512
|
|
| MD5 |
6c84ee61a0ea8faf6ead6bf0d3750fc0
|
|
| BLAKE2b-256 |
16d1352ab602d33a30f3ed47dfb65870cca65494460ef216064105f7d75de52e
|
Provenance
The following attestation bundles were made for parsimony_bls-0.0.1.tar.gz:
Publisher:
release.yml on ockham-sh/parsimony-connectors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parsimony_bls-0.0.1.tar.gz -
Subject digest:
06e9a5ae8411f459c05795960c0fc493879f500b650a2cf9e03d210a378cf512 - Sigstore transparency entry: 1971010802
- Sigstore integration time:
-
Permalink:
ockham-sh/parsimony-connectors@517cb5874f97ffede7738611ed75bb3ed27e26a0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ockham-sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@517cb5874f97ffede7738611ed75bb3ed27e26a0 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file parsimony_bls-0.0.1-py3-none-any.whl.
File metadata
- Download URL: parsimony_bls-0.0.1-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55cc216efb4d1837e2dcb3700c5b5d2b9512f8bd31eed9be4a3a8dc1d97a4062
|
|
| MD5 |
f75f8e7b01ab4fec222d8b610915caa7
|
|
| BLAKE2b-256 |
fb8d766803eb836dfa6a5151fd074b44a57f71ba4e4e15f288faa06422917507
|
Provenance
The following attestation bundles were made for parsimony_bls-0.0.1-py3-none-any.whl:
Publisher:
release.yml on ockham-sh/parsimony-connectors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parsimony_bls-0.0.1-py3-none-any.whl -
Subject digest:
55cc216efb4d1837e2dcb3700c5b5d2b9512f8bd31eed9be4a3a8dc1d97a4062 - Sigstore transparency entry: 1971010860
- Sigstore integration time:
-
Permalink:
ockham-sh/parsimony-connectors@517cb5874f97ffede7738611ed75bb3ed27e26a0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ockham-sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@517cb5874f97ffede7738611ed75bb3ed27e26a0 -
Trigger Event:
workflow_dispatch
-
Statement type: