Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
export AIDBOX_LICENSE_ID="${{ secrets.AIDBOX_LICENSE_ID }}"
make test-python-sdk

test-python-fhirpy-sdk:
test-python-r4-example:
runs-on: ubuntu-latest

steps:
Expand All @@ -110,18 +110,18 @@ jobs:
- name: Test Python fhirpy SDK
run: |
export AIDBOX_LICENSE_ID="${{ secrets.AIDBOX_LICENSE_ID }}"
make test-python-fhirpy-sdk
make test-python-r4-example

- name: Repository contains actual python-fhirpy-sdk version
- name: Repository contains actual python-r4 version
run: |
diff_result=$(git diff --exit-code --name-only examples/python-fhirpy/fhir_types || true)
diff_result=$(git diff --exit-code --name-only examples/python-r4/fhir_types || true)

if [ -z "$diff_result" ]; then
echo "✅ Generated SDK is identical to the one stored in repository."
else
echo "❌ Generated SDK differs from the one stored in repository."
echo "Differences:"
git diff examples/python-fhirpy/fhir_types
git diff examples/python-r4/fhir_types
exit 1
fi

Expand Down
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ FHIR Package → TypeSchema Generator → TypeSchema Format → Code Generators
- Prefer single-line guard clauses without braces: `if (!x) throw new Error("...");` instead of wrapping in `{ }`
- Do not check `kind` of `Identifier`/`TypeIdentifier`/`TypeSchema` by manually comparing the `kind` field. Use dedicated predicates (`isPrimitiveIdentifier`, `isSpecializationTypeSchema`, etc.)

### Documentation
- Don't hard-wrap paragraphs in Markdown files (`README.md`, `docs/`). Write each paragraph as a single physical line and let it soft-wrap; reserve line breaks for list items and intentional structure.

