<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://ga4gh.org/fhir/phenopackets/StructureDefinition/Phenopacket" />
  <version value="1.0.0" />
  <name value="Phenopacket" />
  <status value="draft" />
  <fhirVersion value="4.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Composition" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Composition" />
  <derivation value="constraint" />
  <differential>
    <element id="Composition.type.coding.system">
      <path value="Composition.type.coding.system" />
      <fixedUri value="http://ga4gh.org/fhir/phenopackets/CodeSystem/document-type" />
    </element>
    <element id="Composition.type.coding.code">
      <path value="Composition.type.coding.code" />
      <fixedCode value="phenopacket" />
    </element>
    <element id="Composition.subject">
      <path value="Composition.subject" />
      <type>
        <code value="Reference" />
        <profile value="http://ga4gh.org/fhir/phenopackets/StructureDefinition/Individual" />
        <aggregation value="bundled" />
      </type>
    </element>
    <element id="Composition.subject.extension">
      <path value="Composition.subject.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Composition.subject.extension:karyotypic-sex">
      <path value="Composition.subject.extension" />
      <sliceName value="karyotypic-sex" />
      <sliceIsConstraining value="false" />
      <label value="karyotypicSex" />
      <short value="This element represents the chromosomal sex of an individual." />
      <definition value="This element represents the chromosomal sex of an individual." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://ga4gh.org/fhir/phenopackets/StructureDefinition/karyotypic-sex" />
      </type>
    </element>
    <element id="Composition.subject.extension:karyotypic-sex.value[x]:valueCoding">
      <path value="Composition.subject.extension.value[x]" />
      <sliceName value="valueCoding" />
    </element>
    <element id="Composition.encounter">
      <path value="Composition.encounter" />
      <max value="0" />
    </element>
    <element id="Composition.title">
      <path value="Composition.title" />
      <fixedString value="Phenopacket" />
    </element>
    <element id="Composition.relatesTo">
      <path value="Composition.relatesTo" />
      <max value="0" />
    </element>
    <element id="Composition.event">
      <path value="Composition.event" />
      <max value="0" />
    </element>
    <element id="Composition.section">
      <path value="Composition.section" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="code" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Composition.section:phenotypes">
      <path value="Composition.section" />
      <sliceName value="phenotypes" />
      <sliceIsConstraining value="false" />
    </element>
    <element id="Composition.section:phenotypes.title">
      <path value="Composition.section.title" />
      <short value="Phenotypes" />
      <definition value="This is a list of phenotypic findings observed in the subject." />
      <fixedString value="Phenotypes" />
    </element>
    <element id="Composition.section:phenotypes.author">
      <path value="Composition.section.author" />
      <max value="0" />
    </element>
    <element id="Composition.section:phenotypes.focus">
      <path value="Composition.section.focus" />
      <max value="0" />
    </element>
    <element id="Composition.section:phenotypes.text">
      <path value="Composition.section.text" />
      <max value="0" />
    </element>
    <element id="Composition.section:phenotypes.mode">
      <path value="Composition.section.mode" />
      <fixedCode value="snapshot" />
    </element>
    <element id="Composition.section:phenotypes.orderedBy">
      <path value="Composition.section.orderedBy" />
      <max value="0" />
    </element>
    <element id="Composition.section:phenotypes.entry">
      <path value="Composition.section.entry" />
      <short value="This is a list of phenotypic findings observed in the subject." />
      <type>
        <code value="Reference" />
        <profile value="http://ga4gh.org/fhir/phenopackets/StructureDefinition/Phenotype" />
        <aggregation value="bundled" />
      </type>
    </element>
    <element id="Composition.section:phenotypes.entry.extension">
      <path value="Composition.section.entry.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Composition.section:phenotypes.entry.extension:onset">
      <path value="Composition.section.entry.extension" />
      <sliceName value="onset" />
      <sliceIsConstraining value="false" />
      <label value="onset" />
      <short value="This element can be used to describe the age at which a phenotypic feature was first noticed or diagnosed." />
      <definition value="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 value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://ga4gh.org/fhir/phenopackets/StructureDefinition/phenotype-onset" />
      </type>
    </element>
    <element id="Composition.section:phenotypes.entry.extension:phenotype-modifier.value[x]:valueCoding:valueCoding">
      <path value="Composition.section.entry.extension.value[x]" />
      <sliceName value="valueCoding" />
    </element>
    <element id="Composition.section:phenotypes.entry.extension:phenotype-severity.value[x]:valueCoding:valueCoding">
      <path value="Composition.section.entry.extension.value[x]" />
      <sliceName value="valueCoding" />
    </element>
    <element id="Composition.section:phenotypes.section">
      <path value="Composition.section.section" />
      <max value="0" />
    </element>
    <element id="Composition.section:diseases">
      <path value="Composition.section" />
      <sliceName value="diseases" />
      <sliceIsConstraining value="false" />
    </element>
    <element id="Composition.section:diseases.entry">
      <path value="Composition.section.entry" />
      <short value="This is a field for disease identifiers and can be used for listing either diagnosed or suspected conditions." />
      <type>
        <code value="Reference" />
        <profile value="http://ga4gh.org/fhir/phenopackets/StructureDefinition/Disease" />
        <aggregation value="bundled" />
      </type>
    </element>
  </differential>
</StructureDefinition>