Files
stack/docs/docs/cli/bcda-export.md
kert 63e9c0029a
Some checks failed
CI / lint (push) Successful in 58s
CI / notebooks-smoke (push) Successful in 1m44s
CI / test (push) Failing after 3m3s
Infra CI / notebooks (push) Successful in 1m13s
Infra CI / docs (push) Successful in 1m46s
Infra CI / llm (push) Successful in 49s
Infra CI / mc (push) Failing after 36s
Infra CI / zotero (push) Successful in 27s
Infra CI / api (push) Successful in 1m9s
Infra CI / bcda (push) Successful in 1m37s
CI / lint (pull_request) Successful in 41s
CI / notebooks-smoke (pull_request) Successful in 1m49s
CI / test (pull_request) Failing after 2m50s
Infra CI / docs (pull_request) Successful in 17s
Infra CI / notebooks (pull_request) Successful in 59s
Infra CI / api (pull_request) Successful in 14s
Infra CI / bcda (pull_request) Successful in 14s
Infra CI / llm (pull_request) Successful in 20s
Infra CI / zotero (pull_request) Successful in 14s
Infra CI / mc (pull_request) Failing after 34s
feat(cms): vendor the institutional provider universe (CCN ↔ NPI ↔ TIN) from data.cms.gov; give carrier lines their billed TIN
"No TIN available" is a fact about the data, not a bug in ours.
Institutional claims never carry a TIN: the real Large-entity v3 pull has
0 billing TINs on every claim type and 0 CCNs on every institutional
claim (the dictionary's NamingSystem/CCN identifier is not emitted and
half the institutional claims have no billing provider at all), and
CCLF1 has an OSCAR/CCN and NPIs but no TIN either. The only TIN on
claims is the carrier/DME CLM_RNDRG_PRVDR_TAX_NUM, the TIN the line was
billed under, so the connector now gives professional and DME lines that
value as billing_tin too (institutional stays NULL; the facility is its
NPI and CCN). CMS publishes no provider TIN or EIN on data.cms.gov —
checked every enrollment, ownership, change-of-ownership, Provider of
Services and cost-report family in the catalog.

What can be vendored is CCN ↔ NPI ↔ organization. cms.datacms resolves
a dataset family to its newest version in the data.cms.gov catalog,
downloads the CSV (or pages the API) and names columns like the
generated cms.table models. `stack load cms` (aco.load.cms) loads the
institutional universe — hospital, SNF, HHA, hospice, FQHC and RHC
enrollments, the Provider of Services file and the three cost reports —
as cms.* with provenance columns and ingest_log rows, then derives
cms.institutional_provider, cms.ccn_crosswalk (PECOS ∪ POS-only CCNs,
65,161 rows today), cms.provider_tin_observed (NPI → TIN as seen on our
own claims) and cms.ccn_tin (CCN → NPI → TIN, with cms.aco_participant_tin
as the authoritative hook when a participant list is loaded). The
command prints facility-NPI → CCN → TIN coverage; the Data page gets the
same query. On the sandbox nothing resolves — its 8 facility NPIs are
synthetic — which is the expected answer there.

refs #1139
2026-10-25 17:33:13 -04:00

3.6 KiB

title, sidebar_position
title sidebar_position
stack bcda export 15

stack bcda export

Usage: stack bcda export [OPTIONS]                                             
                                                                                
 Run an export through the store (blocks until downloaded).                     
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --preset                              TEXT     Public sandbox entity when    │
│                                                BCDA_CLIENT_ID is unset.      │
│                                                [default: Large Model Entity] │
│ --type               -t               TEXT     Resource type(s); default all │
│                                                three.                        │
│ --endpoint                            TEXT     Group/all, Group/runout or    │
│                                                Patient.                      │
│                                                [default: Group/all]          │
│ --since                               TEXT     FHIR instant                  │
│                                                (2026-10-01T00:00:00+00:00)   │
│                                                or 'auto' = the per-type      │
│                                                watermark.                    │
│ --force                                        Start even when the _since    │
│                                                checks say block.             │
│ --system-type                         TEXT     _typeFilter System-Type       │
│                                                tag(s).                       │
│ --outcome                             TEXT     _typeFilter outcome: partial  │
│                                                and/or complete.              │
│ --service-date-from                   TEXT     _typeFilter earliest          │
│                                                service-date (YYYY[-MM[-DD]], │
│                                                optional gt/ge/eq prefix).    │
│ --service-date-to                     TEXT     _typeFilter latest            │
│                                                service-date (optional lt/le  │
│                                                prefix).                      │
│ --per-type               --one-job             One job per type (survives    │
│                                                sandbox sweeps).              │
│                                                [default: per-type]           │
│ --cancel-retries                      INTEGER  Restarts after server-side    │
│                                                cancellation.                 │
│                                                [default: 6]                  │
│ --poll-interval                       FLOAT    Seconds between status polls. │
│                                                [default: 15.0]               │
│ --help                                         Show this message and exit.   │
╰──────────────────────────────────────────────────────────────────────────────╯