r4b snapshot tests

This commit is contained in:
Grahame Grieve 2022-09-07 21:56:24 +10:00
parent d14224e987
commit 7dd2f3edf6
5 changed files with 288 additions and 11 deletions

View File

@ -219,20 +219,20 @@ public class SnapShotGenerationTests {
}
public void load() throws FHIRFormatError, FileNotFoundException, IOException {
if (TestingUtilities.findTestResource("r5", "snapshot-generation", id + "-input.json"))
source = (StructureDefinition) new JsonParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", id + "-input.json"));
if (TestingUtilities.findTestResource("r4b", "snapshot-generation", id + "-input.json"))
source = (StructureDefinition) new JsonParser().parse(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", id + "-input.json"));
else
source = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", id + "-input.xml"));
source = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", id + "-input.xml"));
if (!fail)
expected = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", id + "-expected.xml"));
expected = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", id + "-expected.xml"));
if (!Utilities.noString(include))
included.add((StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", include + ".xml")));
included.add((StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", include + ".xml")));
if (!Utilities.noString(register)) {
for (String s : register.split("\\,")) {
if (TestingUtilities.findTestResource("r5", "snapshot-generation", s + ".xml")) {
included.add((StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", s + ".xml")));
if (TestingUtilities.findTestResource("r4b", "snapshot-generation", s + ".xml")) {
included.add((StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", s + ".xml")));
} else {
included.add((StructureDefinition) new JsonParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", s + ".json")));
included.add((StructureDefinition) new JsonParser().parse(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", s + ".json")));
}
}
}
@ -449,7 +449,7 @@ public class SnapShotGenerationTests {
public static Stream<Arguments> data() throws ParserConfigurationException, IOException, FHIRFormatError, SAXException {
SnapShotGenerationTestsContext context = new SnapShotGenerationTestsContext();
Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r5", "snapshot-generation", "manifest.xml"));
Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r4b", "snapshot-generation", "manifest.xml"));
Element test = XMLUtil.getFirstChild(tests.getDocumentElement());
List<Arguments> objects = new ArrayList<>();
while (test != null && test.getNodeName().equals("test")) {
@ -512,7 +512,7 @@ public class SnapShotGenerationTests {
pu.sortDifferential(base, test.getOutput(), test.getOutput().getUrl(), errors, false);
if (!errors.isEmpty())
throw new FHIRException(errors.get(0));
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId() + "-expected.xml")));
IOUtils.copy(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId() + "-expected.xml")));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId() + "-actual.xml")), test.getOutput());
Assertions.assertTrue(test.expected.equalsDeep(test.output), "Output does not match expected");
}
@ -594,7 +594,7 @@ public class SnapShotGenerationTests {
File dst = new File(TestingUtilities.tempFile("snapshot", test.getId() + "-expected.xml"));
if (dst.exists())
dst.delete();
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(dst));
IOUtils.copy(TestingUtilities.loadTestResourceStream("r4b", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(dst));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId() + "-actual.xml")), output);
StructureDefinition t1 = test.expected.copy();
t1.setText(null);

View File

@ -17,3 +17,8 @@ e: {
"error" : "java.lang.NullPointerException"
}
-------------------------------------------------------------------------------------
{"hierarchical" : false, "url": "http://hl7.org/fhir/ValueSet/currencies", "version": "4.6.0"}####
e: {
"error" : "java.lang.NullPointerException"
}
-------------------------------------------------------------------------------------

View File

@ -17,3 +17,8 @@ e: {
"error" : "java.lang.NullPointerException"
}
-------------------------------------------------------------------------------------
{"hierarchical" : false, "url": "http://hl7.org/fhir/ValueSet/mimetypes", "version": "4.6.0"}####
e: {
"error" : "java.lang.NullPointerException"
}
-------------------------------------------------------------------------------------

View File

@ -101,3 +101,105 @@ e: {
"error" : "java.lang.NullPointerException"
}
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "http://unitsofmeasure.org",
"concept" : [{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "second"
}],
"code" : "s",
"display" : "second",
"designation" : [{
"language" : "zh",
"value" : "秒"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "minute"
}],
"code" : "min",
"display" : "minute",
"designation" : [{
"language" : "zh",
"value" : "分钟"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "hour"
}],
"code" : "h",
"display" : "hour",
"designation" : [{
"language" : "zh",
"value" : "小时"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "day"
}],
"code" : "d",
"display" : "day",
"designation" : [{
"language" : "zh",
"value" : "天"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "week"
}],
"code" : "wk",
"display" : "week",
"designation" : [{
"language" : "zh",
"value" : "星期"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "month - Normal practice is to use the 'mo' code as a calendar month when calculating the next occurrence."
}],
"code" : "mo",
"display" : "month",
"designation" : [{
"language" : "zh",
"value" : "月"
}]
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition",
"valueString" : "year"
}],
"code" : "a",
"display" : "year",
"designation" : [{
"language" : "zh",
"value" : "年"
}]
}]
}]
}
}}####
e: {
"error" : "java.lang.NullPointerException"
}
-------------------------------------------------------------------------------------
{"hierarchical" : false, "url": "http://hl7.org/fhir/ValueSet/units-of-time", "version": "4.6.0"}####
e: {
"error" : "java.lang.NullPointerException"
}
-------------------------------------------------------------------------------------

