Merge pull request #467 from ItayGoren/medication_request_default_status_conversion

add default status value to medication request conversion 10_40
This commit is contained in:
Grahame Grieve 2021-03-29 08:54:08 +10:00 committed by GitHub
commit 5833ef8748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 93 additions and 4 deletions

View File

@ -1 +1,2 @@
* minor fixes in code generators for R4B
* add default value to Medication Request during conversion from dstu2 to r4

View File

@ -18,6 +18,8 @@ public class MedicationRequest10_40 {
tgt.setAuthoredOnElement(VersionConvertor_10_40.convertDateTime(src.getDateWrittenElement()));
if (src.hasStatus())
tgt.setStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.fromCode(src.getStatus().toCode()));
else
tgt.setStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.UNKNOWN);
if (src.hasPatient())
tgt.setSubject(VersionConvertor_10_40.convertReference(src.getPatient()));
if (src.hasPrescriber())

View File

@ -6,16 +6,28 @@ 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 MedicationRequest10_40Test {
@Test
private static Stream<Arguments> filesPaths() {
return Stream.of(
Arguments.of("/0_medication_request_10.json", "/0_medication_request_40.json"),
Arguments.of("/1_medication_request_10.json", "/1_medication_request_40.json")
);
}
@ParameterizedTest
@MethodSource("filesPaths")
@DisplayName("Test 10_40 MedicationRequest conversion")
public void testMedicationRequestConversion() throws IOException {
InputStream dstu2_input = this.getClass().getResourceAsStream("/0_medication_request_10.json");
InputStream r4_exepected_input = this.getClass().getResourceAsStream("/0_medication_request_40.json");
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.MedicationOrder dstu2 = (org.hl7.fhir.dstu2.model.MedicationOrder) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor();

View File

@ -0,0 +1,36 @@
{"resourceType": "MedicationOrder",
"dateWritten": "2016-11-13",
"id": "T5YI1tCzs--JEvCICFbx8zgB",
"identifier": [{"use": "usual",
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.2.798268",
"value": "988736"},
{"use": "usual",
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.3.798268.801",
"value": "988736:2150291843"}],
"patient": {"display": "Jason Argonaut",
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"},
"prescriber": {"display": "Historical Provider, MD",
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/T-kmjPGEVPAmnBfmx56HsKgB"},
"medicationReference": {"display": "amitriptyline 10 MG tablet",
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Medication/T0eKLT7EB2ApMM8HCEURdMAB"},
"dosageInstruction": [{"text": "Take 10 mg by mouth nightly.",
"asNeededBoolean": "False",
"route": {"text": "Oral",
"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.698288.330",
"code": "15",
"display": "Oral"}]},
"method": {"text": "Take",
"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.798268.8600",
"code": "11",
"display": "Take"}]},
"timing": {"repeat": {"frequency": 1,
"period": 1.0,
"periodUnits": "d",
"boundsPeriod": {"start": "2016-11-15T00:00:00Z",
"end": "2016-11-23T00:00:00Z"}}},
"doseQuantity": {"value": 10.0,
"unit": "mg",
"code": "mg",
"system": "http://unitsofmeasure.org"}}],
"dispenseRequest": {"validityPeriod": {"start": "2016-11-15T00:00:00Z",
"end": "2016-11-23T00:00:00Z"}}}

View File

@ -0,0 +1,38 @@
{"resourceType": "MedicationRequest",
"id": "T5YI1tCzs--JEvCICFbx8zgB",
"identifier": [{"use": "usual",
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.2.798268",
"value": "988736"},
{"use": "usual",
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.3.798268.801",
"value": "988736:2150291843"}],
"status": "unknown",
"intent": "order",
"medicationReference": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Medication/T0eKLT7EB2ApMM8HCEURdMAB",
"display": "amitriptyline 10 MG tablet"},
"subject": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
"display": "Jason Argonaut"},
"authoredOn": "2016-11-13T00:00:00",
"requester": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/T-kmjPGEVPAmnBfmx56HsKgB",
"display": "Historical Provider, MD"},
"dosageInstruction": [{"text": "Take 10 mg by mouth nightly.",
"timing": {"repeat": {"boundsPeriod": {"start": "2016-11-15T00:00:00Z",
"end": "2016-11-23T00:00:00Z"},
"frequency": 1,
"period": 1.0,
"periodUnit": "d"}},
"asNeededBoolean": "False",
"route": {"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.698288.330",
"code": "15",
"display": "Oral"}],
"text": "Oral"},
"method": {"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.798268.8600",
"code": "11",
"display": "Take"}],
"text": "Take"},
"doseAndRate": [{"doseQuantity": {"value": 10.0,
"unit": "mg",
"system": "http://unitsofmeasure.org",
"code": "mg"}}]}],
"dispenseRequest": {"validityPeriod": {"start": "2016-11-15T00:00:00Z",
"end": "2016-11-23T00:00:00Z"}}}