Search in sources :

Example 1 with StrucDocContent

use of uk.nhs.connect.iucds.cda.ucr.StrucDocContent in project integration-adaptor-111 by nhsconnect.

the class ObservationMapper method mapObservations.

public List<Observation> mapObservations(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter) {
    List<Observation> observations = new ArrayList<>();
    POCDMT000002UK01Component2 component = clinicalDocument.getComponent();
    if (component.isSetStructuredBody()) {
        POCDMT000002UK01Component3[] components = component.getStructuredBody().getComponentArray();
        for (POCDMT000002UK01Component3 component3 : components) {
            POCDMT000002UK01Section section = component3.getSection();
            for (POCDMT000002UK01Component5 component5 : section.getComponentArray()) {
                ST title = component5.getSection().getTitle();
                if (nodeUtil.getNodeValueString(title).matches(PATIENTS_CONDITION_REGEXP)) {
                    StrucDocContent[] contentArray = component5.getSection().getText().getContentArray();
                    List<String> sectionText = stream(contentArray).map(it -> nodeUtil.getNodeValueString(it)).collect(toList());
                    observations.add(createObservation(encounter, sectionText));
                }
            }
        }
    }
    return observations;
}
Also used : ST(uk.nhs.connect.iucds.cda.ucr.ST) Strings.join(org.apache.logging.log4j.util.Strings.join) Coding(org.hl7.fhir.dstu3.model.Coding) NodeUtil(uk.nhs.adaptors.oneoneone.cda.report.util.NodeUtil) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) StrucDocContent(uk.nhs.connect.iucds.cda.ucr.StrucDocContent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) FINAL(org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL) Observation(org.hl7.fhir.dstu3.model.Observation) ArrayList(java.util.ArrayList) Encounter(org.hl7.fhir.dstu3.model.Encounter) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Component(org.springframework.stereotype.Component) POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) StringType(org.hl7.fhir.dstu3.model.StringType) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) ST(uk.nhs.connect.iucds.cda.ucr.ST) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) ArrayList(java.util.ArrayList) StrucDocContent(uk.nhs.connect.iucds.cda.ucr.StrucDocContent) POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) Observation(org.hl7.fhir.dstu3.model.Observation) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)

Example 2 with StrucDocContent

use of uk.nhs.connect.iucds.cda.ucr.StrucDocContent in project integration-adaptor-111 by nhsconnect.

the class AppointmentMapperTest method mockDescriptionXmlStructure.

private void mockDescriptionXmlStructure(StrucDocText description) {
    StrucDocContent structuredContent = mock(StrucDocContent.class);
    when(description.getContentArray(ArgumentMatchers.anyInt())).thenReturn(structuredContent);
}
Also used : StrucDocContent(uk.nhs.connect.iucds.cda.ucr.StrucDocContent)

Example 3 with StrucDocContent

use of uk.nhs.connect.iucds.cda.ucr.StrucDocContent in project integration-adaptor-111 by nhsconnect.

the class ObservationMapperTest method setUp.

@BeforeEach
public void setUp() {
    POCDMT000002UK01Component2 component2 = mock(POCDMT000002UK01Component2.class);
    when(component2.isSetStructuredBody()).thenReturn(true);
    POCDMT000002UK01StructuredBody structuredBody = mock(POCDMT000002UK01StructuredBody.class);
    POCDMT000002UK01Component3 component3 = mock(POCDMT000002UK01Component3.class);
    POCDMT000002UK01Section section = mock(POCDMT000002UK01Section.class);
    POCDMT000002UK01Component5 component5 = mock(POCDMT000002UK01Component5.class);
    POCDMT000002UK01Section innerSection = mock(POCDMT000002UK01Section.class);
    StrucDocText text = mock(StrucDocText.class);
    StrucDocContent contentItem = mock(StrucDocContent.class);
    StrucDocContent[] content = new StrucDocContent[] { contentItem };
    when(text.getContentArray()).thenReturn(content);
    when(innerSection.getText()).thenReturn(text);
    ST title = mock(ST.class);
    when(nodeUtil.getNodeValueString(title)).thenReturn("Patient's Reported Condition");
    when(nodeUtil.getNodeValueString(contentItem)).thenReturn(OBSERVATION_VALUE);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
    when(innerSection.getTitle()).thenReturn(title);
    when(component5.getSection()).thenReturn(innerSection);
    POCDMT000002UK01Component5[] components5 = new POCDMT000002UK01Component5[] { component5 };
    when(section.getComponentArray()).thenReturn(components5);
    when(component3.getSection()).thenReturn(section);
    POCDMT000002UK01Component3[] components3 = new POCDMT000002UK01Component3[] { component3 };
    when(structuredBody.getComponentArray()).thenReturn(components3);
    when(component2.getStructuredBody()).thenReturn(structuredBody);
    when(clinicalDocument.getComponent()).thenReturn(component2);
    when(encounter.getSubject()).thenReturn(subject);
}
Also used : POCDMT000002UK01StructuredBody(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01StructuredBody) ST(uk.nhs.connect.iucds.cda.ucr.ST) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) Reference(org.hl7.fhir.dstu3.model.Reference) StrucDocContent(uk.nhs.connect.iucds.cda.ucr.StrucDocContent) IdType(org.hl7.fhir.dstu3.model.IdType) POCDMT000002UK01Component2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) StrucDocText(uk.nhs.connect.iucds.cda.ucr.StrucDocText) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

StrucDocContent (uk.nhs.connect.iucds.cda.ucr.StrucDocContent)3 POCDMT000002UK01Component2 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component2)2 POCDMT000002UK01Component3 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3)2 POCDMT000002UK01Component5 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)2 POCDMT000002UK01Section (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)2 ST (uk.nhs.connect.iucds.cda.ucr.ST)2 ArrayList (java.util.ArrayList)1 Arrays.stream (java.util.Arrays.stream)1 List (java.util.List)1 Collectors.toList (java.util.stream.Collectors.toList)1 AllArgsConstructor (lombok.AllArgsConstructor)1 Strings.join (org.apache.logging.log4j.util.Strings.join)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Coding (org.hl7.fhir.dstu3.model.Coding)1 Encounter (org.hl7.fhir.dstu3.model.Encounter)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Observation (org.hl7.fhir.dstu3.model.Observation)1 FINAL (org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 StringType (org.hl7.fhir.dstu3.model.StringType)1