Search in sources :

Example 41 with Section

use of org.hl7.fhir.utilities.turtle.Turtle.Section in project integration-adaptor-111 by nhsconnect.

the class CarePlanMapperTest method setup.

@BeforeEach
public void setup() {
    POCDMT000002UK01Component2 component2 = mock(POCDMT000002UK01Component2.class);
    POCDMT000002UK01Component3 component3 = mock(POCDMT000002UK01Component3.class);
    POCDMT000002UK01StructuredBody structuredBody = mock(POCDMT000002UK01StructuredBody.class);
    code = CE.Factory.newInstance();
    code.setCodeSystem(SNOMED);
    code.setCode(INFORMATION_ADVICE_GIVEN);
    when(clinicalDocument.getComponent()).thenReturn(component2);
    when(component2.isSetStructuredBody()).thenReturn(true);
    when(component2.getStructuredBody()).thenReturn(structuredBody);
    when(component3.getSection()).thenReturn(section);
    when(component5.getSection()).thenReturn(section);
    when(structuredBody.getComponentArray()).thenReturn(new POCDMT000002UK01Component3[] { component3 });
    encounter.setPeriod(period);
    title.setLanguage(LANG);
    cs.setCode(LANG);
    Patient subject = mock(Patient.class);
    Reference subjectReference = new Reference(subject);
    when(encounter.getSubject()).thenReturn(subjectReference);
    when(encounter.getSubjectTarget()).thenReturn(subject);
    when(encounter.getPeriod()).thenReturn(period);
    locationComponentList = new ArrayList<>();
    locationComponentList.add(locationComponent);
    when(encounter.hasLocation()).thenReturn(true);
    when(encounter.getLocation()).thenReturn(locationComponentList);
    when(locationComponent.hasLocation()).thenReturn(true);
    when(locationComponent.getLocation()).thenReturn(locationref);
    when(locationref.getResource()).thenReturn(location);
    when(location.hasManagingOrganization()).thenReturn(true);
    when(location.getManagingOrganization()).thenReturn(organization);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
    when(resourceUtil.createReference(condition)).thenReturn(new Reference(condition));
}
Also used : POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) POCDMT000002UK01StructuredBody(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) Reference(org.hl7.fhir.dstu3.model.Reference) Patient(org.hl7.fhir.dstu3.model.Patient) IdType(org.hl7.fhir.dstu3.model.IdType) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 42 with Section

use of org.hl7.fhir.utilities.turtle.Turtle.Section in project integration-adaptor-111 by nhsconnect.

the class ConditionMapperTest method setUp.

@BeforeEach
public void setUp() {
    POCDMT000002UK01Component3[] component3Array = new POCDMT000002UK01Component3[1];
    component3Array[0] = component3;
    POCDMT000002UK01Component5[] component5Array = new POCDMT000002UK01Component5[1];
    component5Array[0] = component5;
    questionnaireResponseList = new ArrayList<>();
    questionnaireResponseList.add(questionnaireResponse);
    when(encounter.getSubject()).thenReturn(patient);
    when(clinicalDocument.getComponent()).thenReturn(component2);
    when(component2.isSetStructuredBody()).thenReturn(true);
    when(component2.getStructuredBody()).thenReturn(structuredBody);
    when(structuredBody.getComponentArray()).thenReturn(component3Array);
    when(component3.getSection()).thenReturn(section);
    POCDMT000002UK01Entry[] entries = new POCDMT000002UK01Entry[] { entry };
    when(section.getEntryArray()).thenReturn(entries);
    when(entry.isSetEncounter()).thenReturn(true);
    when(entry.getEncounter()).thenReturn(itkEncounter);
    when(itkEncounter.isSetEffectiveTime()).thenReturn(true);
    when(itkEncounter.getEffectiveTime()).thenReturn(time);
    when(time.getValue()).thenReturn(EFFECTIVE_TIME_STRING);
    when(itkEncounter.isSetText()).thenReturn(true);
    when(itkEncounter.getText()).thenReturn(ed);
    when(ed.getDomNode()).thenReturn(node);
    when(nodeUtil.getAllText(node)).thenReturn(CONIDITION_TEXT);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
    when(resourceUtil.createReference(questionnaireResponse)).thenReturn(new Reference(QUESTIONNAIRE_RESPONSE_ID));
    when(section.getComponentArray()).thenReturn(component5Array);
    when(component5.getSection()).thenReturn(section);
    when(section.isSetLanguageCode()).thenReturn(true);
    when(section.getLanguageCode()).thenReturn(cs);
    when(cs.isSetCode()).thenReturn(true);
    when(cs.getCode()).thenReturn(LANGUAGE_CODE);
    when(questionnaireResponse.hasId()).thenReturn(true);
}
Also used : POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) IdType(org.hl7.fhir.dstu3.model.IdType) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 43 with Section

