Skip to content

Commit

Permalink
Merge pull request #246 from FirelyTeam/feature/demo-validation-tests…
Browse files Browse the repository at this point in the history
…-stu3

Add unit tests for the STU3 version of the ValidationDemo
  • Loading branch information
mmsmits authored Jan 10, 2024
2 parents e644fb7 + 164c4e3 commit 01d14f3
Show file tree
Hide file tree
Showing 16 changed files with 1,078 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Firely.Fhir.Validation.Compilation.Tests.Shared\Firely.Fhir.Validation.Compilation.Tests.Shared.projitems" Label="Shared" />
<Import Project="../../firely-validator-api-tests.props" />

<PropertyGroup>
<DefineConstants>R4</DefineConstants>
</PropertyGroup>
Expand All @@ -17,9 +17,9 @@
</ItemGroup>

<ItemGroup>
<Content Include="TestData\DocumentComposition\*.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\DocumentComposition\*.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Firely.Fhir.Validation.Compilation.Tests.Shared\Firely.Fhir.Validation.Compilation.Tests.Shared.projitems" Label="Shared" />
<Import Project="../../firely-validator-api-tests.props" />

<PropertyGroup>
<DefineConstants>STU3</DefineConstants>
</PropertyGroup>
Expand All @@ -17,6 +17,13 @@
</ItemGroup>

<ItemGroup>
<Content Include="TestData\DocumentComposition\*.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Hl7.Fhir.STU3" Version="$(FirelySdkVersion)" />
<PackageReference Include="Hl7.Fhir.Specification.Data.STU3" Version="$(FirelySdkVersion)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<url value="http://example.org/StructureDefinition/DocumentBundle" />
<name value="DocumentBundle" />
<status value="draft" />
<fhirVersion value="3.0.1" />
<kind value="resource" />
<type value="Bundle" />
<abstract value="false" />
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Bundle" />
<derivation value="constraint" />
<differential>
<element>
<path value="Bundle" />
<type>
<code value="Bundle" />
</type>
</element>
<element>
<path value="Bundle.type" />
<fixedCode value="document" />
</element>
<element>
<path value="Bundle.total" />
<max value="0" />
</element>
<element>
<path value="Bundle.link" />
<max value="0" />
</element>
<element>
<path value="Bundle.entry" />
<min value="1" />
</element>
</differential>
</StructureDefinition>
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../../Svn/fhir/trunk/build/schema/fhir-all.xsd" xmlns="http://hl7.org/fhir">
<meta>
<lastUpdated value="2016-10-06T11:07:20.873+02:00" />
</meta>
<url value="http://example.org/StructureDefinition/DocumentComposition" />
<name value="DocumentComposition" />
<status value="draft" />
<fhirVersion value="3.0.1" />
<kind value="resource" />
<type value="Composition" />
<abstract value="false" />
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Composition" />
<derivation value="constraint" />
<differential>
<element>
<path value="Composition" />
<type>
<code value="Composition" />
</type>
</element>
<element>
<path value="Composition.type" />
<patternCodeableConcept>
<coding>
<system value="http://loinc.org" />
<code value="18842-5" />
</coding>
</patternCodeableConcept>
</element>
<element>
<path value="Composition.subject" />
<type>
<code value="Reference" />
<targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
<aggregation value="referenced" />
</type>
</element>
<element>
<path value="Composition.author" />
<max value="1" />
<type>
<code value="Reference" />
<targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
<aggregation value="bundled" />
</type>
</element>

<!-- Slice intro on Composition.section with some child constraints -->
<element>
<extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name">
<valueString value="Section" />
</extension>
<path value="Composition.section" />
<slicing>
<discriminator>
<type value="value" />
<path value="code" />
</discriminator>
<ordered value="false" />
<rules value="open" />
</slicing>
<min value="1" />
</element>
<element>
<path value="Composition.section.title" />
<min value="1" />
<maxLength value="20" />
</element>
<element>
<path value="Composition.section.code" />
<min value="1" />
<binding>
<strength value="required" />
<valueSetReference>
<reference value="http://example.org/ValueSet/SectionTitles" />
</valueSetReference>
</binding>
</element>
<element>
<path value="Composition.section.entry" />
<type>
<code value="Reference" />
<targetProfile value="http://hl7.org/fhir/StructureDefinition/Observation" />
<aggregation value="referenced" />
<aggregation value="bundled" />
</type>
</element>
<element>
<path value="Composition.section.emptyReason" />
<max value="0" />
</element>
<element>
<path value="Composition.section.section" />
<max value="0" />
</element>

