Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Except for the Fallback Library, evaluation of an automated processing type Library requires that a measurement has been submitted and that the ProcedureRequest ServiceRequest refers to an ActivityDefinition which refers to the Library, that is, the Library must be used in a CarePlan complex associated with the Patient for which a measurement is submitted.

...

This Library is intended for use with an ActivityDefinition which specifies submitting of an Observation where the submitted Observation.value is to be compared against the reference range(s) defined in the ProcedureRequest ServiceRequest associated with the ActivityDefinition.

...

Although the example here uses Questionnaire answers of integer type, the principle in the Library can easily be adjusted to processing of coded answers as long as they each have an integer value correspondence.

Library Activating a Self-Treatment

...

ServiceRequest

An example use for this Library is to trigger activation of one or more ProcedureRequest ServiceRequest of self-treatment type based on answers (a QuestionnaireResponse) to a Questionnaire or, alternatively, computed from a submitted Observation. In the following, it is assumed that triggering is based on a QuestionnaireResponse.

In the initial state, the CarePlan would contain:

  • a number of ProcedureRequestServiceRequest, say, specifying measuring and questionnaire answering activities (this is typical content but irrelevant for activation of the self-treatment activity).

  • an active ProcedureRequestServiceRequest, here denoted the trigger ProcedureRequestServiceRequest, specifying answering of the Questionnaire that triggers the self-treatment activity

  • an inactive (through a ProcedureRequestServiceRequest.status set to suspended) self-treatment type ProcedureRequestServiceRequest. This could specify an activity to perform a weight measurement or answering of a self-treatment related Questionnaire.

The trigger ProcedureRequest ServiceRequest references an ActivityDefinition which references the Library described below.

...

Expand
titleSelf-Treatment ProcedureRequest ServiceRequest Activation Rule Content
Code Block
package rules
import org.hl7.fhir.dstu3.model.QuestionnaireResponse
// Further imports omitted for brevity

global com.systematic.ehealth.automatedprocessing.AutomatedProcessingDTO ruleResult

rule "SelfTreatmentProcedureRequestActivationRuleSelfTreatmentServiceRequestActivationRule"

dialect "java"

when
   $questionnaireResponses : Collection()
   $listQrs : ArrayList() from collect (QuestionnaireResponse() from $questionnaireResponses)
then
   QuestionnaireResponse qr = (QuestionnaireResponse)$listQrs.get(0);
   boolean activate = false;
   
   // QuestionnaireResponse examined (omitted), activate set to true when needed
   
   ruleResult.setActivateSelfTreatment(activate);
end

The automated processing reaction to a true parameter passed to setActivateSelfTreatment is described in Activation of suspended Self-treatment type ProcedureRequestServiceRequest.

Calculation Type Library Resource Examples

...