Skip to content

Releases: atomic-ehr/codegen

v0.0.13

20 Apr 15:48

Choose a tag to compare

What's Changed

Fixes

  • PY: Fix to_json() omitting resourceType from serialized output — @ryukzak in #136
  • TS: Fix duplicate meta key in createResource when meta is a profile factory param (#137) — @sussdorff in #138

Improvements

  • API: Add ignorePackageIndex option to force .index.json regeneration — @ryukzak in #139
  • CI: Add on-the-fly generation examples for Norge R4 and KBV R4 — @ryukzak in #139

New Contributors

Full Changelog: v0.0.12...v0.0.13

v0.0.12

17 Apr 07:26

Choose a tag to compare

What's Changed

  • Fix work in CJS mode. CI: Rework package-managers job and update deps by @ryukzak in #135
  • TypeSchema: Replace inline FHIRValue casts with proper FHIRCoding import by @ryukzak in #133
  • TypeSchema: Precompute base names for profile methods by @ryukzak in #132

Full Changelog: v0.0.11...v0.0.12

v0.0.11

08 Apr 12:29

Choose a tag to compare

Highlights

This release focuses on the TypeScript Profile API — making generated profile classes more type-safe, more complete in validation, and easier to use with slices.

Python: Extension support (#107)

Extension support for the Python/Pydantic code generator.

TypeScript Profile API

Profile apply() / create() fixes (#121)

  • apply() now sets fixed-value fields and auto-populates discriminator-only slice stubs, matching create() behavior
  • Fixed-value fields get a getter but no setter
  • Extension apply() sets URL, uses upsert for single extensions

Remove buildResource, fix type safety (#126)

  • Remove buildResource<T>() helper — createResource now uses plain object literals for better type checking
  • Generate Reference<string /* Resource */> for family type references so narrower references like Reference<"Patient"> are assignable to base type fields
  • Fix tryPromoteChoice to correctly resolve reference targets with generic params

SliceFlat / SliceFlatAll type split (#127)

Slice flat types are now split into two:

  • SliceFlat — setter input, discriminator fields omitted (auto-applied)
  • SliceFlatAll — getter return, includes readonly discriminator literal types
setVSCat(input?: VSCatSliceFlat): this              // no discriminators needed
getVSCat(): VSCatSliceFlatAll | undefined            // includes { coding: [...] }

Array API for unbounded slices (#129)

Slices with max: * now use array-based setters/getters instead of single-element API:

// Before — second call replaces first
bundle.setOrganizationEntry({ resource: org1 });
bundle.setOrganizationEntry({ resource: org2 });

// After — set all at once
bundle.setOrganizationEntry([{ resource: org1 }, { resource: org2 }]);

Slice field validation (#130)

validate() now checks required fields inside matched slice elements. For example, BP profile reports missing valueQuantity in component slices:

profile.validate().errors
// [
//   "component[SystolicBP].valueQuantity is required",
//   "component[DiastolicBP].valueQuantity is required",
// ]

Cleanup (#131)

  • Remove dead stripMatchKeys export
  • Document Profile API in CLAUDE.md

Contributors

Full Changelog: v0.0.10...v0.0.11

v0.0.10

27 Mar 09:18

Choose a tag to compare

Features

TypeSchema: Auto-collect extension dependencies during tree shake (#103)

  • Extension definitions used by profiles are now included automatically — no need to list them manually in tree shake config
  • Add ignoreExtensions tree shake rule for excluding specific extensions by canonical URL

TypeSchema/TS: Choice type narrowing and validation for profiles (#105)

  • Restrict ChoiceFieldDeclaration.choices to only the variants declared by the most derived constraint
  • Emit validateExcluded for disallowed choice variants in profile validation (e.g. body weight only permits valueQuantity, 10 others are excluded)

TypeSchema/API: Collision resolution config (#106)

  • When multiple FHIR schemas produce a binding enum with the same name (e.g. ObservationCategory from Observation and DiagnosticReport), the generator must pick one — previously it auto-selected the most common source and emitted a warning
  • Add resolveCollisions option to .typeSchema() for explicit control over which source wins
  • IR report now shows (selected) / (auto) marks and suggests config snippets for unresolved collisions

TS: Type discriminator support for slicing (#108)

  • Support type discriminator in slicing — match slices by resourceType field
  • Generate typed getters/setters for type-discriminated slices (e.g. getPatientEntry() / setPatientEntry())
  • Example: Bundle Profile SD, profile-typed-bundle.test.ts.

TS: Generic type-family fields (#109)

  • Emit generic type parameters for fields typed as a resource base type (Resource, DomainResource)
  • BundleEntry<T extends Resource = Resource>, DomainResource<T> — unparameterized usage is unchanged
  • Profile slices use narrowed generics: BundleEntry<Patient>, BundleEntry<Organization>

TypeSchema refactoring

  • Renames (#114, #117):
    • RegularTypeSchemaSpecializationTypeSchema
    • IdentifierTypeIdentifier
    • NestedTypeSchemaNestedType
  • Remove generated profile override interface (#104)
  • Narrow FieldSlicing discriminator type from string to literal union (#110)
  • Add typeFamily.complexTypes, remove resourceChildren (#111)
  • Make SpecializationTypeSchema a discriminated union: ResourceTypeSchema | ComplexTypeTypeSchema | LogicalTypeSchema (#113)
  • Split resolve into resolve(Identifier) and resolveType(TypeIdentifier) (#113)
  • Split dependency types: Identifier[] for specializations, TypeIdentifier[] for profiles (#118)

Maintenance

  • Update @atomic-ehr/fhirschema to 0.0.9 (#119)
  • Remove dead code found by knip (#120)

Full Changelog: v0.0.9...v0.0.10

v0.0.9

12 Mar 18:01

Choose a tag to compare

Highlights

US Core profile support — generated profile classes now cover US Core IG with typed extension setters, component slice accessors, and validate() returning { errors, warnings } with must-support field tracking. See the blog post and working examples.

What's Changed

TypeScript:

  • Fix: skip choice flattening for primitive variant types by @ryukzak in #99
  • Refactor TypeScript profile codegen: typed helpers, reduced casts, resolved references by @ryukzak in #101
  • US Core profile support, unified getter/setter API, validate() with errors/warnings and must-support by @ryukzak in #102

Python:

Internal:

Full Changelog: v0.0.8...v0.0.9

v0.0.8

05 Mar 07:39

Choose a tag to compare

What's Changed

  • TS: Fix primitive array extension types and add extension tests by @ryukzak in #76
  • TS: Enhance profile code generation with factory methods, extensions, and pattern values by @ryukzak in #81
  • Python: feat: improve support for fhirpy client (rebased) by @ruscoder, @MikhailArtemyev in #88
  • Fix logic-promotion + Improve test coverage by @MikhailArtemyev in #73
  • Detect non-BackboneElement nested types via elements-based analysis by @ryukzak in #83
  • Unify FHIR package patching via preprocessPackage hook by @ryukzak in #84
  • Add profile class enhancements: getters, validation, and BP support by @ryukzak in #90
  • Auto-populate required slices in profile createResource() by @ryukzak in #91
  • Preserve original SD slice name casing in generated methods by @ryukzak in #94
  • Flatten single-variant choice types and optional slice auto-fields by @ryukzak in #95

Internal:

  • Refactor TypeScript writer into modular file structure by @ryukzak in #82
  • Update docs, README, and blog posts by @ryukzak in #93
  • Fix US Core example imports and add Makefile target by @ryukzak in #92

Full Changelog: v0.0.7...v0.0.8

v0.0.7

14 Feb 07:20

Choose a tag to compare

What's Changed

  • Export profile base interface alongside the profile class by @aartaka in #68
  • TypeSchema: collision detection, open enum bindings, and file overwrite warnings by @ryukzak in #69
  • Add CCDA (not CDA) tests by @aartaka in #70
  • refactor: cleanup and reduce code complexity by @ryukzak in #71
  • Export registerFromPackageMetas for use in CCDA converter by @aartaka in #72
  • Improve cross-package type resolution and add Norwegian FHIR package support by @ryukzak in #75

Full Changelog: v0.0.6...v0.0.7

v0.0.6

06 Feb 08:56

Choose a tag to compare

✨ New Features

  • Profile Generation Support (#49) - Full support for generating code from FHIR profiles by @octoshikari
  • FHIRSchema & StructureDefinition Export (#55) - Added introspection support for FHIRSchema and StructureDefinition exports by @ryukzak
  • Logical Model Control (#61) - New .typeSchema({ promoteLogical: ... }) option to force logical models to be processed like resources by @ryukzak
  • Python fhirpy Client Support (#43) - Added Python code generation with fhirpy client compatibility by @MikhailArtemyev
  • Tree Shaking Hints (#50) - Added hints to help users optimize package selection with tree shaking by @ryukzak
  • Type generation for CCDA draft

🐛 Bug Fixes

  • TypeScript Profile Generation (#57) - Fixed TypeScript profile generation for CCDA extensions with [x] names by @ryukzak
  • Tree Shaking for Profiles (#51) - Fixed tree shaking behavior when working with profiles by @ryukzak
  • Binding Snapshot Resolution (#66) - Fixed binding snapshot resolution in StructureDefinition processing by @ryukzak

🔧 Improvements

  • Performance Optimization (#65) - Significant optimization for processing large FHIR packages by @ryukzak
  • Unified TypeSchema API (#64) - Refactored to introduce unified .typeSchema({...}) builder API and reporting by @ryukzak
  • Registry Post-Load Fixes (#66) - Added Registry.patchSd(...) for post-load StructureDefinition modifications by @ryukzak
  • Introspection Output (#52) - Refactored to use FileSystemWriter for generating type schemas and type tree by @ryukzak
  • Python Examples (#67) - Simplified Python examples using tree shaking by @MikhailArtemyev

🔄 Breaking Changes

  • TypeScript Logical Model Handling (#63) - TypeScript generator no longer processes logical models like resources by default. Use .promoteLogicToResource for the previous behavior by @ryukzak

🏗️ Technical Changes

  • Code Cleanup (#53) - Refactored and removed deprecated code by @ryukzak
  • CI Integration Tests (#56) - Added integration tests to CI pipeline by @MikhailArtemyev

Full Changelog: v0.0.5...v0.0.6

v0.0.5

26 Dec 08:58

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.0.4...v0.0.5

v0.0.4

11 Dec 13:38

Choose a tag to compare

What's Changed

  • TS: Fix primitive type extension by @ryukzak in #31
  • Dog food: use generated types for CodeSystem and ValueSet by @ryukzak in #33

Full Changelog: v0.0.3...v0.0.4