Skip to main content

Crate fml_model

Crate fml_model 

Source
Expand description

StructureMap for the FHIR Mapping Language: compile FML to a StructureMap resource.

let compiled = fml_model::compile(r#"
/// url = 'http://example.org/StructureMap/Copy'
/// name = 'Copy'
uses "http://hl7.org/fhir/StructureDefinition/Patient" as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" as target

group Copy(source src : Patient, target tgt : Patient) {
  src.name -> tgt.name;
}
"#);
assert!(!compiled.has_errors());
let rule = &compiled.map.group[0].rule[0];
assert_eq!(rule.name.as_deref(), Some("name"));
assert_eq!(rule.target[0].transform.as_deref(), Some("create"));

Re-exports§

pub use flavor::R4Map;
pub use flavor::from_json;
pub use flavor::to_r4;
pub use model::StructureMap;

Modules§

flavor
StructureMap as FHIR R4 (and R4B) shape it, and back.
model
The StructureMap resource, as FHIR R5 and the Mapping Language IG define it.

Structs§

Compiled
The outcome of compiling FML: the map, as complete as the source allows, and the problems.

Constants§

AUTO_VARIABLE
The variable the simple copy form src.a -> tgt.a; binds on both sides.
BATCH_UNNAMED_PREFIX
Name prefix of the rules produced by an unnamed batch identity rule src -> tgt : a, b;.
REFERENCES_CONTAINED_EXTENSION
Extension on a parameter value that refers to a contained resource.
SOURCE_ELEMENT_EXTENSION
Extension holding source path segments after the first element (src.a.b → b).
TARGET_ELEMENT_EXTENSION
Extension holding target path segments after the first element.

Functions§

compile
Compiles FML source text to a StructureMap.
compile_tree
Compiles a parsed file. Syntax errors in the tree are not repeated in the result.
make_id
Utilities.makeId of the reference implementation: keeps ASCII letters, digits, - and ..
print
Writes a StructureMap as FML.
source_path
The source element path: the element and the path segments in the element extension.