grammar: FHIRConnect/v0.0.1
type: model
metadata:
  name: "openEHR-EHR-OBSERVATION.head_circumference.v1"
  version: 0.0.1a # version of this particular mapping
spec: # schema specific to the FHIRConnect v0.0.1 engine
  system: FHIR
  version: R4
  openEhrConfig:
    archetype: "openEHR-EHR-OBSERVATION.head_circumference.v1"
  fhirConfig:
    structureDefinition: http://hl7.org/fhir/StructureDefinition/Observation

preprocessor:
  fhirConditions:
    - targetRoot: "$resource"
      targetAttribute: "category.coding.code"
      operator: "one of"
      criteria: "head_circumference"
    - targetRoot: "$resource"
      targetAttribute: "status"
      operator: "one of"
      criteria: "final"


mappings:
  - name: "head-circumference"
    with:
      fhir: "$resource.value"
      openehr: "$archetype/data[at0001]/events[at0010]/data[at0003]/items[at0004]"
      type: "QUANTITY"
    fhirCondition:
      targetRoot: "$resource"
      targetAttribute: "code.coding.code"
      operator: "one of"
      criteria: "[$loinc.8287-5]"

  - name: "time"
    with:
      fhir: "$resource.effective"
      openehr: "$archetype/data[at0001]/events[at0010]/time"
      type: "DATETIME"