Skip to main content

Events

Events represent important milestones in a patient’s care plan and are managed by the Event (mvn__PJN_Event__c) custom object.

Event creation

Events can be created in several ways:

  • Manually by users. For example, recording therapy access when updating a coverage investigation in the PJNCoverageInvestigationUpdateQuickAction Lightning Component creates an Event record of PJN_Therapy_Access record type. All other manual event creations are of PJN_Therapy_Status_Update record type.

  • Automatically when records related to the care plan are created or updated. For example, out of the box, updating the mvn__PJN_Physician__c field on the Care Plan (Case) record creates an Event record of the Physician Change (PJN_Physician_Change) record type via the PJN_EventCreation Apex class. Additional automation can be configured such that events are also created when a patient reaches a certain milestone. For more information, reference the Milestone event automation section below.

  • Via third-party vendors. For example, out of the box, receiving a pharmacy status update via an integration creates an Event record of PJN_Pharmacy_Status_Update record type.

Milestone event automation

Events can be automatically created based on key milestones in a patient's program journey. A trigger for a milestone can be set either on the Trigger Handler Setting (mvn__PJN_Trigger_Handler_Setting__mdt) custom metadata type or via a custom implementation, but it must call the Event Automation Handler (PJN_EventAutomationHdlr) global Apex class to retrieve a list of Event Configuration (mvn__PJN_Event_Configuration__mdt) metadata records for the triggered object. The Event Automation Handler class then checks the criteria that is defined on each event configuration to determine whether or not the criteria is met and therefore whether or not an event should be created. If so, then an Event record of the specified record type is created with the status and sub-status values specified on the event configuration.

To define a trigger on an object for a specific milestone and then configure an event to be subsequently created:

  1. (Prerequisite) Ensure that records of the object are related to a Care Plan (Case) record and a patient Account record.

  2. (Prerequisite) Determine if the trigger should be set and managed by the Trigger Handler Setting custom metadata type, which will call Komodo Care Connect's out-of-the-box milestone event automation trigger handler, or by a custom implementation.

    1. If choosing the former, create a Trigger Handler Setting (mvn__PJN_Trigger_Handler_Setting__mdt) metadata record for the object that will trigger the automation and set the Class (mvn__PJN_Class__c) field to mvn.PJN_EventAutomationHdlr.

    2. If choosing the latter, implement the custom trigger and call the Event Automation Handler (PJN_EventAutomationHdlr) class.

  3. Create an Event Configuration (mvn__PJN_Event_Configuration__mdt) metadata record. Check the Automation (mvn__PJN_Automation__c) field according to step 2 above.

    1. If the former was chosen, check the Automation field (i.e., set to true).

    2. If the latter was chosen, uncheck the Automation field (i.e., leave as false).

For additional guidance on how to configure a milestone event automation, reference the Example 4, “Create a therapy status update event when a patient is eligible for PAP below.

Example 4. Create a therapy status update event when a patient is eligible for PAP

This example configuration creates an Event record of the Therapy Status Update record type when a patient in a fictitious care program called Kalytex (KTX) is deemed eligible for a Patient Assistance Program (PAP). The configuration uses a Trigger Handler Setting metadata record to call the Event Automation Handler class when an Assistance Program (mvn__PJN_Assistance_Program__c) record is updated. The Event Automation Handler then retrieves the Event Configuration metadata record to check that the Assistance Program record is of the Patient Assistance Program (PJN_Patient_Assistance_Program) record type and has an Outcome (mvn__PJN_Outcome__c) value of Eligible.

If the Assistance Program record that had triggered the milestone event automation feature meets the given criteria on the Event Configuration metadata record, a new Event record of the Therapy Status Update record type will be created with a Pending status and a PAP Complete sub-status.

Table 143. Sample mvn__PJN_Trigger_Handler_Setting__mdt record for Assistance Program object 

Field label

Sample value

Active

true

Class

mvn.PJN_EventAutomationHdlr

Event

AFTER_UPDATE

SObject API Name

mvn__PJN_Assistance_Program__c



Table 144. Sample mvn__PJN_Event_Configuration__mdt record for Assistance Program object

Field label

Sample value

Automation

true

Care Plan Id Field

mvn__PJN_Care_Plan__c

Entry Criteria

{
  "AllTrue": [
    {
      "path": "mvn__PJN_Record_Type__c",
      "operator": "Equals",
      "value": "Patient Assistance Program"
    },
    {
      "path": "mvn__PJN_Outcome__c",
      "operator": "Equals",
      "value": "Eligible"
    }
  ]
}

Patient Id Field

mvn__PJN_Account__c

Record Type

PJN_Therapy_Status_Update

sObject Name

mvn__PJN_Assistance_Program__c

Status Field

mvn__PJN_New_Therapy_Status__c

Status Value

Pending

Sub-Status Field

mvn__PJN_New_Therapy_Sub_Status__c

Sub-Status Value

PAP Complete





Event rollup

Events such as therapy status updates and pharmacy status updates can be rolled up to their parent care plans via the Event Rollup (mvn__PJN_Event_Rollup__mdt) and Event Rollup Mapping (mvn__PJN_Event_Rollup_Mapping__mdt) custom metadata types. Once configured, the PJN_After_Insert_EventTrigger Handler Setting (mvn__PJN_Trigger_Handler_Setting__mdt) metadata record will subsequently call the PJN_EventHdlr class to roll up the values from the defined Event record types to the parent Case records.

Note

The last record inserted of each defined Event record type is what gets mapped to the parent Case record.

To configure an event rollup for a specific Event record type:

  1. Create an Event Rollup (mvn__PJN_Event_Rollup__mdt) metadata record.

  2. Create an Event Rollup Mapping (mvn__PJN_Event_Rollup_Mapping__mdt) metadata record and relate it to the Event Rollup metadata record created in step 1.

Example 5. Therapy status update

The following metadata records are an example of how therapy status update events can be configured to roll up to their parent care plans.

Table 145. Sample therapy status update mvn__PJN_Event_Rollup__mdt metadata record

Field label

Sample value

Event Record Type

PJN_Therapy_Status_Update



Table 146. Sample therapy status update mvn__PJN_Event_Rollup_Mapping__mdt metadata record

Field label

Sample value

Event Rollup

The Event Rollup (mvn__PJN_Event_Rollup__mdt) metadata record created above.

Source Event Field

mvn__PJN_New_Therapy_Status__c

Target Case Field

mvn__PJN_Therapy_Status__c





Example 6. Pharmacy status update

The following metadata records are an example of how pharmacy status update events can be configured to roll up to their parent care plans.

Table 147. Sample pharmacy status update mvn__PJN_Event_Rollup__mdt metadata record

Field label

Sample value

Event Record Type

PJN_Pharmacy_Status_Update



Table 148. Sample pharmacy status update mvn__PJN_Event_Rollup_Mapping__mdt metadata record

Field label

Sample value

Event Rollup

The Event Rollup (mvn__PJN_Event_Rollup__mdt) metadata record created above.

Source Event Field

mvn__PJN_New_Pharmacy_Status__c

Target Case Field

mvn__PJN_Pharmacy_Status__c