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;
23mod metadata;
24pub mod model;
25mod print;
26
27pub use compile::{
28    AUTO_VARIABLE, BATCH_UNNAMED_PREFIX, Compiled, Locations, REFERENCES_CONTAINED_EXTENSION,
29    SOURCE_ELEMENT_EXTENSION, Span, TARGET_ELEMENT_EXTENSION, compile, compile_tree, make_id,
30    source_path,
31};
32pub use flavor::{R4Map, from_json, to_r4};
33pub use model::StructureMap;
34pub use print::print;