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 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 more 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.

In addition to creating events based on milestones, you can also track the amount of time it takes for each milestone to be hit. For more information, reference the Milestone event measurement section 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 156. 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 157. 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





Milestone event measurement

In addition to creating events based on key milestones in a patient’s program journey with the above milestone event automation feature, you can also track the amount of time that a patient takes to go from one milestone event to another, which may be helpful for understanding the velocity of a program journey and measuring the average turnaround time for certain milestones across all patients in a care program. When an Event (mvn__PJN_Event__c) record is created or updated, the Trigger Handler Setting (mvn__PJN_Trigger_Handler_Setting__mdt) custom metadata type calls the non-global PJN_EventMeasurementHdlr Apex class to first check if the Event record contains the record type, status, and sub-status values identified on an Event Configuration (mvn__PJN_Event_Configuration__mdt) metadata record and then evaluate if the Event Configuration metadata record represents a starting or stopping milestone event on any Event Measurement (mvn__PJN_Event_Measurement__mdt) metadata record. If the Event record is determined to be a starting milestone event, then a new Milestone Event Measurement (mvn__PJN_Milestone_Event_Measurement__c) record is created where the Start Event (mvn__PJN_Start_Event__c) field is populated with the Event record and the Status field is set to Open; if the Event record is determined to be a stopping milestone event, then existing Milestone Event Measurement record(s) are updated accordingly such that the Stop Event (mvn__PJN_Stop_Event__c) field is populated with the Event record and the Status field is updated to Closed.

Note

You can use the milestone event measurement functionality even if you do not use the milestone event automation feature. In other words, the Event Configuration metadata records that are referenced by Event Measurement metadata records do not have to be configured for a milestone event automation in order to be used for a milestone event measurement.

Milestone Event Measurement (MEM) records are only created automatically with a starting milestone event and cannot be created manually or with a stopping milestone event. Additionally, every starting event can have one or more stopping events and every stopping event can have one or more starting events, but only a single open MEM record may exist for the same pair of a starting event and a stopping event. This means that if a second starting event occurs after the first stopping event occurs, a new MEM will be created since the previous MEM record will have already been closed, but if a second starting event occurs before the first stopping event occurs, no new MEM record will be created since an open MEM record already exists. The duration fields on every MEM record update automatically with the amount of time that has passed since the starting milestone event. If the MEM record is open, then the time is calculated based on the current date and time; if the MEM record is closed, then the time is calculated based on the stopping milestone event.

To configure the milestone events for which the time in between should be measured and tracked:

  1. Create an Event Configuration metadata record to represent the starting milestone event. Make sure to populate the following fields, which will be used to determine if an Event record identifies as a starting event:

    • Record Type (mvn__PJN_Record_Type__c)

    • Status Field (mvn__PJN_Status_Field__c)

    • Status Value (mvn__PJN_Status_Value__c)

    • Sub-Status Field (mvn__PJN_Sub_Status_Field__c)

    • Sub-Status Value (mvn__PJN_Sub_Status_Value__c)

    Note

    If you already have an existing Event Configuration metadata record created for a milestone event automation, you may use it for this milestone event measurement as well. However, if you do not want to use the milestone event automation feature and only want to create a new Event Configuration metadata record for the milestone event measurement feature, leave the following fields blank:

    • Automation (mvn__PJN_Automation__c)

    • Entry Criteria (mvn__PJN_Entry_Criteria__c)

    • sObject Name (mvn__PJN_sObject_Name__c)

    • Care Plan Id Field (mvn__PJN_Care_Plan_Id_Field__c)

    • Patient Id Field (mvn__PJN_Patient_Id_Field__c)

  2. Repeat step 1 to create another Event Configuration metadata record for the stopping milestone event.

  3. Create an Event Measurement metadata record.

    1. Set the Start Event (mvn__PJN_Start_Event__c) field to the Event Configuration metadata record from step 1.

    2. Set the Stop Event (mvn__PJN_Stop_Event__c) field to the Event Configuration metadata record from step 2.

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 158. Sample therapy status update mvn__PJN_Event_Rollup__mdt metadata record

Field label

Sample value

Event Record Type

PJN_Therapy_Status_Update



Table 159. 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 160. Sample pharmacy status update mvn__PJN_Event_Rollup__mdt metadata record

Field label

Sample value

Event Record Type

PJN_Pharmacy_Status_Update



Table 161. 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