use of org.hl7.fhir.r5.utils.validation.constants in project kindling by HL7.
the class SourceParser method genTypeProfile.
private void genTypeProfile(org.hl7.fhir.definitions.model.TypeDefn t) throws Exception {
StructureDefinition profile;
try {
profile = new ProfileGenerator(definitions, context, page, genDate, version, null, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generate(t);
t.setProfile(profile);
DataTypeTableGenerator dtg = new DataTypeTableGenerator(dstDir, page, t.getName(), true, version);
t.getProfile().getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
t.getProfile().getText().getDiv().getChildNodes().add(dtg.generate(t, null, false));
if (context.hasResource(StructureDefinition.class, t.getProfile().getUrl()))
throw new Exception("Duplicate Profile " + t.getProfile().getUrl());
context.cacheResource(t.getProfile());
} catch (Exception e) {
throw new Exception("Error generating profile for '" + t.getName() + "': " + e.getMessage(), e);
}
}
use of org.hl7.fhir.r5.utils.validation.constants in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7DocumentReferenceFHIRConversionTest method doc_ref_status_test.
@ParameterizedTest
@ValueSource(strings = { "MDM^T02", "MDM^T06" })
void doc_ref_status_test(String segment) {
// Check TXA.19
// TXA.19 value maps to status; OBR.25 is ignored
String documentReferenceMessage = "MSH|^~\\&|HL7Soup|Instance1|MCM|Instance2|200911021022|Security|" + segment + "^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|||MS|MS|||||\n" + "OBR|1||||||20170825010500|||||||||||||002|||||F||||||||\n" + "TXA|1||TEXT||||201801180346||<PHYSID1>||||||||PA||OB|||<PHYSID2>||\n" + "OBX|1|SN|||||||||X";
DocumentReference report = ResourceUtils.getDocumentReference(ftv, documentReferenceMessage);
org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus status = report.getStatus();
// TXA.19
assertThat(status.toCode()).isEqualTo("superseded");
assertThat(status.getSystem()).isEqualTo("http://hl7.org/fhir/document-reference-status");
// Check OBR.25 as fallback
// TXA.19 value is empty so OBR.25 is used
documentReferenceMessage = "MSH|^~\\&|HL7Soup|Instance1|MCM|Instance2|200911021022|Security|" + segment + "^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|||MS|MS\n" + "OBR|1||||||20170825010500|||||||||||||002|||||X\n" + "TXA|1||TEXT||||201801180346||<PHYSID1>||||||||PA|||||<PHYSID2>\n" + "OBX|1|SN|||||||||X";
report = ResourceUtils.getDocumentReference(ftv, documentReferenceMessage);
status = report.getStatus();
// OBR.25
assertThat(status.toCode()).isEqualTo("entered-in-error");
assertThat(status.getSystem()).isEqualTo("http://hl7.org/fhir/document-reference-status");
// Check default value case
// TXA.19 and OBR.25 values are empty so should fallback to "current"
documentReferenceMessage = "MSH|^~\\&|HL7Soup|Instance1|MCM|Instance2|200911021022|Security|" + segment + "^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|||MS|MS|||||\n" + "OBR|1||||||20170825010500|||||||||||||002\n" + "TXA|1||TEXT||||201801180346||<PHYSID1>||||||||PA\n" + "OBX|1|SN|||||||||X";
report = ResourceUtils.getDocumentReference(ftv, documentReferenceMessage);
status = report.getStatus();
// default value
assertThat(status.toCode()).isEqualTo("current");
assertThat(status.getSystem()).isEqualTo("http://hl7.org/fhir/document-reference-status");
}
use of org.hl7.fhir.r5.utils.validation.constants in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7PatientFHIRConversionTest method patientNameTest.
@Test
void patientNameTest() {
String patientHasMiddleName = "MSH|^~\\&|MyEMR|DE-000001| |CAIRLO|20160701123030-0700||VXU^V04^VXU_V04|CA0001|P|2.6|||ER|AL|||||Z22^CDCPHINVS|DE-000001\r" + // PID 5 fields (name) are extracted and tested
"PID|1||PA123456^^^MYEMR^MR||JONES^GEORGE^Q^III^MR^^B||||||||||||||||||||\r";
Patient patientObjUsualName = PatientUtils.createPatientFromHl7Segment(ftv, patientHasMiddleName);
java.util.List<org.hl7.fhir.r4.model.HumanName> name = patientObjUsualName.getName();
List<StringType> givenName = name.get(0).getGiven();
List<StringType> suffixes = name.get(0).getSuffix();
assertThat(suffixes).hasSize(1);
List<StringType> prefixes = name.get(0).getPrefix();
assertThat(prefixes).hasSize(1);
String fullName = name.get(0).getText();
assertThat(prefixes.get(0).toString()).hasToString("MR");
assertThat(givenName.get(0).toString()).hasToString("GEORGE");
assertThat(givenName.get(1).toString()).hasToString("Q");
assertThat(suffixes.get(0).toString()).hasToString("III");
assertThat(fullName).isEqualTo("MR GEORGE Q JONES III");
}
use of org.hl7.fhir.r5.utils.validation.constants in project cqf-ruler by DBCG.
the class CompositionSectionComponentBuilder method initializeDstu2_1.
@Override
protected void initializeDstu2_1(T theResource) {
super.initializeDstu2_1(theResource);
org.hl7.fhir.dstu2016may.model.Composition.SectionComponent section = (org.hl7.fhir.dstu2016may.model.Composition.SectionComponent) theResource;
section.setTitle(myTitle).setId(getId());
getEntries().forEach(entry -> section.addEntry(new Reference(entry)));
if (myText != null) {
Narrative narrative = new Narrative();
narrative.setStatusAsString(myText.getStatus());
narrative.setDivAsString(myText.getText());
section.setText(narrative);
}
// no focus
}
use of org.hl7.fhir.r5.utils.validation.constants in project cqf-ruler by DBCG.
the class DetectedIssueBuilder method initializeR4.
@Override
protected void initializeR4(T theResource) {
super.initializeR4(theResource);
org.hl7.fhir.r4.model.DetectedIssue detectedIssue = (org.hl7.fhir.r4.model.DetectedIssue) theResource;
List<org.hl7.fhir.r4.model.Identifier> identifier = new ArrayList<>();
identifier.add(new org.hl7.fhir.r4.model.Identifier().setSystem(getIdentifier().getKey()).setValue(getIdentifier().getValue()));
detectedIssue.setIdentifier(identifier).setPatient(new org.hl7.fhir.r4.model.Reference(myPatient)).setStatus(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.valueOf(myStatus)).setCode(new CodeableConcept().addCoding(new Coding().setSystem(getCodeSetting().getSystem()).setCode(getCodeSetting().getCode()).setDisplay(getCodeSetting().getDisplay())));
getEvidenceDetails().forEach(evidence -> detectedIssue.addEvidence(new DetectedIssueEvidenceComponent().addDetail(new org.hl7.fhir.r4.model.Reference(evidence))));
}
Aggregations