more testing of FHIRPath reference resolution
This commit is contained in:
parent
54e672394b
commit
6fe8c492d3
|
@ -257,10 +257,16 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (res != null)
|
||||
return res;
|
||||
|
||||
if (externalHostServices == null)
|
||||
throw new Error("Not done yet - resolve "+url+" locally (2)");
|
||||
else
|
||||
if (externalHostServices != null)
|
||||
return externalHostServices.resolveReference(c.appContext, url);
|
||||
else if (fetcher != null)
|
||||
try {
|
||||
return fetcher.fetch(c.appContext, url);
|
||||
} catch (IOException e) {
|
||||
throw new FHIRException(e);
|
||||
}
|
||||
else
|
||||
throw new Error("Not done yet - resolve "+url+" locally (2)");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.validation.tests;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
@ -20,6 +21,7 @@ import org.hl7.fhir.convertors.VersionConvertor_14_50;
|
|||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_50;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
|
@ -300,6 +302,11 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
|
|||
public Element fetch(Object appContext, String url) throws FHIRFormatError, DefinitionException, IOException, FHIRException {
|
||||
if (url.equals("Patient/test"))
|
||||
return new ObjectConverter(TestingUtilities.context()).convert(new Patient());
|
||||
String filename = TestingUtilities.resourceNameToFile("validation-examples", url.replace("/", "-"));
|
||||
if (new File(filename+".json").exists())
|
||||
return Manager.makeParser(TestingUtilities.context(), FhirFormat.JSON).parse(new FileInputStream(filename+".json"));
|
||||
if (new File(filename+".xml").exists())
|
||||
return Manager.makeParser(TestingUtilities.context(), FhirFormat.XML).parse(new FileInputStream(filename+".xml"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"resourceType": "CareTeam",
|
||||
"participant": [
|
||||
{
|
||||
"member": {
|
||||
"reference": "Practitioner/notprac"
|
||||
},
|
||||
|
||||
"onBehalfOf": {
|
||||
"reference": "Organization/2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"resourceType": "CareTeam",
|
||||
"participant": [
|
||||
{
|
||||
"member": {
|
||||
"reference": "Practitioner/1"
|
||||
},
|
||||
|
||||
"onBehalfOf": {
|
||||
"reference": "Organization/2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"resourceType": "CareTeam",
|
||||
"participant": [
|
||||
{
|
||||
"member": {
|
||||
"reference": "Practitioner/x"
|
||||
},
|
||||
|
||||
"onBehalfOf": {
|
||||
"reference": "Organization/2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -185,6 +185,15 @@
|
|||
"errorCount": 1,
|
||||
"errors-for-debugging" : ["ERROR: Medication.extension[2].valueCodeableConcept.coding: The code \"N02AA\" is not valid in the system http://www.whocc.no/atc; The code provided (http://www.whocc.no/atc#N02AA) is not valid in the value set All codes known to the system"],
|
||||
"allowed-extension-domain": "https://api-v8-r4.hspconsortium.org/DrugFormulary0/open"
|
||||
},
|
||||
"fhirpath-good.json": {
|
||||
"errorCount": 0
|
||||
},
|
||||
"fhirpath-bad.json": {
|
||||
"errorCount": 1
|
||||
},
|
||||
"fhirpath-null.json": {
|
||||
"errorCount": 1
|
||||
},
|
||||
"qr-ex.json": {
|
||||
"questionnaire": "q-ex.json",
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"resourceType": "Practitioner",
|
||||
"id": "1",
|
||||
"identifier": [
|
||||
{
|
||||
"system": "http://www.acme.org/practitioners",
|
||||
"value": "23"
|
||||
}
|
||||
],
|
||||
"active": true,
|
||||
"name": [
|
||||
{
|
||||
"family": "Careful",
|
||||
"given": [
|
||||
"Adam"
|
||||
],
|
||||
"prefix": [
|
||||
"Dr"
|
||||
]
|
||||
}
|
||||
],
|
||||
"address": [
|
||||
{
|
||||
"use": "home",
|
||||
"line": [
|
||||
"534 Erewhon St"
|
||||
],
|
||||
"city": "PleasantVille",
|
||||
"state": "Vic",
|
||||
"postalCode": "3999"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
"resourceType": "Patient",
|
||||
"id": "notprac",
|
||||
"identifier": [
|
||||
{
|
||||
"use": "usual",
|
||||
"type": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
|
||||
"code": "MR"
|
||||
}
|
||||
]
|
||||
},
|
||||
"system": "urn:oid:1.2.36.146.595.217.0.1",
|
||||
"value": "12345",
|
||||
"period": {
|
||||
"start": "2001-05-06"
|
||||
},
|
||||
"assigner": {
|
||||
"display": "Acme Healthcare"
|
||||
}
|
||||
}
|
||||
],
|
||||
"active": true,
|
||||
"name": [
|
||||
{
|
||||
"use": "official",
|
||||
"family": "Chalmers",
|
||||
"given": [
|
||||
"Peter",
|
||||
"James"
|
||||
]
|
||||
},
|
||||
{
|
||||
"use": "usual",
|
||||
"given": [
|
||||
"Jim"
|
||||
]
|
||||
},
|
||||
{
|
||||
"use": "maiden",
|
||||
"family": "Windsor",
|
||||
"given": [
|
||||
"Peter",
|
||||
"James"
|
||||
],
|
||||
"period": {
|
||||
"end": "2002"
|
||||
}
|
||||
}
|
||||
],
|
||||
"telecom": [
|
||||
{
|
||||
"use": "home"
|
||||
},
|
||||
{
|
||||
"system": "phone",
|
||||
"value": "(03) 5555 6473",
|
||||
"use": "work",
|
||||
"rank": 1
|
||||
},
|
||||
{
|
||||
"system": "phone",
|
||||
"value": "(03) 3410 5613",
|
||||
"use": "mobile",
|
||||
"rank": 2
|
||||
},
|
||||
{
|
||||
"system": "phone",
|
||||
"value": "(03) 5555 8834",
|
||||
"use": "old",
|
||||
"period": {
|
||||
"end": "2014"
|
||||
}
|
||||
}
|
||||
],
|
||||
"gender": "male",
|
||||
"birthDate": "1974-12-25",
|
||||
"_birthDate": {
|
||||
"extension": [
|
||||
{
|
||||
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
|
||||
"valueDateTime": "1974-12-25T14:35:45-05:00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"deceasedBoolean": false,
|
||||
"address": [
|
||||
{
|
||||
"use": "home",
|
||||
"type": "both",
|
||||
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
|
||||
"line": [
|
||||
"534 Erewhon St"
|
||||
],
|
||||
"city": "PleasantVille",
|
||||
"district": "Rainbow",
|
||||
"state": "Vic",
|
||||
"postalCode": "3999",
|
||||
"period": {
|
||||
"start": "1974-12-25"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue