use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7FinancialInsuranceTest method testInsuranceCoverageUnknownRelationship.
@Test
// As part of the test, there is a valid code in IN2.72 that would create a related person, but it should be ignored.
void testInsuranceCoverageUnknownRelationship() throws IOException {
String hl7message = "MSH|^~\\&|TEST|TEST|||20220101120000||DFT^P03|1234|P|2.6\n" + // + "EVN||20210407191342||||||\n"
"PID|||workers_comp^^^XYZ^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\n" + // FT1.7 is required transaction code (currently not used)
"FT1||||20201231145045||CG|FAKE|||||||||||||||||||||||||||||||||||||\n" + // IN1.2.4, IN1.2.6 to second XV Coverage.identifier
"IN1|1|Value1^^System3^Value4^^System6" + // IN1.5 through 15 NOT REFERENCED (Tested in testBasicInsuranceCoverageFields)
"|IdValue1^^^IdSystem4^^^^|Large Blue Organization|||||||||||" + // IN1.18 through IN1.53 NOT REFERENCED
"||05||||||||||||||||||||||||||||||||||||\n" + // IN2.1 through IN2.71 NOT REFERENCED
"IN2||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" + // A valid code in IN2.72 does not take priority over an invalid code in IN1.17.
"04|\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> encounters = ResourceUtils.getResourceList(e, ResourceType.Encounter);
// From PV1
assertThat(encounters).hasSize(1);
List<Resource> patients = ResourceUtils.getResourceList(e, ResourceType.Patient);
// From PID
assertThat(patients).hasSize(1);
Patient patient = (Patient) patients.get(0);
String patientId = patient.getId();
List<Resource> organizations = ResourceUtils.getResourceList(e, ResourceType.Organization);
// From Payor created by IN1
assertThat(organizations).hasSize(1);
Organization org = (Organization) organizations.get(0);
// Check organization Id's
assertThat(org.getIdentifier()).hasSize(1);
// Org identifiers checked deeply in other tests
List<Resource> coverages = ResourceUtils.getResourceList(e, ResourceType.Coverage);
// From IN1 segment
assertThat(coverages).hasSize(1);
Coverage coverage = (Coverage) coverages.get(0);
// Confirm Coverage Identifiers
// XV, XV
assertThat(coverage.getIdentifier()).hasSize(2);
// Coverage Identifiers deep check in testBasicInsuranceCoverageFields
// Because the relationship is 05, an unknown code, no subscriber is created
assertThat(coverage.hasSubscriber()).isFalse();
// Confirm Coverage Beneficiary references to Patient, and Payor references to Organization
assertThat(coverage.getBeneficiary().getReference()).isEqualTo(patientId);
assertThat(coverage.getPayorFirstRep().getReference()).isEqualTo(organizations.get(0).getId());
// Expect no RelatedPerson because IN1.17 was an unknown code
List<Resource> relatedPersons = ResourceUtils.getResourceList(e, ResourceType.RelatedPerson);
// No related person should be created because IN1.17 was an unknown code
assertThat(relatedPersons).isEmpty();
// Check coverage.relationship (from SubscriberRelationship mapping)
DatatypeUtils.checkCommonCodeableConceptAssertions(coverage.getRelationship(), "05", null, null, // IN1.17, because it is unkown there is no system or display.
null);
// Confirm there are no unaccounted for resources
// Expected: Coverage, Organization, Patient, Encounter
assertThat(e).hasSize(4);
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7IdentifierFHIRConversionTest method encounterIdentifierVisitNumberFromMSH7.
@Test
void encounterIdentifierVisitNumberFromMSH7() {
// Test: Visit number from MSH-7
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\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();
// MSH.7
assertThat(value).isEqualTo("20130531");
// PV1.19.4 and PID.18 is empty so system is null
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");
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7IdentifierFHIRConversionTest method conditionDg1IdentifierTest2.
@Test
void conditionDg1IdentifierTest2() {
// Test PV1-19 for visit number; extID with DG1-3.1.
// Also test DG1-20 creates additional identifiers.
String withDG120 = "MSH|^~\\&|||||||ADT^A01^ADT_A01|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6||||||\r" + "PID|||10290^^^WEST^MR||||20040530|M||||||||||||||||||||||N\n" + "PV1||I||||||||SUR||||||||S|8846511^^^ACME|A|||||||||||||||||||SF|K||||20170215080000\n" + "DG1|1|ICD10|B45678|Broken Arm|20210322154449|A|E123|R45|Y|J76|C|15|1458.98||1|123^DOE^JOHN^A^|C|Y|20210322154326|one^https://terminology.hl7.org/CodeSystem/two^three^https://terminology.hl7.org/CodeSystem/four|S1234|Parent Diagnosis|Value345|Group567|DiagnosisG45|Y\r";
Condition condition = ResourceUtils.getCondition(ftv, withDG120);
// Expect 4 identifiers
assertThat(condition.hasIdentifier()).isTrue();
assertThat(condition.getIdentifier()).hasSize(4);
List<Identifier> identifiers = condition.getIdentifier();
// Match the id's to position; we can't depend on an order.
int posVN = getIdentifierPositionByValue("8846511", identifiers);
assertThat(posVN).isNotSameAs(-1);
int posExtId = getIdentifierPositionByValue("B45678", identifiers);
assertThat(posExtId).isNotSameAs(-1);
int posExtDG20a = getIdentifierPositionByValue("one", identifiers);
assertThat(posExtDG20a).isNotSameAs(-1);
int posExtDG20b = getIdentifierPositionByValue("three", identifiers);
assertThat(posExtDG20b).isNotSameAs(-1);
// Identifier 1: Visit number
Identifier identifier = condition.getIdentifier().get(posVN);
String value = identifier.getValue();
String system = identifier.getSystem();
// PV1.19.1
assertThat(value).isEqualTo("8846511");
// PV1.19.4
assertThat(system).isEqualTo("urn:id:ACME");
CodeableConcept type = identifier.getType();
DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
// Identifier 2: DG1.3.1
identifier = condition.getIdentifier().get(posExtId);
value = identifier.getValue();
system = identifier.getSystem();
// DG1.3.1
assertThat(value).isEqualTo("B45678");
assertThat(system).isEqualTo("urn:id:extID");
// Identifier 3: DG1.20.1 and DG1.20.2
identifier = condition.getIdentifier().get(posExtDG20a);
value = identifier.getValue();
system = identifier.getSystem();
// DG1.20.1
assertThat(value).isEqualTo("one");
// DG1.20.2
assertThat(system).isEqualTo("https://terminology.hl7.org/CodeSystem/two");
// Identifier 4: DG1.20.3 and DG1.20.4
identifier = condition.getIdentifier().get(posExtDG20b);
value = identifier.getValue();
system = identifier.getSystem();
// DG1.20.3
assertThat(value).isEqualTo("three");
// DG1.20.4
assertThat(system).isEqualTo("https://terminology.hl7.org/CodeSystem/four");
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System 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");
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System 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");
}
Aggregations