View File

@ -103,3 +103,168 @@ v: {
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"
}
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"concept" : [{
"code" : "A"
},
{
"code" : "AA"
},
{
"code" : "L"
},
{
"code" : "H"
}]
}]
}
}}####
e: {
"valueSet" : {
"resourceType" : "ValueSet",
"language" : "en",
"status" : "active",
"expansion" : {
"identifier" : "urn:uuid:b52e8b2a-2ec9-4912-b3cd-8e554ba1b242",
"timestamp" : "2022-09-07T11:46:46.676Z",
"parameter" : [{
"name" : "limitedExpansion",
"valueBoolean" : true
},
{
"name" : "excludeNested",
"valueBoolean" : true
},
{
"name" : "version",
"valueUri" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation|2018-08-12"
}],
"contains" : [{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result or observation value is outside the reference range or expected norm (as defined for the respective test procedure).\r\n\n [Note: Typically applies to non-numeric results.]"
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "A",
"display" : "Abnormal"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result or observation value is outside a reference range or expected norm at a level at which immediate action should be considered for patient safety (as defined for the respective test procedure).\r\n\n [Note: Typically applies to non-numeric results. Analogous to critical/panic limits for numeric results.]"
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "AA",
"display" : "Critical abnormal"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result for a quantitative observation is below the lower limit of the reference range (as defined for the respective test procedure).\r\n\n Synonym: Below low normal"
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "L",
"display" : "Low"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result for a quantitative observation is above the upper limit of the reference range (as defined for the respective test procedure).\r\n\n Synonym: Above high normal"
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "H",
"display" : "High"
}]
}
},
"error" : ""
}
-------------------------------------------------------------------------------------
{"hierarchical" : false, "valueSet" :{
"resourceType" : "ValueSet",
"compose" : {
"inactive" : true,
"include" : [{
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"concept" : [{
"code" : "LL"
},
{
"code" : "HH"
},
{
"code" : "L",
"display" : "Extra Low"
},
{
"code" : "H"
}]
}]
}
}}####
e: {
"valueSet" : {
"resourceType" : "ValueSet",
"language" : "en",
"status" : "active",
"expansion" : {
"identifier" : "urn:uuid:6cabd13c-4765-46d1-9ebb-43e87fc0a036",
"timestamp" : "2022-09-07T11:46:47.286Z",
"parameter" : [{
"name" : "limitedExpansion",
"valueBoolean" : true
},
{
"name" : "excludeNested",
"valueBoolean" : true
},
{
"name" : "version",
"valueUri" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation|2018-08-12"
}],
"contains" : [{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result for a quantitative observation is below a reference level at which immediate action should be considered for patient safety (as defined for the respective test procedure).\r\n\n Synonym: Below lower panic limits."
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "LL",
"display" : "Critical low"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result for a quantitative observation is above a reference level at which immediate action should be considered for patient safety (as defined for the respective test procedure).\r\n\n Synonym: Above upper panic limits."
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "HH",
"display" : "Critical high"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result for a quantitative observation is below the lower limit of the reference range (as defined for the respective test procedure).\r\n\n Synonym: Below low normal"
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "L",
"display" : "Extra Low"
},
{
"extension" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-definition",
"valueString" : "The result for a quantitative observation is above the upper limit of the reference range (as defined for the respective test procedure).\r\n\n Synonym: Above high normal"
}],
"system" : "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code" : "H",
"display" : "High"
}]
}
},
"error" : ""
}
-------------------------------------------------------------------------------------