Fix #11: bundled R4 schema is actually R5 — regenerate from R4 4.0.1, add R5 schema#12
Open
piotrszul wants to merge 1 commit into
Open
Fix #11: bundled R4 schema is actually R5 — regenerate from R4 4.0.1, add R5 schema#12piotrszul wants to merge 1 commit into
piotrszul wants to merge 1 commit into
Conversation
The bundled schemas/fhir-schema-r4.json — used by default for every compilation and documented as FHIR R4 — was actually built from FHIR R5 5.0.0 definitions (byte-identical to a fresh R5 build). For R4 data, any element renamed/removed in R5 (e.g. Encounter.period) failed to resolve, silently fell back to a JSON column type, and produced wrong typing. - Regenerate schemas/fhir-schema-r4.json from genuine R4 4.0.1 profiles-resources.json + profiles-types.json (8,503 keys; restores Encounter.period/statusHistory/classHistory, drops R5-only actualPeriod/subjectStatus/EncounterHistory, corrects 340 element types such as ActivityDefinition.location CodeableReference -> Reference). - Add schemas/fhir-schema-r5.json built from R5 5.0.0 (the previous fhir-schema-r4.json content) for running ViewDefinitions against R5. - Document the bundled R5 schema and --schema-file usage in README. No code change required — the builder already produces correct output; only the committed artifact was generated from the wrong source version. All 191 tests pass against the regenerated R4 schema. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11.
Problem
schemas/fhir-schema-r4.json— used by default for every compilation and documented as FHIR R4 — was actually built from FHIR R5 5.0.0 definitions. I confirmed this: the committed file is byte-identical (same md5) to a schema freshly built from R5 source.For R4 data, any element renamed/removed in R5 (e.g.
Encounter.period, absent in R5 which renamed it toactualPeriod) failed to resolve, silently fell back to aJSONcolumn type, and produced wrong/over-broad typing.Fix (data regeneration — no code change)
The builder (
scripts/build-fhir-schema.js) already produces correct output; only the committed artifact came from the wrong source version.schemas/fhir-schema-r4.jsonfrom genuine R4 4.0.1profiles-resources.json+profiles-types.json(8,503 keys).schemas/fhir-schema-r5.jsonbuilt from R5 5.0.0 (this is the previousfhir-schema-r4.jsoncontent), for running ViewDefinitions against R5 via--schema-file.Diff (current R5 → regenerated R4)
EncounterHistory,Encounter.actualPeriod)Encounter.period,statusHistory,classHistory)ActivityDefinition.location:CodeableReference→Reference)Verification:
Encounter.periodnow types asSTRUCT(start VARCHAR, end VARCHAR); the "unknown type" warnings disappear.Tests
All 191 tests pass (
bun test) against the regenerated R4 schema.