Merge branch 'master' of github.com:jamesagnew/hapi-fhir

This commit is contained in:
James 2016-08-25 23:07:45 -04:00
commit 64066a93ce
16 changed files with 1220 additions and 112 deletions

View File

@ -10,7 +10,7 @@ package ca.uhn.fhir.parser;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@ -26,7 +26,12 @@ package ca.uhn.fhir.parser;
public class ErrorHandlerAdapter implements IParserErrorHandler { public class ErrorHandlerAdapter implements IParserErrorHandler {
@Override @Override
public void unknownElement(IParseLocation theLocation, String theElementName) { public void containedResourceWithNoId(IParseLocation theLocation) {
// NOP
}
@Override
public void unexpectedRepeatingElement(IParseLocation theLocation, String theElementName) {
// NOP // NOP
} }
@ -36,7 +41,12 @@ public class ErrorHandlerAdapter implements IParserErrorHandler {
} }
@Override @Override
public void unexpectedRepeatingElement(IParseLocation theLocation, String theElementName) { public void unknownElement(IParseLocation theLocation, String theElementName) {
// NOP
}
@Override
public void unknownReference(IParseLocation theLocation, String theReference) {
// NOP // NOP
} }

View File

@ -10,7 +10,7 @@ package ca.uhn.fhir.parser;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@ -25,12 +25,25 @@ package ca.uhn.fhir.parser;
*/ */
public interface IParserErrorHandler { public interface IParserErrorHandler {
/**
* Invoked when a contained resource is parsed that has no ID specified (and is therefore invalid)
*
* @param theLocation
* The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without
* changing the API.
* @since 2.0
*/
void containedResourceWithNoId(IParseLocation theLocation);
/** /**
* Invoked when an element repetition (e.g. a second repetition of something) is found for a field * Invoked when an element repetition (e.g. a second repetition of something) is found for a field
* which is non-repeating. * which is non-repeating.
* *
* @param theLocation The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without changing the API. * @param theLocation
* @param theElementName The name of the element that was found. * The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without
* changing the API.
* @param theElementName
* The name of the element that was found.
* @since 1.2 * @since 1.2
*/ */
void unexpectedRepeatingElement(IParseLocation theLocation, String theElementName); void unexpectedRepeatingElement(IParseLocation theLocation, String theElementName);
@ -38,19 +51,37 @@ public interface IParserErrorHandler {
/** /**
* Invoked when an unknown element is found in the document. * Invoked when an unknown element is found in the document.
* *
* @param theLocation The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without changing the API. * @param theLocation
* @param theAttributeName The name of the attribute that was found. * The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without
* changing the API.
* @param theAttributeName
* The name of the attribute that was found.
*/ */
void unknownAttribute(IParseLocation theLocation, String theAttributeName); void unknownAttribute(IParseLocation theLocation, String theAttributeName);
/** /**
* Invoked when an unknown element is found in the document. * Invoked when an unknown element is found in the document.
* *
* @param theLocation The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without changing the API. * @param theLocation
* @param theElementName The name of the element that was found. * The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without
* changing the API.
* @param theElementName
* The name of the element that was found.
*/ */
void unknownElement(IParseLocation theLocation, String theElementName); void unknownElement(IParseLocation theLocation, String theElementName);
/**
* Resource contained a reference that could not be resolved and needs to be resolvable (e.g. because
* it is a local reference to an unknown contained resource)
*
* @param theLocation
* The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without
* changing the API.
* @param theReference The actual invalid reference (e.g. "#3")
* @since 2.0
*/
void unknownReference(IParseLocation theLocation, String theReference);
/** /**
* For now this is an empty interface. Error handling methods include a parameter of this * For now this is an empty interface. Error handling methods include a parameter of this
* type which will currently always be set to null. This interface is included here so that * type which will currently always be set to null. This interface is included here so that

View File

@ -71,4 +71,18 @@ public class LenientErrorHandler implements IParserErrorHandler {
} }
} }
@Override
public void containedResourceWithNoId(IParseLocation theLocation) {
if (myLogErrors) {
ourLog.warn("Resource has contained child resource with no ID");
}
}
@Override
public void unknownReference(IParseLocation theLocation, String theReference) {
if (myLogErrors) {
ourLog.warn("Resource has invalid reference: {}", theReference);
}
}
} }

View File

@ -1396,7 +1396,9 @@ class ParserState<T> {
IResource res = (IResource) getCurrentElement(); IResource res = (IResource) getCurrentElement();
assert res != null; assert res != null;
if (res.getId() == null || res.getId().isEmpty()) { if (res.getId() == null || res.getId().isEmpty()) {
ourLog.debug("Discarding contained resource with no ID!"); // If there is no ID, we don't keep the resource because it's useless (contained resources
// need an ID to be referred to)
myErrorHandler.containedResourceWithNoId(null);
} else { } else {
if (!res.getId().isLocal()) { if (!res.getId().isLocal()) {
res.setId(new IdDt('#' + res.getId().getIdPart())); res.setId(new IdDt('#' + res.getId().getIdPart()));
@ -1436,11 +1438,11 @@ class ParserState<T> {
IBaseResource res = getCurrentElement(); IBaseResource res = getCurrentElement();
assert res != null; assert res != null;
if (res.getIdElement() == null || res.getIdElement().isEmpty()) { if (res.getIdElement() == null || res.getIdElement().isEmpty()) {
ourLog.debug("Discarding contained resource with no ID!"); // If there is no ID, we don't keep the resource because it's useless (contained resources
// need an ID to be referred to)
myErrorHandler.containedResourceWithNoId(null);
} else { } else {
if (!res.getIdElement().isLocal()) { res.getIdElement().setValue('#' + res.getIdElement().getIdPart());
res.getIdElement().setValue('#' + res.getIdElement().getIdPart());
}
getPreResourceState().getContainedResources().put(res.getIdElement().getValue(), res); getPreResourceState().getContainedResources().put(res.getIdElement().getValue(), res);
} }
@ -1985,11 +1987,54 @@ class ParserState<T> {
@Override @Override
public void endingElement() throws DataFormatException { public void endingElement() throws DataFormatException {
// postProcess();
stitchBundleCrossReferences(); stitchBundleCrossReferences();
pop(); pop();
} }
protected void weaveContainedResources() {
FhirTerser terser = myContext.newTerser();
terser.visit(myInstance, new IModelVisitor() {
@Override
public void acceptElement(IBase theElement, List<String> thePathToElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition<?> theDefinition) {
if (theElement instanceof BaseResourceReferenceDt) {
BaseResourceReferenceDt nextRef = (BaseResourceReferenceDt) theElement;
String ref = nextRef.getReference().getValue();
if (isNotBlank(ref)) {
if (ref.startsWith("#")) {
IResource target = (IResource) myContainedResources.get(ref);
if (target != null) {
ourLog.debug("Resource contains local ref {} in field {}", ref, thePathToElement);
nextRef.setResource(target);
} else {
myErrorHandler.unknownReference(null, ref);
}
}
}
} else if (theElement instanceof IBaseReference) {
IBaseReference nextRef = (IBaseReference) theElement;
String ref = nextRef.getReferenceElement().getValue();
if (isNotBlank(ref)) {
if (ref.startsWith("#")) {
IBaseResource target = myContainedResources.get(ref);
if (target != null) {
ourLog.debug("Resource contains local ref {} in field {}", ref, thePathToElement);
nextRef.setResource(target);
} else {
myErrorHandler.unknownReference(null, ref);
}
}
}
}
}
@Override
public void acceptUndeclaredExtension(ISupportsUndeclaredExtensions theContainingElement, List<String> thePathToElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition<?> theDefinition, ExtensionDt theNextExt) {
acceptElement(theNextExt.getValue(), null, null, null);
}
});
}
@Override @Override
public void enteringNewElement(String theNamespaceUri, String theLocalPart) throws DataFormatException { public void enteringNewElement(String theNamespaceUri, String theLocalPart) throws DataFormatException {
BaseRuntimeElementDefinition<?> definition; BaseRuntimeElementDefinition<?> definition;
@ -2107,47 +2152,6 @@ class ParserState<T> {
} }
} }
FhirTerser terser = myContext.newTerser();
terser.visit(myInstance, new IModelVisitor() {
@Override
public void acceptElement(IBase theElement, List<String> thePathToElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition<?> theDefinition) {
if (theElement instanceof BaseResourceReferenceDt) {
BaseResourceReferenceDt nextRef = (BaseResourceReferenceDt) theElement;
String ref = nextRef.getReference().getValue();
if (isNotBlank(ref)) {
if (ref.startsWith("#")) {
IResource target = (IResource) myContainedResources.get(ref);
if (target != null) {
nextRef.setResource(target);
} else {
ourLog.warn("Resource contains unknown local ref: " + ref);
}
}
}
} else if (theElement instanceof IBaseReference) {
IBaseReference nextRef = (IBaseReference) theElement;
String ref = nextRef.getReferenceElement().getValue();
if (isNotBlank(ref)) {
if (ref.startsWith("#")) {
IBaseResource target = myContainedResources.get(ref);
if (target != null) {
nextRef.setResource(target);
} else {
ourLog.warn("Resource contains unknown local ref: " + ref);
}
}
}
}
}
@Override
public void acceptUndeclaredExtension(ISupportsUndeclaredExtensions theContainingElement, List<String> thePathToElement, BaseRuntimeChildDefinition theChildDefinition,
BaseRuntimeElementDefinition<?> theDefinition, ExtensionDt theNextExt) {
acceptElement(theNextExt.getValue(), null, null, null);
}
});
populateTarget(); populateTarget();
} }
@ -2229,6 +2233,7 @@ class ParserState<T> {
@Override @Override
protected void populateTarget() { protected void populateTarget() {
weaveContainedResources();
if (myEntry != null) { if (myEntry != null) {
myEntry.setResource((IResource) getCurrentElement()); myEntry.setResource((IResource) getCurrentElement());
} }
@ -2274,6 +2279,7 @@ class ParserState<T> {
@Override @Override
protected void populateTarget() { protected void populateTarget() {
weaveContainedResources();
if (myMutator != null) { if (myMutator != null) {
myMutator.setValue(myTarget, getCurrentElement()); myMutator.setValue(myTarget, getCurrentElement());
} }

View File

@ -46,5 +46,15 @@ public class StrictErrorHandler implements IParserErrorHandler {
throw new DataFormatException("Multiple repetitions of non-repeatable element '" + theElementName + "' found during parse"); throw new DataFormatException("Multiple repetitions of non-repeatable element '" + theElementName + "' found during parse");
} }
@Override
public void containedResourceWithNoId(IParseLocation theLocation) {
throw new DataFormatException("Resource has contained child resource with no ID");
}
@Override
public void unknownReference(IParseLocation theLocation, String theReference) {
throw new DataFormatException("Resource has invalid reference: " + theReference);
}
} }

View File

@ -20,6 +20,7 @@ import static org.mockito.Mockito.verify;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -67,6 +68,64 @@ public class XmlParserDstu2Test {
} }
} }
/**
* If a contained resource refers to a contained resource that comes after it, it should still be successfully
* woven together.
*/
@Test
public void testParseWovenContainedResources() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_woven_obs.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new StrictErrorHandler());
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = parser.parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, string);
DiagnosticReport resource = (DiagnosticReport) bundle.getEntry().get(0).getResource();
Observation obs = (Observation) resource.getResult().get(1).getResource();
assertEquals("#2", obs.getId().getValue());
ResourceReferenceDt performerFirstRep = obs.getPerformer().get(0);
Practitioner performer = (Practitioner) performerFirstRep.getResource();
assertEquals("#3", performer.getId().getValue());
}
@Test(expected=DataFormatException.class)
public void testContainedResourceWithNoId() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_contained_with_no_id.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new StrictErrorHandler());
parser.parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, string);
}
@Test()
public void testContainedResourceWithNoIdLenient() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_contained_with_no_id.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new LenientErrorHandler());
parser.parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, string);
}
@Test(expected=DataFormatException.class)
public void testParseWithInvalidLocalRef() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_invalid_contained_ref.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new StrictErrorHandler());
parser.parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, string);
}
@Test()
public void testParseWithInvalidLocalRefLenient() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_invalid_contained_ref.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new LenientErrorHandler());
parser.parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, string);
}
@Test @Test
public void testBundleWithBinary() { public void testBundleWithBinary() {
//@formatter:off //@formatter:off

View File

@ -0,0 +1,77 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="fe7ff16d-8bdf-47a5-9de3-20165c6fe440" />
<meta>
<lastUpdated value="2016-08-25T12:17:12.159-04:00" />
</meta>
<type value="searchset" />
<total value="208" />
<link>
<relation value="self" />
<url value="http://foo.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport?_format=xml&amp;_include=DiagnosticReport%3Aencounter&amp;_include=Encounter%3AfacilityLocation&amp;_include=Observation%3Aperformer&amp;_include=DiagnosticReport%3Aresult&amp;_include=Encounter%3Alocation&amp;_include=Location.partOf&amp;_include=Encounter%3Aparticipant&amp;_include=DiagnosticReport%3Apatient&amp;subject%3Aidentifier=urn%3Aoid%3A2.16.840.1.113883.3.239.18.148%7C7000135" />
</link>
<entry>
<fullUrl value="http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport/7162221" />
<resource>
<DiagnosticReport xmlns="http://hl7.org/fhir">
<id value="7162221" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/diagnosticreport" />
</meta>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10017.1" />
</coding>
<text value="Date Dictated" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Fri, 26 Sep 2014" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<extension url="http://fhir.uhn.ca/Profile/diagnosticreport#source_system_status">
<valueString value="F" />
</extension>
<identifier>
<system value="urn:uhn:qcpr:order_ids" />
<value value="GI93#discharge_5677961273802d07ad7d079141525bba" />
</identifier>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.5" />
<code value="5053" />
</coding>
<text value="Unscheduled Discharge Summary" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<encounter>
<reference value="Encounter/5885735" />
</encounter>
<effectiveDateTime value="2014-09-26T11:55:00-04:00" />
<issued value="2014-09-26T11:55:33.000-04:00" />
</DiagnosticReport>
</resource>
</entry>
</Bundle>

View File

@ -0,0 +1,50 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="fe7ff16d-8bdf-47a5-9de3-20165c6fe440" />
<meta>
<lastUpdated value="2016-08-25T12:17:12.159-04:00" />
</meta>
<type value="searchset" />
<total value="208" />
<link>
<relation value="self" />
<url value="http://foo.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport?_format=xml&amp;_include=DiagnosticReport%3Aencounter&amp;_include=Encounter%3AfacilityLocation&amp;_include=Observation%3Aperformer&amp;_include=DiagnosticReport%3Aresult&amp;_include=Encounter%3Alocation&amp;_include=Location.partOf&amp;_include=Encounter%3Aparticipant&amp;_include=DiagnosticReport%3Apatient&amp;subject%3Aidentifier=urn%3Aoid%3A2.16.840.1.113883.3.239.18.148%7C7000135" />
</link>
<entry>
<fullUrl value="http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport/7162221" />
<resource>
<DiagnosticReport xmlns="http://hl7.org/fhir">
<id value="7162221" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/diagnosticreport" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/diagnosticreport#source_system_status">
<valueString value="F" />
</extension>
<identifier>
<system value="urn:uhn:qcpr:order_ids" />
<value value="GI93#discharge_5677961273802d07ad7d079141525bba" />
</identifier>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.5" />
<code value="5053" />
</coding>
<text value="Unscheduled Discharge Summary" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<encounter>
<reference value="Encounter/5885735" />
</encounter>
<effectiveDateTime value="2014-09-26T11:55:00-04:00" />
<issued value="2014-09-26T11:55:33.000-04:00" />
<result>
<reference value="#1" />
</result>
</DiagnosticReport>
</resource>
</entry>
</Bundle>

View File

@ -0,0 +1,317 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="fe7ff16d-8bdf-47a5-9de3-20165c6fe440" />
<meta>
<lastUpdated value="2016-08-25T12:17:12.159-04:00" />
</meta>
<type value="searchset" />
<total value="208" />
<link>
<relation value="self" />
<url value="http://foo.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport?_format=xml&amp;_include=DiagnosticReport%3Aencounter&amp;_include=Encounter%3AfacilityLocation&amp;_include=Observation%3Aperformer&amp;_include=DiagnosticReport%3Aresult&amp;_include=Encounter%3Alocation&amp;_include=Location.partOf&amp;_include=Encounter%3Aparticipant&amp;_include=DiagnosticReport%3Apatient&amp;subject%3Aidentifier=urn%3Aoid%3A2.16.840.1.113883.3.239.18.148%7C7000135" />
</link>
<entry>
<fullUrl value="http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport/7162221" />
<resource>
<DiagnosticReport xmlns="http://hl7.org/fhir">
<id value="7162221" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/diagnosticreport" />
</meta>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="1" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10017.1" />
</coding>
<text value="Date Dictated" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Fri, 26 Sep 2014" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="2" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="1126527.2" />
</coding>
<text value="Dictated by" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<performer>
<reference value="#3" />
</performer>
<valueString value="Gered Trystan King" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="normal" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Practitioner xmlns="http://hl7.org/fhir">
<id value="3" />
<identifier>
<system value="urn:uhn:qcpr:user_ids" />
<value value="160920" />
</identifier>
<name>
<family value="Gered Trystan King" />
</name>
</Practitioner>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="4" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="14002.3" />
</coding>
<text value="Attending/Staff" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<performer>
<reference value="#5" />
</performer>
<valueString value="Gered Trystan King" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="normal" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Practitioner xmlns="http://hl7.org/fhir">
<id value="5" />
<identifier>
<system value="urn:uhn:qcpr:user_ids" />
<value value="160920" />
</identifier>
<name>
<family value="Gered Trystan King" />
</name>
</Practitioner>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="6" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10063.4" />
</coding>
<text value="Distribute Y/N?" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="yes" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="7" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="14001.5" />
</coding>
<text value="Medical Records Report" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Medical Records Report" />
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="8" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10060.6" />
</coding>
<text value="Report Type" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Unscheduled Discharge Summary" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="9" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10064.7" />
</coding>
<text value="Review/Query?" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="no" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<extension url="http://fhir.uhn.ca/Profile/diagnosticreport#source_system_status">
<valueString value="F" />
</extension>
<identifier>
<system value="urn:uhn:qcpr:order_ids" />
<value value="GI93#discharge_5677961273802d07ad7d079141525bba" />
</identifier>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.5" />
<code value="5053" />
</coding>
<text value="Unscheduled Discharge Summary" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<encounter>
<reference value="Encounter/5885735" />
</encounter>
<effectiveDateTime value="2014-09-26T11:55:00-04:00" />
<issued value="2014-09-26T11:55:33.000-04:00" />
<result>
<reference value="#1" />
</result>
<result>
<reference value="#2" />
</result>
<result>
<reference value="#4" />
</result>
<result>
<reference value="#6" />
</result>
<result>
<reference value="#7" />
</result>
<result>
<reference value="#8" />
</result>
<result>
<reference value="#9" />
</result>
</DiagnosticReport>
</resource>
</entry>
</Bundle>

View File

@ -1,39 +0,0 @@
package ca.uhn.fhir.parser;
import org.junit.Test;
import ca.uhn.fhir.parser.ErrorHandlerAdapter;
import ca.uhn.fhir.parser.IParserErrorHandler;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
/**
* Adapter implementation with NOP implementations of all {@link IParserErrorHandler} methods.
*/
public class ErrorHandlerAdapterTest {
@Test
public void testMethods() {
new ErrorHandlerAdapter().unexpectedRepeatingElement(null, null);
new ErrorHandlerAdapter().unknownAttribute(null, null);
new ErrorHandlerAdapter().unknownElement(null, null);
}
}

View File

@ -0,0 +1,70 @@
package ca.uhn.fhir.parser;
import org.junit.Test;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class ErrorHandlerTest {
@Test
public void testAdapterMethods() {
new ErrorHandlerAdapter().unexpectedRepeatingElement(null, null);
new ErrorHandlerAdapter().unknownAttribute(null, null);
new ErrorHandlerAdapter().unknownElement(null, null);
new ErrorHandlerAdapter().containedResourceWithNoId(null);
new ErrorHandlerAdapter().unknownReference(null, null);
}
@Test
public void testLenientMethods() {
new LenientErrorHandler().unexpectedRepeatingElement(null, null);
new LenientErrorHandler().unknownAttribute(null, null);
new LenientErrorHandler().unknownElement(null, null);
new LenientErrorHandler().containedResourceWithNoId(null);
new LenientErrorHandler().unknownReference(null, null);
}
@Test(expected = DataFormatException.class)
public void testStrictMethods1() {
new StrictErrorHandler().unexpectedRepeatingElement(null, null);
}
@Test(expected = DataFormatException.class)
public void testStrictMethods2() {
new StrictErrorHandler().unknownAttribute(null, null);
}
@Test(expected = DataFormatException.class)
public void testStrictMethods3() {
new StrictErrorHandler().unknownElement(null, null);
}
@Test(expected = DataFormatException.class)
public void testStrictMethods4() {
new StrictErrorHandler().containedResourceWithNoId(null);
}
@Test(expected = DataFormatException.class)
public void testStrictMethods5() {
new StrictErrorHandler().unknownReference(null, null);
}
}

View File

@ -21,13 +21,9 @@ import static org.mockito.Mockito.verify;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.Diff;
@ -44,6 +40,7 @@ import org.hl7.fhir.dstu3.model.Bundle.BundleType;
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem; import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem;
import org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus; import org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus;
import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent; import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent;
import org.hl7.fhir.dstu3.model.Enumeration;
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender; import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus; import org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus;
import org.hl7.fhir.dstu3.model.HumanName.NameUse; import org.hl7.fhir.dstu3.model.HumanName.NameUse;
@ -51,11 +48,7 @@ import org.hl7.fhir.dstu3.model.Identifier.IdentifierUse;
import org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType; import org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType;
import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; import org.hl7.fhir.dstu3.model.Observation.ObservationStatus;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.junit.After; import org.junit.*;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -83,6 +76,63 @@ public class XmlParserDstu3Test {
ourCtx.setNarrativeGenerator(null); ourCtx.setNarrativeGenerator(null);
} }
/**
* If a contained resource refers to a contained resource that comes after it, it should still be successfully
* woven together.
*/
@Test
public void testParseWovenContainedResources() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_woven_obs.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new StrictErrorHandler());
org.hl7.fhir.dstu3.model.Bundle bundle = parser.parseResource(Bundle.class, string);
DiagnosticReport resource = (DiagnosticReport) bundle.getEntry().get(0).getResource();
Observation obs = (Observation) resource.getResult().get(1).getResource();
assertEquals("#2", obs.getId());
Reference performerFirstRep = obs.getPerformerFirstRep();
Practitioner performer = (Practitioner) performerFirstRep.getResource();
assertEquals("#3", performer.getId());
}
@Test(expected=DataFormatException.class)
public void testContainedResourceWithNoId() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_contained_with_no_id.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new StrictErrorHandler());
parser.parseResource(Bundle.class, string);
}
@Test()
public void testContainedResourceWithNoIdLenient() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_contained_with_no_id.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new LenientErrorHandler());
parser.parseResource(Bundle.class, string);
}
@Test(expected=DataFormatException.class)
public void testParseWithInvalidLocalRef() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_invalid_contained_ref.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new StrictErrorHandler());
parser.parseResource(Bundle.class, string);
}
@Test()
public void testParseWithInvalidLocalRefLenient() throws IOException {
String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_invalid_contained_ref.xml"), StandardCharsets.UTF_8);
IParser parser = ourCtx.newXmlParser();
parser.setParserErrorHandler(new LenientErrorHandler());
parser.parseResource(Bundle.class, string);
}
@Test @Test
public void testBundleWithBinary() { public void testBundleWithBinary() {
//@formatter:off //@formatter:off

View File

@ -0,0 +1,77 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="fe7ff16d-8bdf-47a5-9de3-20165c6fe440" />
<meta>
<lastUpdated value="2016-08-25T12:17:12.159-04:00" />
</meta>
<type value="searchset" />
<total value="208" />
<link>
<relation value="self" />
<url value="http://foo.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport?_format=xml&amp;_include=DiagnosticReport%3Aencounter&amp;_include=Encounter%3AfacilityLocation&amp;_include=Observation%3Aperformer&amp;_include=DiagnosticReport%3Aresult&amp;_include=Encounter%3Alocation&amp;_include=Location.partOf&amp;_include=Encounter%3Aparticipant&amp;_include=DiagnosticReport%3Apatient&amp;subject%3Aidentifier=urn%3Aoid%3A2.16.840.1.113883.3.239.18.148%7C7000135" />
</link>
<entry>
<fullUrl value="http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport/7162221" />
<resource>
<DiagnosticReport xmlns="http://hl7.org/fhir">
<id value="7162221" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/diagnosticreport" />
</meta>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10017.1" />
</coding>
<text value="Date Dictated" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Fri, 26 Sep 2014" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<extension url="http://fhir.uhn.ca/Profile/diagnosticreport#source_system_status">
<valueString value="F" />
</extension>
<identifier>
<system value="urn:uhn:qcpr:order_ids" />
<value value="GI93#discharge_5677961273802d07ad7d079141525bba" />
</identifier>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.5" />
<code value="5053" />
</coding>
<text value="Unscheduled Discharge Summary" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<encounter>
<reference value="Encounter/5885735" />
</encounter>
<effectiveDateTime value="2014-09-26T11:55:00-04:00" />
<issued value="2014-09-26T11:55:33.000-04:00" />
</DiagnosticReport>
</resource>
</entry>
</Bundle>

View File

@ -0,0 +1,50 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="fe7ff16d-8bdf-47a5-9de3-20165c6fe440" />
<meta>
<lastUpdated value="2016-08-25T12:17:12.159-04:00" />
</meta>
<type value="searchset" />
<total value="208" />
<link>
<relation value="self" />
<url value="http://foo.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport?_format=xml&amp;_include=DiagnosticReport%3Aencounter&amp;_include=Encounter%3AfacilityLocation&amp;_include=Observation%3Aperformer&amp;_include=DiagnosticReport%3Aresult&amp;_include=Encounter%3Alocation&amp;_include=Location.partOf&amp;_include=Encounter%3Aparticipant&amp;_include=DiagnosticReport%3Apatient&amp;subject%3Aidentifier=urn%3Aoid%3A2.16.840.1.113883.3.239.18.148%7C7000135" />
</link>
<entry>
<fullUrl value="http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport/7162221" />
<resource>
<DiagnosticReport xmlns="http://hl7.org/fhir">
<id value="7162221" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/diagnosticreport" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/diagnosticreport#source_system_status">
<valueString value="F" />
</extension>
<identifier>
<system value="urn:uhn:qcpr:order_ids" />
<value value="GI93#discharge_5677961273802d07ad7d079141525bba" />
</identifier>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.5" />
<code value="5053" />
</coding>
<text value="Unscheduled Discharge Summary" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<encounter>
<reference value="Encounter/5885735" />
</encounter>
<effectiveDateTime value="2014-09-26T11:55:00-04:00" />
<issued value="2014-09-26T11:55:33.000-04:00" />
<result>
<reference value="#1" />
</result>
</DiagnosticReport>
</resource>
</entry>
</Bundle>

View File

@ -0,0 +1,317 @@
<Bundle xmlns="http://hl7.org/fhir">
<id value="fe7ff16d-8bdf-47a5-9de3-20165c6fe440" />
<meta>
<lastUpdated value="2016-08-25T12:17:12.159-04:00" />
</meta>
<type value="searchset" />
<total value="208" />
<link>
<relation value="self" />
<url value="http://foo.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport?_format=xml&amp;_include=DiagnosticReport%3Aencounter&amp;_include=Encounter%3AfacilityLocation&amp;_include=Observation%3Aperformer&amp;_include=DiagnosticReport%3Aresult&amp;_include=Encounter%3Alocation&amp;_include=Location.partOf&amp;_include=Encounter%3Aparticipant&amp;_include=DiagnosticReport%3Apatient&amp;subject%3Aidentifier=urn%3Aoid%3A2.16.840.1.113883.3.239.18.148%7C7000135" />
</link>
<entry>
<fullUrl value="http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-2.1/DiagnosticReport/7162221" />
<resource>
<DiagnosticReport xmlns="http://hl7.org/fhir">
<id value="7162221" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/diagnosticreport" />
</meta>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="1" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10017.1" />
</coding>
<text value="Date Dictated" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Fri, 26 Sep 2014" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="2" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="1126527.2" />
</coding>
<text value="Dictated by" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<performer>
<reference value="#3" />
</performer>
<valueString value="Gered Trystan King" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="normal" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Practitioner xmlns="http://hl7.org/fhir">
<id value="3" />
<identifier>
<system value="urn:uhn:qcpr:user_ids" />
<value value="160920" />
</identifier>
<name>
<family value="Gered Trystan King" />
</name>
</Practitioner>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="4" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="14002.3" />
</coding>
<text value="Attending/Staff" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<performer>
<reference value="#5" />
</performer>
<valueString value="Gered Trystan King" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="normal" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Practitioner xmlns="http://hl7.org/fhir">
<id value="5" />
<identifier>
<system value="urn:uhn:qcpr:user_ids" />
<value value="160920" />
</identifier>
<name>
<family value="Gered Trystan King" />
</name>
</Practitioner>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="6" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10063.4" />
</coding>
<text value="Distribute Y/N?" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="yes" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="7" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="14001.5" />
</coding>
<text value="Medical Records Report" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Medical Records Report" />
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="8" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10060.6" />
</coding>
<text value="Report Type" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="Unscheduled Discharge Summary" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<contained>
<Observation xmlns="http://hl7.org/fhir">
<id value="9" />
<meta>
<lastUpdated value="2014-09-26T11:55:33.000-04:00" />
<profile value="http://fhir.uhn.ca/Profile/observation" />
</meta>
<extension url="http://fhir.uhn.ca/Profile/observation#source_system_status">
<valueString value="F" />
</extension>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.6" />
<code value="10064.7" />
</coding>
<text value="Review/Query?" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<issued value="2014-09-26T11:55:33.000-04:00" />
<valueString value="no" />
<interpretation>
<coding>
<system value="urn:uhn:qcpr:interpretation_codes" />
<code value="N" />
</coding>
</interpretation>
</Observation>
</contained>
<extension url="http://fhir.uhn.ca/Profile/diagnosticreport#source_system_status">
<valueString value="F" />
</extension>
<identifier>
<system value="urn:uhn:qcpr:order_ids" />
<value value="GI93#discharge_5677961273802d07ad7d079141525bba" />
</identifier>
<status value="final" />
<code>
<coding>
<system value="urn:oid:1.3.6.1.4.1.12201.102.5" />
<code value="5053" />
</coding>
<text value="Unscheduled Discharge Summary" />
</code>
<subject>
<reference value="Patient/5556918" />
</subject>
<encounter>
<reference value="Encounter/5885735" />
</encounter>
<effectiveDateTime value="2014-09-26T11:55:00-04:00" />
<issued value="2014-09-26T11:55:33.000-04:00" />
<result>
<reference value="#1" />
</result>
<result>
<reference value="#2" />
</result>
<result>
<reference value="#4" />
</result>
<result>
<reference value="#6" />
</result>
<result>
<reference value="#7" />
</result>
<result>
<reference value="#8" />
</result>
<result>
<reference value="#9" />
</result>
</DiagnosticReport>
</resource>
</entry>
</Bundle>

View File

@ -197,6 +197,15 @@
Fix NullPointerException when encoding an extension containing CodeableConcept Fix NullPointerException when encoding an extension containing CodeableConcept
with log level set to TRACE. Thanks to Bill Denton for the report! with log level set to TRACE. Thanks to Bill Denton for the report!
</action> </action>
<action type="add">
Add two new methods to the parser error handler that let users trap
invalid contained resources with no ID, as well as references to contained
resource that do not exist.
</action>
<action type="add">
Improve performance when parsing resources containing contained resources
by eliminating a step where references were woven twice
</action>
<action type="fix" issue="426"> <action type="fix" issue="426">
Parser failed to parse resources containing an extension with a value type of Parser failed to parse resources containing an extension with a value type of
"id". Thanks to Raphael Mäder for reporting! "id". Thanks to Raphael Mäder for reporting!