{
  "resourceType": "StructureDefinition",
  "url": "http://ga4gh.org/fhir/phenopackets/StructureDefinition/Phenopacket",
  "version": "1.0.0",
  "name": "Phenopacket",
  "status": "draft",
  "fhirVersion": "4.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "Composition",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Composition",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Composition.type.coding.system",
        "path": "Composition.type.coding.system",
        "fixedUri": "http://ga4gh.org/fhir/phenopackets/CodeSystem/document-type"
      },
      {
        "id": "Composition.type.coding.code",
        "path": "Composition.type.coding.code",
        "fixedCode": "phenopacket"
      },
      {
        "id": "Composition.subject",
        "path": "Composition.subject",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "http://ga4gh.org/fhir/phenopackets/StructureDefinition/Individual"
            ],
            "aggregation": [
              "bundled"
            ]
          }
        ]
      },
      {
        "id": "Composition.subject.extension",
        "path": "Composition.subject.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Composition.subject.extension:karyotypic-sex",
        "path": "Composition.subject.extension",
        "sliceName": "karyotypic-sex",
        "sliceIsConstraining": false,
        "label": "karyotypicSex",
        "short": "This element represents the chromosomal sex of an individual.",
        "definition": "This element represents the chromosomal sex of an individual.",
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://ga4gh.org/fhir/phenopackets/StructureDefinition/karyotypic-sex"
            ]
          }
        ]
      },
      {
        "id": "Composition.subject.extension:karyotypic-sex.value[x]:valueCoding",
        "path": "Composition.subject.extension.value[x]",
        "sliceName": "valueCoding"
      },
      {
        "id": "Composition.encounter",
        "path": "Composition.encounter",
        "max": "0"
      },
      {
        "id": "Composition.title",
        "path": "Composition.title",
        "fixedString": "Phenopacket"
      },
      {
        "id": "Composition.relatesTo",
        "path": "Composition.relatesTo",
        "max": "0"
      },
      {
        "id": "Composition.event",
        "path": "Composition.event",
        "max": "0"
      },
      {
        "id": "Composition.section",
        "path": "Composition.section",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Composition.section:phenotypes",
        "path": "Composition.section",
        "sliceName": "phenotypes",
        "sliceIsConstraining": false
      },
      {
        "id": "Composition.section:phenotypes.title",
        "path": "Composition.section.title",
        "short": "Phenotypes",
        "definition": "This is a list of phenotypic findings observed in the subject.",
        "fixedString": "Phenotypes"
      },
      {
        "id": "Composition.section:phenotypes.author",
        "path": "Composition.section.author",
        "max": "0"
      },
      {
        "id": "Composition.section:phenotypes.focus",
        "path": "Composition.section.focus",
        "max": "0"
      },
      {
        "id": "Composition.section:phenotypes.text",
        "path": "Composition.section.text",
        "max": "0"
      },
      {
        "id": "Composition.section:phenotypes.mode",
        "path": "Composition.section.mode",
        "fixedCode": "snapshot"
      },
      {
        "id": "Composition.section:phenotypes.orderedBy",
        "path": "Composition.section.orderedBy",
        "max": "0"
      },
      {
        "id": "Composition.section:phenotypes.entry",
        "path": "Composition.section.entry",
        "short": "This is a list of phenotypic findings observed in the subject.",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "http://ga4gh.org/fhir/phenopackets/StructureDefinition/Phenotype"
            ],
            "aggregation": [
              "bundled"
            ]
          }
        ]
      },
      {
        "id": "Composition.section:phenotypes.entry.extension",
        "path": "Composition.section.entry.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Composition.section:phenotypes.entry.extension:onset",
        "path": "Composition.section.entry.extension",
        "sliceName": "onset",
        "sliceIsConstraining": false,
        "label": "onset",
        "short": "This element can be used to describe the age at which a phenotypic feature was first noticed or diagnosed.",
        "definition": "This element can be used to describe the age at which a phenotypic feature was first noticed or diagnosed. For many medical use cases, either the Age subelement or an ontology class (e.g., from the HPO Onset (HP:0003674) terms) will be used.",
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://ga4gh.org/fhir/phenopackets/StructureDefinition/phenotype-onset"
            ]
          }
        ]
      },
      {
        "id": "Composition.section:phenotypes.entry.extension:phenotype-modifier.value[x]:valueCoding:valueCoding",
        "path": "Composition.section.entry.extension.value[x]",
        "sliceName": "valueCoding"
      },
      {
        "id": "Composition.section:phenotypes.entry.extension:phenotype-severity.value[x]:valueCoding:valueCoding",
        "path": "Composition.section.entry.extension.value[x]",
        "sliceName": "valueCoding"
      },
      {
        "id": "Composition.section:phenotypes.section",
        "path": "Composition.section.section",
        "max": "0"
      },
      {
        "id": "Composition.section:diseases",
        "path": "Composition.section",
        "sliceName": "diseases",
        "sliceIsConstraining": false
      },
      {
        "id": "Composition.section:diseases.entry",
        "path": "Composition.section.entry",
        "short": "This is a field for disease identifiers and can be used for listing either diagnosed or suspected conditions.",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "http://ga4gh.org/fhir/phenopackets/StructureDefinition/Disease"
            ],
            "aggregation": [
              "bundled"
            ]
          }
        ]
      }
    ]
  }
}