add tests for allergy intolerance conversion
This commit is contained in:
parent
05994163dd
commit
b93cb71032
|
@ -1,4 +1,43 @@
|
|||
package org.hl7.fhir.convertors.conv10_30;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_30;
|
||||
import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class AllergyIntolerance10_30Test {
|
||||
private static Stream<Arguments> filesPaths() {
|
||||
return Stream.of(
|
||||
Arguments.of("/0_allergy_intolerance_10.json", "/0_allergy_intolerance_30.json"),
|
||||
Arguments.of("/1_allergy_intolerance_10.json", "/1_allergy_intolerance_30.json")
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("filesPaths")
|
||||
@DisplayName("Test 10_30 AllergyIntolerance conversion")
|
||||
public void testMedicationRequestConversion(String dstu2_path, String stu_path) throws IOException {
|
||||
InputStream dstu2_input = this.getClass().getResourceAsStream(dstu2_path);
|
||||
InputStream stu_exepected_input = this.getClass().getResourceAsStream(stu_path);
|
||||
|
||||
org.hl7.fhir.dstu2.model.AllergyIntolerance dstu2 = (org.hl7.fhir.dstu2.model.AllergyIntolerance) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
|
||||
VersionConvertorAdvisor30 advisor = new R2ToR3Loader();
|
||||
org.hl7.fhir.dstu3.model.Resource stu_actual = VersionConvertor_10_30.convertResource(dstu2, advisor);
|
||||
|
||||
org.hl7.fhir.dstu3.formats.JsonParser stu_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
|
||||
org.hl7.fhir.dstu3.model.Resource stu_expected = stu_parser.parse(stu_exepected_input);
|
||||
|
||||
Assertions.assertTrue(stu_expected.equalsDeep(stu_actual),
|
||||
"Failed comparing\n" + stu_parser.composeString(stu_actual) + "\nand\n" + stu_parser.composeString(stu_expected)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.hl7.fhir.convertors.conv10_40;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class AllergyIntolerance10_40Test {
|
||||
private static Stream<Arguments> filesPaths() {
|
||||
return Stream.of(
|
||||
Arguments.of("/0_allergy_intolerance_10.json", "/0_allergy_intolerance_40.json"),
|
||||
Arguments.of("/1_allergy_intolerance_10.json", "/1_allergy_intolerance_40.json")
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("filesPaths")
|
||||
@DisplayName("Test 10_40 AllergyIntolerance conversion")
|
||||
public void testMedicationRequestConversion(String dstu2_path, String r4_path) throws IOException {
|
||||
InputStream dstu2_input = this.getClass().getResourceAsStream(dstu2_path);
|
||||
InputStream r4_exepected_input = this.getClass().getResourceAsStream(r4_path);
|
||||
|
||||
org.hl7.fhir.dstu2.model.AllergyIntolerance dstu2 = (org.hl7.fhir.dstu2.model.AllergyIntolerance) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
|
||||
VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor();
|
||||
org.hl7.fhir.r4.model.Resource r4_actual = VersionConvertor_10_40.convertResource(dstu2, advisor);
|
||||
|
||||
org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser();
|
||||
org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_exepected_input);
|
||||
|
||||
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual),
|
||||
"Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{"resourceType": "AllergyIntolerance",
|
||||
"recordedDate": "2015-08-25T02:11:36",
|
||||
"status": "confirmed",
|
||||
"criticality": "CRITL",
|
||||
"id": "TBwnNbrAqC0Qw5Ha7AFT-2AB",
|
||||
"onset": "2012-11-07T00:00:00Z",
|
||||
"recorder": {"display": "MOORE, NICK",
|
||||
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"},
|
||||
"patient": {"display": "Jason Argonaut",
|
||||
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"},
|
||||
"substance": {"text": "PENICILLIN G",
|
||||
"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||
"code": "7980",
|
||||
"display": "PENICILLIN G"},
|
||||
{"system": "http://fdasis.nlm.nih.gov",
|
||||
"code": "Q42T66VG0C",
|
||||
"display": "PENICILLIN G"}]},
|
||||
"reaction": [{"certainty": "confirmed",
|
||||
"onset": "2012-11-07T00:00:00Z",
|
||||
"manifestation": [{"text": "Hives"}]}]}
|
|
@ -0,0 +1,22 @@
|
|||
{"resourceType": "AllergyIntolerance",
|
||||
"id": "TBwnNbrAqC0Qw5Ha7AFT-2AB",
|
||||
"clinicalStatus": "active",
|
||||
"verificationStatus": "confirmed",
|
||||
"criticality": "low",
|
||||
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||
"code": "7980",
|
||||
"display": "PENICILLIN G"},
|
||||
{"system": "http://fdasis.nlm.nih.gov",
|
||||
"code": "Q42T66VG0C",
|
||||
"display": "PENICILLIN G"}],
|
||||
"text": "PENICILLIN G"},
|
||||
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||
"display": "Jason Argonaut"},
|
||||
"onsetDateTime": "2012-11-07T00:00:00",
|
||||
"assertedDate": "2015-08-25T02:11:36",
|
||||
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||
"display": "MOORE, NICK"},
|
||||
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||
"valueString": "confirmed"}],
|
||||
"manifestation": [{"text": "Hives"}],
|
||||
"onset": "2012-11-07T00:00:00"}]}
|
|
@ -0,0 +1,23 @@
|
|||
{"resourceType": "AllergyIntolerance",
|
||||
"clinicalStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
|
||||
"code": "confirmed"}]},
|
||||
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
|
||||
"code": "confirmed"}]},
|
||||
"criticality": "low",
|
||||
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||
"code": "7980",
|
||||
"display": "PENICILLIN G"},
|
||||
{"system": "http://fdasis.nlm.nih.gov",
|
||||
"code": "Q42T66VG0C",
|
||||
"display": "PENICILLIN G"}],
|
||||
"text": "PENICILLIN G"},
|
||||
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||
"display": "Jason Argonaut"},
|
||||
"onsetDateTime": "2012-11-07T00:00:00Z",
|
||||
"recordedDate": "2015-08-25T02:11:36",
|
||||
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||
"display": "MOORE, NICK"},
|
||||
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||
"valueString": "confirmed"}],
|
||||
"manifestation": [{"text": "Hives"}],
|
||||
"onset": "2012-11-07T00:00:00"}]}
|
|
@ -0,0 +1,20 @@
|
|||
{"resourceType": "AllergyIntolerance",
|
||||
"recordedDate": "2015-11-07T22:56:34",
|
||||
"status": "confirmed",
|
||||
"criticality": "CRITH",
|
||||
"id": "TKebKfLXzu6Sp.LY-IpvpmQB",
|
||||
"onset": "2014-03-07T00:00:00Z",
|
||||
"recorder": {"display": "MOORE, NICK",
|
||||
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"},
|
||||
"patient": {"display": "Jason Argonaut",
|
||||
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"},
|
||||
"substance": {"text": "STRAWBERRY",
|
||||
"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||
"code": "892484",
|
||||
"display": "STRAWBERRY"},
|
||||
{"system": "http://fdasis.nlm.nih.gov",
|
||||
"code": "4J2TY8Y81V",
|
||||
"display": "STRAWBERRY"}]},
|
||||
"reaction": [{"certainty": "confirmed",
|
||||
"onset": "2014-03-07T00:00:00Z",
|
||||
"manifestation": [{"text": "Anaphylaxis"}]}]}
|
|
@ -0,0 +1,22 @@
|
|||
{"resourceType": "AllergyIntolerance",
|
||||
"id": "TKebKfLXzu6Sp.LY-IpvpmQB",
|
||||
"clinicalStatus": "active",
|
||||
"verificationStatus": "confirmed",
|
||||
"criticality": "high",
|
||||
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||
"code": "892484",
|
||||
"display": "STRAWBERRY"},
|
||||
{"system": "http://fdasis.nlm.nih.gov",
|
||||
"code": "4J2TY8Y81V",
|
||||
"display": "STRAWBERRY"}],
|
||||
"text": "STRAWBERRY"},
|
||||
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||
"display": "Jason Argonaut"},
|
||||
"onsetDateTime": "2014-03-07T00:00:00",
|
||||
"assertedDate": "2015-11-07T22:56:34",
|
||||
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||
"display": "MOORE, NICK"},
|
||||
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||
"valueString": "confirmed"}],
|
||||
"manifestation": [{"text": "Anaphylaxis"}],
|
||||
"onset": "2014-03-07T00:00:00"}]}
|
|
@ -0,0 +1,23 @@
|
|||
{"resourceType": "AllergyIntolerance",
|
||||
"clinicalStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
|
||||
"code": "confirmed"}]},
|
||||
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
|
||||
"code": "confirmed"}]},
|
||||
"criticality": "high",
|
||||
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||
"code": "892484",
|
||||
"display": "STRAWBERRY"},
|
||||
{"system": "http://fdasis.nlm.nih.gov",
|
||||
"code": "4J2TY8Y81V",
|
||||
"display": "STRAWBERRY"}],
|
||||
"text": "STRAWBERRY"},
|
||||
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||
"display": "Jason Argonaut"},
|
||||
"onsetDateTime": "2014-03-07T00:00:00Z",
|
||||
"recordedDate": "2015-11-07T22:56:34",
|
||||
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||
"display": "MOORE, NICK"},
|
||||
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||
"valueString": "confirmed"}],
|
||||
"manifestation": [{"text": "Anaphylaxis"}],
|
||||
"onset": "2014-03-07T00:00:00"}]}
|
Loading…
Reference in New Issue