fhir-types
Per-version FHIR types and terminology operation contracts.
Generated Rust types for the FHIR R4 (4.0.1), R4B (4.3.0), R5 (5.0.0), and R6
(6.0.0-ballot5) terminology surface: CodeSystem, ValueSet, ConceptMap,
Parameters, OperationOutcome, CapabilityStatement,
TerminologyCapabilities, Bundle, the datatypes and primitives they reach,
a JSON codec, and typed request and response contracts for $lookup,
$validate-code, $expand, $subsumes, and $translate per version, each
with a runtime descriptor of the declared parameter set.
Every file is generated by fhir-codegen
from the vendored HL7 packages and marked // @generated. To change the
output, change the generator and regenerate; the crate is never hand-edited.
The terminology ecosystem overlay (the HL7 terminology ecosystem IG requirements)
is applied at generation and marked per parameter.
JSON and decimal precision
The codec reads and writes FHIR JSON through its own document model,
fhir_types::codec::Value, which holds a number in the text the document
carried. FHIR says "Do not use an IEEE type floating point type, instead use
something that works like a true decimal"
(https://hl7.org/fhir/R4B/datatypes.html#decimal), so 1.10 keeps its
trailing zero and a decimal past f64 precision keeps its digits, through the
Serialize impls and through Json::to_json alike.
That costs a dependent nothing. The crate turns on no serde_json feature that
changes how numbers deserialize, so your own types keep reading and writing the
JSON they always did. Reading a document uses serde_json's raw value, so the
Deserialize impls read serde_json's format.
Where it sits
fhir-types is one crate of FerroTERM,
a pure-Rust FHIR terminology server for SNOMED CT, LOINC, and other clinical
code systems. The crates are published so other projects can reuse them; the
API is pre-1.0 and moves with the FerroTERM release train. Documentation:
https://docs.rs/fhir-types.
Licence
Apache License, Version 2.0 (LICENSE). This crate is one of the two the
workspace publishes under Apache 2.0 rather than its Business Source License
1.1, so any Rust project can depend on it without a licence conversation. Clinical terminology content (SNOMED
CT, LOINC, RxNorm, ICD, the Dutch national code systems) is licensed by its
publisher and is never part of this crate.