use of io.github.linuxforhealth.core.terminology.SimpleCode in project hl7v2-fhir-converter by LinuxForHealth.
the class SimpleDataValueResolverTest method get_race_value_valid.
@Test
void get_race_value_valid() throws DataTypeException {
CWE cwe = new CWE(null);
cwe.getCwe3_NameOfCodingSystem().setValue("HL70005");
cwe.getCwe1_Identifier().setValue("2028-9");
cwe.getCwe2_Text().setValue("Asian");
SimpleCode code = SimpleDataValueResolver.CODING_SYSTEM_V2.apply(cwe);
assertThat(code.getDisplay()).isEqualTo(V3Race._20289.getDisplay());
assertThat(code.getCode()).isEqualTo(V3Race._20289.toCode());
assertThat(code.getSystem()).isEqualTo(V3Race._20289.getSystem());
}
use of io.github.linuxforhealth.core.terminology.SimpleCode in project hl7v2-fhir-converter by LinuxForHealth.
the class SimpleDataValueResolverTest method testSubscriberRelationship.
@Test
void testSubscriberRelationship() {
// Check supported known input code (from table 0063) REVERSES the relationship. See notes in v2ToFhirMapping.
SimpleCode coding = SimpleDataValueResolver.SUBSCRIBER_RELATIONSHIP_IN117.apply("CHD");
assertThat(coding).isNotNull();
assertThat(coding.getCode()).isEqualTo("parent");
assertThat(coding.getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/subscriber-relationship");
assertThat(coding.getDisplay()).isEqualTo("Parent");
// Check supported known input code (from table 0344)
// is child
coding = SimpleDataValueResolver.SUBSCRIBER_RELATIONSHIP_IN272.apply("04");
assertThat(coding).isNotNull();
assertThat(coding.getCode()).isEqualTo("child");
assertThat(coding.getSystem()).isEqualTo("http://terminology.hl7.org/CodeSystem/subscriber-relationship");
assertThat(coding.getDisplay()).isEqualTo("Child");
// Check unsupported unknown input codes
// Because GOAT has no mapping, we pass it without a system.
coding = SimpleDataValueResolver.POLICYHOLDER_RELATIONSHIP_IN117.apply("GOAT");
assertThat(coding.getCode()).isEqualTo("GOAT");
assertThat(coding.getSystem()).isNull();
assertThat(coding.getDisplay()).isNull();
// Because GOAT has no mapping, we pass it without a system.
coding = SimpleDataValueResolver.POLICYHOLDER_RELATIONSHIP_IN272.apply("GOAT");
assertThat(coding.getCode()).isEqualTo("GOAT");
assertThat(coding.getSystem()).isNull();
assertThat(coding.getDisplay()).isNull();
}
use of io.github.linuxforhealth.core.terminology.SimpleCode in project hl7v2-fhir-converter by LinuxForHealth.
the class SimpleDataValueResolverTest method testMaritalStatusValueNonValid.
@Test
void testMaritalStatusValueNonValid() {
String gen = "ZZZ";
SimpleCode code = SimpleDataValueResolver.MARITAL_STATUS.apply(gen);
assertThat(code).isNotNull();
assertThat(code.getCode()).isNull();
String theSystem = V3MaritalStatus.M.getSystem();
assertThat(code.getSystem()).isEqualTo(theSystem);
assertThat(code.getDisplay()).containsPattern("Invalid.*ZZZ.*" + theSystem);
}
use of io.github.linuxforhealth.core.terminology.SimpleCode in project hl7v2-fhir-converter by LinuxForHealth.
the class ResourceExpressionTest method testSegmentIdentifierObxCc.
@Test
void testSegmentIdentifierObxCc() throws IOException {
String message = "MSH|^~\\&|hl7Integration|hl7Integration|||||ADT^A01|||2.3|\r" + "EVN|A01|20130617154644\r" + "PID|1|465 306 5961|12345678^^^MR|407623|TestPatient^John^^MR||19700101|male||||||||||\r" + "PV1|1||Location||||||||||||||||261938_6_201306171546|||||||||||||||||||||||||20130617134644|||||||||\r" + "OBX|1|TX|1234^some text^SCT||First line: ECHOCARDIOGRAPHIC REPORT||||||F||\r";
Message hl7message = getMessage(message);
HL7DataExtractor hl7DTE = new HL7DataExtractor(hl7message);
Structure s = hl7DTE.getStructure("OBX", 0).getValue();
ExpressionAttributes attr = new ExpressionAttributes.Builder().withSpecs("OBX.3").withValueOf("datatype/Identifier").withGenerateList(true).build();
ResourceExpression exp = new ResourceExpression(attr);
assertThat(exp.getData()).isNotNull();
Map<String, EvaluationResult> context = new HashMap<>();
EvaluationResult value = exp.evaluate(new HL7MessageData(hl7DTE), ImmutableMap.copyOf(context), new SimpleEvaluationResult(s));
List<Map<String, Object>> result = (List<Map<String, Object>>) value.getValue();
Map<String, Object> type = (Map<String, Object>) result.get(0).get("type");
assertThat(type).containsEntry("text", "some text");
assertThat(type.get("coding")).isNotNull();
List<Object> list = (List) type.get("coding");
SimpleCode scs = (SimpleCode) list.get(0);
assertThat(scs.getCode()).isEqualTo("1234");
assertThat(scs.getSystem()).isEqualTo("http://snomed.info/sct");
assertThat(scs.getDisplay()).isEqualTo("some text");
}
use of io.github.linuxforhealth.core.terminology.SimpleCode in project hl7v2-fhir-converter by LinuxForHealth.
the class ResourceExpressionTest method testSegmentIdentifierObxCcKnownSystem.
@Test
void testSegmentIdentifierObxCcKnownSystem() throws IOException {
String message = "MSH|^~\\&|hl7Integration|hl7Integration|||||ADT^A01|||2.3|\r" + "EVN|A01|20130617154644\r" + "PID|1|465 306 5961|123456^^^MR|407623|TestPatient^John^^^MR||19700101|male||||||||||\r" + "PV1|1||Location||||||||||||||||261938_6_201306171546|||||||||||||||||||||||||20130617134644|||||||||\r" + "OBX|1|TX|1234^some text^SCT||First line: ECHOCARDIOGRAPHIC REPORT||||||F||\r";
Message hl7message = getMessage(message);
HL7DataExtractor hl7DTE = new HL7DataExtractor(hl7message);
Structure s = hl7DTE.getStructure("OBX", 0).getValue();
ExpressionAttributes attr = new ExpressionAttributes.Builder().withSpecs("OBX.3").withValueOf("datatype/CodeableConcept").withGenerateList(true).build();
ResourceExpression exp = new ResourceExpression(attr);
assertThat(exp.getData()).isNotNull();
Map<String, EvaluationResult> context = new HashMap<>();
EvaluationResult value = exp.evaluate(new HL7MessageData(hl7DTE), ImmutableMap.copyOf(context), new SimpleEvaluationResult(s));
List<Map<String, Object>> result = (List<Map<String, Object>>) value.getValue();
assertThat(result.get(0)).containsEntry("text", "some text");
assertThat(result.get(0).get("coding")).isNotNull();
List<Object> list = (List) result.get(0).get("coding");
SimpleCode scs = (SimpleCode) list.get(0);
assertThat(scs.getCode()).isEqualTo("1234");
assertThat(scs.getSystem()).isEqualTo("http://snomed.info/sct");
assertThat(scs.getDisplay()).isEqualTo("some text");
}
Aggregations