Search in sources :

Example 11 with PlanDefinition

use of org.hl7.fhir.r4b.model.PlanDefinition in project cqf-ruler by DBCG.

the class PlanDefinitionApplyProviderIT method testPlanDefinitionApplyRec10NoScreenings.

@Test
public void testPlanDefinitionApplyRec10NoScreenings() throws Exception {
    DomainResource plandefinition = (DomainResource) planDefinitions.get("opioidcds-10");
    // Patient First
    uploadTests("test/plandefinition/Rec10/Patient");
    Map<String, IBaseResource> resources = uploadTests("test/plandefinition/Rec10");
    IBaseResource patient = resources.get("example-rec-10-no-screenings");
    Object recommendation = planDefinitionApplyProvider.applyPlanDefinition(new SystemRequestDetails(), plandefinition.getIdElement(), patient.getIdElement().getIdPart(), null, null, null, null, null, null, null, null);
    assertTrue(recommendation instanceof CarePlan);
}
Also used : CarePlan(org.hl7.fhir.dstu3.model.CarePlan) DomainResource(org.hl7.fhir.dstu3.model.DomainResource) SystemRequestDetails(ca.uhn.fhir.jpa.partition.SystemRequestDetails) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 12 with PlanDefinition

use of org.hl7.fhir.r4b.model.PlanDefinition in project cqf-ruler by DBCG.

the class ExpressionEvaluationIT method testOpioidCdsPlanDefinitionDomain.

@Test
public void testOpioidCdsPlanDefinitionDomain() throws Exception {
    DomainResource plandefinition = (DomainResource) planDefinitions.get("opioidcds-10");
    // Patient First
    uploadTests("test/plandefinition/Rec10/Patient");
    Map<String, IBaseResource> resources = uploadTests("test/plandefinition/Rec10");
    IBaseResource patient = resources.get("example-rec-10-no-screenings");
    Object isFormerSmoker = expressionEvaluation.evaluateInContext(plandefinition, "true", false, patient.getIdElement().getIdPart(), new SystemRequestDetails());
    assertTrue(isFormerSmoker instanceof Boolean);
    assertTrue(((Boolean) isFormerSmoker).booleanValue());
}
Also used : DomainResource(org.hl7.fhir.dstu3.model.DomainResource) SystemRequestDetails(ca.uhn.fhir.jpa.partition.SystemRequestDetails) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 13 with PlanDefinition

use of org.hl7.fhir.r4b.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePlanDefinitionPlanDefinitionActionRelatedActionComponent.

protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "relatedAction", name, element, index);
    if (element.hasActionIdElement())
        composeId(t, "PlanDefinition", "actionId", element.getActionIdElement(), -1);
    if (element.hasRelationshipElement())
        composeEnum(t, "PlanDefinition", "relationship", element.getRelationshipElement(), -1);
    if (element.hasOffset())
        composeType(t, "PlanDefinition", "offset", element.getOffset(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 14 with PlanDefinition

use of org.hl7.fhir.r4b.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePlanDefinitionPlanDefinitionGoalComponent.

protected void composePlanDefinitionPlanDefinitionGoalComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionGoalComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "goal", name, element, index);
    if (element.hasCategory())
        composeCodeableConcept(t, "PlanDefinition", "category", element.getCategory(), -1);
    if (element.hasDescription())
        composeCodeableConcept(t, "PlanDefinition", "description", element.getDescription(), -1);
    if (element.hasPriority())
        composeCodeableConcept(t, "PlanDefinition", "priority", element.getPriority(), -1);
    if (element.hasStart())
        composeCodeableConcept(t, "PlanDefinition", "start", element.getStart(), -1);
    for (int i = 0; i < element.getAddresses().size(); i++) composeCodeableConcept(t, "PlanDefinition", "addresses", element.getAddresses().get(i), i);
    for (int i = 0; i < element.getDocumentation().size(); i++) composeRelatedArtifact(t, "PlanDefinition", "documentation", element.getDocumentation().get(i), i);
    for (int i = 0; i < element.getTarget().size(); i++) composePlanDefinitionPlanDefinitionGoalTargetComponent(t, "PlanDefinition", "target", element.getTarget().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 15 with PlanDefinition

use of org.hl7.fhir.r4b.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePlanDefinition.

protected void composePlanDefinition(Complex parent, String parentType, String name, PlanDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "PlanDefinition", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "PlanDefinition", "url", element.getUrlElement(), -1);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "PlanDefinition", "identifier", element.getIdentifier().get(i), i);
    if (element.hasVersionElement())
        composeString(t, "PlanDefinition", "version", element.getVersionElement(), -1);
    if (element.hasNameElement())
        composeString(t, "PlanDefinition", "name", element.getNameElement(), -1);
    if (element.hasTitleElement())
        composeString(t, "PlanDefinition", "title", element.getTitleElement(), -1);
    if (element.hasSubtitleElement())
        composeString(t, "PlanDefinition", "subtitle", element.getSubtitleElement(), -1);
    if (element.hasType())
        composeCodeableConcept(t, "PlanDefinition", "type", element.getType(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "PlanDefinition", "status", element.getStatusElement(), -1);
    if (element.hasExperimentalElement())
        composeBoolean(t, "PlanDefinition", "experimental", element.getExperimentalElement(), -1);
    if (element.hasSubject())
        composeType(t, "PlanDefinition", "subject", element.getSubject(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "PlanDefinition", "date", element.getDateElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "PlanDefinition", "publisher", element.getPublisherElement(), -1);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "PlanDefinition", "contact", element.getContact().get(i), i);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "PlanDefinition", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "PlanDefinition", "useContext", element.getUseContext().get(i), i);
    for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "PlanDefinition", "jurisdiction", element.getJurisdiction().get(i), i);
    if (element.hasPurposeElement())
        composeMarkdown(t, "PlanDefinition", "purpose", element.getPurposeElement(), -1);
    if (element.hasUsageElement())
        composeString(t, "PlanDefinition", "usage", element.getUsageElement(), -1);
    if (element.hasCopyrightElement())
        composeMarkdown(t, "PlanDefinition", "copyright", element.getCopyrightElement(), -1);
    if (element.hasApprovalDateElement())
        composeDate(t, "PlanDefinition", "approvalDate", element.getApprovalDateElement(), -1);
    if (element.hasLastReviewDateElement())
        composeDate(t, "PlanDefinition", "lastReviewDate", element.getLastReviewDateElement(), -1);
    if (element.hasEffectivePeriod())
        composePeriod(t, "PlanDefinition", "effectivePeriod", element.getEffectivePeriod(), -1);
    for (int i = 0; i < element.getTopic().size(); i++) composeCodeableConcept(t, "PlanDefinition", "topic", element.getTopic().get(i), i);
    for (int i = 0; i < element.getAuthor().size(); i++) composeContactDetail(t, "PlanDefinition", "author", element.getAuthor().get(i), i);
    for (int i = 0; i < element.getEditor().size(); i++) composeContactDetail(t, "PlanDefinition", "editor", element.getEditor().get(i), i);
    for (int i = 0; i < element.getReviewer().size(); i++) composeContactDetail(t, "PlanDefinition", "reviewer", element.getReviewer().get(i), i);
    for (int i = 0; i < element.getEndorser().size(); i++) composeContactDetail(t, "PlanDefinition", "endorser", element.getEndorser().get(i), i);
    for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "PlanDefinition", "relatedArtifact", element.getRelatedArtifact().get(i), i);
    for (int i = 0; i < element.getLibrary().size(); i++) composeCanonical(t, "PlanDefinition", "library", element.getLibrary().get(i), i);
    for (int i = 0; i < element.getGoal().size(); i++) composePlanDefinitionPlanDefinitionGoalComponent(t, "PlanDefinition", "goal", element.getGoal().get(i), i);
    for (int i = 0; i < element.getAction().size(); i++) composePlanDefinitionPlanDefinitionActionComponent(t, "PlanDefinition", "action", element.getAction().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Aggregations

Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)8 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)8 PlanDefinition (org.hl7.fhir.dstu3.model.PlanDefinition)7 PlanDefinition (org.hl7.fhir.r4.model.PlanDefinition)7 SystemRequestDetails (ca.uhn.fhir.jpa.partition.SystemRequestDetails)6 Test (org.junit.jupiter.api.Test)6 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 ArrayList (java.util.ArrayList)5 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)5 JsonObject (com.google.gson.JsonObject)4 DomainResource (org.hl7.fhir.dstu3.model.DomainResource)4 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)3 Library (org.hl7.fhir.r4.model.Library)3 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)3 CanonicalResourceProxy (org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy)3 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)3 FhirContext (ca.uhn.fhir.context.FhirContext)2 Operation (ca.uhn.fhir.rest.annotation.Operation)2 RequestDetails (ca.uhn.fhir.rest.api.server.RequestDetails)2