Search in sources :

Example 46 with Identifier

use of org.hl7.fhir.r4.model.Identifier in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method documentReferenceIdentifierTest3.

@Test
void documentReferenceIdentifierTest3() {
    // Placer from OBR, Filler from TXA-15
    String documentReferenceMessage = "MSH|^~\\&|HL7Soup|Instance1|MCM|Instance2|200911021022|Security|MDM^T02|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6|56789^NID^UID|MCM||||\n" + "PID|1||000054321^^^MRN|||||||||||||M|CAT|||||N\n" + "PV1|1|I|||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|NW|||PGN001|SC|D|1||20170825010500|MS|MS||||20170825010500|\n" + "OBR|1|CD_000000^OE||2244^General Order|||20170825010500||||||Relevant Clinical Information|||||||002|||||F|||550600^Tsadok550600^Janetary~660600^Merrit660600^Darren^F~770600^Das770600^Surjya^P~880600^Winter880600^Oscar^||||770600&Das770600&Surjya&P^^^6N^1234^A|\n" + "TXA|1||B45678||||||||||||FON001^IE\n";
    DocumentReference report = ResourceUtils.getDocumentReference(ftv, documentReferenceMessage);
    // 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("200911021022", identifiers);
    assertThat(posExtId).isNotSameAs(-1);
    int posFILLER = getIdentifierPositionByValue("FON001", identifiers);
    assertThat(posFILLER).isNotSameAs(-1);
    int posPLACER = getIdentifierPositionByValue("CD_000000", identifiers);
    assertThat(posPLACER).isNotSameAs(-1);
    // Identifier 1: extID from MSH-7
    Identifier identifier = report.getIdentifier().get(posExtId);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // MSH-7
    assertThat(value).isEqualTo("200911021022");
    assertThat(system).isEqualTo("urn:id:extID");
    // Identifier 2: Filler
    Identifier identifier3 = report.getIdentifier().get(posFILLER);
    value = identifier3.getValue();
    system = identifier3.getSystem();
    // TXA-15.1
    assertThat(value).isEqualTo("FON001");
    // TXA.15.2
    assertThat(system).isEqualTo("urn:id:IE");
    CodeableConcept type = identifier3.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("FILL");
    assertThat(coding.getDisplay()).isEqualTo("Filler Identifier");
    // Identifier 3: Placer
    identifier = report.getIdentifier().get(posPLACER);
    value = identifier.getValue();
    system = identifier.getSystem();
    // OBR.2.1
    assertThat(value).isEqualTo("CD_000000");
    // OBR.2.2
    assertThat(system).isEqualTo("urn:id:OE");
    type = identifier.getType();
    coding = type.getCoding().get(0);
    assertThat(type.getText()).isNull();
    assertThat(coding.getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/v2-0203");
    assertThat(coding.getCode()).isEqualTo("PLAC");
    assertThat(coding.getDisplay()).isEqualTo("Placer Identifier");
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Example 47 with Identifier

use of org.hl7.fhir.r4.model.Identifier in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method observationIdentifierTest.

@Test
void observationIdentifierTest() {
    // identifier uses the logic from BUILD_IDENTIFIER_FROM_CWE (OBX.3) and joins FILL or PLAC values with it
    // Filler from OBR-3; OBX-3.1/OBX-3.3
    String joinFillPlaAndObx3 = "MSH|^~\\&|SOARF|E_AMC|||201512201012||ADT^A01|MSG$1|P|2.7||1|||||||\r" + "EVN|A01|201512201012||CI|wiestc|201512201007|1488\r" + "PID|||MRN12345678^^^ID-XYZ^MR~111223333^^^USA^SS~MN1234567^^^MNDOT^DL||||||||||||||\r" + "PV1|1|I|E2^E211^E211B^1488|Elective||||||||||V\r" + "OBR|1|ORD448811^NIST EHR|R-511^NIST Lab Filler|1000^Hepatitis A B C Panel^99USL|||20120628070100|||||||||\r" + "OBX|1|ST|DINnumber^^LSFUSERDATAE||N/A||||||R||||||\r";
    Observation observation = ResourceUtils.getObservation(ftv, joinFillPlaAndObx3);
    // Expect a single identifier
    assertThat(observation.hasIdentifier()).isTrue();
    assertThat(observation.getIdentifier()).hasSize(1);
    // Identifier 1: extID from OBR.3 plus OBX-3.1/OBX-3.3
    Identifier identifier = observation.getIdentifier().get(0);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // OBR.3.1-OBX.3.1-OBX.3.3
    assertThat(value).isEqualTo("R-511-DINnumber-LSFUSERDATAE");
    assertThat(system).isEqualTo("urn:id:extID");
    // Placer from OBR-2; OBX-3.1
    String msg = "MSH|^~\\&|SOARF|E_AMC|||201512201012||ADT^A01|MSG$1|P|2.7||1|||||||\r" + "EVN|A01|201512201012||CI|wiestc|201512201007|1488\r" + "PID|||MRN12345678^^^ID-XYZ^MR~111223333^^^USA^SS~MN1234567^^^MNDOT^DL||||||||||||||\r" + "PV1|1|I|E2^E211^E211B^1488|Elective||||||||||V\r" + "OBR|1|ORD448811^NIST EHR|^NIST Lab Filler|1000^Hepatitis A B C Panel^99USL|||20120628070100|||||||||\r" + "OBX|1|ST|DINnumber^^||N/A||||||R||||||\r";
    observation = ResourceUtils.getObservation(ftv, msg);
    // Expect a single identifier
    assertThat(observation.hasIdentifier()).isTrue();
    assertThat(observation.getIdentifier()).hasSize(1);
    // Identifier 1: extID from OBR.2 and OBX-3.1
    identifier = observation.getIdentifier().get(0);
    value = identifier.getValue();
    system = identifier.getSystem();
    // OBR.2.1-OBX.3.1
    assertThat(value).isEqualTo("ORD448811-DINnumber");
    assertThat(system).isEqualTo("urn:id:extID");
    // Filler from ORC-3; OBX-3.2
    msg = "MSH|^~\\&|SendTest1|Sendfac1|Receiveapp1|Receivefac1|200603081747|security|PPR^PC1^PPR_PC1|1|P^I|2.6||||||ASCII||\r" + "PID|||555444222111^^^MPI&GenHosp&L^MR||james^anderson||19600614|M||C|||^^^^^626^5641111|^^^^^626^5647654||||||||N\r" + "PV1||I|6N^1234^A^GENHOS||||0100^ANDERSON^CARL|0148^ADDISON^JAMES||SUR|||||||0148^ANDERSON^CARL|S|1400|A|||||||||||||||||||SF|K||||199501102300\r" + "PRB|AD|200603150625|aortic stenosis|53692||2||200603150625\r" + "OBX|1|ST|DINnumber^^LSFUSERDATAE||ECHOCARDIOGRAPHIC REPORT||||||F|||20150930164100|||\r" + "ORC|NW|PON001|FON001|PGN001|SC|D|1||20170825010500|MS|MS||||20170825010500|";
    observation = ResourceUtils.getObservation(ftv, msg);
    // Expect a single identifier
    assertThat(observation.hasIdentifier()).isTrue();
    assertThat(observation.getIdentifier()).hasSize(1);
    // Identifier 1: extID from OBR.3 plus OBX-3.1/OBX-3.3
    identifier = observation.getIdentifier().get(0);
    value = identifier.getValue();
    system = identifier.getSystem();
    // ORC.3-OBX.3.1-OBX.3.3
    assertThat(value).isEqualTo("FON001-DINnumber-LSFUSERDATAE");
    assertThat(system).isEqualTo("urn:id:extID");
    // Placer from ORC-2; OBX-3.1
    msg = "MSH|^~\\&|SendTest1|Sendfac1|Receiveapp1|Receivefac1|200603081747|security|PPR^PC1^PPR_PC1|1|P^I|2.6||||||ASCII||\r" + "PID|||555444222111^^^MPI&GenHosp&L^MR||james^anderson||19600614|M||C|99 Oakland #106^^qwerty^OH^44889||||||||||N\r" + "PV1||I|6N^1234^A^GENHOS||||0100^ANDERSON^CARL|0148^ADDISON^JAMES||SUR|||||||0148^ANDERSON^CARL|S|1400|A||SF|K||||199501102300\r" + "PRB|AD|200603150625|aortic stenosis|53692||2||200603150625\r" + "OBX|1|ST|DINnumber||ECHOCARDIOGRAPHIC REPORT||||||F|||20150930164100|||\r" + "ORC|NW|PON001|||SC|D|1||20170825010500|MS|MS|||||";
    observation = ResourceUtils.getObservation(ftv, msg);
    // Expect a single identifier
    assertThat(observation.hasIdentifier()).isTrue();
    assertThat(observation.getIdentifier()).hasSize(1);
    // Identifier 1: extID from OBR.2 and OBX-3.1
    identifier = observation.getIdentifier().get(0);
    value = identifier.getValue();
    system = identifier.getSystem();
    // ORC.2-OBX.3.1
    assertThat(value).isEqualTo("PON001-DINnumber");
    assertThat(system).isEqualTo("urn:id:extID");
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) Observation(org.hl7.fhir.r4.model.Observation) Test(org.junit.jupiter.api.Test)

Example 48 with Identifier

use of org.hl7.fhir.r4.model.Identifier 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 49 with Identifier

use of org.hl7.fhir.r4.model.Identifier 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 50 with Identifier

use of org.hl7.fhir.r4.model.Identifier 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)

Aggregations

Identifier (org.hl7.fhir.r4.model.Identifier)212 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)143 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)125 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)116 Test (org.junit.Test)109 Test (org.junit.jupiter.api.Test)84 ArrayList (java.util.ArrayList)67 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)66 Reference (org.hl7.fhir.r4.model.Reference)57 Identifier (org.hl7.fhir.dstu3.model.Identifier)55 Patient (org.hl7.fhir.r4.model.Patient)55 Coding (org.hl7.fhir.r4.model.Coding)49 List (java.util.List)47 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)41 Practitioner (org.hl7.fhir.r4.model.Practitioner)41 Date (java.util.Date)40 Collectors (java.util.stream.Collectors)38 Resource (org.hl7.fhir.r4.model.Resource)37 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)36 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)34