diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index abcc03105..634873048 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1 +1,2 @@ * minor fixes in code generators for R4B +* add default value to Medication Request during conversion from dstu2 to r4 diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java index e0e3bbed0..fd44431f6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java @@ -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()) diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40Test.java index 2972bbf51..026b2a735 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40Test.java @@ -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 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(); diff --git a/org.hl7.fhir.convertors/src/test/resources/1_medication_request_10.json b/org.hl7.fhir.convertors/src/test/resources/1_medication_request_10.json new file mode 100644 index 000000000..6a88dcd13 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/1_medication_request_10.json @@ -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"}}} diff --git a/org.hl7.fhir.convertors/src/test/resources/1_medication_request_40.json b/org.hl7.fhir.convertors/src/test/resources/1_medication_request_40.json new file mode 100644 index 000000000..a37492607 --- /dev/null +++ b/org.hl7.fhir.convertors/src/test/resources/1_medication_request_40.json @@ -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"}}}