feat(cms): vendor the institutional provider universe (CCN ↔ NPI ↔ TIN) from data.cms.gov; give carrier lines their billed TIN
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

"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
This commit is contained in:
kert
2026-10-25 17:33:13 -04:00
parent 2cc13008a9
commit 63e9c0029a
129 changed files with 1548 additions and 119 deletions

View File

@@ -1,6 +1,6 @@
---
title: stack api serve
sidebar_position: 80
sidebar_position: 81
---
# `stack api serve`

View File

@@ -1,6 +1,6 @@
---
title: stack api
sidebar_position: 79
sidebar_position: 80
---
# `stack api`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda adopt
sidebar_position: 15
sidebar_position: 16
---
# `stack bcda adopt`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda auth
sidebar_position: 12
sidebar_position: 13
---
# `stack bcda auth`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda cancel
sidebar_position: 17
sidebar_position: 18
---
# `stack bcda cancel`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda errors
sidebar_position: 19
sidebar_position: 20
---
# `stack bcda errors`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda export
sidebar_position: 14
sidebar_position: 15
---
# `stack bcda export`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda jobs
sidebar_position: 13
sidebar_position: 14
---
# `stack bcda jobs`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda load
sidebar_position: 20
sidebar_position: 21
---
# `stack bcda load`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda preflight
sidebar_position: 11
sidebar_position: 12
---
# `stack bcda preflight`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda resume
sidebar_position: 16
sidebar_position: 17
---
# `stack bcda resume`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda store
sidebar_position: 18
sidebar_position: 19
---
# `stack bcda store`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda sync
sidebar_position: 22
sidebar_position: 23
---
# `stack bcda sync`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda ui
sidebar_position: 10
sidebar_position: 11
---
# `stack bcda ui`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda vendor
sidebar_position: 21
sidebar_position: 22
---
# `stack bcda vendor`

View File

@@ -1,6 +1,6 @@
---
title: stack bcda
sidebar_position: 9
sidebar_position: 10
---
# `stack bcda`

View File

@@ -1,6 +1,6 @@
---
title: stack bib attach-iom
sidebar_position: 35
sidebar_position: 36
---
# `stack bib attach-iom`

View File

@@ -1,6 +1,6 @@
---
title: stack bib attach-oig
sidebar_position: 40
sidebar_position: 41
---
# `stack bib attach-oig`

View File

@@ -1,6 +1,6 @@
---
title: stack bib backfill-comments
sidebar_position: 33
sidebar_position: 34
---
# `stack bib backfill-comments`

View File

@@ -1,6 +1,6 @@
---
title: stack bib cfr-jump
sidebar_position: 45
sidebar_position: 46
---
# `stack bib cfr-jump`

View File

@@ -1,6 +1,6 @@
---
title: stack bib code-tags
sidebar_position: 46
sidebar_position: 47
---
# `stack bib code-tags`

View File

@@ -1,6 +1,6 @@
---
title: stack bib discover-pfs-rules
sidebar_position: 29
sidebar_position: 30
---
# `stack bib discover-pfs-rules`

View File

@@ -1,6 +1,6 @@
---
title: stack bib fetch-docket-comments
sidebar_position: 30
sidebar_position: 31
---
# `stack bib fetch-docket-comments`

View File

@@ -1,6 +1,6 @@
---
title: stack bib fetch-pfs-comments
sidebar_position: 31
sidebar_position: 32
---
# `stack bib fetch-pfs-comments`

View File

@@ -1,6 +1,6 @@
---
title: stack bib fr-grab
sidebar_position: 43
sidebar_position: 44
---
# `stack bib fr-grab`

View File

@@ -1,6 +1,6 @@
---
title: stack bib fr-jump
sidebar_position: 44
sidebar_position: 45
---
# `stack bib fr-jump`

View File

@@ -1,6 +1,6 @@
---
title: stack bib import-zotero
sidebar_position: 37
sidebar_position: 38
---
# `stack bib import-zotero`

View File

@@ -1,6 +1,6 @@
---
title: stack bib ingest-iom
sidebar_position: 34
sidebar_position: 35
---
# `stack bib ingest-iom`

