(forked from https://github.com/smart-on-fhir/fhir-parser)
The original project seemed to abandoned and its structure was not quite pythonic. The work which has been done was great and we wanted to continue development here. We wanted to have a more self-contained project, which already has the definitions for the languages on board.
Our main support goals are Python (3.8) with pydantic and FHIR R4.
This work is licensed under the APACHE license. FHIR® is the registered trademark of HL7 and is used with the permission of HL7.
The fhir_zeug.cli
module is the central CLI utility included. In an installed environment it can
be called with
Make sure you have the ouput not in the project directory otherwise you will run into issues with poetry.
poetry run fhirzeug --output-directory ../pydantic-fhir --generator python_pydantic
It will:
Article to understand the difference in FHIR between a ValueSets and a CodeSystems : https://fhir-drills.github.io/ValueSet-And-CodeSystem.html .
FHIR Specification provides different ways to define a ValueSet. At the moment, FHIRzeug implementation only handle a few cases :
DocEnum
object is generated to validate this ValueSet.spec["compose"]["include"][0]["concept"]
), ValueSet is validated by a typing.Literal
.
Warning : this is different from having access to the full CodeSystem. Especially, there is no documentation.Note : when no specific validation is implemented, the attribute has the generic type FHIRCode
which is a constrained string with the very permissive regex [^\s]+(\s[^\s]+)*
.
Every “property” of a class, meaning every element
in a profile snapshot, is represented as a FHIRStructureDefinitionElement
instance.
If an element itself defines a class, e.g. Patient.animal
, calling the instance's as_properties()
method returns a list of FHIRClassProperty
instances – usually only one – that indicates a class was found in the profile.
The class of this property is derived from element.type
, which is expected to only contain one entry, in this matter:
BackboneElement
, a class name is constructed from the parent element (in this case Patient) and the property name (in this case animal), camel-cased (in this case PatientAnimal).*
, a class for all classes found in settings`star_expand_types
is createdclassmap
, which is expected to be a valid FHIR class.Maintained by:
and