### Testing Strategy
- Uses Bun's built-in test runner
- Unit tests for core functionality (transformers, builders)
Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ VERSION = $(shell cat package.json | grep version | sed -E 's/ *"version": "//'
test-on-the-fly-example test-on-the-fly-norge-r4 test-on-the-fly-kbv-r4 test-on-the-fly-ccda \
test-typescript-r4-us-core-example test-typescript-custom-packages-example \
test-mustache-java-r4-example \
test-csharp-sdk generate-python-r4-us-core-sdk generate-python-sdk-fhirpy \
python-r4-us-core-test-setup python-fhirpy-test-setup \
test-python-sdk test-python-fhirpy-sdk test-python-r4-us-core-example
test-csharp-sdk generate-python-r4-us-core-sdk generate-python-r4-sdk \
python-r4-us-core-test-setup python-r4-test-setup \
test-python-sdk test-python-r4-example test-python-r4-us-core-example

all: test test-multi-package test-typescript-r4-us-core-example test-typescript-custom-packages-example lint-unsafe test-all-example-generation

Expand Down Expand Up @@ -57,7 +57,7 @@ test-all-example-generation: test-other-example-generation
bun run examples/typescript-custom-packages/generate.ts
bun run examples/mustache/mustache-java-r4-gen.ts
bun run examples/python-r4-us-core/generate.ts
bun run examples/python-fhirpy/generate.ts
bun run examples/python-r4/generate.ts
bun run examples/typescript-r4-us-core/generate.ts

test-other-example-generation: test-on-the-fly-example
Expand Down Expand Up @@ -102,15 +102,15 @@ test-csharp-sdk: typecheck prepare-aidbox-runme

PYTHON=python3.13
PYTHON_R4_US_CORE_EXAMPLE=./examples/python-r4-us-core
PYTHON_FHIRPY_EXAMPLE=./examples/python-fhirpy
PYTHON_R4_EXAMPLE=./examples/python-r4

generate-python-r4-us-core-sdk:
$(TYPECHECK) --project examples/python-r4-us-core/tsconfig.json
bun run examples/python-r4-us-core/generate.ts

generate-python-sdk-fhirpy:
$(TYPECHECK) --project examples/python-fhirpy/tsconfig.json
bun run examples/python-fhirpy/generate.ts
generate-python-r4-sdk:
$(TYPECHECK) --project examples/python-r4/tsconfig.json
bun run examples/python-r4/generate.ts

python-r4-us-core-test-setup:
@if [ ! -d "$(PYTHON_R4_US_CORE_EXAMPLE)/venv" ]; then \
Expand All @@ -120,9 +120,9 @@ python-r4-us-core-test-setup:
pip install -r fhir_types/requirements.txt; \
fi

python-fhirpy-test-setup:
@if [ ! -d "$(PYTHON_FHIRPY_EXAMPLE)/venv" ]; then \
cd $(PYTHON_FHIRPY_EXAMPLE) && \
python-r4-test-setup:
@if [ ! -d "$(PYTHON_R4_EXAMPLE)/venv" ]; then \
cd $(PYTHON_R4_EXAMPLE) && \
$(PYTHON) -m venv venv && \
. venv/bin/activate && \
pip install -r fhir_types/requirements.txt && \
Expand All @@ -145,7 +145,7 @@ test-python-sdk: typecheck prepare-aidbox-runme generate-python-r4-us-core-sdk p
. venv/bin/activate && \
python -m pytest test_sdk.py -v

test-python-fhirpy-sdk: typecheck prepare-aidbox-runme generate-python-sdk-fhirpy python-fhirpy-test-setup
cd $(PYTHON_FHIRPY_EXAMPLE) && \
test-python-r4-example: typecheck prepare-aidbox-runme generate-python-r4-sdk python-r4-test-setup
cd $(PYTHON_R4_EXAMPLE) && \
. venv/bin/activate && \
mypy .
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ See the [examples/](examples/) directory for working demonstrations:

- **[typescript-r4-us-core/](examples/typescript-r4-us-core/)** - FHIR R4 core + US Core type generation with resource creation, profiles, and extensions
- **[on-the-fly/ccda/](examples/on-the-fly/ccda/)** - C-CDA on FHIR type generation (logical models, generated on the fly)
- **[python-r4-us-core/](examples/python-r4-us-core/)** - Python/Pydantic models for FHIR R4 core + US Core profiles, with a requests-based client
- **[python-fhirpy/](examples/python-fhirpy/)** - Python/Pydantic model generation with fhirpy async client
- **[python-r4-us-core/](examples/python-r4-us-core/)** - Python/Pydantic models for FHIR R4 core + US Core profiles, with the default fhirpy async client
- **[python-r4/](examples/python-r4/)** - Python/Pydantic model generation with the simple requests-based client
- **[csharp/](examples/csharp/)** - C# class generation with namespace configuration
- **[mustache/](examples/mustache/)** - Java generation with Mustache templates and post-generation hooks
- **[typescript-custom-packages/](examples/typescript-custom-packages/)** - Loading packages from local folders or remote TGZ URLs (SQL-on-FHIR)
Expand Down
11 changes: 5 additions & 6 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ This directory contains working examples demonstrating the capabilities of Atomi
### Python Generation

- **[python-r4-us-core/](python-r4-us-core/)** - Python/Pydantic models for FHIR R4 core + US Core profiles
- `generate.ts` - Generates R4 models and US Core profiles in one tree; configurable `snake_case`/`camelCase` field naming and extra-field validation
- `generate.ts` - Generates R4 models and US Core profiles in one tree with the default `fhirpy` async client
- US Core profile classes (Patient, blood pressure, body weight) with typed accessors and race/ethnicity/birth-sex extensions
- Simple `requests`-based FHIR client ([python-r4-us-core/client.py](python-r4-us-core/client.py)), exercised by `test_sdk.py`
- `fhirpy` `AsyncFHIRClient` demo ([python-r4-us-core/demo.py](python-r4-us-core/demo.py)), exercised by `test_sdk.py`

- **[python-fhirpy/](python-fhirpy/)** - Python/Pydantic models with fhirpy async client
- `generate.ts` - Generates Python models with fhirpy integration
- Uses `fhirpyClient: true` for async FHIR client support
- Client implementation example: [python-fhirpy/client.py](python-fhirpy/client.py)
- **[python-r4/](python-r4/)** - Python/Pydantic models with the simple `requests`-based client
- `generate.ts` - Generates R4 models with `client: "none"`, `snake_case`
- Reusable `Client` class with basic auth and CRUD/search ([python-r4/client.py](python-r4/client.py))

### C# Generation

Expand Down
153 changes: 0 additions & 153 deletions examples/python-fhirpy/README.md

This file was deleted.

Loading
Loading