{
  "resourceType": "StructureDefinition",
  "id": "epa-patient",
  "url": "https://gematik.de/fhir/epa/StructureDefinition/epa-patient",
  "version": "1.1.0",
  "name": "EPAPatient",
  "title": "EPA Patient",
  "status": "active",
  "experimental": false,
  "date": "2024-08-14",
  "publisher": "gematik GmbH",
  "description": "Defines the data structure for the patient profile in the ePA system.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Patient",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Patient",
        "path": "Patient",
        "constraint": [
          {
            "key": "pat-de-1",
            "human": "Die amtliche Differenzierung der Geschlechtsangabe 'other' darf nur gefüllt sein, wenn das Geschlecht 'other' angegeben ist",
            "source": "https://gematik.de/fhir/epa/StructureDefinition/epa-patient",
            "severity": "error",
            "expression": "gender.exists() and gender='other' implies gender.extension('http://fhir.de/StructureDefinition/gender-amtlich-de').exists()"
          }
        ]
      },
      {
        "id": "Patient.id",
        "path": "Patient.id",
        "mustSupport": true
      },
      {
        "id": "Patient.meta",
        "path": "Patient.meta",
        "mustSupport": true
      },
      {
        "id": "Patient.meta.versionId",
        "path": "Patient.meta.versionId",
        "mustSupport": true
      },
      {
        "id": "Patient.meta.lastUpdated",
        "path": "Patient.meta.lastUpdated",
        "mustSupport": true
      },
      {
        "id": "Patient.identifier",
        "path": "Patient.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.identifier:KVNR",
        "path": "Patient.identifier",
        "sliceName": "KVNR",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://fhir.de/StructureDefinition/identifier-kvid-10"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Patient.active",
        "path": "Patient.active",
        "mustSupport": true
      },
      {
        "id": "Patient.name",
        "path": "Patient.name",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "comment": "In order to maintain the differentiations of name parts as given in the VSDM dataset or qualify prefixes as academic titles, vendors can opt to support the extensions specified in the German HumanName Base Profile https://simplifier.net/basisprofil-de-r4/humannamedebasis\r\nThis is however not required within the scope of this specification.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name",
        "path": "Patient.name",
        "sliceName": "Name",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "HumanName",
            "profile": [
              "http://fhir.de/StructureDefinition/humanname-de-basis"
            ]
          }
        ],
        "patternHumanName": {
          "use": "official"
        },
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.use",
        "path": "Patient.name.use",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.family",
        "path": "Patient.name.family",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.family.extension:namenszusatz",
        "path": "Patient.name.family.extension",
        "sliceName": "namenszusatz",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.family.extension:nachname",
        "path": "Patient.name.family.extension",
        "sliceName": "nachname",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.family.extension:vorsatzwort",
        "path": "Patient.name.family.extension",
        "sliceName": "vorsatzwort",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.given",
        "path": "Patient.name.given",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.prefix",
        "path": "Patient.name.prefix",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.prefix.extension:prefix-qualifier",
        "path": "Patient.name.prefix.extension",
        "sliceName": "prefix-qualifier",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Name.prefix.extension:prefix-qualifier.value[x]",
        "path": "Patient.name.prefix.extension.value[x]",
        "fixedCode": "AC"
      },
      {
        "id": "Patient.name:Geburtsname",
        "path": "Patient.name",
        "sliceName": "Geburtsname",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "HumanName",
            "profile": [
              "http://fhir.de/StructureDefinition/humanname-de-basis"
            ]
          }
        ],
        "patternHumanName": {
          "use": "maiden"
        },
        "mustSupport": true
      },
      {
        "id": "Patient.name:Geburtsname.use",
        "path": "Patient.name.use",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.name:Geburtsname.family",
        "path": "Patient.name.family",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.name:Geburtsname.family.extension:namenszusatz",
        "path": "Patient.name.family.extension",
        "sliceName": "namenszusatz",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Geburtsname.family.extension:nachname",
        "path": "Patient.name.family.extension",
        "sliceName": "nachname",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Geburtsname.family.extension:vorsatzwort",
        "path": "Patient.name.family.extension",
        "sliceName": "vorsatzwort",
        "mustSupport": true
      },
      {
        "id": "Patient.name:Geburtsname.given",
        "path": "Patient.name.given",
        "max": "0"
      },
      {
        "id": "Patient.name:Geburtsname.prefix",
        "path": "Patient.name.prefix",
        "max": "0"
      },
      {
        "id": "Patient.name:Geburtsname.suffix",
        "path": "Patient.name.suffix",
        "max": "0"
      },
      {
        "id": "Patient.gender",
        "path": "Patient.gender",
        "mustSupport": true
      },
      {
        "id": "Patient.gender.extension:other-amtlich",
        "path": "Patient.gender.extension",
        "sliceName": "other-amtlich",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://fhir.de/StructureDefinition/gender-amtlich-de"
            ]
          }
        ]
      },
      {
        "id": "Patient.birthDate",
        "path": "Patient.birthDate",
        "min": 1,
        "mustSupport": true
      }
    ]
  }
}