{
  "resourceType": "StructureDefinition",
  "id": "medicalTestResult-eu-core",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger": 2
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
      "valueCode": "trial-use"
    }
  ],
  "url": "http://hl7.eu/fhir/base/StructureDefinition/medicalTestResult-eu-core",
  "name": "MedicalTestResultEuCore",
  "title": "Observation: Medical Test Result (EU core)",
  "status": "active",
  "description": "This profile introduces essential constraints and extensions for the Observation resource for Medical Test Results that apply across multiple use cases.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation",
        "constraint": [
          {
            "key": "obs-value-1",
            "severity": "error",
            "human": "The elements Observation.extension:value-r5 and Observation.value[x] SHALL not be used simultaneously.",
            "expression": "value.empty() or extension('http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.value').empty()",
            "source": "http://hl7.eu/fhir/base/StructureDefinition/medicalTestResult-eu-core"
          }
        ]
      },
      {
        "id": "Observation.language",
        "path": "Observation.language",
        "short": "Language of the observation"
      },
      {
        "id": "Observation.extension",
        "path": "Observation.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "Observation.extension:bodyStructure",
        "path": "Observation.extension",
        "sliceName": "bodyStructure",
        "requirements": "EHDSObservation.anatomicLocation",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.bodyStructure"
            ]
          }
        ]
      },
      {
        "id": "Observation.extension:triggeredBy",
        "path": "Observation.extension",
        "sliceName": "triggeredBy",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.triggeredBy"
            ]
          }
        ]
      },
      {
        "id": "Observation.extension:triggeredBy.extension:observation",
        "path": "Observation.extension.extension",
        "sliceName": "observation"
      },
      {
        "id": "Observation.extension:triggeredBy.extension:observation.extension",
        "path": "Observation.extension.extension.extension",
        "max": "0"
      },
      {
        "id": "Observation.extension:triggeredBy.extension:observation.value[x]",
        "path": "Observation.extension.extension.value[x]",
        "requirements": "EHDSObservation.triggeredBy[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.eu/fhir/base/StructureDefinition/medicalTestResult-eu-core"
            ]
          }
        ]
      },
      {
        "id": "Observation.extension:value-r5",
        "path": "Observation.extension",
        "sliceName": "value-r5",
        "short": "only for Diagrams or Pictures",
        "definition": "When the result is a Diagram or Picture (Microbiology), then the Attachment data type should be used. In FHIR R4 this can be done by preadopting the R5 Observation.value[x] element using the cross-version extension.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.value"
            ]
          }
        ]
      },
      {
        "id": "Observation.extension:value-r5.extension",
        "path": "Observation.extension.extension",
        "max": "0"
      },
      {
        "id": "Observation.extension:value-r5.value[x]",
        "path": "Observation.extension.value[x]",
        "type": [
          {
            "code": "Attachment"
          }
        ]
      },
      {
        "id": "Observation.identifier",
        "path": "Observation.identifier",
        "requirements": "EHDSObservation.header.identifier"
      },
      {
        "id": "Observation.basedOn",
        "path": "Observation.basedOn",
        "requirements": "EHDSObservation.order"
      },
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "requirements": "EHDSObservation.header.status"
      },
      {
        "id": "Observation.category",
        "path": "Observation.category",
        "min": 1
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "requirements": "EHDSObservation.code",
        "binding": {
          "strength": "example",
          "valueSet": "http://hl7.eu/fhir/base/ValueSet/medicalTestResult-eu"
        }
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "requirements": "EHDSObservation.header.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.eu/fhir/base/StructureDefinition/patient-eu-core",
              "http://hl7.org/fhir/StructureDefinition/Device",
              "http://hl7.org/fhir/StructureDefinition/Group",
              "http://hl7.org/fhir/StructureDefinition/Location"
            ]
          }
        ]
      },
      {
        "id": "Observation.focus",
        "path": "Observation.focus",
        "requirements": "EHDSObservation.directSubject[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.eu/fhir/base/StructureDefinition/patient-eu-core",
              "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
              "http://hl7.org/fhir/StructureDefinition/Group",
              "http://hl7.org/fhir/StructureDefinition/Device",
              "http://hl7.eu/fhir/base/StructureDefinition/location-eu-core"
            ]
          }
        ]
      },
      {
        "id": "Observation.effective[x]",
        "path": "Observation.effective[x]",
        "requirements": "EHDSObservation.observationDate[x]",
        "min": 1,
        "type": [
          {
            "code": "dateTime"
          },
          {
            "code": "Period"
          }
        ]
      },
      {
        "id": "Observation.issued",
        "path": "Observation.issued",
        "requirements": "EHDSObservation.header.authorship.datetime"
      },
      {
        "id": "Observation.performer",
        "path": "Observation.performer",
        "requirements": "EHDSObservation.header.performer",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.eu/fhir/base/StructureDefinition/practitioner-eu-core",
              "http://hl7.eu/fhir/base/StructureDefinition/practitionerRole-eu-core",
              "http://hl7.eu/fhir/base/StructureDefinition/organization-eu-core",
              "http://hl7.eu/fhir/base/StructureDefinition/patient-eu-core",
              "http://hl7.org/fhir/StructureDefinition/RelatedPerson"
            ]
          }
        ]
      },
      {
        "id": "Observation.performer.extension:performerFunction",
        "path": "Observation.performer.extension",
        "sliceName": "performerFunction",
        "requirements": "EHDSObservation.performer.function",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/event-performerFunction"
            ]
          }
        ]
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "requirements": "EHDSObservation.result.value[x]"
      },
      {
        "id": "Observation.value[x]:valueQuantity",
        "path": "Observation.value[x]",
        "sliceName": "valueQuantity",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Quantity"
          }
        ]
      },
      {
        "id": "Observation.value[x]:valueQuantity.extension:uncertainty",
        "path": "Observation.value[x].extension",
        "sliceName": "uncertainty",
        "requirements": "EHDSObservation.result.uncertainty",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/iso21090-uncertainty"
            ]
          }
        ]
      },
      {
        "id": "Observation.dataAbsentReason",
        "path": "Observation.dataAbsentReason",
        "requirements": "EHDSObservation.dataAbsentReason"
      },
      {
        "id": "Observation.interpretation",
        "path": "Observation.interpretation",
        "requirements": "EHDSObservation.interpretation"
      },
      {
        "id": "Observation.note",
        "path": "Observation.note",
        "requirements": "EHDSObservation.resultDescription"
      },
      {
        "id": "Observation.bodySite",
        "path": "Observation.bodySite",
        "requirements": "EHDSObservation.anatomicLocation"
      },
      {
        "id": "Observation.method",
        "path": "Observation.method",
        "requirements": "EHDSObservation.method"
      },
      {
        "id": "Observation.specimen",
        "path": "Observation.specimen",
        "short": "Specimen used for the observation"
      },
      {
        "id": "Observation.device",
        "path": "Observation.device",
        "requirements": "Device information for laboratory observations"
      },
      {
        "id": "Observation.referenceRange",
        "path": "Observation.referenceRange",
        "requirements": "EHDSObservation.referenceRange"
      },
      {
        "id": "Observation.hasMember",
        "path": "Observation.hasMember",
        "requirements": "EHDSObservation.hasMember[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.eu/fhir/base/StructureDefinition/medicalTestResult-eu-core"
            ]
          }
        ]
      },
      {
        "id": "Observation.derivedFrom",
        "path": "Observation.derivedFrom",
        "requirements": "EHDSObservation.derivedFrom[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.eu/fhir/base/StructureDefinition/medicalTestResult-eu-core",
              "http://hl7.org/fhir/StructureDefinition/ImagingStudy"
            ]
          }
        ]
      },
      {
        "id": "Observation.component",
        "path": "Observation.component",
        "requirements": "EHDSObservation.component"
      },
      {
        "id": "Observation.component.extension",
        "path": "Observation.component.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "Observation.component.extension:value-r5",
        "path": "Observation.component.extension",
        "sliceName": "value-r5",
        "short": "only for Diagrams or Pictures",
        "definition": "When the result is a Diagram or Picture (Microbiology), then the Attachment data type should be used. In FHIR R4 this can be done by preadopting the R5 Observation.value[x] element using the cross-version extension.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.value"
            ]
          }
        ]
      },
      {
        "id": "Observation.component.extension:value-r5.extension",
        "path": "Observation.component.extension.extension",
        "max": "0"
      },
      {
        "id": "Observation.component.extension:value-r5.value[x]",
        "path": "Observation.component.extension.value[x]",
        "type": [
          {
            "code": "Attachment"
          }
        ]
      },
      {
        "id": "Observation.component.code",
        "path": "Observation.component.code",
        "requirements": "EHDSObservation.component.code",
        "binding": {
          "strength": "example",
          "valueSet": "http://hl7.eu/fhir/base/ValueSet/medicalTestResult-eu"
        }
      },
      {
        "id": "Observation.component.value[x]",
        "path": "Observation.component.value[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "requirements": "EHDSObservation.component.result.value[x]"
      },
      {
        "id": "Observation.component.value[x]:valueQuantity",
        "path": "Observation.component.value[x]",
        "sliceName": "valueQuantity",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Quantity"
          }
        ]
      },
      {
        "id": "Observation.component.value[x]:valueQuantity.extension:uncertainty",
        "path": "Observation.component.value[x].extension",
        "sliceName": "uncertainty",
        "requirements": "EHDSObservation.component.result.uncertainty",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/iso21090-uncertainty"
            ]
          }
        ]
      },
      {
        "id": "Observation.component.dataAbsentReason",
        "path": "Observation.component.dataAbsentReason",
        "requirements": "EHDSObservation.component.dataAbsentReason"
      },
      {
        "id": "Observation.component.interpretation",
        "path": "Observation.component.interpretation",
        "requirements": "EHDSObservation.component.interpretation"
      },
      {
        "id": "Observation.component.referenceRange",
        "path": "Observation.component.referenceRange",
        "requirements": "EHDSObservation.component.referenceRange"
      }
    ]
  }
}
