{
  "resourceType": "StructureDefinition",
  "id": "profile-reference-patient",
  "url": "https://fhir.synapxe.sg/StructureDefinition/profile-reference-patient",
  "title": "Patient Reference Type Profile",
  "description": "A profile constraining the Reference data type for references to Patient resources.",
  "name": "Reference",
  "publisher": "Synapxe",
  "status": "active",
  "fhirVersion": "5.0.0",
  "kind": "complex-type",
  "abstract": false,
  "type": "Reference",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Reference",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Reference",
        "path": "Reference",
        "constraint": [
          {
            "key": "ref-patient-local",
            "severity": "error",
            "human": "A patient reference is by identifier; Reference.reference may only point at a contained Patient (\"#<id>\")",
            "expression": "reference.empty() or reference.startsWith('#')",
            "source": "https://fhir.synapxe.sg/StructureDefinition/profile-reference-patient"
          }
        ]
      },
      {
        "id": "Reference.id",
        "path": "Reference.id",
        "max": "0"
      },
      {
        "id": "Reference.extension",
        "path": "Reference.extension",
        "max": "0"
      },
      {
        "id": "Reference.reference",
        "path": "Reference.reference",
        "short": "\"#<id>\" of a contained Patient, else absent",
        "definition": "Only a local reference to a Patient contained in the same resource (e.g. \"#patient\"), so the contained Patient is referenced (dom-3). Bundle entries reference the patient by identifier only."
      },
      {
        "id": "Reference.type",
        "path": "Reference.type",
        "min": 1,
        "patternUri": "Patient"
      },
      {
        "id": "Reference.identifier",
        "path": "Reference.identifier",
        "min": 1,
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "https://fhir.synapxe.sg/StructureDefinition/profile-identifier-nric",
              "https://fhir.synapxe.sg/StructureDefinition/profile-identifier-fin",
              "https://fhir.synapxe.sg/StructureDefinition/profile-identifier-others",
              "https://fhir.synapxe.sg/StructureDefinition/profile-identifier-mrn"
            ]
          }
        ]
      },
      {
        "id": "Reference.identifier.system",
        "path": "Reference.identifier.system",
        "short": "https://fhir.synapxe.sg/NamingSystem/nric, /fin, /others or /mrn",
        "definition": "The naming system of the patient's identification: nric for an NRIC, fin for a FIN, others for any other identification document (e.g. a passport number, NEHR identification type P), with Identifier.type saying which document (patient-identifier-type); mrn when the patient is referenced by MRN (e.g. identification type OT).",
        "min": 1,
        "example": [
          {
            "label": "NRIC",
            "valueUri": "https://fhir.synapxe.sg/NamingSystem/nric"
          },
          {
            "label": "FIN",
            "valueUri": "https://fhir.synapxe.sg/NamingSystem/fin"
          },
          {
            "label": "Others",
            "valueUri": "https://fhir.synapxe.sg/NamingSystem/others"
          },
          {
            "label": "MRN",
            "valueUri": "https://fhir.synapxe.sg/NamingSystem/mrn"
          }
        ]
      }
    ]
  }
}