{
  "resourceType": "StructureDefinition",
  "id": "ObservationDiagnosticResultMERT",
  "url": "https://intrahealth.com/fhir/mert/StructureDefinition/ObservationDiagnosticResultMERT",
  "name": "ObservationDiagnosticResultMERT",
  "title": "Observation - Diagnostic Result (MERT)",
  "status": "draft",
  "description": "Observation profile intended for use as DiagnosticReport.result. Supports laboratory and imaging result observations.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "comment": "MERT requires Observation.status. All FHIR ObservationStatus codes are permitted.",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "http://hl7.org/fhir/ValueSet/observation-status"
        }
      },
      {
        "id": "Observation.category",
        "path": "Observation.category",
        "comment": "MERT allows only 'laboratory' and 'imaging' categories for DiagnosticReport.result observations.",
        "min": 1,
        "max": "1",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://intrahealth.com/fhir/mert/ValueSet/mert-observation-diagnostic-category-vs"
        }
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "comment": "Provide a standard code (e.g., LOINC) when possible. If only an internal/local code exists, transmit that code.",
        "mustSupport": true
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://intrahealth.com/fhir/mert/StructureDefinition/PatientMERT"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.encounter",
        "path": "Observation.encounter",
        "mustSupport": true
      },
      {
        "id": "Observation.effective[x]",
        "path": "Observation.effective[x]",
        "mustSupport": true
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "comment": "A result value SHALL be present. Use the most appropriate value[x] type available.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.interpretation",
        "path": "Observation.interpretation",
        "mustSupport": true
      },
      {
        "id": "Observation.note",
        "path": "Observation.note",
        "mustSupport": true
      },
      {
        "id": "Observation.referenceRange",
        "path": "Observation.referenceRange",
        "constraint": [
          {
            "key": "mert-ref-range-has-low-high-or-text",
            "severity": "error",
            "human": "referenceRange must have at least one of low, high, or text.",
            "expression": "low.exists() or high.exists() or text.exists()",
            "source": "https://intrahealth.com/fhir/mert/StructureDefinition/ObservationDiagnosticResultMERT"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.referenceRange.low",
        "path": "Observation.referenceRange.low",
        "mustSupport": true
      },
      {
        "id": "Observation.referenceRange.high",
        "path": "Observation.referenceRange.high",
        "mustSupport": true
      },
      {
        "id": "Observation.referenceRange.text",
        "path": "Observation.referenceRange.text",
        "mustSupport": true
      }
    ]
  }
}