{
  "resourceType": "StructureDefinition",
  "id": "DocumentReferenceMERT",
  "url": "https://intrahealth.com/fhir/mert/StructureDefinition/DocumentReferenceMERT",
  "name": "DocumentReferenceMERT",
  "title": "DocumentReference (MERT)",
  "status": "draft",
  "description": "This profile describes the DocumentReference constraints for MERT.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "DocumentReference",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DocumentReference",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "DocumentReference",
        "path": "DocumentReference",
        "constraint": [
          {
            "key": "DocumentReferenceAttachmentHasUrlOrData",
            "severity": "error",
            "human": "Attachment SHALL have at least one of url or data.",
            "expression": "content.attachment.url.exists() or content.attachment.data.exists()",
            "source": "https://intrahealth.com/fhir/mert/StructureDefinition/DocumentReferenceMERT"
          }
        ]
      },
      {
        "id": "DocumentReference.status",
        "path": "DocumentReference.status",
        "short": "current",
        "comment": "MERT only supports 'current' DocumentReference instances; superseded/previous versions are not supported.",
        "patternCode": "current",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.category",
        "path": "DocumentReference.category",
        "comment": "Senders SHALL populate category.text with a human-readable document category label. Senders MAY populate category.coding using local code systems. Receivers MUST accept and persist category.text and any provided codings. Cross-system interpretation of coded categories is not guaranteed.",
        "constraint": [
          {
            "key": "DocumentReferenceCategoryHasText",
            "severity": "error",
            "human": "DocumentReference.category SHALL have a text value.",
            "expression": "text.exists()",
            "source": "https://intrahealth.com/fhir/mert/StructureDefinition/DocumentReferenceMERT"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.subject",
        "path": "DocumentReference.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://intrahealth.com/fhir/mert/StructureDefinition/PatientMERT"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author",
        "path": "DocumentReference.author",
        "comment": "Who and/or what authored the document. For MERT, this is who it is assigned to.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://intrahealth.com/fhir/mert/StructureDefinition/PractitionerMERT"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.authenticator",
        "path": "DocumentReference.authenticator",
        "comment": "Who/what authenticated the document. For MERT, this is who signed this document.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://intrahealth.com/fhir/mert/StructureDefinition/PractitionerMERT"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.description",
        "path": "DocumentReference.description",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content",
        "path": "DocumentReference.content",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment",
        "path": "DocumentReference.content.attachment",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.contentType",
        "path": "DocumentReference.content.attachment.contentType",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.data",
        "path": "DocumentReference.content.attachment.data",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.url",
        "path": "DocumentReference.content.attachment.url",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context",
        "path": "DocumentReference.context",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.period",
        "path": "DocumentReference.context.period",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.period.start",
        "path": "DocumentReference.context.period.start",
        "min": 1,
        "mustSupport": true
      }
    ]
  }
}