Skip to content

Examples: consolidate example dirs, dedup TS profile tests, move ccda to on-the-fly - #184

Merged
ryukzak merged 8 commits into
mainfrom
example-decouple
Jun 18, 2026
Merged

Examples: consolidate example dirs, dedup TS profile tests, move ccda to on-the-fly#184
ryukzak merged 8 commits into
mainfrom
example-decouple

Conversation

@ryukzak

@ryukzak ryukzak commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Consolidate and reorganize the examples/ directory: fewer top-level dirs, less duplication, clearer per-language structure, and a clean split between examples that commit their generated types and those generated on the fly.

Directory changes

Before → after:

examples/                              examples/
├── typescript-r4/             ──┐     ├── typescript-r4-us-core/        (merged)
├── typescript-us-core/        ──┘     ├── typescript-custom-packages/   (merged)
├── typescript-sql-on-fhir/    ──┐     └── on-the-fly/
├── local-package-folder/      ──┘         ├── norge-r4/
├── typescript-ccda/           ────────────┤   kbv-r4/
└── on-the-fly/{norge-r4,kbv-r4}/          └── ccda/                     (moved)
  • typescript-r4 + typescript-us-coretypescript-r4-us-core — a single generate.ts pulls US Core 8.0.1 (which depends on R4 core), so one fhir-types/ tree holds both hl7-fhir-r4-core and hl7-fhir-us-core.
  • local-package-folder + typescript-sql-on-fhirtypescript-custom-packages — both demonstrate non-registry input sources; a single generate.ts runs both in sequence: local StructureDefinitions via .localStructureDefinitions()fhir-types, and a remote TGZ via .fromPackageRef()sql-on-fhir-types.
  • typescript-ccdaon-the-fly/ccda — ccda never commits its fhir-types/ (generated on the fly), so it belongs with the other on-the-fly examples. The parent on-the-fly/.gitignore already covers fhir-types/, and the depth-sensitive tsconfig/generate.ts paths were fixed.

Test dedup & naming

  • Trimmed the US Core bp/bodyweight tests: the base profile-class API (create/apply/from/slice accessors, category auto-population) is already demonstrated against the R4 profiles, so the US Core files keep one self-contained create demo plus only US-Core-specific scenarios (constrained value[x] validation, narrowed-choice mutual exclusion, a working from() round-trip the R4 BP can't do, and Bundle<T> + multi-profile is()).
  • Renamed the typescript-r4-us-core test files into a consistent scheme:
    • core-type usage: resources.test.ts, raw-extensions.test.ts
    • profile classes: profile-r4-{extension,bodyweight,bp}.test.ts, profile-us-core-{patient,bp,bodyweight}.test.ts

Build & CI

Makefile targets before → after:

test-typescript-r4-example          ─┐
test-typescript-us-core-example     ─┴→ test-typescript-r4-us-core-example
test-typescript-sql-on-fhir-example ─┐
test-local-package-folder-example   ─┴→ test-typescript-custom-packages-example
test-typescript-ccda-example         → test-on-the-fly-ccda   (under test-on-the-fly-example)
  • CI (sdk-tests.yml): consolidated the two TypeScript SDK jobs into one test-typescript-r4-us-core-example job, renamed the local-package job to test-typescript-custom-packages-example, and removed the standalone ccda job (now covered by the on-the-fly job). Each on-the-fly example runs generate → typecheck → test.
  • The test-on-the-fly-ccda target drops a redundant unit-test invocation (test/unit/typeschema/transformer/ccda.test.ts is already covered by make test).

Docs

  • examples/README.md restructured into per-language sections (TypeScript / Python / C#), plus Template-Based and On-the-Fly; the C# Aidbox integration-test instructions moved into the C# section and a couple of stray snippets removed.
  • Updated README.md, design docs, CLAUDE.md, and .zed/tasks.json references.

Notes

  • The combined typescript-r4-us-core/fhir-types is committed and CI verifies it matches a fresh generation; the trimmed/merged outputs were regenerated and confirmed deterministic.
  • The dated docs/posts/* blog archives still reference the old paths and were intentionally left untouched (they already point at since-removed files).

ryukzak added 4 commits June 18, 2026 13:39
…custom-packages

Both demonstrate non-registry input sources, so combine them into one example:
local StructureDefinitions from disk (.localStructureDefinitions) and a remote
TGZ package by URL (.fromPackageRef), each writing to its own output dir.
…r4-us-core

A single generate.ts pulls US Core 8.0.1 (which depends on R4 core), so one
fhir-types tree holds both hl7-fhir-r4-core and hl7-fhir-us-core. The US Core
bp/bodyweight tests are trimmed to only US-Core-specific scenarios; the base
profile-class API stays demonstrated once against the R4 profiles.
ccda does not commit its fhir-types (generated on the fly), so it belongs with
the other on-the-fly examples rather than the committed-types TS examples.
…ples

- Makefile: test-typescript-r4-us-core-example, test-typescript-custom-packages-example,
  and test-on-the-fly-ccda (folded into test-on-the-fly-example)
- CI: consolidate the two TS SDK jobs, drop the standalone ccda job (covered by on-the-fly)
- Update README, examples README, design docs, CLAUDE.md, .zed tasks, and the
  multi-package test / python-us-core fixture paths
@ryukzak
ryukzak force-pushed the example-decouple branch from 9aee3c9 to d6eb640 Compare June 18, 2026 11:39
Comment thread examples/typescript-custom-packages/README.md Outdated
Comment thread examples/typescript-r4-us-core/generate.ts
ryukzak added 4 commits June 18, 2026 14:27
Address review: merge generate-local.ts and generate-sql-on-fhir.ts into one
generate.ts that runs both input mechanisms (local StructureDefinitions →
fhir-types, remote TGZ → sql-on-fhir-types) in sequence. Update Makefile and READMEs.
Address review: the R4 profile tests were named profile-bodyweight/profile-bp
while the US Core ones are profile-us-core-*; rename so the file names show
they exercise the base R4 profiles. Update README/CLAUDE.md references.
- Give TypeScript, Python, and C# their own per-language sections
  (move typescript-custom-packages under TypeScript Generation)
- Drop the stray Mustache snippet from Running Examples
- Move the C# Aidbox integration-test instructions into the C# Generation section
- extension-profile.test.ts -> profile-r4-extension.test.ts (it exercises R4
  extension *profile classes*, so it belongs in the profile-<pkg>-* group)
- resource.test.ts -> resources.test.ts; raw-extension.test.ts -> raw-extensions.test.ts
- Fix stale profile-bodyweight/profile-bp cross-references in the US Core test headers
- Update README and root README references
@ryukzak
ryukzak force-pushed the example-decouple branch from 9e608aa to 4b14ee0 Compare June 18, 2026 12:47
@ryukzak
ryukzak merged commit c742bf8 into main Jun 18, 2026
35 checks passed
@ryukzak
ryukzak deleted the example-decouple branch June 18, 2026 12:52
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