use of org.hl7.fhir.utilities.turtle.Turtle.Section in project integration-adaptor-111 by nhsconnect.

the class AppointmentMapperTest method shouldMapAppointment.

@Test
public void shouldMapAppointment() {
    POCDMT000002UK01Entry entry = mockEntry();
    POCDMT000002UK01Section section = mockSection();
    Reference patient = mock(Reference.class);
    when(locationMapper.mapRoleToLocation(any())).thenReturn(location);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Optional<Appointment> appointment = appointmentMapper.mapAppointment(entry, section, patient);
    assertThat(appointment.isPresent());
    assertThat(appointment.get().getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(appointment.get().getStatus()).isEqualTo(BOOKED);
    assertThat(appointment.get().getStart()).isNull();
    assertThat(appointment.get().getEnd()).isNull();
    assertThat(appointment.get().getMinutesDuration()).isEqualTo(0);
    assertThat(appointment.get().getDescription()).isEqualTo(TITLE);
    assertThat(appointment.get().getComment()).isEqualTo(COMMENT);
    assertThat(appointment.get().getParticipantFirstRep().getActor()).isEqualTo(patient);
    assertThat(appointment.get().getParticipantFirstRep().getRequired()).isEqualTo(REQUIRED);
    assertThat(appointment.get().getParticipantFirstRep().getStatus()).isEqualTo(ACCEPTED);
    assertThat(appointment.get().getReasonFirstRep().getText()).isEqualTo(REASON);
}
Also used : Appointment(org.hl7.fhir.dstu3.model.Appointment) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) Reference(org.hl7.fhir.dstu3.model.Reference) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 44 with Section

use of org.hl7.fhir.utilities.turtle.Turtle.Section in project kindling by HL7.

the class BreadCrumbManager method parse.

public void parse(String filename) throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document xdoc = builder.parse(new CSFileInputStream(new CSFile(filename)));
    if (xdoc.getDocumentElement().getNodeName().equals("fhir")) {
        home = parsePage(XMLUtil.getFirstChild(xdoc.getDocumentElement()));
    } else
        throw new Exception("File not recognised");
    // now we assign section numbers to everything, and index the source files
    home.setId("0");
    numberChildren(home, null);
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) CSFile(org.hl7.fhir.utilities.CSFile) Document(org.w3c.dom.Document) CSFileInputStream(org.hl7.fhir.utilities.CSFileInputStream)

Example 45 with Section

use of org.hl7.fhir.utilities.turtle.Turtle.Section in project kindling by HL7.

the class SchematronGenerator method generate.

public void generate(OutputStream out, ResourceDefn root, Definitions definitions) throws Exception {
    SchematronWriter sch = new SchematronWriter(out, SchematronType.RESOURCE, root.getName());
    insertGlobalRules(sch);
    Section s = sch.section(root.getName());
    ArrayList<String> parents = new ArrayList<String>();
    generateInvariants(s, null, root.getRoot(), definitions, parents, root.getName());
    sch.dump();
    sch.close();
}
Also used : SchematronWriter(org.hl7.fhir.utilities.xml.SchematronWriter) ArrayList(java.util.ArrayList) Section(org.hl7.fhir.utilities.xml.SchematronWriter.Section)

Aggregations

ArrayList (java.util.ArrayList)21 Element (org.w3c.dom.Element)11 IOException (java.io.IOException)10 LinkedHashMap (java.util.LinkedHashMap)9 Section (org.hl7.fhir.utilities.xml.SchematronWriter.Section)9 POCDMT000002UK01Section (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)8 Rule (org.hl7.fhir.utilities.xml.SchematronWriter.Rule)7 POCDMT000002UK01Component3 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3)7 Reference (org.hl7.fhir.dstu3.model.Reference)6 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)6 SectionComponent (org.hl7.fhir.dstu3.model.Composition.SectionComponent)5 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 HashMap (java.util.HashMap)4 NotImplementedException (org.apache.commons.lang3.NotImplementedException)4 IdType (org.hl7.fhir.dstu3.model.IdType)4 Section (org.hl7.fhir.utilities.turtle.Turtle.Section)4 Subject (org.hl7.fhir.utilities.turtle.Turtle.Subject)4 POCDMT000002UK01Component5 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)4 FileNotFoundException (java.io.FileNotFoundException)3