more working on tests

This commit is contained in:
Grahame Grieve 2019-01-29 11:00:01 +11:00
parent 9e583e8e35
commit 40c0a58eb3
12 changed files with 762 additions and 23 deletions

View File

@ -174,6 +174,7 @@ public class FHIRPathEngine {
private StringBuilder log = new StringBuilder();
private Set<String> primitiveTypes = new HashSet<String>();
private Map<String, StructureDefinition> allTypes = new HashMap<String, StructureDefinition>();
private boolean legacyMode; // some R2 and R3 constraints assume that != is valid for emptty sets, so when running for R2/R3, this is set ot true
// if the fhir path expressions are allowed to use constants beyond those defined in the specification
// the application can implement them by providing a constant resolver
@ -311,6 +312,17 @@ public class FHIRPathEngine {
result.add(v);
}
public boolean isLegacyMode() {
return legacyMode;
}
public void setLegacyMode(boolean legacyMode) {
this.legacyMode = legacyMode;
}
// --- public API -------------------------------------------------------
/**
* Parse a path for later use using execute
@ -1549,7 +1561,7 @@ public class FHIRPathEngine {
}
private List<Base> opNotEquals(List<Base> left, List<Base> right) {
if (left.size() == 0 || right.size() == 0)
if (!legacyMode && (left.size() == 0 || right.size() == 0))
return new ArrayList<Base>();
if (left.size() != right.size())
@ -3529,7 +3541,8 @@ public class FHIRPathEngine {
if (focus.size() == 1) {
String s = convertToString(focus.get(0));
result.add(new BooleanType(!Utilities.noString(s)).noExtensions());
}
} else
result.add(new BooleanType(false).noExtensions());
return result;
}

View File

@ -448,6 +448,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
this.externalHostServices = hostServices;
fpe = new FHIRPathEngine(context);
fpe.setHostServices(new ValidatorHostServices());
if (theContext.getVersion().startsWith("3.0") || theContext.getVersion().startsWith("1.0"))
fpe.setLegacyMode(true);
source = Source.InstanceValidator;
}

View File

@ -0,0 +1,15 @@
package org.hl7.fhir.validation.tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
ValidationTestSuite.class,
ValidationEngineTests.class,
JsonSchemaTests.class,
CDAValidationTestCase.class})
public class AllTests {
}

View File

@ -1,7 +1,8 @@
package org.hl7.fhir.validation.r4.tests;
package org.hl7.fhir.validation.tests;
import org.hl7.fhir.r4.context.SimpleWorkerContext;
import org.hl7.fhir.r4.validation.Validator;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.junit.Test;
public class CDAValidationTestCase {
@ -10,7 +11,7 @@ public class CDAValidationTestCase {
@Test
public void test() throws Exception {
Validator.main(new String[] {"c:\\temp\\cda.xml", "-ig", "hl7.fhir.cda"});
Validator.main(new String[] {TestUtilities.resourceNameToFile("ccda.xml"), "-ig", "hl7.fhir.cda"});
}
}

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.validation.r4.tests;
package org.hl7.fhir.validation.tests;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.validation.r4.tests;
package org.hl7.fhir.validation.tests;
import java.io.FileNotFoundException;
import java.io.IOException;
@ -8,6 +8,7 @@ import org.everit.json.schema.ValidationException;
import org.everit.json.schema.loader.SchemaLoader;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.junit.Assert;
@ -21,7 +22,7 @@ public class JsonSchemaTests {
public static final String TEST_SCHEMA = "{\r\n"+
" \"$schema\": \"http://json-schema.org/draft-06/schema#\",\r\n"+
" \"id\": \"http://hl7.org/fhir/test-json-schema/3.4\",\r\n"+
// " \"id\": \"http://hl7.org/fhir/test-json-schema/4.0\",\r\n"+
" \"description\": \"for unit tests\",\r\n"+
" \"discriminator\": {\r\n"+
" \"propertyName\": \"resourceType\",\r\n"+
@ -129,11 +130,11 @@ public class JsonSchemaTests {
@Before
public void setUp() throws Exception {
if (sFhir == null) {
String path = Utilities.path("r:\\fhir\\publish", "fhir.schema.json"); // todo... what should this be?
String source = TextFile.fileToString(path);
JSONObject rawSchema = new JSONObject(new JSONTokener(source));
sFhir = SchemaLoader.load(rawSchema);
rawSchema = new JSONObject(new JSONTokener(TEST_SCHEMA));
// String path = TestUtilities.resourceNameToFile("fhir.schema.json"); // todo... what should this be?
// String source = TextFile.fileToString(path);
// JSONObject rawSchema = new JSONObject(new JSONTokener(source));
// sFhir = SchemaLoader.load(rawSchema);
JSONObject rawSchema = new JSONObject(new JSONTokener(TEST_SCHEMA));
sTest = SchemaLoader.load(rawSchema);
}
}

View File

@ -1,7 +1,8 @@
package org.hl7.fhir.validation.r4.tests;
package org.hl7.fhir.validation.tests;
import org.hl7.fhir.r4.validation.NativeHostServices;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
public class NativeHostServiceTester {
@ -9,26 +10,26 @@ public class NativeHostServiceTester {
System.out.println("starting...");
NativeHostServices svc = new NativeHostServices();
svc.init("C:\\work\\org.hl7.fhir\\build\\publish\\igpack.zip");
svc.connectToTxSvc("http://tx.fhir.org/r3", null);
svc.init("hl7.fhir.core#4.0.0");
svc.connectToTxSvc("http://tx.fhir.org/r4", null);
System.out.println("base: "+svc.status());
svc.seeResource(TextFile.fileToBytes("C:\\work\\fhirserver\\resources\\dicom\\CID_2.xml"));
svc.seeResource(TextFile.fileToBytes(TestUtilities.resourceNameToFile("ValueSet-dicm-2-AnatomicModifier.json")));
System.out.println("added: "+svc.status());
svc.dropResource("ValueSet", "dicm-2-AnatomicModifier");
System.out.println("removed: "+svc.status());
System.out.println("validate:");
byte[] res = svc.validateResource("my-loc", TextFile.fileToBytes("C:\\work\\fhirserver\\resources\\r3\\patient-group.xml"), "XML", "any-extensions id-optional");
byte[] res = svc.validateResource("my-loc", TextFile.fileToBytes(TestUtilities.resourceNameToFile("validation-examples", "patient-example.xml")), "XML", "any-extensions id-optional");
System.out.println(new String(res));
System.out.println("convert:");
byte[] r4 = svc.convertResource(TextFile.fileToBytes("C:\\work\\org.hl7.fhir.old\\org.hl7.fhir.dstu2\\build\\publish\\patient-example.xml"), "xml", "r2");
byte[] r4 = svc.convertResource(TextFile.fileToBytes(TestUtilities.resourceNameToFile("validation-examples", "patient-example.xml")), "xml", "r2");
System.out.println(new String(r4));
System.out.println("unconvert:");
byte[] r2 = svc.convertResource(TextFile.fileToBytes("C:\\work\\org.hl7.fhir\\build\\publish\\patient-example.xml"), "xml", "r2");
byte[] r2 = svc.convertResource(TextFile.fileToBytes(TestUtilities.resourceNameToFile("validation-examples", "patient-example.xml")), "xml", "r2");
System.out.println(new String(r2));

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.validation.r4.tests;
package org.hl7.fhir.validation.tests;
import java.io.File;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.validation.r4.tests;
package org.hl7.fhir.validation.tests;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.validation.r4.tests;
package org.hl7.fhir.validation.tests;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -97,7 +97,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
@Test
public void test() throws Exception {
if (ve == null) {
ve = new ValidationEngine(TestingUtilities.content(), DEF_TX, null, FhirPublication.R4);
ve = new ValidationEngine("hl7.fhir.core#4.0.0", DEF_TX, null, FhirPublication.R4);
ve.getContext().setCanRunWithoutTerminology(true);
TestingUtilities.fcontext = ve.getContext();
}

View File

@ -0,0 +1 @@
{"resourceType":"ValueSet","id":"dicm-2-AnatomicModifier","url":"http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_2.html","identifier":[{"system":"urn:ietf:rfc:3986","value":"urn:oid:1.2.840.10008.6.1.1"}],"version":"20160314","name":"AnatomicModifier","status":"active","experimental":false,"date":"2017-11-23","publisher":"NEMA MITA DICOM","description":"Transitive closure of CID 2 AnatomicModifier","copyright":"© 2017 NEMA","compose":{"include":[{"system":"http://snomed.info/srt","concept":[{"code":"R-40819","display":"Internal"},{"code":"G-A171","display":"Capsular"},{"code":"G-A170","display":"Hilar"},{"code":"G-A151","display":"Extra-articular"},{"code":"G-A172","display":"Subcapsular"},{"code":"R-404CE","display":"Posterior"},{"code":"G-A174","display":"Edge"},{"code":"G-A111","display":"Peripheral"},{"code":"G-A110","display":"Central"},{"code":"R-404CC","display":"Anterior"},{"code":"G-A114","display":"Intermediate"},{"code":"G-A117","display":"Transverse"},{"code":"G-A139","display":"Superficial"},{"code":"G-A138","display":"Coronal"},{"code":"G-A119","display":"Distal"},{"code":"G-A118","display":"Proximal"},{"code":"G-A15A","display":"Intra-articular"},{"code":"R-4094A","display":"Inferior"},{"code":"R-42191","display":"Superior"},{"code":"G-A180","display":"Anterolateral"},{"code":"G-A182","display":"Posterolateral"},{"code":"G-A140","display":"Deep"},{"code":"G-A120","display":"Postaxial"},{"code":"G-A142","display":"Horizontal"},{"code":"R-40941","display":"External"},{"code":"G-A100","display":"Right"},{"code":"G-A122","display":"Apical"},{"code":"G-A144","display":"Vertical"},{"code":"G-A121","display":"Preaxial"},{"code":"G-A143","display":"Longitudinal"},{"code":"G-A102","display":"Bilateral"},{"code":"G-A101","display":"Left"},{"code":"G-A123","display":"Basal"},{"code":"G-A145","display":"Sagittal"},{"code":"G-A104","display":"Lateral"},{"code":"G-A103","display":"Unilateral"},{"code":"G-A147","display":"Axial"},{"code":"G-A169","display":"Gutter"},{"code":"G-A128","display":"Efferent"},{"code":"G-A127","display":"Afferent"},{"code":"G-A108","display":"Caudal"},{"code":"G-A107","display":"Cephalic"},{"code":"G-A206","display":"Surface"},{"code":"G-A428","display":"Marginal"},{"code":"R-404D5","display":"Medial"}]}]}}

View File

@ -0,0 +1,705 @@
<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<realmCode code="US"/>
<typeId extension="POCD_HD000040" root="2.16.840.1.113883.1.3"/>
<templateId root="2.16.840.1.113883.10.20.22.1.2"/>
<templateId root="2.16.840.1.113883.10.20.22.1.1"/>
<id assigningAuthorityName="DCI" root="2.16.840.1.113883.3.4808"/>
<code code="34133-9" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Summarization of Episode Note DCI"/>
<title>DCI Continuity of Care Document</title>
<effectiveTime value="20160414095027"/>
<confidentialityCode code="R" codeSystem="2.16.840.1.113883.5.25" codeSystemName="ConfidentialityCode"/>
<languageCode code="en-US"/>
<recordTarget>
<patientRole>
<id extension="337993" root="2.16.840.1.113883.3.4808"/>
<id extension=" " root="2.16.840.1.113883.4.1"/>
<addr use="HP">
<state>CA</state>
<city>OROVILLE</city>
<postalCode>21014</postalCode>
<streetAddressLine>302 Cumming Ave RR 2</streetAddressLine>
<country>US</country>
</addr>
<telecom use="HP" value="4105550305"/>
<patient>
<name use="L">
<given>BARBARA</given>
<family>DCI</family>
</name>
<administrativeGenderCode code="F" codeSystem="2.16.840.1.113883.5.1" displayName="Female"/>
<birthTime value="19811208"/>
<maritalStatusCode code="M " codeSystem="2.16.840.1.113883.5.2" codeSystemName="MaritalStatusCode" displayName="MARRIED "/>
<raceCode code="null " codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race &amp; Ethnicity - CDC" displayName="null "/>
<ethnicGroupCode code="2186-5" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race &amp; Ethnicity - CDC" displayName="Hispanic or Latino "/>
<languageCommunication>
<languageCode code="english"/>
<preferenceInd value="true"/>
</languageCommunication>
</patient>
</patientRole>
</recordTarget>
<author>
<time value="20160414"/>
<assignedAuthor>
<id extension="111111" root="2.16.840.1.113883.4.6"/>
<addr>
<streetAddressLine>302 Cumming Ave RR 2</streetAddressLine>
<city>OROVILLE</city>
<state>CA</state>
<postalCode>21014</postalCode>
<country>US</country>
</addr>
<telecom use="WP" value="4105550305"/>
<assignedPerson>
<name>
<prefix>Dr</prefix>
<given>Colon</given>
<family>Wilma</family>
</name>
</assignedPerson>
</assignedAuthor>
</author>
<custodian>
<assignedCustodian>
<representedCustodianOrganization>
<id extension="99999999" root="2.16.840.1.113883.4.6"/>
<name/>
<telecom use="WP" value="tel: +1-(410)555-5544"/>
<addr use="WP">
<streetAddressLine>8333 Clairemont Blvd</streetAddressLine>
<city>Bel Air</city>
<state>MD</state>
<postalCode>21014</postalCode>
<country>US</country>
</addr>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.5.1"/>
<templateId root="2.16.840.1.113883.10.20.22.2.5"/>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem List"/>
<title>Problems</title>
<text>
<!--
********************************************************
Problem Narrative
********************************************************
-->
<table width="100%" border="1">
<thead>
<tr>
<th>Condition</th>
<th>Effective Date</th>
<th>Resolved Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td ID="problem920000584281">Burn Of Third Degree Of Unspecified Thigh, Subsequent Encounter</td>
<td>06/25/2015</td>
<td/>
<td>Active</td>
</tr>
<tr>
<td ID="problem920000584280">Burn Of Second Degree Of Female Genital Region, Initial Encounter</td>
<td>06/25/2015</td>
<td/>
<td>Active</td>
</tr>
<tr>
<td ID="problem920000584278">Burns on lower body</td>
<td>06/18/2015</td>
<td>06/25/2015</td>
<td>Resolved</td>
</tr>
<tr>
<td ID="problem920000584276">Cerebral Palsy, Unspecified</td>
<td>08/29/1982</td>
<td/>
<td>Active</td>
</tr>
</tbody>
</table>
</text>
<entry>
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.3"/>
<id extension="920000584281" root="2c92a6bc-4614-f58f-0146-155c72be4d6c"/>
<code nullFlavor="NI"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20160413003547Z"/>
</effectiveTime>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
<id root="ff5f915d-5258-4547-91ad-ddf934e24c58"/>
<code code="55607006" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED" displayName="Problem"/>
<text>
<reference value="#problem920000584281"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20150625"/>
</effectiveTime>
<value xsi:type="CD" nullFlavor="OTH">
<translation code="T24.319D" codeSystem="2.16.840.1.113883.6.3" codeSystemName="ICD-10-CM"/>
</value>
</observation>
</entryRelationship>
</act>
</entry>
<entry>
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.3"/>
<id extension="920000584280" root="2c92a6bc-4614-f58f-0146-155c72be4d6c"/>
<code nullFlavor="NI"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20160413003543Z"/>
</effectiveTime>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
<id root="70211e95-0e6a-43f2-91b5-b85eba3616b1"/>
<code code="55607006" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED" displayName="Problem"/>
<text>
<reference value="#problem920000584280"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20150625"/>
</effectiveTime>
<value xsi:type="CD" nullFlavor="OTH">
<translation code="T21.27XA" codeSystem="2.16.840.1.113883.6.3" codeSystemName="ICD-10-CM"/>
</value>
</observation>
</entryRelationship>
</act>
</entry>
<entry>
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.3"/>
<id extension="920000584278" root="2c92a6bc-4614-f58f-0146-155c72be4d6c"/>
<code nullFlavor="NI"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20160413034835Z"/>
<high value="20150625"/>
</effectiveTime>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
<id root="10f0ec87-bac6-4357-ab1b-9c3c31008d62"/>
<code code="55607006" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED" displayName="Problem"/>
<text>
<reference value="#problem920000584278"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="20150618"/>
<high value="20150625"/>
</effectiveTime>
<value xsi:type="CD" nullFlavor="OTH">
<translation code="T21.07XA" codeSystem="2.16.840.1.113883.6.3" codeSystemName="ICD-10-CM"/>
</value>
</observation>
</entryRelationship>
</act>
</entry>
<entry>
<act classCode="ACT" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.3"/>
<id extension="920000584276" root="2c92a6bc-4614-f58f-0146-155c72be4d6c"/>
<code nullFlavor="NI"/>
<statusCode code="completed"/>
<effectiveTime>
<low value="20160413033854Z"/>
</effectiveTime>
<entryRelationship typeCode="SUBJ">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
<id root="f2705276-28ee-4f28-9384-21fdf0705ba5"/>
<code code="55607006" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED" displayName="Problem"/>
<text>
<reference value="#problem920000584276"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low value="19820829"/>
</effectiveTime>
<value xsi:type="CD" nullFlavor="OTH">
<translation code="G80.9" codeSystem="2.16.840.1.113883.6.3" codeSystemName="ICD-10-CM"/>
</value>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.1.1"/>
<templateId root="2.16.840.1.113883.10.20.22.2.1"/>
<code code="10160-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="History of medication use"/>
<title>Medications</title>
<text>
<!--
********************************************************
Medications Narrative
********************************************************
-->
<table width="100%" border="1">
<thead>
<tr>
<th>Medication</th>
<th>Instructions</th>
<th>Date Range</th>
<th>Status</th>
<th>comments</th>
</tr>
</thead>
<tbody>
<tr>
<td ID="medication920000875889">SENOKOT 187 MG | 2 Tablet(s) | PO | QHS (06/01/2015 - present)</td>
<td>187 MG | 2 Tablet(s) | PO | QHS</td>
<td>06/01/2015-</td>
<td>Completed</td>
<td ID="medcommentsmedication920000875889">Taken in clinic | </td>
</tr>
<tr>
<td ID="medication920000875890">CLOTRIMAZOLE 1 % | 1 GM | VA | BID (06/01/2015 - present)</td>
<td>1 % | 1 GM | VA | BID</td>
<td>06/01/2015-</td>
<td>Completed</td>
<td ID="medcommentsmedication920000875890">Taken in clinic | </td>
</tr>
<tr>
<td ID="medication920000875891">TYLENOL WITH CODEINE #3 300-30 MG | 1 Tablet(s) | PO | QD-PRN (06/25/2015 - present)</td>
<td>300-30 MG | 1 Tablet(s) | PO | QD-PRN</td>
<td>06/25/2015-</td>
<td>Completed</td>
<td ID="medcommentsmedication920000875891">Taken in clinic | </td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<substanceAdministration classCode="SBADM" moodCode="INT">
<templateId root="2.16.840.1.113883.10.20.22.4.16"/>
<id root="a0e312da-2007-4f4b-b8ed-3973e93b948d"/>
<text>
<reference value="#medication920000875889"/>
</text>
<!-- <comments>
<reference value="#medcommentsmedication920000875889"/>
</comments> -->
<statusCode code="completed"/>
<effectiveTime xsi:type="IVL_TS">
<low value="20150601"/>
<high nullFlavor="NI"/>
</effectiveTime>
<effectiveTime xsi:type="PIVL_TS" operator="A">
<period unit="d" value="1"/>
</effectiveTime>
<effectiveTime xsi:type="EIVL_TS" operator="A">
<event code="HS"/>
</effectiveTime>
<routeCode displayName="PO"/>
<doseQuantity unit="MG" value="374"/>
<consumable>
<manufacturedProduct classCode="MANU">
<templateId root="2.16.840.1.113883.10.20.22.4.23"/>
<manufacturedMaterial>
<code nullFlavor="OTH">
<originalText>
<reference value="#medication920000875889"/>
</originalText>
<translation code="35356057820" codeSystem="2.16.840.1.113883.6.69" codeSystemName="NDC" displayName="SENOKOT"/>
<translation code="019286" codeSystem="2.16.840.1.113883.6.253" codeSystemName="MDDID" displayName="SENOKOT"/>
</code>
</manufacturedMaterial>
</manufacturedProduct>
</consumable>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.47"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Status"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active"/>
</observation>
</entryRelationship>
<precondition typeCode="PRCN">
<criterion>
<templateId root="2.16.840.1.113883.10.20.22.4.25"/>
<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
<value xsi:type="CE"/>
</criterion>
</precondition>
</substanceAdministration>
</entry>
<entry typeCode="DRIV">
<substanceAdministration classCode="SBADM" moodCode="INT">
<templateId root="2.16.840.1.113883.10.20.22.4.16"/>
<id root="5e328ab0-2c51-4391-823d-ea8a3743e0cf"/>
<text>
<reference value="#medication920000875890"/>
</text>
<!-- <comments>
<reference value="#medcommentsmedication920000875890"/>
</comments> -->
<statusCode code="completed"/>
<effectiveTime xsi:type="IVL_TS">
<low value="20150601"/>
<high nullFlavor="NI"/>
</effectiveTime>
<effectiveTime xsi:type="PIVL_TS" operator="A">
<period unit="d" value=".5"/>
</effectiveTime>
<routeCode displayName="VA"/>
<doseQuantity unit="GM" value="1"/>
<consumable>
<manufacturedProduct classCode="MANU">
<templateId root="2.16.840.1.113883.10.20.22.4.23"/>
<manufacturedMaterial>
<code nullFlavor="OTH">
<originalText>
<reference value="#medication920000875890"/>
</originalText>
<translation code="00472022041" codeSystem="2.16.840.1.113883.6.69" codeSystemName="NDC" displayName="CLOTRIMAZOLE"/>
<translation code="004781" codeSystem="2.16.840.1.113883.6.253" codeSystemName="MDDID" displayName="CLOTRIMAZOLE"/>
</code>
</manufacturedMaterial>
</manufacturedProduct>
</consumable>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.47"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Status"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active"/>
</observation>
</entryRelationship>
<precondition typeCode="PRCN">
<criterion>
<templateId root="2.16.840.1.113883.10.20.22.4.25"/>
<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
<value xsi:type="CE"/>
</criterion>
</precondition>
</substanceAdministration>
</entry>
<entry typeCode="DRIV">
<substanceAdministration classCode="SBADM" moodCode="INT">
<templateId root="2.16.840.1.113883.10.20.22.4.16"/>
<id root="51737098-eecb-42b0-821a-2717d23861b0"/>
<text>
<reference value="#medication920000875891"/>
</text>
<!-- <comments>
<reference value="#medcommentsmedication920000875891"/>
</comments> -->
<statusCode code="completed"/>
<effectiveTime xsi:type="IVL_TS">
<low value="20150625"/>
<high nullFlavor="NI"/>
</effectiveTime>
<effectiveTime xsi:type="PIVL_TS" operator="A">
<period unit="d" value="1"/>
</effectiveTime>
<routeCode displayName="PO"/>
<doseQuantity unit="Tablet(s)" value="1"/>
<consumable>
<manufacturedProduct classCode="MANU">
<templateId root="2.16.840.1.113883.10.20.22.4.23"/>
<manufacturedMaterial>
<code nullFlavor="OTH">
<originalText>
<reference value="#medication920000875891"/>
</originalText>
<translation code="50458051380" codeSystem="2.16.840.1.113883.6.69" codeSystemName="NDC" displayName="TYLENOL WITH CODEINE #3"/>
<translation code="022591" codeSystem="2.16.840.1.113883.6.253" codeSystemName="MDDID" displayName="TYLENOL WITH CODEINE #3"/>
</code>
</manufacturedMaterial>
</manufacturedProduct>
</consumable>
<entryRelationship typeCode="REFR">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.1.47"/>
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Status"/>
<value xsi:type="CE" code="55561003" codeSystem="2.16.840.1.113883.6.96" displayName="Active"/>
</observation>
</entryRelationship>
<precondition typeCode="PRCN">
<criterion>
<templateId root="2.16.840.1.113883.10.20.22.4.25"/>
<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
<value xsi:type="CE"/>
</criterion>
</precondition>
</substanceAdministration>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.38.1"/>
<templateId root="2.16.840.1.113883.10.20.22.2.38"/>
<code code="10160-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="History of medication use"/>
<title>Medications Administered</title>
<text>
<!--
********************************************************
Medications Administered Narrative
********************************************************
-->
<table width="100%" border="1">
<thead>
<tr>
<th>Medication</th>
<th>Start Date</th>
<th>End Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td ID="medicationadmin1">No Known Medication Administrations</td>
<td ID="medicationadmin_desc1"/>
<td/>
<td/>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<substanceAdministration classCode="SBADM" moodCode="EVN" negationInd="true">
<text>
<reference value="#Medication_1"/>
</text>
<consumable>
<manufacturedProduct>
<manufacturedLabeledDrug>
<code code="410942007" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Drug or Medicament"/>
</manufacturedLabeledDrug>
</manufacturedProduct>
</consumable>
</substanceAdministration>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.2.1"/>
<templateId root="2.16.840.1.113883.10.20.22.2.2"/>
<code code="11369-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="History of immunizations"/>
<title>IMMUNIZATIONS</title>
<text>
<!--
********************************************************
Immunizations Narrative
********************************************************
-->
<table width="100%" border="1">
<thead>
<tr>
<th>Date</th>
<th>Vaccination</th>
<th>Appointment</th>
<th>Status/Event</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td ID="immunization1">No Known Immunizations</td>
<td ID="immunizationsig1"/>
<td/>
<td/>
<td>
<content ID="vacComment1"/>
</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<substanceAdministration classCode="SBADM" moodCode="EVN" negationInd="false">
<!-- Empty Immunization Activity entry template -->
<templateId root="2.16.840.1.113883.10.20.22.4.52"/>
<id nullFlavor="NA"/>
<statusCode code="completed"/>
<effectiveTime/>
<consumable>
<manufacturedProduct classCode="MANU">
<!-- Immunization Medication Information template -->
<templateId root="2.16.840.1.113883.10.20.22.4.54"/>
<manufacturedMaterial>
<code codeSystem="2.16.840.1.113883.12.292" codeSystemName="CVX">
<originalText>
<reference value="#immunization1"/>
</originalText>
</code>
</manufacturedMaterial>
</manufacturedProduct>
</consumable>
</substanceAdministration>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.6.1"/>
<templateId root="2.16.840.1.113883.10.20.22.2.6"/>
<code code="48765-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Allergies, adverse reactions, alerts"/>
<title>Allergies/Adverse Reactions</title>
<text>
<!--
********************************************************
Allergies Narrative
********************************************************
-->
<table width="100%" border="1">
<thead>
<tr>
<th>Substance</th>
<th>Reaction</th>
<th>Effective Date</th>
<th>Resolved Date</th>
<th>Severity</th>
<th>Status</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td ID="allergy1">No Known Allergies</td>
<td ID="reaction1"/>
<td/>
<td/>
<td/>
<td/>
<td ID="allergynote1"/>
</tr>
</tbody>
</table>
</text>
<!-- empty entry below -->
<entry>
<act>
<entryRelationship>
<observation classCode="OBS" moodCode="EVN" negationInd="true">
<code code="106190000" codeSystem="2.16.840.1.113883.6.1" displayName="Allergy"/>
<effectiveTime>
<low nullFlavor="NI"/>
<high nullFlavor="NI"/>
</effectiveTime>
<value xsi:type="CD"/>
<participant typeCode="CSM">
<participantRole classCode="MANU">
<playingEntity classCode="MMAT">
<code code="413477004" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Allergen or Pseudoallergen"/>
</playingEntity>
</participantRole>
</participant>
<entryRelationship inversionInd="true" typeCode="MFST">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.9"/>
<id root="2c92a296-461f-51ac-0146-2047dd110048"/>
<code nullFlavor="NA"/>
<text>
<reference value="#reaction1"/>
</text>
<statusCode code="completed"/>
<effectiveTime>
<low nullFlavor="NI"/>
<high nullFlavor="NI"/>
</effectiveTime>
<value xsi:type="CD">
<translation nullFlavor="NI"/>
</value>
</observation>
</entryRelationship>
</observation>
</entryRelationship>
</act>
</entry>
</section>
</component>
<!-- vital signs template -->
<component>
<!-- nullFlavor of NI indicates No Information. -->
<!-- Validator currently checks for entries even in case of nullFlavor - this will need to be updated if approved. -->
<section nullFlavor="NI">
<templateId root="2.16.840.1.113883.10.20.22.2.4.1"/>
<!-- Vital Signs (entries required) -->
<code code="8716-3" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Vital Signs"/>
<title>VITAL SIGNS</title>
<text>No Information</text>
</section>
</component>
<component>
<!-- EMPTY SOCIAL HISTORY TEMPLATE -->
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.17"/>
<!-- ******** Social history section template ******** -->
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" displayName="Social History"/>
<title>Social History</title>
<text>
<table width="100%" border="1">
<thead>
<tr>
<th>Social History Element</th>
<th>Description</th>
<th>Effective Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<content>Smoking</content>
</td>
<td>Never as of 06/18/2015</td>
<td>20150618000000</td>
</tr>
</tbody>
</table>
</text>
<entry typeCode="DRIV">
<observation classCode="OBS" moodCode="EVN">
<templateId root="2.16.840.1.113883.10.20.22.4.78"/>
<!-- ******** Social history observation template ******** -->
<id root="9b56c25d-9104-45ee-9fa4-e0f3afaa01c1"/>
<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode" displayName="Assertion">
<originalText>
<reference value="#soc1"/>
</originalText>
</code>
<statusCode code="completed"/>
<effectiveTime>
<low/>
<high value="20150618000000"/>
</effectiveTime>
<value xsi:type="CD" code="266919005" codeSystem="2.16.840.1.113883.6.96" displayName="Never smoker"/>
</observation>
</entry>
</section>
</component>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.13"/>
<code code="46239-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="REASON FOR VISIT + CHIEF COMPLAINT"/>
<title>Reason for Visit/Chief Complaint</title>
<text>
Pain and Blistering on legs
</text>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>