<!-- slice on Composition.section: vital signs, EXACTLY 1 -->
<element>
<path value="Composition.section" />
<sliceName value="vitalSigns" />
<min value="1" />
<max value="1" />
</element>
<element>
<path value="Composition.section.code" />
<min value="1" />
<patternCodeableConcept>
<coding>
<system value="http://loinc.org" />
<code value="8716-3" />
</coding>
</patternCodeableConcept>
</element>

<!-- slice on Composition.section: chief complaint, MAX 1 -->
<element>
<path value="Composition.section" />
<sliceName value="chiefComplaint" />
<min value="0" />
<max value="1" />
</element>
<element>
<path value="Composition.section.code" />
<min value="1" />
<patternCodeableConcept>
<coding>
<system value="http://loinc.org" />
<code value="10154-3" />
</coding>
</patternCodeableConcept>
</element>
</differential>
</StructureDefinition>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<meta>
<lastUpdated value="2016-10-05T18:16:38.432+02:00" />
</meta>
<text>
<status value="empty" /><div xmlns="http://www.w3.org/1999/xhtml" /></text>
<url value="http://example.org/StructureDefinition/HeightQuantity" />
<name value="HeightQuantity" />
<status value="draft" />
<fhirVersion value="3.0.1" />
<kind value="primitive-type" />
<type value="Quantity" />
<abstract value="false" />
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Quantity" />
<derivation value="constraint" />
<differential>
<element>
<path value="Quantity" />
<type>
<code value="Quantity" />
</type>
</element>
<element>
<path value="Quantity.value" />
<min value="1" />
<minValueDecimal value="0" />
<maxValueDecimal value="350" />
</element>
<element>
<path value="Quantity.comparator" />
<max value="0" />
</element>
<element>
<path value="Quantity.system" />
<min value="1" />
<fixedUri value="http://unitsofmeasure.org" />
</element>
<element>
<path value="Quantity.code" />
<min value="1" />
<fixedCode value="cm" />
</element>
</differential>
</StructureDefinition>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<Practitioner xmlns="http://hl7.org/fhir">
<id value="Hippocrates"/>
<meta>
<lastUpdated value="2012-05-29T23:45:32Z"/>
</meta>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Hippocrates, Harold. SSN:
444444444</div>
</text>
<identifier>
<type>
<coding>
<system value="http://hl7.org/fhir/v2/0203"/>
<code value="TAX"/>
</coding>
</type>
<system value="http://hl7.org/fhir/sid/us-ssn"/>
<value value="444444444"/>
</identifier>
<name>
<use value="official"/>
<family value="Hippocrates"/>
<given value="Harold"/>
</name>
<telecom>
<system value="phone"/>
<value value="555-555-1003"/>
<use value="work"/>
</telecom>
<address>
<use value="home"/>
<line value="1003 Healthcare Drive"/>
</address>
<gender value="male"/>
</Practitioner>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<Patient xmlns="http://hl7.org/fhir">
<id value="Levin"/>
<meta>
<lastUpdated value="2014-11-13T11:41:00+11:00"/>
</meta>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Henry Levin the 7th</p>
<p>MRN: 123456. Male, 24-Sept 1932</p>
</div>
</text>
<extension url="http://hl7.org/fhir/StructureDefinition/birthPlace">
<valueAddress>
<text value="1 Back Lane&#13;&#10;Holmfirth&#13;&#10;HUDDERSFIELD&#13;&#10;HD7 1HQ"/>
<line value="1 Back Lane"/>
<city value="Holmfirth"/>
<district value="HUDDERSFIELD"/>
<postalCode value="HD7 1HQ"/>
</valueAddress>
</extension>
<extension url="http://hl7.org/fhir/StructureDefinition/patient-clinicalTrial" >
<extension url="NCT" >
<valueString value="123456789" />
</extension>
<extension url="period" >
<valuePeriod>
<start value="2009-03-14" />
</valuePeriod>
</extension>
<extension url="reason" >
<valueCodeableConcept>
<coding>
<system value="http://acme.org/codes/general" />
<code value="tt14j" />
</coding>
</valueCodeableConcept>
</extension>
</extension>
<identifier>
<use value="usual"/>
<type>
<coding>
<system value="http://hl7.org/fhir/v2/0203"/>
<code value="MR"/>
</coding>
</type>
<system value="http://www.goodhealth.org/identifiers/mrn"/>
<value value="123456"/>
</identifier>
<active value="true"/>
<name>
<family value="Levin"/>
<given value="Henry"/>
<suffix value="The 7th"/>
</name>
<gender value="male"/>
<birthDate value="1932-09-24">
<extension url="http://hl7.org/fhir/StructureDefinition/patient-birthTime">
<valueDateTime value="1932-09-24T15:15:50+02:00" />
</extension>
</birthDate>
</Patient>
Loading

0 comments on commit 01d14f3

Please sign in to comment.