Expand description
§FHIR Model Infrastructure
This module provides the foundational types and infrastructure that support the generated FHIR specification implementations. It contains hand-coded types that enable the generated code to handle FHIR’s complex requirements for precision, extensions, and cross-version compatibility.
§Architecture
The FHIR crate is organized as follows:
- Generated modules (
r4.rs,r4b.rs,r5.rs,r6.rs): Complete FHIR type implementations - Infrastructure module (
lib.rs): Foundational types used by generated code - Test modules: Validation against official FHIR examples
§Key Infrastructure Types
PreciseDecimal- High-precision decimal arithmetic preserving original string formatElement<T, Extension>- Base container for FHIR elements with extension supportDecimalElement<Extension>- Specialized element for decimal valuesFhirVersion- Version enumeration for multi-version support
§Usage Example
use helios_fhir::r4::{Patient, HumanName};
use helios_fhir::PreciseDecimal;
use rust_decimal::Decimal;
// Create a patient with precise decimal handling
let patient = Patient {
name: Some(vec![HumanName {
family: Some("Doe".to_string().into()),
given: Some(vec!["John".to_string().into()]),
..Default::default()
}]),
..Default::default()
};
// Work with precise decimals
let precise = PreciseDecimal::from(Decimal::new(12340, 3)); // 12.340Re-exports§
pub use parameters::ParameterValueAccessor;pub use parameters::VersionIndependentParameters;
Modules§
- parameters
- Version-independent FHIR Parameters resource wrapper
- r4
- FHIR R4 (4.0.1) - generated type definitions
- r5
- FHIR R5 (5.0.0) - generated type definitions
- r6
- FHIR R6 (current) - generated type definitions
- r4b
- FHIR R4B (4.3.0) - generated type definitions
Structs§
- Decimal
Element - Specialized element container for FHIR decimal values with precision preservation.
- Element
- Generic element container supporting FHIR’s extension mechanism.
- Precise
Decimal - High-precision decimal type that preserves original string representation.
- Precision
Date - Precision-aware FHIR Date type.
- Precision
Date Time - Precision-aware FHIR DateTime type.
- Precision
Instant - A FHIR instant value that preserves the original string representation and precision.
- Precision
Time - Precision-aware FHIR Time type.
Enums§
- Date
Precision - Precision levels for FHIR Date values.
- Date
Time Precision - Precision levels for FHIR DateTime values.
- Fhir
Version - Enumeration of supported FHIR specification versions.
- Time
Precision - Precision levels for FHIR Time values.
Traits§
- Fhir
Complex Type Provider - Trait for providing FHIR complex type information
- Fhir
Resource Type Provider - Trait for providing FHIR resource type information
Functions§
- deserialize_
forgiving_ option - Custom deserializer that is more forgiving of null values in JSON.