{
  "resourceType": "StructureDefinition",
  "url": "http://adrianh-example.org/fhir/StructureDefinition/MyPatient",
  "name": "MyPatient",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "cda",
      "uri": "http://hl7.org/v3/cda",
      "name": "CDA (R2)"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    },
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    },
    {
      "identity": "loinc",
      "uri": "http://loinc.org",
      "name": "LOINC code for the element"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Patient",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Patient.extension",
        "path": "Patient.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Patient.extension:birthPlace",
        "path": "Patient.extension",
        "sliceName": "birthPlace",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/patient-birthPlace"
            ]
          }
        ]
      },
      {
        "id": "Patient.extension:occupation",
        "path": "Patient.extension",
        "sliceName": "occupation",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://example.org/fhir/StructureDefinition/Occupation"
            ]
          }
        ],
        "binding": {
          "strength": "preferred",
          "valueSet": "http://example.org/fhir/ValueSet/occupations"
        }
      },
      {
        "id": "Patient.identifier",
        "path": "Patient.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Patient.identifier:nationalIdentifier",
        "path": "Patient.identifier",
        "sliceName": "nationalIdentifier",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Patient.identifier:nationalIdentifier.system",
        "path": "Patient.identifier.system",
        "fixedUri": "http://national.registry.org/ids"
      },
      {
        "id": "Patient.identifier:hospitalNumber",
        "path": "Patient.identifier",
        "sliceName": "hospitalNumber",
        "max": "1"
      },
      {
        "id": "Patient.identifier:hospitalNumber.system",
        "path": "Patient.identifier.system",
        "fixedUri": "http://myshospital.org/sct"
      },
      {
        "id": "Patient.name",
        "path": "Patient.name",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "HumanName",
            "profile": [
              "http://example.org/fhir/StructureDefinition/MyHumanName"
            ]
          }
        ]
      },
      {
        "id": "Patient.gender",
        "path": "Patient.gender",
        "mustSupport": true
      },
      {
        "id": "Patient.birthDate",
        "path": "Patient.birthDate",
        "min": 1
      },
      {
        "id": "Patient.birthDate.extension",
        "path": "Patient.birthDate.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Patient.birthDate.extension:birthTime",
        "path": "Patient.birthDate.extension",
        "sliceName": "birthTime",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/patient-birthTime"
            ]
          }
        ]
      },
      {
        "id": "Patient.address",
        "path": "Patient.address",
        "constraint": [
          {
            "key": "temp-address-requires-period",
            "severity": "error",
            "human": "If the patient has a temporary address, the period this address is in use should be",
            "expression": "(use = 'temp') implies period.exists()",
            "source": "http://adrianh-example.org/fhir/StructureDefinition/MyPatient"
          }
        ]
      },
      {
        "id": "Patient.address.use",
        "path": "Patient.address.use",
        "condition": [
          "temp-address-requires-period"
        ]
      },
      {
        "id": "Patient.address.period",
        "path": "Patient.address.period",
        "condition": [
          "temp-address-requires-period"
        ]
      },
      {
        "id": "Patient.contact",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name",
            "valueString": "Contact"
          }
        ],
        "path": "Patient.contact"
      }
    ]
  }
}