Skip to main content

fml_model/
lib.rs

1//! StructureMap for the FHIR Mapping Language: compile FML to a StructureMap resource.
2//!
3//! ```
4//! let compiled = fml_model::compile(r#"
5//! /// url = 'http://example.org/StructureMap/Copy'
6//! /// name = 'Copy'
7//! uses "http://hl7.org/fhir/StructureDefinition/Patient" as source
8//! uses "http://hl7.org/fhir/StructureDefinition/Patient" as target
9//!
10//! group Copy(source src : Patient, target tgt : Patient) {
11//!   src.name -> tgt.name;
12//! }
13//! "#);
14//! assert!(!compiled.has_errors());
15//! let rule = &compiled.map.group[0].rule[0];
16//! assert_eq!(rule.name.as_deref(), Some("name"));
17//! assert_eq!(rule.target[0].transform.as_deref(), Some("create"));
18//! ```
19
20mod canonical;
21mod compile;
22pub mod flavor;
23pub mod model;
24mod print;
25
26pub use compile::{
27    AUTO_VARIABLE, BATCH_UNNAMED_PREFIX, Compiled, REFERENCES_CONTAINED_EXTENSION,
28    SOURCE_ELEMENT_EXTENSION, TARGET_ELEMENT_EXTENSION, compile, compile_tree, make_id,
29    source_path,
30};
31pub use flavor::{R4Map, from_json, to_r4};
32pub use model::StructureMap;
33pub use print::print;