Skip to content

docs(data-integration): let each dataset name its own key - #73

Merged
akim1995 merged 3 commits into
mainfrom
akim/data-integration-dataset-keys
Aug 27, 2026
Merged

docs(data-integration): let each dataset name its own key#73
akim1995 merged 3 commits into
mainfrom
akim/data-integration-dataset-keys

Conversation

@akim1995

Copy link
Copy Markdown
Contributor

No description provided.

Row keys said every row carries record_id, which was never true of the
Provider Directory feed and sat awkwardly beside the keys four datasets
already had: patients kept PT-0001 next to an MRN, encounters and
diagnostic_reports carried record_id equal to encounter_id and report_id
on every row, and documents ended up with record_id twice, in columns one
and five, because the page listed it mid-table as well.

Each dataset now names its own key, listed first: allergy_id, condition_id,
observation_id and the rest, keeping encounter_id, location_id, report_id
and patient_identifier where they already existed. Fourteen tables gained
the row that names it — until now only six said what keyed them — and the
foreign keys name the column they resolve against, which is the same name
in most cases.

The convention keeps only what is not per-dataset: the key must stay stable
because the resource id derives from it, and is_deleted retracts the row.
Akim Khalitov added 2 commits August 27, 2026 22:18
The site serves assets/** with `cache-control: max-age=31536000, immutable`
while the pages get max-age=60, so an edited template never reaches anyone:
the edge froze the pre-16:12 CSVs and would have served them until 2027.
A query string does not help, since it is not part of the cache key.

That header is right for content-addressed files and wrong for permanent
ones, so the filenames now carry the content hash — new content, new URL,
fresh fetch. The file widget keeps the URL and the label on separate lines,
so a reader still sees clinical_observations.csv.

`bun assets:hash` recomputes them; run it after touching a template.
…ionship

Sixteen bespoke key names — device_id, coverage_id, goal_id — were one idea
wearing sixteen labels: the dataset is already known from the file, so the
name carried nothing the column did not. They are record_id again. Only
patients and encounters keep their own, because patient_identifier and
encounter_id pair with a _system and become the resource's identifier.

practitioners and care_team lose the key entirely. A row there is a
relationship — a clinician at a location in a role, a member on a patient's
team — and no roster has a primary key for one, so record_id could only be
minted, and a minted key that is regenerated each export churns every
resource it names. Both are keyed by the columns that define the
relationship, which is how the Provider Directory feed already keys the
same grain.
@akim1995
akim1995 merged commit 254a902 into main Aug 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant