Crates.io | octofhir-fhir-model |
lib.rs | octofhir-fhir-model |
version | 0.1.5 |
created_at | 2025-08-07 19:12:56.4637+00 |
updated_at | 2025-09-19 21:18:43.266569+00 |
description | Core FHIR model abstractions, ModelProvider trait, and FhirPathEvaluator |
homepage | |
repository | https://github.com/octofhir/fhir-model-rs |
max_upload_size | |
id | 1785667 |
size | 185,863 |
Core FHIR model abstractions and ModelProvider trait for FHIRPath type-aware evaluation.
This crate provides the foundational types and traits for FHIR model integration with FHIRPath engines. It serves as an intermediate dependency to break circular dependencies between FHIRPath implementations and FHIR schema libraries.
The crate is designed around the ModelProvider
trait, which abstracts access to FHIR model information including:
default
- Core functionality without optional dependenciesasync
- Enables async support with async-trait
and tokio
serde
- Adds serialization support via serde
Add this to your Cargo.toml
:
[dependencies]
octofhir-fhir-model = "0.1.0"
For async support:
[dependencies]
octofhir-fhir-model = { version = "0.1.0", features = ["async"] }
For serialization support:
[dependencies]
octofhir-fhir-model = { version = "0.1.0", features = ["serde"] }
use octofhir_fhir_model::{ModelProvider, TypeReflectionInfo, FhirVersion};
// ModelProvider implementations provide type information
fn example_usage(provider: &dyn ModelProvider) {
if let Some(type_info) = provider.get_type_reflection("Patient") {
println!("Patient type: {:?}", type_info);
}
}
use octofhir_fhir_model::{ModelProvider, TypeReflectionInfo};
fn inspect_type(provider: &dyn ModelProvider, type_name: &str) {
if let Some(reflection) = provider.get_type_reflection(type_name) {
println!("Type: {}", reflection.type_name);
println!("Base type: {:?}", reflection.base_type);
for element in &reflection.elements {
println!(" Element: {} ({})", element.name, element.type_name);
}
}
}
use octofhir_fhir_model::{ModelProvider, ConformanceResult};
fn validate_resource(provider: &dyn ModelProvider, resource_data: &str) -> ConformanceResult {
// Implementation would validate the resource against FHIR profiles
// This is typically implemented by concrete ModelProvider implementations
provider.validate_conformance(resource_data)
}
boxing
- Boxed value types and extensions for FHIRPath evaluationconformance
- Conformance validation results and violation reportingconstraints
- Constraint definitions and evaluation resultserror
- Error types and result handlingprovider
- Core ModelProvider trait and related typesreflection
- Type reflection and metadata structuresThis crate is designed to work with multiple FHIR versions through the FhirVersion
enum:
cargo build
Or using just:
just build
cargo test --all-features
Or using just:
just test-all
Generate and open documentation:
cargo doc --no-deps --all-features --open
Or using just:
just doc-open
Contributions are welcome! Please feel free to submit a Pull Request.
just test-all
just fmt
and just lint
This project is dual-licensed under either:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
This project is part of the OctoFHIR ecosystem for FHIR processing in Rust.