grammar: FHIRConnect/v0.0.1
type: model
metadata:
  name: "openEHR-EHR-OBSERVATION.body_weight.v2"
  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.body_weight.v2"
  fhirConfig:
    structureDefinition: http://hl7.org/fhir/StructureDefinition/Observation
    condition:
      - targetRoot: "$resource"
        targetAttribute: "category.coding.code"
        operator: "one of"
        criteria: "[weight]"



mappings:
  - name: "weight"
    with:
      fhir: "$resource.value"
      openehr: "$archetype/data[at0002]/events[at0003]/data[at0001]/items[at0004]"
      type: "QUANTITY"
    fhirCondition:
      targetRoot: "$resource"
      targetAttribute: "code.coding.code"
      operator: "one of"
      criteria: "[$loinc.29463-7, $snomed.27113001]"

  - name: "time"
    with:
      fhir: "$resource.effective"
      openehr: "$archetype/data[at0002]/events[at0003]/time"
      type: "DATETIME"
  - name: "comment"
    with:
      fhir: "$resource.note.text"
      openehr: "$archetype/data[at0002]/events[at0003]/data[at0001]/items[at0024]"
      type: "STRING"