{
  "resourceType": "StructureDefinition",
  "id": "SocialHistoryAlcoholUseMERT",
  "url": "https://intrahealth.com/fhir/mert/StructureDefinition/SocialHistoryAlcoholUseMERT",
  "name": "SocialHistoryAlcoholUseMERT",
  "title": "Social History - Alcohol Use (MERT)",
  "status": "draft",
  "description": "Social history alcohol use observation for MERT exchange.",
  "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": "mert-alcohol-prefer-quantity",
            "severity": "warning",
            "human": "When Alcohol Use is populated, valueQuantity SHOULD be used when available.",
            "expression": "value.empty() or value.ofType(Quantity).exists()",
            "source": "https://intrahealth.com/fhir/mert/StructureDefinition/SocialHistoryAlcoholUseMERT"
          },
          {
            "key": "mert-alcohol-nonquantity-readable",
            "severity": "warning",
            "human": "If value is not a Quantity, it SHOULD be human-readable (string, or CodeableConcept with text or coding).",
            "expression": "value.empty() or value.ofType(Quantity).exists() or value.ofType(string).exists() or (value.ofType(CodeableConcept).text.exists() or value.ofType(CodeableConcept).coding.exists())",
            "source": "https://intrahealth.com/fhir/mert/StructureDefinition/SocialHistoryAlcoholUseMERT"
          }
        ]
      },
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "short": "'final' only",
        "comment": "For MERT, only Observation.status = 'final' is processed.",
        "patternCode": "final",
        "mustSupport": true
      },
      {
        "id": "Observation.category",
        "path": "Observation.category",
        "short": "social-history",
        "comment": "Exactly one category is used in Social History - Alcohol Use for MERT, and it SHALL be social-history.",
        "min": 1,
        "max": "1",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "social-history",
              "system": "http://terminology.hl7.org/CodeSystem/observation-category"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "short": "Alcoholic drinks per day (LOINC 74013-4)",
        "comment": "MERT Alcohol Use uses LOINC 74013-4 (alcoholic drinks per day).",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "74013-4",
              "system": "http://loinc.org"
            }
          ]
        },
        "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.effective[x]",
        "path": "Observation.effective[x]",
        "comment": "Use effective[x] when available to indicate the clinically relevant timing of the alcohol use assessment.",
        "mustSupport": true
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "type": [
          {
            "code": "Quantity"
          },
          {
            "code": "CodeableConcept"
          },
          {
            "code": "string"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.value[x]:valueQuantity",
        "path": "Observation.value[x]",
        "sliceName": "valueQuantity",
        "comment": "Preferred representation for LOINC 74013-4 is valueQuantity (drinks per day). Use UCUM when possible (e.g., system http://unitsofmeasure.org and code '/d').",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Quantity"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.note",
        "path": "Observation.note",
        "comment": "Use note for alcohol-use related comments.",
        "mustSupport": true
      }
    ]
  }
}