<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://npcr.se/fhir/StructureDefinition/npcr-gleason-score-observation" />
  <name value="NPCR_Gleason_Score_Observation" />
  <status value="draft" />
  <description value="Patient-level &quot;Summary&quot; Gleason score observation, representing the overall Gleason assessment of a patient's prostate cancer regardless of the specimen source. This is the primary Profile in the NPCR Gleason score observation family and the Observation a clinician would reference when answering &quot;what is this patient's Gleason score?&quot;.&#xD;&#xA;&#xD;&#xA;Source variables covered (4 NPCR Variabelbeskrivning variables, dual-role):&#xD;&#xA;- D_GleasSakn → component:missingFlag&#xD;&#xA;- D_GleasEtt → component:primaryGrade&#xD;&#xA;- D_GleasTva → component:secondaryGrade&#xD;&#xA;- D_GleasSa → component:gleasonSum&#xD;&#xA;&#xD;&#xA;Relationship to source-specific Gleason observations:&#xD;&#xA;A Summary Gleason Observation (this Profile) is conceptually derived from one or more source-specific Gleason observations. FHIR's Observation.derivedFrom element represents this relationship, referencing instances of:&#xD;&#xA;- NPCRGleasonScoreTargetedBiopsyObservation&#xD;&#xA;- NPCRGleasonScoreSystematicBiopsyObservation&#xD;&#xA;- NPCRGleasonScoreUnclearBiopsyObservation&#xD;&#xA;- NPCRGleasonScoreTURPCystoObservation&#xD;&#xA;&#xD;&#xA;Derivation logic (per NPCR INCA) — documented but outside this Profile's enforcement scope:&#xD;&#xA;- D_Vavn = 1 (core needle biopsy): INCA automatically derives Summary from source observations by priority: first available of Systematic → Unclear → Targeted. When this Profile is used, derivedFrom should reference the chosen source.&#xD;&#xA;- D_Vavn = 2 (Cystoprostatektomi) or 5 (TUR-P): Registrar directly enters Summary from the pathology report. derivedFrom may reference the corresponding NPCRGleasonScoreTURPCystoObservation, or the relationship may be implicit (Summary is the primary representation in these scenarios).&#xD;&#xA;&#xD;&#xA;The derivation rule itself is implementation logic belonging to the INCA integration layer or a downstream transformation, beyond the scope of this pre-implementation feasibility study. This Profile provides the structural capability to represent both the Summary value and its derivation relationship; the derivation process is left to implementers.&#xD;&#xA;&#xD;&#xA;Terminology binding — documentation gap (Observation.code):&#xD;&#xA;NPCR Informationsspecifikation §7 does not provide a section for Gleason score identification. Observation.code is Must Support but without fixed value or terminology binding, consistent with other NPCR observation profiles. Resource identification relies on meta.profile.&#xD;&#xA;&#xD;&#xA;Rationale for a dedicated Summary Profile:&#xD;&#xA;Every NPCR-registered prostate cancer case has a patient-level Gleason assessment (when histopathology is available). Separating this from the source-specific observations allows clinical queries and downstream reporting systems to work with a single canonical Gleason value per patient, while preserving the ability to audit the underlying source data. This design aligns with FHIR's Observation.derivedFrom usage pattern (&quot;Related resource that the observation is made from ... a transformation or translation of the source observations to the observation&quot;)." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Observation" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation">
      <path value="Observation" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.status">
      <path value="Observation.status" />
      <fixedCode value="final" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.category">
      <path value="Observation.category" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.category.coding.system">
      <path value="Observation.category.coding.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/observation-category" />
    </element>
    <element id="Observation.category.coding.code">
      <path value="Observation.category.coding.code" />
      <fixedCode value="laboratory" />
    </element>
    <element id="Observation.category.coding.display">
      <path value="Observation.category.coding.display" />
      <fixedString value="Laboratory" />
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.subject">
      <path value="Observation.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://npcr.se/fhir/StructureDefinition/npcr-patient" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <type>
        <code value="dateTime" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.derivedFrom">
      <path value="Observation.derivedFrom" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://npcr.se/fhir/StructureDefinition/npcr-gleason-score-targeted-biopsy-observation" />
        <targetProfile value="https://npcr.se/fhir/StructureDefinition/npcr-gleason-score-systematic-biopsy-observation" />
        <targetProfile value="https://npcr.se/fhir/StructureDefinition/npcr-gleason-score-unclear-biopsy-observation" />
        <targetProfile value="https://npcr.se/fhir/StructureDefinition/npcr-gleason-score-turp-cysto-observation" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.component">
      <path value="Observation.component" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="code" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:primaryGrade">
      <path value="Observation.component" />
      <sliceName value="primaryGrade" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:primaryGrade.code">
      <path value="Observation.component.code" />
      <patternCodeableConcept>
        <coding>
          <system value="https://npcr.se/fhir/CodeSystem/npcr-gleason-observation-types" />
          <code value="primaryGrade" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.component:primaryGrade.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="1" />
      <type>
        <code value="integer" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:secondaryGrade">
      <path value="Observation.component" />
      <sliceName value="secondaryGrade" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:secondaryGrade.code">
      <path value="Observation.component.code" />
      <patternCodeableConcept>
        <coding>
          <system value="https://npcr.se/fhir/CodeSystem/npcr-gleason-observation-types" />
          <code value="secondaryGrade" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.component:secondaryGrade.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="1" />
      <type>
        <code value="integer" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:gleasonSum">
      <path value="Observation.component" />
      <sliceName value="gleasonSum" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:gleasonSum.code">
      <path value="Observation.component.code" />
      <patternCodeableConcept>
        <coding>
          <system value="https://npcr.se/fhir/CodeSystem/npcr-gleason-observation-types" />
          <code value="gleasonSum" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.component:gleasonSum.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="1" />
      <type>
        <code value="integer" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:missingFlag">
      <path value="Observation.component" />
      <sliceName value="missingFlag" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:missingFlag.code">
      <path value="Observation.component.code" />
      <patternCodeableConcept>
        <coding>
          <system value="https://npcr.se/fhir/CodeSystem/npcr-gleason-observation-types" />
          <code value="missingFlag" />
        </coding>
      </patternCodeableConcept>
      <mustSupport value="true" />
    </element>
    <element id="Observation.component:missingFlag.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="1" />
      <type>
        <code value="boolean" />
      </type>
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>