Merge pull request #66 from lmckenzi/master

Fix problem with link resolution within Bundles
This commit is contained in:
Grahame Grieve 2019-07-31 16:04:34 +10:00 committed by GitHub
commit 47ee89301f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 4 deletions

View File

@ -2524,14 +2524,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

@ -827,7 +827,11 @@
"source": "profile-slicing-profile-open.xml",
"errorCount": 1
}
}
},
"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"