Fix problem with link resolution within Bundles - and add test case that checks it. (Also update Synthea test case to reflect new status codes for Encounter.)

This commit is contained in:
Lloyd McKenzie 2019-07-30 23:23:48 -06:00
parent 6c4620996f
commit 7c1786279f
4 changed files with 53 additions and 3 deletions

View File

@ -2527,14 +2527,15 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
String u = null;
if (fullUrl != null && fullUrl.endsWith(type+"/"+id))
// fullUrl = complex
u = fullUrl.substring((type+"/"+id).length())+ref;
u = fullUrl.substring(0, fullUrl.length() - (type+"/"+id).length())+ref;
// u = fullUrl.substring((type+"/"+id).length())+ref;
String[] parts = ref.split("\\/");
if (parts.length >= 2) {
String t = parts[0];
String i = parts[1];
for (Element entry : entries) {
String fu = entry.getNamedChildValue("fullUrl");
if (u != null && fullUrl.equals(u))
if (u != null && fu.equals(u))
return entry;
if (u == null) {
Element resource = entry.getNamedChild("resource");

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bundle xmlns="http://hl7.org/fhir">
<id value="bundle-local-refs"/>
<meta>
<lastUpdated value="2019-07-21T11:01:00+05:00"/>
</meta>
<identifier>
<system value="http://example.org/documentIDs"/>
<value value="A12345"/>
</identifier>
<type value="document"/>
<timestamp value="2019-07-21T11:01:00+05:00"/>
<entry>
<fullUrl value="http://example.org/fhir/Composition/1"/>
<resource>
<Composition>
<id value="1"/>
<status value="final"/>
<type>
<text value="foo"/>
</type>
<subject>
<reference value="Patient/1"/>
</subject>
<date value="2019-07-21T23:09:00+07:00"/>
<author>
<display value="foo"/>
</author>
<title value="Example with local references"/>
</Composition>
</resource>
</entry>
<entry>
<fullUrl value="http://example.org/fhir/Patient/1"/>
<resource>
<Patient>
<id value="1"/>
<name>
<family value="SMITH"/>
<given value="JOE"/>
</name>
</Patient>
</resource>
</entry>
</Bundle>

View File

@ -790,6 +790,10 @@
"source": "azatadha/param-profile.xml",
"errorCount": 0
}
},
"bundle-local-refs.xml" : {
"errorCount": 0,
"warningCount": 0
}
}
}

View File

@ -17,7 +17,7 @@
"value": "v6751"
}
],
"status": "finished",
"status": "completed",
"subject": {
"reference": "Patient/f001",
"display": "P. van de Heuvel"