Releases: atomic-ehr/codegen
v0.0.13
What's Changed
Fixes
- PY: Fix
to_json()omittingresourceTypefrom serialized output — @ryukzak in #136 - TS: Fix duplicate
metakey increateResourcewhenmetais a profile factory param (#137) — @sussdorff in #138
Improvements
- API: Add
ignorePackageIndexoption to force.index.jsonregeneration — @ryukzak in #139 - CI: Add on-the-fly generation examples for Norge R4 and KBV R4 — @ryukzak in #139
New Contributors
- @sussdorff made their first contribution in #138
Full Changelog: v0.0.12...v0.0.13
v0.0.12
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
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, matchingcreate()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 —createResourcenow uses plain object literals for better type checking - Generate
Reference<string /* Resource */>for family type references so narrower references likeReference<"Patient">are assignable to base type fields - Fix
tryPromoteChoiceto 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
stripMatchKeysexport - Document Profile API in CLAUDE.md
Contributors
Full Changelog: v0.0.10...v0.0.11
v0.0.10
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
ignoreExtensionstree shake rule for excluding specific extensions by canonical URL
TypeSchema/TS: Choice type narrowing and validation for profiles (#105)
- Restrict
ChoiceFieldDeclaration.choicesto only the variants declared by the most derived constraint - Emit
validateExcludedfor disallowed choice variants in profile validation (e.g. body weight only permitsvalueQuantity, 10 others are excluded)
TypeSchema/API: Collision resolution config (#106)
- When multiple FHIR schemas produce a binding enum with the same name (e.g.
ObservationCategoryfromObservationandDiagnosticReport), the generator must pick one — previously it auto-selected the most common source and emitted a warning - Add
resolveCollisionsoption 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
typediscriminator in slicing — match slices byresourceTypefield - 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):
RegularTypeSchema→SpecializationTypeSchemaIdentifier→TypeIdentifierNestedTypeSchema→NestedType
- Remove generated profile override interface (#104)
- Narrow
FieldSlicingdiscriminator type fromstringto literal union (#110) - Add
typeFamily.complexTypes, removeresourceChildren(#111) - Make
SpecializationTypeSchemaa discriminated union:ResourceTypeSchema | ComplexTypeTypeSchema | LogicalTypeSchema(#113) - Split
resolveintoresolve(Identifier)andresolveType(TypeIdentifier)(#113) - Split dependency types:
Identifier[]for specializations,TypeIdentifier[]for profiles (#118)
Maintenance
Full Changelog: v0.0.9...v0.0.10
v0.0.9
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:
- Added fhirpy support search/fetch API by @MikhailArtemyev in #89
- Binding support by @MikhailArtemyev in #97
Internal:
- Treeshake US Core example to Patient, BP, and BodyWeight by @ryukzak in #100
- New logger with suppression functionality by @MikhailArtemyev in #79
Full Changelog: v0.0.8...v0.0.9
v0.0.8
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
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
✨ 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
FileSystemWriterfor 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
.promoteLogicToResourcefor 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
What's Changed
- Add configurable log levels in CLI and API by @octoshikari in #29
- Support local packages by @octoshikari in #37
- Add support for custom registries by @iw-an in #38
- Python generator migration by @MikhailArtemyev @ryukzak in #34
- Fix tree shake bugs related to nested types & add selectFields to the rules by @ryukzak in #41
- Fix CSharp generator API. by @ryukzak in #44
- Tests for generators by @ryukzak in #45
- Actualize documentation & add GenerationReport prettifier by @ryukzak in #46
- Add a mustache based generator and java template (PR port) by @ryukzak in #27
New Contributors
- @octoshikari made their first contribution in #29
- @iw-an made their first contribution in #38
Full Changelog: v0.0.4...v0.0.5