This directory contains working examples demonstrating the capabilities of Atomic FHIR Codegen.
-
typescript-r4/ - FHIR R4 core type generation
generate.ts- Generates TypeScript interfaces for FHIR R4 specificationdemo.ts- Demonstrates resource creation, profile usage (bodyweight), and bundle composition- Shows how to use
attachandextractfunctions for FHIR profiles
-
typescript-ccda/ - C-CDA on FHIR type generation
generate.ts- Generates types from HL7 CDA UV Core package (hl7.cda.uv.core@2.0.1-sd)- Exports TypeSchema files and dependency tree
-
typescript-sql-on-fhir/ - SQL on FHIR ViewDefinition types
generate.ts- Generates types from remote TGZ package- Demonstrates tree shaking to include only specific resources
-
typescript-us-core/ - US Core profile generation with profile classes
generate.ts- Generates TypeScript types for US Core 8.0.1 with profile classesprofile-demo.ts- Demonstrates profile class fluent API for extensions and slices- Shows type-safe handling of race, ethnicity, birth sex extensions
- Demonstrates blood pressure observation slicing
-
python/ - Python/Pydantic model generation with simple requests-based client
generate.ts- Generates Python models with configurable field formats- Supports
snake_caseorcamelCasefield naming - Configurable extra field validation
- Client implementation example: python/client.py
-
python-fhirpy/ - Python/Pydantic models with fhirpy async client
generate.ts- Generates Python models with fhirpy integration- Uses
fhirpyClient: truefor async FHIR client support - Client implementation example: python-fhirpy/client.py
-
csharp/ - C# class generation
generate.ts- Generates C# classes with custom namespace- Includes static files for base functionality
- Includes integration tests with Aidbox FHIR server
- mustache/ - Java generation with Mustache templates
mustache-java-r4-gen.ts- Generates Java code using Mustache templates- Full Maven project structure with post-generation hooks
- Demonstrates template-driven code generation for any language or format
- local-package-folder/ - Working with unpublished FHIR packages
generate.ts- Loads local StructureDefinitions from disk- Demonstrates dependency resolution with FHIR R4 core
- Shows tree shaking for custom logical models
Each example contains a generate.ts script that can be run with:
# Using Bun
bun run examples/typescript-r4/generate.ts
# Using Node with tsx
npx tsx examples/typescript-r4/generate.ts
# Using ts-node
npx ts-node examples/typescript-r4/generate.tsTo run the TypeScript R4 demo after generation:
bun run examples/typescript-r4/demo.tsFor the Mustache example:
bun run examples/mustache/mustache-java-r4-gen.tsThis generates a complete Maven project with Java classes ready to build.
The C# example includes integration tests with Aidbox FHIR server. To run the tests:
# Start Aidbox server
docker compose up
# In another terminal, run the C# tests
cd examples/csharp
dotnet testSee examples/csharp/README.md for detailed setup instructions.