{
  "resourceType": "StructureDefinition",
  "id": "custom-patient-profile",
  "url": "http://example.org/fhir/StructureDefinition/custom-patient-profile",
  "name": "CustomPatientProfile",
  "status": "active",
  "date": "2025-01-10",
  "publisher": "Example Organization",
  "kind": "resource",
  "abstract": false,
  "type": "Patient",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Patient.identifier",
        "path": "Patient.identifier",
        "min": 1,
        "type": [
          {
            "code": "Identifier"
          }
        ]
      },
      {
        "id": "Patient.identifier.type",
        "path": "Patient.identifier.type",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "code"
            }
          ],
          "rules": "open"
        },
        "sliceName": "nationalID",
        "definition": "National ID (14-digit numeric string)",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://example.org/fhir/identifier-types",
              "code": "NATIONAL_ID",
              "display": "National ID"
            }
          ]
        }
      },
      {
        "id": "Patient.identifier.value",
        "path": "Patient.identifier.value",
        "patternString": "^[0-9]{14}$",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "Patient.identifier.type:passportNumber",
        "path": "Patient.identifier.type",
        "sliceName": "passportNumber",
        "definition": "Passport Number",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://example.org/fhir/identifier-types",
              "code": "PASSPORT",
              "display": "Passport Number"
            }
          ]
        }
      },
      {
        "id": "Patient.name",
        "path": "Patient.name",
        "min": 1,
        "max": 1,
        "type": [
          {
            "code": "HumanName"
          }
        ]
      },
      {
        "id": "Patient.name.text",
        "path": "Patient.name.text",
        "min": 1,
        "max": 1,
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "Patient.gender",
        "path": "Patient.gender",
        "min": 1,
        "max": 1,
        "type": [
          {
            "code": "code"
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "http://hl7.org/fhir/ValueSet/administrative-gender"
        }
      },
      {
        "id": "Patient.birthDate",
        "path": "Patient.birthDate",
        "min": 1,
        "max": 1,
        "type": [
          {
            "code": "date"
          }
        ]
      },
      {
        "id": "Patient.address",
        "path": "Patient.address",
        "type": [
          {
            "code": "Address"
          }
        ]
      },
      {
        "id": "Patient.address.extension",
        "path": "Patient.address.extension",
        "min": 1,
        "type": [
          {
            "code": "Extension"
          }
        ]
      },
      {
        "id": "Patient.address.extension:center",
        "path": "Patient.address.extension",
        "sliceName": "center",
        "definition": "The center or department",
        "type": [
          {
            "code": "Extension"
          }
        ]
      },
      {
        "id": "Patient.address.extension:center.valueString",
        "path": "Patient.address.extension.valueString",
        "min": 0,
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "Patient.address.extension:town",
        "path": "Patient.address.extension",
        "sliceName": "town",
        "definition": "The town",
        "type": [
          {
            "code": "Extension"
          }
        ]
      },
      {
        "id": "Patient.address.extension:town.valueString",
        "path": "Patient.address.extension.valueString",
        "min": 0,
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "Patient.address.district",
        "path": "Patient.address.district",
        "definition": "Governorate code",
        "binding": {
          "strength": "required",
          "valueSet": "http://example.org/fhir/ValueSet/governorate-codes"
        }
      },
      {
        "id": "Patient.communication",
        "path": "Patient.communication",
        "max": "0"
      },
      {
        "id": "Patient.extension:nationality",
        "path": "Patient.extension",
        "sliceName": "nationality",
        "definition": "The nationality of the patient",
        "type": [
          {
            "code": "Extension"
          }
        ],
        "extension": [
          {
            "url": "valueCodeableConcept",
            "valueCodeableConcept": {
              "coding": [
                {
                  "system": "http://example.org/fhir/ValueSet/nationality-codes",
                  "code": "NATIONALITY_CODE",
                  "display": "Nationality Display Name"
                }
              ]
            }
          }
        ]
      }
    ]
  }
}