View File

@@ -1,6 +1,6 @@
---
title: stack bib ingest-mail
sidebar_position: 32
sidebar_position: 33
---
# `stack bib ingest-mail`

View File

@@ -1,6 +1,6 @@
---
title: stack bib ingest-oig
sidebar_position: 39
sidebar_position: 40
---
# `stack bib ingest-oig`

View File

@@ -1,6 +1,6 @@
---
title: stack bib query
sidebar_position: 28
sidebar_position: 29
---
# `stack bib query`

View File

@@ -1,6 +1,6 @@
---
title: stack bib refresh-iom
sidebar_position: 42
sidebar_position: 43
---
# `stack bib refresh-iom`

View File

@@ -1,6 +1,6 @@
---
title: stack bib refresh-oig
sidebar_position: 41
sidebar_position: 42
---
# `stack bib refresh-oig`

View File

@@ -1,6 +1,6 @@
---
title: stack bib sync-zotero
sidebar_position: 38
sidebar_position: 39
---
# `stack bib sync-zotero`

View File

@@ -1,6 +1,6 @@
---
title: stack bib sync
sidebar_position: 26
sidebar_position: 27
---
# `stack bib sync`

View File

@@ -1,6 +1,6 @@
---
title: stack bib tag
sidebar_position: 27
sidebar_position: 28
---
# `stack bib tag`

View File

@@ -1,6 +1,6 @@
---
title: stack bib watch-iom
sidebar_position: 36
sidebar_position: 37
---
# `stack bib watch-iom`

View File

@@ -1,6 +1,6 @@
---
title: stack bib
sidebar_position: 25
sidebar_position: 26
---
# `stack bib`

View File

@@ -1,6 +1,6 @@
---
title: stack bls ces
sidebar_position: 49
sidebar_position: 50
---
# `stack bls ces`

View File

@@ -1,6 +1,6 @@
---
title: stack bls oews
sidebar_position: 48
sidebar_position: 49
---
# `stack bls oews`

View File

@@ -1,6 +1,6 @@
---
title: stack bls
sidebar_position: 47
sidebar_position: 48
---
# `stack bls`

View File

@@ -1,6 +1,6 @@
---
title: stack comments dockets
sidebar_position: 54
sidebar_position: 55
---
# `stack comments dockets`

View File

@@ -1,6 +1,6 @@
---
title: stack comments extract-ocr
sidebar_position: 52
sidebar_position: 53
---
# `stack comments extract-ocr`

View File

@@ -1,6 +1,6 @@
---
title: stack comments extract
sidebar_position: 51
sidebar_position: 52
---
# `stack comments extract`

View File

@@ -1,6 +1,6 @@
---
title: stack comments seal
sidebar_position: 55
sidebar_position: 56
---
# `stack comments seal`

View File

@@ -1,6 +1,6 @@
---
title: stack comments stats
sidebar_position: 53
sidebar_position: 54
---
# `stack comments stats`

View File

@@ -1,6 +1,6 @@
---
title: stack comments unseal
sidebar_position: 56
sidebar_position: 57
---
# `stack comments unseal`

View File

@@ -1,6 +1,6 @@
---
title: stack comments
sidebar_position: 50
sidebar_position: 51
---
# `stack comments`

View File

@@ -1,6 +1,6 @@
---
title: stack db comment
sidebar_position: 73
sidebar_position: 74
---
# `stack db comment`

View File

@@ -1,6 +1,6 @@
---
title: stack db inspect
sidebar_position: 74
sidebar_position: 75
---
# `stack db inspect`

View File

@@ -1,6 +1,6 @@
---
title: stack db
sidebar_position: 72
sidebar_position: 73
---
# `stack db`

View File

@@ -1,6 +1,6 @@
---
title: stack docs build
sidebar_position: 76
sidebar_position: 77
---
# `stack docs build`

View File

@@ -1,6 +1,6 @@
---
title: stack docs generate
sidebar_position: 78
sidebar_position: 79
---
# `stack docs generate`

View File

