Search in sources :

Example 16 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ResourceReferenceUtilTest method testResourcesReferencedAtEhrCompositionLevel.

@ParameterizedTest
@MethodSource("ehrCompositionResourceFiles")
public void testResourcesReferencedAtEhrCompositionLevel(String inputXML, String referenceString) {
    final RCMRMT030101UK04EhrComposition ehrComposition = unmarshallEhrCompositionElement(inputXML);
    lenient().when(immunizationChecker.isImmunization(any())).thenAnswer(new Answer<Boolean>() {

        @Override
        public Boolean answer(InvocationOnMock invocation) throws Throwable {
            String input = (String) invocation.getArgument(0);
            return input.equals("1664081000000114");
        }
    });
    List<Reference> references = new ArrayList<>();
    resourceReferenceUtil.extractChildReferencesFromEhrComposition(ehrComposition, references);
    assertThat(references.size()).isOne();
    assertThat(references.get(0).getReference()).isEqualTo(referenceString);
}
Also used : RCMRMT030101UK04EhrComposition(org.hl7.v3.RCMRMT030101UK04EhrComposition) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 17 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ResourceReferenceUtilTest method testMedicationResourcesReferencedAtEhrCompositionLevel.

@Test
public void testMedicationResourcesReferencedAtEhrCompositionLevel() {
    final RCMRMT030101UK04EhrComposition ehrComposition = unmarshallEhrCompositionElement("ehr_composition_medication.xml");
    List<Reference> references = new ArrayList<>();
    resourceReferenceUtil.extractChildReferencesFromEhrComposition(ehrComposition, references);
    assertThat(references.size()).isEqualTo(THREE);
    assertThat(references.get(0).getReference()).isEqualTo("MedicationStatement/A0A70B62-2649-4C8F-B3AB-618B8257C942-MS");
    assertThat(references.get(1).getReference()).isEqualTo("MedicationRequest/A0A70B62-2649-4C8F-B3AB-618B8257C942");
    assertThat(references.get(2).getReference()).isEqualTo("MedicationRequest/9B4B797A-D674-4362-B666-2ADC8551EEDA");
}
Also used : RCMRMT030101UK04EhrComposition(org.hl7.v3.RCMRMT030101UK04EhrComposition) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 18 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ResourceReferenceUtilTest method testTemplateChildResourcesReferencedAsQuestionnaireAnswers.

@Test
public void testTemplateChildResourcesReferencedAsQuestionnaireAnswers() {
    final RCMRMT030101UK04EhrComposition ehrComposition = unmarshallEhrCompositionElement("ehr_composition_template.xml");
    List<Reference> references = new ArrayList<>();
    resourceReferenceUtil.extractChildReferencesFromTemplate(ehrComposition.getComponent().get(0).getCompoundStatement(), references);
    assertThat(references.size()).isEqualTo(2);
    assertThat(references.get(0).getReference()).isEqualTo("Observation/3DCC9FC9-1873-4004-9789-C4E5C52B02B9");
    assertThat(references.get(1).getReference()).isEqualTo("Observation/278ADD5F-2AC7-48DC-966A-0BA7C029C793");
}
Also used : RCMRMT030101UK04EhrComposition(org.hl7.v3.RCMRMT030101UK04EhrComposition) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 19 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ResourceReferenceUtilTest method testTemplateResourcesReferencedAtEhrCompositionLevel.

@Test
public void testTemplateResourcesReferencedAtEhrCompositionLevel() {
    final RCMRMT030101UK04EhrComposition ehrComposition = unmarshallEhrCompositionElement("ehr_composition_template.xml");
    List<Reference> references = new ArrayList<>();
    resourceReferenceUtil.extractChildReferencesFromEhrComposition(ehrComposition, references);
    assertThat(references.size()).isEqualTo(FOUR);
    assertThat(references.get(0).getReference()).isEqualTo("QuestionnaireResponse/7334D39A-BBB3-424A-B5D3-E841BCA39BF7-QRSP");
    assertThat(references.get(1).getReference()).isEqualTo("Observation/7334D39A-BBB3-424A-B5D3-E841BCA39BF7");
    assertThat(references.get(2).getReference()).isEqualTo("Observation/3DCC9FC9-1873-4004-9789-C4E5C52B02B9");
    assertThat(references.get(THREE).getReference()).isEqualTo("Observation/278ADD5F-2AC7-48DC-966A-0BA7C029C793");
}
Also used : RCMRMT030101UK04EhrComposition(org.hl7.v3.RCMRMT030101UK04EhrComposition) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Reference (org.hl7.fhir.dstu3.model.Reference)17 ArrayList (java.util.ArrayList)5 RCMRMT030101UK04EhrComposition (org.hl7.v3.RCMRMT030101UK04EhrComposition)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 ListEntryComponent (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)3 Test (org.junit.jupiter.api.Test)3 ParticipantReferenceUtil.getParticipantReference (uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference)3 Observation (org.hl7.fhir.dstu3.model.Observation)2 StringType (org.hl7.fhir.dstu3.model.StringType)2 ResourceUtil.addContextToObservation (uk.nhs.adaptors.pss.translator.util.ResourceUtil.addContextToObservation)2 Annotation (org.hl7.fhir.dstu3.model.Annotation)1 Condition (org.hl7.fhir.dstu3.model.Condition)1 DiagnosticReport (org.hl7.fhir.dstu3.model.DiagnosticReport)1 DocumentReference (org.hl7.fhir.dstu3.model.DocumentReference)1 EncounterLocationComponent (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent)1 Extension (org.hl7.fhir.dstu3.model.Extension)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Immunization (org.hl7.fhir.dstu3.model.Immunization)1 ImmunizationPractitionerComponent (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent)1 Period (org.hl7.fhir.dstu3.model.Period)1