InstanceOf: <type> (Decleration)
Just like a FSH instance decleration, a FLASH script must have the
InstanceOf: keyword followed by the name of the resource type or an identifier of a resource profile. The identifier can be the canonical URL or the ID of its StructureDefinition resource.
InstanceOf: Patient => Create a Patient resource instance
InstanceOf: bp => Create an instance of HL7's blood pressure profile, who's id is
InstanceOf: http://hl7.org/fhir/StructureDefinition/bp => Same as using
Instance: <expression> (Logical ID)
Instance keyword in FLASH assigns the evaluated
expr into the logical id of the resulting resource. The expression can be any valid FUME expression that evaluates to a string.
Instance keyword is used, it SHOULD come before the
InstanceOf keyword, as defined in the FHIR Shorthand language.
* <element> = <expr> (Assignment)
Just like in FHIR Shorthand, assigning values into FHIR elements is done by declaring assignment rules.
Rules always start on a new line and are prefixed with the
* symbol. The FHIR element name follows the asterisk. After the element name, the
= sign tells fume to assign the evaluated
expr on the right into the element on the left.
* status = 'active'=> Assings a fixed value 'active' into the element named
* identifier.value = mrn=> Assigns the value of the
mrnkey from the current context item into the identifier.value element
* <context element> (Context Rule)
A context rule is used in FLASH to allow the use of indented rules in the following lines. The indented rules should come immediately after the context rule, and they should be indented with two white spaces.
* value = mrn
^ Will assign the value of the
mrn key from the input context into the identifier.value element. This is the same as
* identifier.value = mrn.
* (context).<element> (Input Context)
This syntax is used to set a context from the input document on the current rule, and for any following indented rules. When
(context) evaluates to an object, this means that inside this rule, all keys of the object can be used in the expressions without the need to prefix them with the path.
(context) evaluates to an array, this means that the rule will be duplicated for each element in the array, and the following expressions will be evaluated in relation to the current element in the context array. This is a type of forEach loop.
* <element>[sliceName] (Slices)
When you want to address a slice in a profile, this is done by inserting the slice name into a pair of square brackets that immediatly follow the element name.
Inserting values into FHIR arrays
In FLASH, if a rule appears more than once in the same context, and the element the rule refers to has a maximum cardinality greater than one (array), then the evaluated expressions will be appended into the element, in the same order they appear in the FLASH script. If the element has a maximum cardinality of 1, then each evaluated expression will override the previous one.