@@ -1,6 +1,6 @@
---
title: stack docs serve
sidebar_position: 77
sidebar_position: 78
---
# `stack docs serve`

View File

@@ -1,6 +1,6 @@
---
title: stack docs
sidebar_position: 75
sidebar_position: 76
---
# `stack docs`

View File

@@ -1,6 +1,6 @@
---
title: stack generate models
sidebar_position: 24
sidebar_position: 25
---
# `stack generate models`

View File

@@ -1,6 +1,6 @@
---
title: stack generate
sidebar_position: 23
sidebar_position: 24
---
# `stack generate`

View File

@@ -1,6 +1,6 @@
---
title: stack lake deploy
sidebar_position: 58
sidebar_position: 59
---
# `stack lake deploy`

View File

@@ -1,6 +1,6 @@
---
title: stack lake load
sidebar_position: 59
sidebar_position: 60
---
# `stack lake load`

View File

@@ -1,6 +1,6 @@
---
title: stack lake parity
sidebar_position: 61
sidebar_position: 62
---
# `stack lake parity`

View File

@@ -1,6 +1,6 @@
---
title: stack lake validate
sidebar_position: 60
sidebar_position: 61
---
# `stack lake validate`

View File

@@ -1,6 +1,6 @@
---
title: stack lake
sidebar_position: 57
sidebar_position: 58
---
# `stack lake`

View File

@@ -1,6 +1,6 @@
---
title: stack llm eval-tags
sidebar_position: 69
sidebar_position: 70
---
# `stack llm eval-tags`

View File

@@ -1,6 +1,6 @@
---
title: stack llm hosts
sidebar_position: 65
sidebar_position: 66
---
# `stack llm hosts`

View File

@@ -1,6 +1,6 @@
---
title: stack llm index
sidebar_position: 63
sidebar_position: 64
---
# `stack llm index`

View File

@@ -1,6 +1,6 @@
---
title: stack llm prune-rules
sidebar_position: 70
sidebar_position: 71
---
# `stack llm prune-rules`

View File

@@ -1,6 +1,6 @@
---
title: stack llm restamp
sidebar_position: 64
sidebar_position: 65
---
# `stack llm restamp`

View File

@@ -1,6 +1,6 @@
---
title: stack llm serve
sidebar_position: 66
sidebar_position: 67
---
# `stack llm serve`

View File

@@ -1,6 +1,6 @@
---
title: stack llm stamp-themes
sidebar_position: 71
sidebar_position: 72
---
# `stack llm stamp-themes`

View File

@@ -1,6 +1,6 @@
---
title: stack llm tag
sidebar_position: 68
sidebar_position: 69
---
# `stack llm tag`

View File

@@ -1,6 +1,6 @@
---
title: stack llm vocab
sidebar_position: 67
sidebar_position: 68
---
# `stack llm vocab`

View File

@@ -1,6 +1,6 @@
---
title: stack llm
sidebar_position: 62
sidebar_position: 63
---
# `stack llm`

30
docs/docs/cli/load-cms.md Normal file
View File

@@ -0,0 +1,30 @@
---
title: stack load cms
sidebar_position: 8
---
# `stack load cms`
```
Usage: stack load cms [OPTIONS]
Vendor the institutional provider universe from data.cms.gov: CCN ↔ NPI ↔ TIN.
PECOS enrollments (hospital, SNF, HHA, hospice, FQHC, RHC), the
Provider of Services file and the cost reports, loaded as ``cms.*``
with their models' column names, then the crosswalk tables. CMS
publishes no TIN; ``cms.ccn_tin`` carries one only where our own
claims or ``cms.aco_participant_tin`` know it.
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --table -t TEXT cms.<table> (default: the institutional │
│ universe). │
│ --database TEXT DuckDB database path (default: config). │
│ --refresh Re-download even if the CSV is on disk. │
│ --derive --no-derive Rebuild institutional_provider / │
│ ccn_crosswalk / provider_tin_observed / │
│ ccn_tin. │
│ [default: derive] │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
```

View File

@@ -1,6 +1,6 @@
---
title: stack load seed
sidebar_position: 8
sidebar_position: 9
---
# `stack load seed`

