Search in sources :

Example 46 with System

use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method medicationRequestIdentifierTest5.

@Test
void medicationRequestIdentifierTest5() throws IOException {
    // Test: Visit number from PV1-19, extID from RXE-2.1 and RXE-2.3
    String medicationRequest = "MSH|^~\\&|PROSLOV|MYHOSPITAL|WHIA|IBM|20170215080000||RDE^O11^RDE_O11|MSGID005520|T|2.6|||AL|NE|764|ASCII||||||^4086::132:2A57:3C28^IPv6\r" + "PID|1||000054321^^^MRN|||||||||||||||78654\r" + "PV1||I|||||||||||||||||789789\r" + "ORC|NW|||||E|10^BID^D4^^^R||20170215080000\r" + "RXE|^^^20170923230000^^R|999^Ampicillin 250 MG TAB^NDC|100||mg|123^test^ABC||||10||5|";
    MedicationRequest medReq = ResourceUtils.getMedicationRequest(ftv, medicationRequest);
    // Expect 2 identifiers
    assertThat(medReq.hasIdentifier()).isTrue();
    assertThat(medReq.getIdentifier()).hasSize(2);
    List<Identifier> identifiers = medReq.getIdentifier();
    // Match the id's to position; we can't depend on an order.
    int posVN = getIdentifierPositionByValue("789789", identifiers);
    assertThat(posVN).isNotSameAs(-1);
    int posExtId = getIdentifierPositionByValue("999-NDC", identifiers);
    assertThat(posExtId).isNotSameAs(-1);
    // Identifier 1: Visit number
    Identifier identifier = medReq.getIdentifier().get(posVN);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // PV1.19
    assertThat(value).isEqualTo("789789");
    assertThat(system).isNull();
    CodeableConcept type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
    // Identifier 2: extID based on RXE-2.1 and RXE-2.3
    identifier = medReq.getIdentifier().get(posExtId);
    value = identifier.getValue();
    system = identifier.getSystem();
    // RXE-2.1 and RXE-2.3
    assertThat(value).isEqualTo("999-NDC");
    assertThat(system).isEqualTo("urn:id:extID");
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Example 47 with System

use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method medicationRequestIdentifierTest4.

@Test
void medicationRequestIdentifierTest4() throws IOException {
    // Test: Visit number from MSH-7, no RXO-1
    String medicationRequest = "MSH|^~\\&|PROSLOV|MYHOSPITAL|WHIA|IBM|20170215080000||RDE^O11^RDE_O11|MSGID005520|T|2.6|||AL|NE|764|ASCII||||||^4086::132:2A57:3C28^IPv6\r" + "PID|1||000054321^^^MRN\r" + "PV1||I||||||||SUR||||||||S||A|||||||||||||||||||SF|K||||20170215080000\r" + "ORC|NW|||||E|10^BID^D4^^^R||20170215080000\r" + "RXO|||||||||G||10||5|\r" + "RXE|^^^20170923230000^^R|999^Ampicillin 250 MG TAB^NDC|100||mg|123^test^ABC||||10||5|";
    MedicationRequest medReq = ResourceUtils.getMedicationRequest(ftv, medicationRequest);
    // Expect 2 identifier
    assertThat(medReq.hasIdentifier()).isTrue();
    assertThat(medReq.getIdentifier()).hasSize(2);
    List<Identifier> identifiers = medReq.getIdentifier();
    // Match the id's to position; we can't depend on an order.
    int posVN = getIdentifierPositionByValue("20170215080000", identifiers);
    assertThat(posVN).isNotSameAs(-1);
    int posExtId = getIdentifierPositionByValue("999-NDC", identifiers);
    assertThat(posExtId).isNotSameAs(-1);
    // Identifier 1: Visit number
    Identifier identifier = medReq.getIdentifier().get(posVN);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // MSH-7
    assertThat(value).isEqualTo("20170215080000");
    assertThat(system).isNull();
    CodeableConcept type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
    // Identifier 2: extID based on RXE-2.1 and RXE-2.3
    identifier = medReq.getIdentifier().get(posExtId);
    value = identifier.getValue();
    system = identifier.getSystem();
    // RXE-2.1 and RXE-2.3
    assertThat(value).isEqualTo("999-NDC");
    assertThat(system).isEqualTo("urn:id:extID");
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Example 48 with System

use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method diagnosticReportIdentifierTestFillerPlacerFromOBR.

@Test
void diagnosticReportIdentifierTestFillerPlacerFromOBR() {
    // Filler and placer from OBR
    String diagnosticReport = "MSH|^~\\&|PROSLOV|MYHOSPITAL|WHIA|IBM|20170825010500||ORU^R01|MSGID22102712|T|2.6\n" + "PID|||1234||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|||PGN001|SC|D|1||20170825010500|MS|MS||||20170825010500|\n" + "OBR|1|CC_000000^OE PHIMS Stage|CD_000000|2244^General Order|||20170825010500||||||Relevant Clinical Information|||||||002|||||F\n" + "OBX|1|TX|||Impression: 1. Markedly intense metabolic activity corresponding with the area of nodular enhancement in the left oral cavity.||||||F|||20170825010500\n";
    DiagnosticReport report = ResourceUtils.getDiagnosticReport(ftv, diagnosticReport);
    // Expect 3 identifiers
    assertThat(report.hasIdentifier()).isTrue();
    assertThat(report.getIdentifier()).hasSize(3);
    List<Identifier> identifiers = report.getIdentifier();
    // Match the three id's to position; we can't depend on an order.
    int posExtId = getIdentifierPositionByValue("20170825010500", identifiers);
    assertThat(posExtId).isNotSameAs(-1);
    int posFILLER = getIdentifierPositionByValue("CD_000000", identifiers);
    assertThat(posFILLER).isNotSameAs(-1);
    int posPLACER = getIdentifierPositionByValue("CC_000000", identifiers);
    assertThat(posPLACER).isNotSameAs(-1);
    // Identifier 1: extID with MSH-7
    Identifier identifier = report.getIdentifier().get(posExtId);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // MSH-7
    assertThat(value).isEqualTo("20170825010500");
    assertThat(system).isEqualTo("urn:id:extID");
    // Identifier 2: Filler
    identifier = report.getIdentifier().get(posFILLER);
    value = identifier.getValue();
    system = identifier.getSystem();
    // OBR-3.1
    assertThat(value).isEqualTo("CD_000000");
    // OBR-3.2 is empty
    assertThat(system).isNull();
    CodeableConcept type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "FILL", "Filler Identifier", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
    // Identifier 3: Placer
    identifier = report.getIdentifier().get(posPLACER);
    value = identifier.getValue();
    system = identifier.getSystem();
    // OBR-2
    assertThat(value).isEqualTo("CC_000000");
    // OBR-2.2
    assertThat(system).isEqualTo("urn:id:OE_PHIMS_Stage");
    type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "PLAC", "Placer Identifier", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) DiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Example 49 with System

use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method serviceRequestIdentifierTest2.

@Test
void serviceRequestIdentifierTest2() {
    // Test 3:
    // - Visit number with PV1-19
    // - filler from OBR
    // - placer from ORC
    String serviceRequest = "MSH|^~\\&|SendTest1|Sendfac1|Receiveapp1|Receivefac1|200603081747|security|PPR^PC1^PPR_PC1|1|P^I|2.6||||||ASCII||\n" + "PID|1||000054321^^^MRN|||||||||||||M|CAT|||||N\n" + "PV1||I|6N^1234^A^GENERAL HOSPITAL2|||||||SUR||||||||S|8846511|A|||||||||||||||||||SF|K||||20170215080000\n" + "PRB|AD|200603150625|aortic stenosis|53692||2||200603150625\n" + "ORC||PON001||||E|^Q6H^D10^^^R\n" + "OBR|1||CD150920001336|||20150930000000|20150930164100|||||||||25055^MARCUSON^PATRICIA^L|||||||||F|||5755^DUNN^CHAD^B~25055^MARCUSON^PATRICIA^L|||WEAKNESS|DAS, SURJYA P||SHIELDS, SHARON A|||||||||";
    ServiceRequest serviceReq = ResourceUtils.getServiceRequest(ftv, serviceRequest);
    // Expect 3 identifiers
    assertThat(serviceReq.hasIdentifier()).isTrue();
    assertThat(serviceReq.getIdentifier()).hasSize(3);
    List<Identifier> identifiers = serviceReq.getIdentifier();
    // Match the id's to position; we can't depend on an order.
    int posVN = getIdentifierPositionByValue("8846511", identifiers);
    assertThat(posVN).isNotSameAs(-1);
    int posFILLER = getIdentifierPositionByValue("CD150920001336", identifiers);
    assertThat(posFILLER).isNotSameAs(-1);
    int posPLACER = getIdentifierPositionByValue("PON001", identifiers);
    assertThat(posPLACER).isNotSameAs(-1);
    // Identifier 1: visit number
    Identifier identifier = serviceReq.getIdentifier().get(posVN);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // PV1.19
    assertThat(value).isEqualTo("8846511");
    assertThat(system).isNull();
    CodeableConcept type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
    // Identifier 2: filler
    identifier = serviceReq.getIdentifier().get(posFILLER);
    value = identifier.getValue();
    system = identifier.getSystem();
    // OBR.3.1
    assertThat(value).isEqualTo("CD150920001336");
    assertThat(system).isNull();
    type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "FILL", "Filler Identifier", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
    // Identifier 3: placer
    identifier = serviceReq.getIdentifier().get(posPLACER);
    value = identifier.getValue();
    system = identifier.getSystem();
    // ORC.2.1
    assertThat(value).isEqualTo("PON001");
    assertThat(system).isNull();
    type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "PLAC", "Placer Identifier", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) ServiceRequest(org.hl7.fhir.r4.model.ServiceRequest) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Example 50 with System

use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method encounterIdentifierTest.

@Test
void encounterIdentifierTest() {
    // Test: Visit number from PV1-19
    String encounterMsg = "MSH|^~\\&|MYEHR2.5|RI88140101|KIDSNET_IFL|RIHEALTH|20130531||VXU^V04^VXU_V04|20130531RI881401010105|P|2.6|||AL|NE|764|ASCII||||||^4086::132:2A57:3C28^IPv6\r" + "EVN|A01|20130617154644||01\r" + "PID|||12345^^^^MR||smith^john|||||||||||||112233\r" + "PV1||I||||||||SUR||||||||S||A\r";
    Encounter encounter = ResourceUtils.getEncounter(ftv, encounterMsg);
    // Expect a single identifier
    assertThat(encounter.hasIdentifier()).isTrue();
    assertThat(encounter.getIdentifier()).hasSize(1);
    // Identifier 1: Visit number
    Identifier identifier = encounter.getIdentifier().get(0);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // PID.18
    assertThat(value).isEqualTo("112233");
    assertThat(system).isNull();
    CodeableConcept type = identifier.getType();
    Coding coding = type.getCoding().get(0);
    assertThat(type.getText()).isNull();
    assertThat(coding.getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/v2-0203");
    assertThat(coding.getCode()).isEqualTo("VN");
    assertThat(coding.getDisplay()).isEqualTo("Visit number");
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) Encounter(org.hl7.fhir.r4.model.Encounter) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)92 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)75 ArrayList (java.util.ArrayList)70 Coding (org.hl7.fhir.r4.model.Coding)70 Identifier (org.hl7.fhir.r4.model.Identifier)62 FHIRException (org.hl7.fhir.exceptions.FHIRException)45 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)45 Resource (org.hl7.fhir.r4.model.Resource)45 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)38 Test (org.junit.Test)37 Coding (org.hl7.fhir.dstu3.model.Coding)32 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)32 HashMap (java.util.HashMap)30 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)28 List (java.util.List)27 IOException (java.io.IOException)26 Bundle (org.hl7.fhir.r4.model.Bundle)26 Patient (org.hl7.fhir.r4.model.Patient)25 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)24 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)21