Search in sources :

Example 6 with Consent

use of org.hl7.fhir.dstu3.model.Consent in project integration-adaptor-111 by nhsconnect.

the class ConsentMapper method extractAuthCodesFromDoc.

private void extractAuthCodesFromDoc(Consent consent, POCDMT000002UK01ClinicalDocument1 clinicalDocument) {
    if (clinicalDocument.sizeOfAuthorizationArray() > 0) {
        for (POCDMT000002UK01Authorization auth : clinicalDocument.getAuthorizationArray()) {
            POCDMT000002UK01Consent authConsent = auth.getConsent();
            if (authConsent.isSetCode()) {
                Optional<CodeableConcept> codeableConcept = getCodingFromCE(authConsent.getCode());
                codeableConcept.ifPresent(consent::addAction);
            }
        }
    }
}
Also used : POCDMT000002UK01Consent(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Consent) POCDMT000002UK01Authorization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Authorization) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 7 with Consent

use of org.hl7.fhir.dstu3.model.Consent in project integration-adaptor-111 by nhsconnect.

the class ConsentMapper method extractDataPeriodFromDoc.

private void extractDataPeriodFromDoc(Consent consent, POCDMT000002UK01StructuredBody structuredBody) {
    List<POCDMT000002UK01Entry> permissionEntries = getEntriesOfType(structuredBody);
    if (permissionEntries.isEmpty()) {
        return;
    }
    for (POCDMT000002UK01Entry permissionEntry : permissionEntries) {
        Period dataPeriod = getDataPeriod(permissionEntry);
        if (dataPeriod == null) {
            continue;
        }
        consent.setDataPeriod(dataPeriod);
    }
}
Also used : POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) Period(org.hl7.fhir.dstu3.model.Period)

Example 8 with Consent

use of org.hl7.fhir.dstu3.model.Consent in project integration-adaptor-111 by nhsconnect.

the class ConsentMapper method extractTextBody.

private void extractTextBody(Consent consent, POCDMT000002UK01StructuredBody structuredBody) {
    List<POCDMT000002UK01Section> sections = getSectionsOfType(structuredBody);
    for (POCDMT000002UK01Section section : sections) {
        Narrative narrative = new Narrative();
        narrative.setStatus(GENERATED);
        if (section.isSetText()) {
            narrative.setDivAsString(Arrays.asList(DIV_START, section.getText().xmlText(), DIV_END).stream().collect(Collectors.joining()));
            consent.setText(narrative);
        }
    }
}
Also used : POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) Narrative(org.hl7.fhir.dstu3.model.Narrative)

Example 9 with Consent

use of org.hl7.fhir.dstu3.model.Consent in project integration-adaptor-111 by nhsconnect.

the class ConsentMapper method extractConsentSource.

private void extractConsentSource(Consent consent, POCDMT000002UK01StructuredBody structuredBody) {
    List<POCDMT000002UK01Section> sections = getSectionsOfType(structuredBody);
    sections.stream().filter(POCDMT000002UK01Section::isSetId).forEach(section -> consent.setSource(new Identifier().setValue(section.getId().getRoot())));
}
Also used : Identifier(org.hl7.fhir.dstu3.model.Identifier) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)

Example 10 with Consent

use of org.hl7.fhir.dstu3.model.Consent in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeConsentExceptComponent.

protected void composeConsentExceptComponent(Complex parent, String parentType, String name, Consent.ExceptComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "except", name, element, index);
    if (element.hasTypeElement())
        composeEnum(t, "Consent", "type", element.getTypeElement(), -1);
    if (element.hasPeriod())
        composePeriod(t, "Consent", "period", element.getPeriod(), -1);
    for (int i = 0; i < element.getActor().size(); i++) composeConsentExceptActorComponent(t, "Consent", "actor", element.getActor().get(i), i);
    for (int i = 0; i < element.getAction().size(); i++) composeCodeableConcept(t, "Consent", "action", element.getAction().get(i), i);
    for (int i = 0; i < element.getSecurityLabel().size(); i++) composeCoding(t, "Consent", "securityLabel", element.getSecurityLabel().get(i), i);
    for (int i = 0; i < element.getPurpose().size(); i++) composeCoding(t, "Consent", "purpose", element.getPurpose().get(i), i);
    for (int i = 0; i < element.getClass_().size(); i++) composeCoding(t, "Consent", "class", element.getClass_().get(i), i);
    for (int i = 0; i < element.getCode().size(); i++) composeCoding(t, "Consent", "code", element.getCode().get(i), i);
    if (element.hasDataPeriod())
        composePeriod(t, "Consent", "dataPeriod", element.getDataPeriod(), -1);
    for (int i = 0; i < element.getData().size(); i++) composeConsentExceptDataComponent(t, "Consent", "data", element.getData().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Aggregations

Consent (org.hl7.fhir.r4.model.Consent)15 Consent (org.hl7.fhir.dstu3.model.Consent)8 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)8 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)7 Test (org.junit.jupiter.api.Test)7 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)6 List (java.util.List)5 Bundle (org.hl7.fhir.r4.model.Bundle)5 Reference (org.hl7.fhir.r4.model.Reference)5 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)4 ConsentEntity (gov.cms.dpc.common.consent.entities.ConsentEntity)4 Optional (java.util.Optional)4 Collectors (java.util.stream.Collectors)4 IIdType (org.hl7.fhir.instance.model.api.IIdType)4 ConsentCreateException (org.hl7.gravity.refimpl.sdohexchange.exception.ConsentCreateException)4 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)3 SmartOnFhirContext (com.healthlx.smartonfhir.core.SmartOnFhirContext)2 DPCIdentifierSystem (gov.cms.dpc.fhir.DPCIdentifierSystem)2 FHIR (gov.cms.dpc.fhir.annotations.FHIR)2 UnitOfWork (io.dropwizard.hibernate.UnitOfWork)2