View File

@@ -16,6 +16,8 @@ Usage: stack load [OPTIONS] COMMAND [ARGS]...
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ cclf Ingest CCLF claim files into DuckDB. │
│ bcda Flatten BCDA FHIR exports and load into DuckDB. │
│ cms Vendor the institutional provider universe from data.cms.gov: CCN ↔ │
│ NPI ↔ TIN. │
│ seed Load seed/reference data (CSV, Excel, Parquet) into DuckDB. │
╰──────────────────────────────────────────────────────────────────────────────╯
```

View File

@@ -1,6 +1,6 @@
---
title: stack mail attach-smarthost
sidebar_position: 121
sidebar_position: 122
---
# `stack mail attach-smarthost`

View File

@@ -1,6 +1,6 @@
---
title: stack mail dkim-export
sidebar_position: 120
sidebar_position: 121
---
# `stack mail dkim-export`

View File

@@ -1,6 +1,6 @@
---
title: stack mail dns
sidebar_position: 119
sidebar_position: 120
---
# `stack mail dns`

View File

@@ -1,6 +1,6 @@
---
title: stack mail down
sidebar_position: 117
sidebar_position: 118
---
# `stack mail down`

View File

@@ -1,6 +1,6 @@
---
title: stack mail provision
sidebar_position: 115
sidebar_position: 116
---
# `stack mail provision`

View File

@@ -1,6 +1,6 @@
---
title: stack mail rotate-creds
sidebar_position: 122
sidebar_position: 123
---
# `stack mail rotate-creds`

View File

@@ -1,6 +1,6 @@
---
title: stack mail seed-mailboxes
sidebar_position: 123
sidebar_position: 124
---
# `stack mail seed-mailboxes`

View File

@@ -1,6 +1,6 @@
---
title: stack mail status
sidebar_position: 118
sidebar_position: 119
---
# `stack mail status`

View File

@@ -1,6 +1,6 @@
---
title: stack mail up
sidebar_position: 116
sidebar_position: 117
---
# `stack mail up`

View File

@@ -1,6 +1,6 @@
---
title: stack mail wire-git
sidebar_position: 124
sidebar_position: 125
---
# `stack mail wire-git`

View File

@@ -1,6 +1,6 @@
---
title: stack mail
sidebar_position: 114
sidebar_position: 115
---
# `stack mail`

View File

@@ -1,6 +1,6 @@
---
title: stack perf show
sidebar_position: 82
sidebar_position: 83
---
# `stack perf show`

View File

@@ -1,6 +1,6 @@
---
title: stack perf
sidebar_position: 81
sidebar_position: 82
---
# `stack perf`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs cpt-ingest
sidebar_position: 96
sidebar_position: 97
---
# `stack pfs cpt-ingest`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs elements
sidebar_position: 88
sidebar_position: 89
---
# `stack pfs elements`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs exposure
sidebar_position: 93
sidebar_position: 94
---
# `stack pfs exposure`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs families
sidebar_position: 90
sidebar_position: 91
---
# `stack pfs families`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs guidance
sidebar_position: 91
sidebar_position: 92
---
# `stack pfs guidance`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs lineage
sidebar_position: 89
sidebar_position: 90
---
# `stack pfs lineage`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs reaction
sidebar_position: 92
sidebar_position: 93
---
# `stack pfs reaction`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs review
sidebar_position: 95
sidebar_position: 96
---
# `stack pfs review`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs utilization
sidebar_position: 94
sidebar_position: 95
---
# `stack pfs utilization`

View File

@@ -1,6 +1,6 @@
---
title: stack pfs
sidebar_position: 87
sidebar_position: 88
---
# `stack pfs`

View File

@@ -1,6 +1,6 @@
---
title: stack prisma eligible
sidebar_position: 108
sidebar_position: 109
---
# `stack prisma eligible`

View File

@@ -1,6 +1,6 @@
---
title: stack prisma export
sidebar_position: 105
sidebar_position: 106
---
# `stack prisma export`

Some files were not shown because too many files have changed in this diff Show More