Search in sources :

Example 16 with Consent

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

the class RdfParser method composeConsent.

protected void composeConsent(Complex parent, String parentType, String name, Consent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Consent", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Consent", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Consent", "status", element.getStatusElement(), -1);
    if (element.hasScope())
        composeCodeableConcept(t, "Consent", "scope", element.getScope(), -1);
    for (int i = 0; i < element.getCategory().size(); i++) composeCodeableConcept(t, "Consent", "category", element.getCategory().get(i), i);
    if (element.hasPatient())
        composeReference(t, "Consent", "patient", element.getPatient(), -1);
    if (element.hasDateTimeElement())
        composeDateTime(t, "Consent", "dateTime", element.getDateTimeElement(), -1);
    for (int i = 0; i < element.getPerformer().size(); i++) composeReference(t, "Consent", "performer", element.getPerformer().get(i), i);
    for (int i = 0; i < element.getOrganization().size(); i++) composeReference(t, "Consent", "organization", element.getOrganization().get(i), i);
    if (element.hasSource())
        composeType(t, "Consent", "source", element.getSource(), -1);
    for (int i = 0; i < element.getPolicy().size(); i++) composeConsentConsentPolicyComponent(t, "Consent", "policy", element.getPolicy().get(i), i);
    if (element.hasPolicyRule())
        composeCodeableConcept(t, "Consent", "policyRule", element.getPolicyRule(), -1);
    for (int i = 0; i < element.getVerification().size(); i++) composeConsentConsentVerificationComponent(t, "Consent", "verification", element.getVerification().get(i), i);
    if (element.hasProvision())
        composeConsentprovisionComponent(t, "Consent", "provision", element.getProvision(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 17 with Consent

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

the class RdfParser method composeResearchSubject.

protected void composeResearchSubject(Complex parent, String parentType, String name, ResearchSubject element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ResearchSubject", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ResearchSubject", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "ResearchSubject", "status", element.getStatusElement(), -1);
    if (element.hasPeriod())
        composePeriod(t, "ResearchSubject", "period", element.getPeriod(), -1);
    if (element.hasStudy())
        composeReference(t, "ResearchSubject", "study", element.getStudy(), -1);
    if (element.hasIndividual())
        composeReference(t, "ResearchSubject", "individual", element.getIndividual(), -1);
    if (element.hasAssignedArmElement())
        composeString(t, "ResearchSubject", "assignedArm", element.getAssignedArmElement(), -1);
    if (element.hasActualArmElement())
        composeString(t, "ResearchSubject", "actualArm", element.getActualArmElement(), -1);
    if (element.hasConsent())
        composeReference(t, "ResearchSubject", "consent", element.getConsent(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 18 with Consent

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

the class RdfParser method composeConsentprovisionActorComponent.

protected void composeConsentprovisionActorComponent(Complex parent, String parentType, String name, Consent.provisionActorComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "actor", name, element, index);
    if (element.hasRole())
        composeCodeableConcept(t, "Consent", "role", element.getRole(), -1);
    if (element.hasReference())
        composeReference(t, "Consent", "reference", element.getReference(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 19 with Consent

use of org.hl7.fhir.r4.model.Consent in project fhir-bridge by ehrbase.

the class FindConsentTransactionIT method findConsentVRead.

@Test
void findConsentVRead() throws IOException {
    MethodOutcome outcome = create("Consent/transactions/provide-consent-create.json");
    IIdType id = outcome.getId();
    Consent consent = vread(id.getIdPart(), id.getVersionIdPart(), Consent.class);
    Assertions.assertNotNull(consent);
    Assertions.assertNotNull(consent.getId(), id.getIdPart());
    Assertions.assertNotNull(consent.getMeta().getVersionId(), id.getVersionIdPart());
    Assertions.assertEquals(PATIENT_ID, consent.getPatient().getIdentifier().getValue());
}
Also used : Consent(org.hl7.fhir.r4.model.Consent) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IIdType(org.hl7.fhir.instance.model.api.IIdType) Test(org.junit.jupiter.api.Test)

Example 20 with Consent

use of org.hl7.fhir.r4.model.Consent in project fhir-bridge by ehrbase.

the class FindConsentTransactionIT method findConsentRead.

@Test
void findConsentRead() throws IOException {
    MethodOutcome outcome = create("Consent/transactions/provide-consent-create.json");
    IIdType id = outcome.getId();
    Consent consent = read(id.getIdPart(), Consent.class);
    Assertions.assertNotNull(consent);
    Assertions.assertNotNull(consent.getId(), id.getIdPart());
    Assertions.assertEquals(PATIENT_ID, consent.getPatient().getIdentifier().getValue());
}
Also used : Consent(org.hl7.fhir.r4.model.Consent) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IIdType(org.hl7.fhir.instance.model.api.IIdType) Test(org.junit.jupiter.api.Test)

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