Search in sources :

Example 1 with RCMRMT030101UK04NarrativeStatement

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

the class ResourceFilterUtilTest method testIsDocumentReferenceResource.

@Test
public void testIsDocumentReferenceResource() {
    final RCMRMT030101UK04NarrativeStatement narrativeStatement = unmarshallNarrativeStatementElement("document_reference_resource.xml");
    assertThat(ResourceFilterUtil.isDocumentReference(narrativeStatement)).isTrue();
}
Also used : RCMRMT030101UK04NarrativeStatement(org.hl7.v3.RCMRMT030101UK04NarrativeStatement) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with RCMRMT030101UK04NarrativeStatement

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

the class DocumentReferenceMapper method mapDocumentReference.

private DocumentReference mapDocumentReference(RCMRMT030101UK04NarrativeStatement narrativeStatement, RCMRMT030101UK04EhrComposition ehrComposition, Patient patient, RCMRMT030101UK04EhrExtract ehrExtract, List<Encounter> encounterList, Organization organization) {
    DocumentReference documentReference = new DocumentReference();
    var id = narrativeStatement.getReference().get(0).getReferredToExternalDocument().getId().getRoot();
    documentReference.addIdentifier(buildIdentifier(id, organization.getIdentifierFirstRep().getValue()));
    documentReference.setId(id);
    documentReference.getMeta().addProfile(META_PROFILE);
    documentReference.setStatus(DocumentReferenceStatus.CURRENT);
    documentReference.setType(getType(narrativeStatement));
    documentReference.setSubject(new Reference(patient));
    documentReference.setIndexedElement(getIndexed(ehrExtract));
    documentReference.setDescription(buildDescription(narrativeStatement));
    documentReference.setCustodian(new Reference(organization));
    getAuthor(narrativeStatement, ehrComposition).ifPresent(documentReference::addAuthor);
    if (narrativeStatement.hasAvailabilityTime() && narrativeStatement.getAvailabilityTime().hasValue()) {
        documentReference.setCreatedElement(DateFormatUtil.parseToDateTimeType(narrativeStatement.getAvailabilityTime().getValue()));
    }
    var encounterReference = encounterList.stream().filter(encounter -> encounter.getId().equals(ehrComposition.getId().getRoot())).findFirst().map(Reference::new);
    if (encounterReference.isPresent()) {
        DocumentReference.DocumentReferenceContextComponent documentReferenceContextComponent = new DocumentReference.DocumentReferenceContextComponent().setEncounter(encounterReference.get());
        documentReference.setContext(documentReferenceContextComponent);
    }
    setContentAttachments(documentReference, narrativeStatement);
    return documentReference;
}
Also used : ParticipantReferenceUtil.getParticipantReference(uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference) Reference(org.hl7.fhir.dstu3.model.Reference) DocumentReference(org.hl7.fhir.dstu3.model.DocumentReference) DocumentReference(org.hl7.fhir.dstu3.model.DocumentReference)

Example 3 with RCMRMT030101UK04NarrativeStatement

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

the class ResourceFilterUtilTest method testIsNotDocumentReferenceResource.

@Test
public void testIsNotDocumentReferenceResource() {
    final RCMRMT030101UK04NarrativeStatement narrativeStatement = unmarshallNarrativeStatementElement("observation_comment_resource.xml");
    assertThat(ResourceFilterUtil.isDocumentReference(narrativeStatement)).isFalse();
}
Also used : RCMRMT030101UK04NarrativeStatement(org.hl7.v3.RCMRMT030101UK04NarrativeStatement) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with RCMRMT030101UK04NarrativeStatement

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

the class ObservationCommentMapper method mapObservation.

private Observation mapObservation(RCMRMT030101UK04EhrExtract ehrExtract, RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04NarrativeStatement narrativeStatement, Patient patient, List<Encounter> encounters, String practiseCode) {
    var narrativeStatementId = narrativeStatement.getId();
    var observation = new Observation();
    observation.setId(narrativeStatement.getId().getRoot());
    observation.setMeta(generateMeta(META_URL));
    observation.setStatus(FINAL);
    observation.setSubject(new Reference(patient));
    observation.setIssuedElement(createIssued(ehrExtract, ehrComposition));
    observation.setCode(createCodeableConcept());
    observation.addPerformer(createPerformer(ehrComposition, narrativeStatement));
    observation.addIdentifier(buildIdentifier(narrativeStatementId.getRoot(), practiseCode));
    setObservationEffective(observation, narrativeStatement.getAvailabilityTime());
    setObservationComment(observation, narrativeStatement.getText());
    addContextToObservation(observation, encounters, ehrComposition);
    return observation;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) ResourceFilterUtil.isDocumentReference(uk.nhs.adaptors.pss.translator.util.ResourceFilterUtil.isDocumentReference) Observation(org.hl7.fhir.dstu3.model.Observation) ResourceUtil.addContextToObservation(uk.nhs.adaptors.pss.translator.util.ResourceUtil.addContextToObservation)

Aggregations

Reference (org.hl7.fhir.dstu3.model.Reference)2 RCMRMT030101UK04NarrativeStatement (org.hl7.v3.RCMRMT030101UK04NarrativeStatement)2 Test (org.junit.jupiter.api.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 DocumentReference (org.hl7.fhir.dstu3.model.DocumentReference)1 Observation (org.hl7.fhir.dstu3.model.Observation)1 ParticipantReferenceUtil.getParticipantReference (uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference)1 ResourceFilterUtil.isDocumentReference (uk.nhs.adaptors.pss.translator.util.ResourceFilterUtil.isDocumentReference)1 ResourceUtil.addContextToObservation (uk.nhs.adaptors.pss.translator.util.ResourceUtil.addContextToObservation)1