Skip to content

Commit

Permalink
Add test cases for missing profile discriminators
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Nov 10, 2023
1 parent e162e7f commit a49401c
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 0 deletions.
41 changes: 41 additions & 0 deletions validator/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -35622,6 +35622,47 @@
}
}
},
{
"name": "profile-slicing-missing-instance",
"file": "profile-slicing-missing-instance.xml",
"description": "Checking profile based slicing with missing entries",
"profiles": [
"profile-slicing-missing-profile1.xml", "profile-slicing-missing-profile2.xml", "profile-slicing-missing-profile3.xml", "profile-slicing-missing-profile4.xml", "profile-slicing-missing-profile5.xml"
],
"version": "4.0",
"java": {
"outcome": {
"resourceType" : "OperationOutcome",
"issue" : [{
"severity" : "information",
"code" : "code-invalid",
"details" : {
"text" : "None of the codings provided are in the value set 'Observation Category Codes' (http://hl7.org/fhir/ValueSet/observation-category|4.0.1), and a coding is recommended to come from this value set) (codes = http://example.org/profile2#code2)"
},
"diagnostics" : "[9,13]",
"expression" : ["Observation.category[0]"]
},
{
"severity" : "information",
"code" : "code-invalid",
"details" : {
"text" : "None of the codings provided are in the value set 'Observation Category Codes' (http://hl7.org/fhir/ValueSet/observation-category|4.0.1), and a coding is recommended to come from this value set) (codes = http://example.org/profile3#code3)"
},
"diagnostics" : "[17,13]",
"expression" : ["Observation.category[1]"]
},
{
"severity" : "information",
"code" : "informational",
"details" : {
"text" : "This element does not match any known slice defined in the profile http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile1|0.1.0 (this may not be a problem, but you should check that it's not intended to match a slice)"
},
"diagnostics" : "[31,13]",
"expression" : ["Observation.category[3]"]
}]
}
}
},
{
"name": "zzz",
"file": "zzz.json",
Expand Down
37 changes: 37 additions & 0 deletions validator/profile-slicing-missing-instance.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Observation xmlns="http://hl7.org/fhir">
<id value="profile-slicing-missing-instance"/>
<meta>
<profile value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile1"/>
</meta>
<status value="final"/>

<!-- slice 1 -->
<category>
<coding>
<system value="http://example.org/profile2"/>
<code value="code2"/>
</coding>
</category>

<!-- slice 2 -->
<category>
<coding>
<system value="http://example.org/profile3"/>
<code value="code3"/>
</coding>
<text value="Some Text"/>
</category>

<!-- slice 3 -->
<category>
<text value="Some Text 2"/>
</category>

<!-- no slice -->
<category>
<text value="something else"/>
</category>


<code><text value="code"/></code>
</Observation>
82 changes: 82 additions & 0 deletions validator/profile-slicing-missing-profile1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="profile-slicing-missing-profile1"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile1"/>
<version value="0.1.0"/>
<name value="TestMissingProfile1"/>
<title value="Test Missing Profile #1"/>
<status value="draft"/>
<date value="2023-11-11T06:30:54+00:00"/>
<publisher value="HL7"/>
<fhirVersion value="4.0.0"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Observation"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
<derivation value="constraint"/>
<differential>
<element>
<path value="Observation.category"/>
<slicing>
<discriminator>
<type value="profile"/>
<path value="coding"/>
</discriminator>
<discriminator>
<type value="profile"/>
<path value="text"/>
</discriminator>
<rules value="open"/>
</slicing>
</element>

<element>
<path value="Observation.category"/>
<sliceName value="slice1"/>
<min value="1"/>
</element>
<element>
<path value="Observation.category.coding"/>
<min value="1"/>
<type>
<code value="Coding"/>
<profile value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile2"/>
</type>
</element>

<element>
<path value="Observation.category"/>
<sliceName value="slice2"/>
<min value="1"/>
</element>
<element>
<path value="Observation.category.coding"/>
<min value="1"/>
<type>
<code value="Coding"/>
<profile value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile3"/>
</type>
</element>
<element>
<path value="Observation.category.text"/>
<type>
<code value="string"/>
<profile value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile4"/>
</type>
</element>

<element>
<path value="Observation.category"/>
<sliceName value="slice3"/>
<min value="1"/>
</element>
<element>
<path value="Observation.category.text"/>
<min value="1"/>
<type>
<code value="string"/>
<profile value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile5"/>
</type>
</element>

</differential>
</StructureDefinition>
22 changes: 22 additions & 0 deletions validator/profile-slicing-missing-profile2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="profile-slicing-missing-profile2"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile2"/>
<version value="0.1.0"/>
<name value="TestMissingProfile2"/>
<title value="Test Missing Profile #2"/>
<status value="draft"/>
<date value="2023-11-11T06:30:54+00:00"/>
<publisher value="HL7"/>
<fhirVersion value="4.0.0"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Coding"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Coding"/>
<derivation value="constraint"/>
<differential>
<element id="Coding.system">
<path value="Coding.system"/>
<fixedUri value="http://example.org/profile2"/>
</element>
</differential>
</StructureDefinition>
22 changes: 22 additions & 0 deletions validator/profile-slicing-missing-profile3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="profile-slicing-missing-profile3"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile3"/>
<version value="0.1.0"/>
<name value="TestMissingProfile3"/>
<title value="Test Missing Profile #3"/>
<status value="draft"/>
<date value="2023-11-11T06:30:54+00:00"/>
<publisher value="HL7"/>
<fhirVersion value="4.0.0"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Coding"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Coding"/>
<derivation value="constraint"/>
<differential>
<element id="Coding.system">
<path value="Coding.system"/>
<fixedUri value="http://example.org/profile3"/>
</element>
</differential>
</StructureDefinition>
22 changes: 22 additions & 0 deletions validator/profile-slicing-missing-profile4.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="profile-slicing-missing-profile4"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile4"/>
<version value="0.1.0"/>
<name value="TestMissingProfile4"/>
<title value="Test Missing Profile #4"/>
<status value="draft"/>
<date value="2023-11-11T06:30:54+00:00"/>
<publisher value="HL7"/>
<fhirVersion value="4.0.0"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="string"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/string"/>
<derivation value="constraint"/>
<differential>
<element id="string">
<path value="string"/>
<fixedString value="Some Text"/>
</element>
</differential>
</StructureDefinition>
22 changes: 22 additions & 0 deletions validator/profile-slicing-missing-profile5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="profile-slicing-missing-profile5"/>
<url value="http://hl7.org/fhir/test/StructureDefinition/profile-slicing-missing-profile5"/>
<version value="0.1.0"/>
<name value="TestMissingProfile5"/>
<title value="Test Missing Profile #5"/>
<status value="draft"/>
<date value="2023-11-11T06:30:54+00:00"/>
<publisher value="HL7"/>
<fhirVersion value="4.0.0"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="string"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/string"/>
<derivation value="constraint"/>
<differential>
<element id="string">
<path value="string"/>
<fixedString value="Some Text 2"/>
</element>
</differential>
</StructureDefinition>

0 comments on commit a49401c

Please sign in to comment.