Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Snapshot generation fails for Task resources #43

Closed
wetret opened this issue Sep 23, 2019 · 4 comments · Fixed by #87 or #109
Closed

Snapshot generation fails for Task resources #43

wetret opened this issue Sep 23, 2019 · 4 comments · Fixed by #87 or #109
Labels
bug Something isn't working ready for release Issue is fixed and merged into develop, ready for next release
Milestone

Comments

@wetret
Copy link
Member

wetret commented Sep 23, 2019

Snapshot generation fails if a task profile has more defined input slices than the highmed-task-base profile and throws the following exception:

org.hl7.fhir.exceptions.DefinitionException: Differential does not have a slice: 
Task.input/ (b:44 of 55 / 1/ 11) in profile 
@wetret wetret changed the title Snapshot generation fails for Task resource Snapshot generation fails for Task resources Sep 23, 2019
@wetret wetret added the bug Something isn't working label Sep 23, 2019
@wetret
Copy link
Member Author

wetret commented Sep 24, 2019

Forge does not add slicing tags in slices of profiles if the parent profile already has the slicing information. The HAPI snapshot generator expect these slicing tags in every profile with slices, independent of the parent profile.

TODO: check FHIR spec if slicing information is needed multiple times or only when first slicing an element and not in the child profiles. Depending on this create bug report for HAPI or Forge.

Thanks @hhund for finding the issue!

@hhund
Copy link
Member

hhund commented Sep 24, 2019

Here's a patch that should fix issues with highmed-task-base-0.1.0.xml and highmed-task-request-simple-feasibility-0.1.0.xml I'm not sure tho if all my min max additions are necessary. The important bits are the tags for task.input and task.output

diff --git a/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-base-0.1.0.xml b/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-base-0.1.0.xml
index 75c3164..20286d0 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-base-0.1.0.xml
+++ b/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-base-0.1.0.xml
@@ -52,7 +52,7 @@
           <type value="value" />
           <path value="type.coding.code" />
         </discriminator>
-        <rules value="openAtEnd" />
+        <rules value="open" />
       </slicing>
       <min value="3" />
     </element>
@@ -145,6 +145,11 @@
       <path value="Task.output" />
       <sliceName value="error" />
     </element>
+    <element id="Task.output:error.type.coding">
+      <path value="Task.output.type.coding" />
+      <min value="1" />
+      <max value="1" />
+    </element>
     <element id="Task.output:error.type.coding.system">
       <path value="Task.output.type.coding.system" />
       <fixedUri value="http://highmed.org/fhir/CodeSystem/bpmn-message" />
diff --git a/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-request-simple-feasibility-0.1.0.xml b/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-request-simple-feasibility-0.1.0.xml
index acd02ba..6007b4d 100644
--- a/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-request-simple-feasibility-0.1.0.xml
+++ b/dsf-fhir/dsf-fhir-server/src/main/resources/fhir/StructureDefinition/highmed-task-request-simple-feasibility-0.1.0.xml
@@ -18,7 +18,15 @@
     </element>
     <element id="Task.input">
       <path value="Task.input" />
+      <slicing>
+        <discriminator>
+          <type value="value" />
+          <path value="type.coding.code" />
+        </discriminator>
+        <rules value="closed" />
+      </slicing>
       <min value="4" />
+      <max value="4" />
     </element>
     <element id="Task.input:message-name">
       <path value="Task.input" />
@@ -34,6 +42,11 @@
       <min value="1" />
       <max value="1" />
     </element>
+    <element id="Task.input:research-study.type.coding">
+      <path value="Task.input.type.coding" />
+      <min value="1" />
+      <max value="1" />
+    </element>
     <element id="Task.input:research-study.type.coding.system">
       <path value="Task.input.type.coding.system" />
       <fixedUri value="http://highmed.org/fhir/CodeSystem/task-input" />
@@ -49,9 +62,27 @@
         <targetProfile value="http://highmed.org/fhir/StructureDefinition/highmed-research-study" />
       </type>
     </element>
+    <element id="Task.output">
+      <path value="Task.output" />
+      <slicing>
+        <discriminator>
+          <type value="value" />
+          <path value="type.coding.code" />
+        </discriminator>
+        <rules value="open" />
+      </slicing>
+      <min value="2" />
+    </element>
     <element id="Task.output:participatingMedics">
       <path value="Task.output" />
       <sliceName value="participatingMedics" />
+      <min value="1" />
+      <max value="1" />
+    </element>
+    <element id="Task.output:participatingMedics.type.coding">
+      <path value="Task.output.type.coding" />
+      <min value="1" />
+      <max value="1" />
     </element>
     <element id="Task.output:participatingMedics.type.coding.system">
       <path value="Task.output.type.coding.system" />
@@ -70,6 +101,13 @@
     <element id="Task.output:cohortSize">
       <path value="Task.output" />
       <sliceName value="cohortSize" />
+      <min value="1" />
+      <max value="1" />
+    </element>
+    <element id="Task.output:cohortSize.type.coding">
+      <path value="Task.output.type.coding" />
+      <min value="1" />
+      <max value="1" />
     </element>
     <element id="Task.output:cohortSize.type.coding.system">
       <path value="Task.output.type.coding.system" />

wetret added a commit that referenced this issue Sep 24, 2019
@hhund
Copy link
Member

hhund commented Sep 24, 2019

I not sure yet but the proposed fix e9e0fff for #43 might be a workaround for #45

@wetret
Copy link
Member Author

wetret commented Oct 1, 2019

According to the FHIR specification a re-slice of an already sliced element in the parent profile needs to define the tag again in the element to be sliced. See https://www.hl7.org/fhir/profiling-examples.html, section 5.1.1.7. This means that Forge probably has an error in creating slices in child profiles since the information is missing.

wetret added a commit that referenced this issue Oct 25, 2019
- slicing information added again, has to be done every time after changes to the profiles have been made with forge
- fixes cardinalities of inputs and outputs
@hhund hhund added this to the v0.2.0 milestone Jun 8, 2020
@hhund hhund added the ready for release Issue is fixed and merged into develop, ready for next release label Jun 15, 2020
@hhund hhund linked a pull request Jun 24, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working ready for release Issue is fixed and merged into develop, ready for next release
Projects
None yet
2 participants