{
  "resourceType": "StructureDefinition",
  "id": "MyPatient",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-category",
      "valueString": "Base.Individuals"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category",
      "valueCode": "patient"
    }
  ],
  "url": "https://simplifier.net/workshop210112/StructureDefinition/MyPatient",
  "version": "0.1.0",
  "name": "MyPatient",
  "status": "draft",
  "description": "Galactic patient",
  "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"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Patient.extension:species",
        "path": "Patient.extension",
        "sliceName": "species",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://simplifier.net/workshop210112/StructureDefinition/SpeciesExtension"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Patient.identifier",
        "path": "Patient.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Patient.identifier:citizenID",
        "path": "Patient.identifier",
        "sliceName": "citizenID",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Patient.identifier:citizenID.system",
        "path": "Patient.identifier.system",
        "min": 1,
        "fixedUri": "http://fhir.ufp/NamingSystem/ufp-citizen-id"
      },
      {
        "id": "Patient.identifier:citizenID.value",
        "path": "Patient.identifier.value",
        "min": 1
      },
      {
        "id": "Patient.identifier:insuranceID",
        "path": "Patient.identifier",
        "sliceName": "insuranceID",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Patient.identifier:insuranceID.system",
        "path": "Patient.identifier.system",
        "min": 1,
        "fixedUri": "http://fhir.de/NamingSystem/gkv/kvid-10"
      },
      {
        "id": "Patient.identifier:insuranceID.value",
        "path": "Patient.identifier.value",
        "min": 1,
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "only-ten-digits",
            "severity": "error",
            "human": "This is not a valid health insurance number",
            "expression": "matches('^[A-Z][0-9]{9}$')",
            "source": "https://simplifier.net/workshop210112/StructureDefinition/MyPatient"
          }
        ]
      },
      {
        "id": "Patient.name",
        "path": "Patient.name",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "use"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Patient.name:official",
        "path": "Patient.name",
        "sliceName": "official",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Patient.name:official.use",
        "path": "Patient.name.use",
        "min": 1,
        "fixedCode": "official"
      },
      {
        "id": "Patient.name:official.family",
        "path": "Patient.name.family",
        "min": 1
      },
      {
        "id": "Patient.name:official.given",
        "path": "Patient.name.given",
        "min": 1
      },
      {
        "id": "Patient.gender",
        "path": "Patient.gender",
        "min": 1
      },
      {
        "id": "Patient.address",
        "path": "Patient.address",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Address",
            "profile": [
              "https://simplifier.net/workshop210112/StructureDefinition/galactic-address"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Patient.contact.address",
        "path": "Patient.contact.address",
        "type": [
          {
            "code": "Address",
            "profile": [
              "https://simplifier.net/workshop210112/StructureDefinition/galactic-address"
            ]
          }
        ]
      }
    ]
  }
}