Skip to content

Convert FHIR StructureDefinition into Python type annotations

License

Notifications You must be signed in to change notification settings

beda-software/fhir-py-types

Repository files navigation

build status Supported Python version

Quick start

Download StructureDefinition bundle and build type definitions from it:

git clone --depth 1 https://github.com/beda-software/fhir-py-types.git
cd fhir-py-types/spec/
sh download_spec_bundle.sh
cd ..
docker compose up

The generated type definitions can then be found in generated/resources.py.

How it works

The build process is based on the standard StructureDefintion resource (available in JSON format from the FHIR download page, direct link at the time of writing).

Contributing

The project uses poetry for package management.

Type definitions can be generated by running:

poetry install
poetry run typegen --from-bundles spec/fhir.types.json --from-bundles spec/fhir.resources.json --outfile generated/resources.py

Where spec/fhir.types.json and spec/fhir.resources.json are bundles of StructureDefinition resources.

Type check definitions (the very first type checking process might take a while to complete, consecutive runs should be faster)

poetry run mypy generated/resources.py

About

Convert FHIR StructureDefinition into Python type annotations

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •