use of org.hl7.v3.TS in project hl7v2-fhir-converter by LinuxForHealth.
the class MedicationFHIRConverterTest method practitonerCreatedForRXA.
// Tests that we create a practitioner from the RXA segment in hl7 message.
// This uses the Performer resource (specifically actor)
@Test
void practitonerCreatedForRXA() {
String hl7message = "MSH|^~\\&|EHR|12345^SiteName|MIIS|99990|20140701041038||VXU^V04^VXU_V04|MSG.Valid_01|P|2.6|||\r" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + "NK1|1|mother^patient|MTH^Mother^HL70063|5 elm st^^boston^MA^01234^^P|781-999-9999^PRN^PH^^1^781^9999999|||||||||||||||||01^No reminder/recall^HL70215\r" + "PV1|1|R||||||||||||||||||V01^20120901041038\r" + "IN1|1||8|Aetna Inc\r" + "ORC|RE||4242546^NameSpaceID||||||||||||||\r" + "RXA|0|1|20140701041038|20140701041038|48^HPV, quadrivalent^CVX|0.5|ml^MilliLiter [SI Volume Units]^UCUM||00^New Immunization^NIP001|NPI001^LastName^ClinicianFirstName^^^^Title^^AssigningAuthority|14509||||L987||MSD^Merck^MVX|||CP||20120901041038\r" + "RXR|C28161^Intramuscular^NCIT|LA^Leftarm^HL70163\r" + "OBX|1|CE|30963-3^ VACCINE FUNDING SOURCE^LN|1|VXC2^STATE FUNDS^HL70396||||||F|||20120901041038\r" + "OBX|2|CE|64994-7^Vaccine funding program eligibility category^LN|1|V01^Not VFC^HL70064||||||F|||20140701041038\r" + "OBX|3|TS|29768-9^DATE VACCINE INFORMATION STATEMENT PUBLISHED^LN|1|20010711||||||F|||20120720101321\r" + "OBX|4|TS|29769-7^DATE VACCINE INFORMATION STATEMENT PRESENTED^LN|1|19901207||||||F|||20140701041038\r";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
// Find the practitioner from the FHIR bundle.
List<Resource> practitionerResource = e.stream().filter(v -> ResourceType.Practitioner == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
// Verify we have one practitioner
assertThat(practitionerResource).hasSize(1);
// Get practitioner Resource
Resource practitioner = practitionerResource.get(0);
// Verify name text, family, and given are set correctly.
Base name = ResourceUtils.getValue(practitioner, "name");
assertThat(ResourceUtils.getValueAsString(name, "text")).isEqualTo("ClinicianFirstName LastName");
assertThat(ResourceUtils.getValueAsString(name, "family")).isEqualTo("LastName");
assertThat(ResourceUtils.getValueAsString(name, "given")).isEqualTo("ClinicianFirstName");
// Verify asserter identifier is set correctly.
Base identifier = ResourceUtils.getValue(practitioner, "identifier");
assertThat(ResourceUtils.getValueAsString(identifier, "value")).isEqualTo("NPI001");
}
use of org.hl7.v3.TS in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testDoubleMultipleNestedEducation.
// The following creates education records which combine information from related OBX's, indicated by matching OBX.4 value
// There are three ORC/RXA/RXR/OBX* sections, two differ only by dates and other small differences; enough to ensure we
// are finding the correct matching publication and presentation dates for the correct siblings and there is no data bleed.
// Others have handle various cases of completeness of data, according to rules outlined in Immunization.yml.
// For each of RXA sections below, Immunization.education should be (dates & xx vary):
//
// "education": [
// {
// "documentType": "DTaP, xx UF",
// "publicationDate": "2007-05-17",
// "presentationDate": "2014-12-03"
// },
// {
// "documentType": "Hep B, xx UF",
// "publicationDate": "2012-02-02",
// "presentationDate": "2014-12-03"
// }
// ],
@Test
void testDoubleMultipleNestedEducation() throws IOException {
String hl7VUXmessageRep = "MSH|^~\\&|||||20160106165800070+0000||VXU^V04^VXU_V04|20210205NH0000 01|P|2.5.1|||||||||Z22^CDCPHPHINVS|||\n" + "PID|1||12345^^^^MR||TestPatient^Jane^^^^^L||||||\n" + "NK1|1|LASTNAME^FIRST^^^^^L|SPO^SPOUSE^HL70063||^PRN^PH^^^603^7772222\n" + // ----- FIRST IMMUNIZATION SET. ----- Descriptions have AA, and dates 2007.
"ORC|RE||2623980^EHR|||||||||^ORDERINGLASTNAME^FIRST^^^^^^^L^^^MD|\n" + "RXA|0|1|20160105||33^PNEUMOCOCCAL POLYSACCHARIDE PPV23^CVX|0.5|ML^^UCUM|||||||||||||||\n" + "RXR|C28161^Intramuscular^NCIT|LD^Left Deltoid^HL70163|\n" + // Reference will be used as DocumentType
"OBX|1|CE|30956-7^Vaccine Type^LN|2|107^DTaP, AA1 UF^CVX||||||F\n" + "OBX|2|DT|29768-9^Date Vaccine Information Statement Published^LN|2|20070517||||||F\n" + "OBX|3|DT|29769-7^Date Vaccine Information Statement Presented^LN|2|20071203||||||F\n" + // Random OBX to prove it doesn't confuse searching or group association.
"OBX|4|CWE|64994-7^funding pgm eligibility^LN||V01^Insured^HL70064||||||F||||||VXC40^per immunization^CDCPHINVS\n" + // Reference will be used as DocumentType
"OBX|5|CE|30956-7^Vaccine Type^LN|3|45^Hep B, AA2 UF^CVX||||||F\n" + "OBX|6|DT|29768-9^Date Vaccine Information Statement Published^LN|3|20070202||||||F\n" + "OBX|7|DT|29769-7^Date Vaccine Information Statement Presented^LN|3|20071203||||||F\n" + // 48767-8 record in group will be ignore.
"OBX|2|DT|69764-9^HIB Info Sheet^LN|8|20070505||||||F|||20130531\n" + "OBX|3|DT|29768-9^VIS Publication Date^LN|8|20070606||||||F|||20130531\n" + "OBX|4|DT|29769-7^VIS Presentation Date^LN|8|20070707||||||F|||20130531\n" + "OBX|5|ST|48767-8^Annotation^LN|8|Some text from doctor||||||F|||20130531\n" + // ----- SECOND IMMUNIZATION SET. ----- Descriptions have BB, and dates 2014.
"ORC|RE||2623980^EHR|||||||||^ORDERINGLASTNAME^FIRST^^^^^^^L^^^MD|\n" + "RXA|0|1|20160105||33^PNEUMOCOCCAL POLYSACCHARIDE PPV23^CVX|0.5|ML^^UCUM||||||||||||||||\n" + "RXR|C28161^Intramuscular^NCIT|LD^Left Deltoid^HL70163|\n" + // Random OBX to prove it doesn't confuse searching or group association.
"OBX|1|CWE|64994-7^funding pgm eligibility^LN||V01^Insured^HL70064||||||F||||||VXC40^per immunization^CDCPHINVS\n" + // Reference will be used as DocumentType
"OBX|2|CE|30956-7^Vaccine Type^LN|2|107^DTaP, BB1 UF^CVX||||||F\n" + "OBX|3|DT|29768-9^Date Vaccine Information Statement Published^LN|2|20140517||||||F\n" + "OBX|4|DT|29769-7^Date Vaccine Information Statement Presented^LN|2|20141203||||||F\n" + // Reference will be used as DocumentType
"OBX|5|CE|30956-7^Vaccine Type^LN|3|45^Hep B, BB2 UF^CVX||||||F\n" + "OBX|6|DT|29768-9^Date Vaccine Information Statement Published^LN|3|20140202||||||F\n" + "OBX|7|DT|29769-7^Date Vaccine Information Statement Presented^LN|3|20141203||||||F\n" + // 'unspecified' is used as DocumentType.
"OBX|32|DT|29768-9^Date Vaccine Information Statement Published^LN|6|20140503||||||F\n" + "OBX|33|DT|29769-7^Date Vaccine Information Statement Presented^LN|6|20140505||||||F\n" + // ----- THIRD IMMUNIZATION SET. ----- Descriptions have CC, and dates 2017.
"ORC|RE||2623980^EHR|||||||||^ORDERINGLASTNAME^FIRST^^^^^^^L^^^MD|\n" + "RXA|0|1|20160105||33^PNEUMOCOCCAL POLYSACCHARIDE PPV23^CVX|0.5|ML^^UCUM||||||||||||||||\n" + "RXR|C28161^Intramuscular^NCIT|LD^Left Deltoid^HL70163|\n" + // OBX times have type TS to prove that works
"OBX|8|CE|69764-9^Vaccine Type^LN|4|45^Hep B, CC3a UF^CVX||||||F\n" + "OBX|9|CE|30956-7^Vaccine Type^LN|4|45^Hep B, CC3b UF^CVX||||||F\n" + "OBX|10|TS|29768-9^Date Vaccine Information Statement Published^LN|4|20170303||||||F\n" + "OBX|11|TS|29769-7^Date Vaccine Information Statement Presented^LN|4|20170305||||||F\n" + // OBX times have type DTM to prove that works
"OBX|21|CE|69764-9^Vaccine Type^LN|5|45^Hep B, CC4 UF^CVX||||||F\n" + "OBX|22|DTM|29768-9^Date Vaccine Information Statement Published^LN|5|20170403011212000+0000||||||F\n" + "OBX|23|DTM|29769-7^Date Vaccine Information Statement Presented^LN|5|20170405011212000+0000||||||F\n" + // 'unspecified' is used as DocumentType.
"OBX|43|DT|29769-7^Date Vaccine Information Statement Presented^LN|7|20170605||||||F\n" + "ORC|RE||9999^EHR|||||||\n";
List<Bundle.BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7VUXmessageRep);
List<Resource> immunizations = ResourceUtils.getResourceList(e, ResourceType.Immunization);
assertThat(immunizations).hasSize(3);
// First immunization set. Descriptions have AA, and dates 2007.
Immunization immunization = (Immunization) immunizations.get(0);
assertThat(immunization.getEducation()).hasSize(3);
checkImmunizationEducation(immunization.getEducation().get(1), "DTaP, AA1 UF", "2007-05-17", "2007-12-03");
checkImmunizationEducation(immunization.getEducation().get(2), "Hep B, AA2 UF", "2007-02-02", "2007-12-03");
// Degenerate 69764-9 without CE/CWE data. DocumentType will default to "unspecified"
checkImmunizationEducation(immunization.getEducation().get(0), "unspecified", "2007-06-06", "2007-07-07");
// Second immunization set. Descriptions have BB, and dates 2014.
immunization = (Immunization) immunizations.get(1);
assertThat(immunization.getEducation()).hasSize(3);
// Reference used as DocumentType
checkImmunizationEducation(immunization.getEducation().get(0), "DTaP, BB1 UF", "2014-05-17", "2014-12-03");
// Reference used as DocumentType
checkImmunizationEducation(immunization.getEducation().get(1), "Hep B, BB2 UF", "2014-02-02", "2014-12-03");
// Has no DocumentType nor Reference record. 'unspecified' is used as DocumentType.
checkImmunizationEducation(immunization.getEducation().get(2), "unspecified", "2014-05-03", "2014-05-05");
// Second immunization set. Descriptions have CC, and dates 2017.
immunization = (Immunization) immunizations.get(2);
assertThat(immunization.getEducation()).hasSize(3);
// Has both DocumentType and Reference records. DocumentType will be used.
checkImmunizationEducation(immunization.getEducation().get(0), "Hep B, CC3a UF", "2017-03-03", "2017-03-05");
// Has only DocumentType record. DocumentType will be used.
checkImmunizationEducation(immunization.getEducation().get(1), "Hep B, CC4 UF", "2017-04-03", "2017-04-05");
// Has no DocumentType nor Reference record nor PublicationDate. 'unspecified' is used as DocumentType.
checkImmunizationEducation(immunization.getEducation().get(2), "unspecified", null, "2017-06-05");
}
use of org.hl7.v3.TS in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ORUMessageTest method test_oru_with_multiple_observations.
// Suppress warnings about too many assertions in a test. Justification: creating a FHIR message is very costly; we need to check many asserts per creation for efficiency.
@java.lang.SuppressWarnings("squid:S5961")
@Test
// Observation resources are created instead of attachments in the diagReport because they are not type TX.
void test_oru_with_multiple_observations() throws IOException {
String hl7message = "MSH|^~\\\\&|SendTest1|Sendfac1|Receiveapp1|Receivefac1|200603081747|security|ORU^R01|MSGID000005|T|2.6\r" + "PID||45483|45483||SMITH^SUZIE^||20160813|M|||123 MAIN STREET^^SCHENECTADY^NY^12345||(123)456-7890|||||^^^T||||||||||||\r" + // OBR.24 creates a DiagnosticReport.category
"OBR|1||986^IA PHIMS Stage^2.16.840.1.114222.4.3.3.5.1.2^ISO|1051-2^New Born Screening^LN|||20151009173644|||||||||||||002||||CUS|F|||2740^Tsadok^Janetary~2913^Merrit^Darren^F~3065^Mahoney^Paul^J~4723^Loh^Robert^L~9052^Winter^Oscar^||||3065^Mahoney^Paul^J|\r" + "OBX|1|ST|TS-F-01-002^Endocrine Disorders^L||obs report||||||F\r" + "OBX|2|ST|GA-F-01-024^Galactosemia^L||ECHOCARDIOGRAPHIC REPORT||||||F\r";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
// Verify correct resources created
List<Resource> patientResource = ResourceUtils.getResourceList(e, ResourceType.Patient);
assertThat(patientResource).hasSize(1);
List<Resource> obsResource = ResourceUtils.getResourceList(e, ResourceType.Observation);
assertThat(obsResource).hasSize(2);
List<Resource> practitionerResource = ResourceUtils.getResourceList(e, ResourceType.Practitioner);
assertThat(practitionerResource).hasSize(1);
List<Resource> diagnosticReport = ResourceUtils.getResourceList(e, ResourceType.DiagnosticReport);
assertThat(diagnosticReport).hasSize(1);
List<Resource> servReqResource = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
assertThat(servReqResource).hasSize(1);
// Expecting only the above resources, no extras!
assertThat(e).hasSize(6);
// /////////////////////////////////////////
// Now confirm content of the diagnosticReport because we don't have separate tests for DiagnosticReport
// /////////////////////////////////////////
DiagnosticReport diag = ResourceUtils.getResourceDiagnosticReport(diagnosticReport.get(0), context);
// Verify status from OBR.25
assertThat(diag.getStatus().toCode()).isEqualTo("final");
// Verify category from OBR.24
assertThat(diag.getCategory()).hasSize(1);
DatatypeUtils.checkCommonCodeableConceptAssertions(diag.getCategoryFirstRep(), "CUS", "Cardiac Ultrasound", "http://terminology.hl7.org/CodeSystem/v2-0074", "CUS");
// Verify code from OBR.4
assertThat(diag.hasCode()).isTrue();
List<Coding> codings = diag.getCode().getCoding();
assertThat(codings).hasSize(1);
Coding coding = codings.get(0);
assertThat(coding.hasDisplay()).isTrue();
assertThat(coding.getDisplay()).hasToString("New Born Screening");
assertThat(coding.hasCode()).isTrue();
assertThat(coding.getCode()).hasToString("1051-2");
assertThat(coding.hasSystem()).isTrue();
assertThat(coding.getSystem()).hasToString("http://loinc.org");
// Verify encounter reference
assertThat(diag.getEncounter().isEmpty()).isTrue();
// Verify subject reference
assertThat(diag.getSubject().isEmpty()).isFalse();
// Verify effectiveDateTime from OBR.7 and OBR.8
assertThat(diag.getEffectiveDateTimeType().asStringValue()).isEqualTo(// This also verifies the type, confirming effectiveDateTime was set rather than effectivePeriod
"2015-10-09T17:36:44+08:00");
// Verify issued from OBR.22
assertThat(diag.getIssued()).isNull();
// Verify resultsInterpreter from OBR.32
assertThat(diag.getResultsInterpreter()).hasSize(1);
// Verify basedOn is ref to the ServiceRequest created for ORC or OBR
assertThat(diag.getBasedOn()).hasSize(1);
assertThat(diag.getBasedOn().get(0).getReference().substring(0, 15)).isEqualTo("ServiceRequest/");
// Verify specimen reference
assertThat(diag.getSpecimen()).isEmpty();
// Verify result reference
List<Reference> obsRef = diag.getResult();
assertThat(obsRef).hasSize(2);
assertThat(obsRef.get(0).isEmpty()).isFalse();
assertThat(obsRef.get(1).isEmpty()).isFalse();
// Verify presentedForm from OBX of type TX - In this case no attachments created because the OBX of type TX have ids.
List<Attachment> attachments = diag.getPresentedForm();
Assertions.assertEquals(0, attachments.size(), "Unexpected number of attachments");
// //////////////////////////////////
for (Resource res : obsResource) {
// Verify encounter reference is not set
Observation obs = (Observation) res;
assertThat(obs.getEncounter().isEmpty()).isTrue();
// Verify subject reference to Patient exists
assertThat(obs.getSubject().isEmpty()).isFalse();
assertThat(obs.getSubject().getReference().substring(0, 8)).isEqualTo("Patient/");
}
}
use of org.hl7.v3.TS in project integration-adaptor-111 by nhsconnect.
the class EncounterReportBundleServiceTest method setUp.
@BeforeEach
public void setUp() throws XmlException {
INT versionNumber = mock(INT.class);
when(versionNumber.getValue()).thenReturn(VERSION);
when(document.getVersionNumber()).thenReturn(versionNumber);
when(document.getEffectiveTime()).thenReturn(ts);
when(ts.getValue()).thenReturn(EFFECTIVE_TIME);
List<QuestionnaireResponse> questionnaireResponseList = new ArrayList<>();
questionnaireResponseList.add(QUESTIONNAIRE_RESPONSE);
when(deviceMapper.mapDevice()).thenReturn(DEVICE);
when(encounterMapper.mapEncounter(any(), any(), any(), any())).thenReturn(ENCOUNTER);
when(conditionMapper.mapCondition(any(), any(), any())).thenReturn(CONDITION);
when(compositionMapper.mapComposition(any(), any(), any(), any(), any(), any())).thenReturn(COMPOSITION);
when(listMapper.mapList(any(), any(), any(), any())).thenReturn(LIST_RESOURCE);
when(carePlanMapper.mapCarePlan(any(), any(), any())).thenReturn(singletonList(CAREPLAN));
when(healthcareServiceMapper.mapHealthcareService(any())).thenReturn(singletonList(HEALTHCARE_SERVICE));
when(consentMapper.mapConsent(any(), any())).thenReturn(CONSENT);
when(pathwayUtil.getQuestionnaireResponses(any(), any(), any())).thenReturn(questionnaireResponseList);
when(messageHeaderService.createMessageHeader(any(), any(), eq(EFFECTIVE_TIME))).thenReturn(MESSAGE_HEADER);
when(referralRequestMapper.mapReferralRequest(any(), any(), any(), any(), any())).thenReturn(REFERRAL_REQUEST);
when(observationMapper.mapObservations(any(), eq(ENCOUNTER))).thenReturn(Arrays.asList(OBSERVATION));
when(practitionerRoleMapper.mapAuthorRoles(any())).thenReturn(singletonList(AUTHOR_ROLE));
when(practitionerRoleMapper.mapResponsibleParty(any())).thenReturn(Optional.of(PRACTITIONER_ROLE));
when(relatedPersonMapper.createEmergencyContactRelatedPerson(eq(document), eq(ENCOUNTER))).thenReturn(RELATED_PERSON);
when(deviceMapper.mapDevice()).thenReturn(DEVICE);
Encounter.DiagnosisComponent diagnosisComponent = new Encounter.DiagnosisComponent();
diagnosisComponent.setCondition(new Reference());
diagnosisComponent.setRole(new CodeableConcept());
diagnosisComponent.setRank(1);
diagnosisComponent.setConditionTarget(CONDITION);
ENCOUNTER.addDiagnosis(diagnosisComponent);
}
use of org.hl7.v3.TS in project kindling by HL7.
the class CDAGenerator method processAttribute.
private void processAttribute(List<Element> classes, List<ElementDefinition> diff, List<ElementDefinition> snapshot, Element cclss, String path, Element attr) throws FHIRFormatError {
String n = attr.getAttribute("name");
ElementDefinition ed = new ElementDefinition();
ed.setPath(path + "." + n);
ed.setMin(Integer.parseInt(attr.getAttribute("minimumMultiplicity")));
ed.setMax(attr.getAttribute("maximumMultiplicity"));
if (ed.getMax().equals("0"))
return;
seePath(ed);
if (!Utilities.noString(attr.getAttribute("namespace")))
ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType(attr.getAttribute("namespace")));
String type = getType(attr);
if ("true".equals(attr.getAttribute("isImmutable"))) {
if (primitiveTypes.containsKey(type))
type = primitiveTypes.get(type);
else
throw new Error("Immutable attribute that is not a primitive type");
ed.addRepresentation(PropertyRepresentation.XMLATTR);
}
if ("GTS".equals(type)) {
ed.setMax("*");
ed.addRepresentation(PropertyRepresentation.TYPEATTR);
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/IVL_TS");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/PIVL_TS");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS");
ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype").setValue(new StringType("SXPR_TS"));
} else if ("ANY".equals(type)) {
ed.addRepresentation(PropertyRepresentation.TYPEATTR);
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/BL");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/ED");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/ST");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/CD");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/CV");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/CE");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/SC");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/TEL");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/AD");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/EN");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/INT");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/REAL");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/PQ");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/MO");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/TS");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/IVL_PQ");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/IVL_TS");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/PIVL_TS");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS");
} else if (isPrimitive(type))
ed.addType().setCode(type);
else if (Utilities.existsInList(type, "PN"))
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/EN");
else if (Utilities.existsInList(type, "ON"))
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/ST");
else if (Utilities.existsInList(type, "NARRATIVE")) {
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/StrucDoc.Text");
ed.addRepresentation(PropertyRepresentation.CDATEXT);
} else
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/" + type);
if ("R".equals(attr.getAttribute("conformance")))
ed.setMustSupport(true);
if (attr.hasAttribute("defaultValue"))
ed.setDefaultValue(buildValue(attr.getAttribute("defaultValue"), type, ed.getPath()));
List<Element> enums = new ArrayList<Element>();
XMLUtil.getNamedChildren(attr, "enumerationValue", enums);
if (enums.size() == 1)
ed.setFixed(buildValue(enums.get(0).getTextContent(), type, ed.getPath()));
if (enums.size() > 1) {
// throw new Error("todo: enums on "+ed.getPath());
} else if (XMLUtil.getNamedChild(attr, "vocabulary") != null) {
// <vocabulary codingStrength="CWE"><conceptDomain name="ActClass"/></vocabulary>
Element vocab = XMLUtil.getNamedChild(attr, "vocabulary");
String cs = vocab.getAttribute("codingStrength");
String cd = XMLUtil.getNamedChildAttribute(vocab, "conceptDomain", "name");
ElementDefinitionBindingComponent bd = ed.getBinding();
bd.setStrength(cs.equals("CNE") ? BindingStrength.REQUIRED : BindingStrength.EXTENSIBLE);
bd.setValueSet("http://terminology.hl7.org/ValueSet/v3-" + cd);
v3vs.add(cd);
}
diff.add(ed);
snapshot.add(popBase(ed));
}
Aggregations