Creating an Event Strategy that detects dropped calls
7 Tasks
15 mins
Beginner
Pega Platform '24.2
English
Scenario
U+ Comms, a sizable telecommunications company, aims to promptly assist customers who often experience dropped calls. Recent survey data indicates that customers who encounter multiple dropped calls within a week are likely to switch to a competitor. The survey also revealed that customers are particularly dissatisfied when calls are dropped quickly.
To identify these dropped calls, you develop an Event Strategy that detects the second dropped call with a duration of less than five minutes within a five-day period. A secondary requirement is for the Event Strategy to detect the third dropped call within a one-week period, regardless of the call's duration. When the Event strategy detects these events, it must emit once a day.
Create the Detect Dropped Calls Event Strategy in the Sample-Data-CallDetailRecords Class, and confirm that it meets the requirements.
The Class uses the following data structure:
Field | Type | Description |
---|---|---|
Call Detail Record ID |
Identifier |
A unique identifier for every incoming record |
Completion Status |
Text |
A text field that can hold a description of how the call ends (Dropped / Completed) |
Duration |
Integer |
The duration of the call |
Phone Number |
Identifier |
The number of the phone |
Time Of Call |
DateTime |
The time when the call took place. |
Use the following credentials to log in to the exercise system:
Role | User name | Password |
---|---|---|
System architect | SystemArchitect | rules |
Your assignment consists of the following tasks:
Task 1: Create the Dropped Calls Event Strategy
Create an Event Strategy named Detect Dropped Calls and configure the Real-time data component. Use the PhoneNumber field as the Event Key, and use the TimeOfCall field for the Event time.
Task 2: Filter dropped calls
Filter out irrelevant events. Add a Filter component that only propagates dropped calls. Use the CompletionStatus field to identify dropped calls.
Task 3: Add a Split component to apply multiple windows
Add a Split component to separately analyze calls that were dropped within five minutes, as well as all dropped calls. In the primary path, add a Filter component to select dropped calls with a duration of less than 5 minutes.
Task 4: Count the short, dropped calls in a Sliding Window
In the primary path, add a Sliding window of 5 days, and then aggregate the count of the short, dropped calls as CountShortCalls.
Task 5: Filter two short, dropped calls in a 5-day Window
In the primary path, add a Filter component that uses the CountShortCalls field to filter the second short, dropped call in a 5-day Window.
Task 6: Count all dropped calls in a Sliding Window
In the secondary path, add a 7-day Sliding window, and then aggregate the count of the dropped calls as CountCalls.
Task 7: Filter 3 dropped calls in a 7-day Window
In the secondary path, add a Filter component that uses the CountCalls field to filter the third dropped call in a 7-day Window.
Challenge Walkthrough
Detailed Tasks
1 Create the Dropped Calls Event Strategy
- Log in as the system architect:
- In the User name field, enter SystemArchitect.
- In the Password field, enter rules.
- In the navigation pane of Dev Studio, click App to open the Application Explorer.
- In the Application Explorer, search for the Sample-Data-CallDetailRecords Class.
- In the Application Explorer, right-click on Sample-Data-CallDetailRecords Class, then select Create > Decision> Event Strategy.
- On the Create Event Strategy tab, create a new Event Strategy:
- In the Label field, enter Detect Dropped Calls.
- In the upper-right corner, click Create and open.
- On the canvas, double-click the Real-time data component to set up the Real-time data properties:
- In the Name field, enter Call Detail Records Stream.
- In the Event key list, select PhoneNumber.
- In the Event timestamp section, select the Event time radio button, and then, in the Field field, select TimeOfCall.
- Click Submit.
2 Filter dropped calls
- On the canvas, on the first component, click Add > Filter to add a new Filter component.
- On the canvas, double-click the Filter component to set up the Filter properties:
- In the Name field, enter Filter Dropped Calls.
- In the Filter conditions section, click Add Condition to define a new condition.
- In the first field, select CompletionStatus.
- In the Operator list, select =.
- In the Expression field, enter "Dropped".
- Click Submit.
3 Add a Split component to apply multiple windows
- On the canvas, on the Filter Dropped Calls component, click Add > Split to add a Split component.
Tip: The connector that radiates from the Split component always leads to the Emit component. This means that the events from individual paths are not combined prior to being emitted. In each path of a split, the final component sets a field called "Event Type". This field can be utilized further in a Data Flow, enableing users to take additional actions for different types of events.
- On the Split component, in the primary path, click Add > Filter to add a new Filter component.
- On the canvas, double-click the Filter component to set up the Filter properties:
- In the Name field, enter Filter Short Calls.
- In the Filter conditions section, click Add Condition to define a new condition.
- In the first field, select Duration.
- In the Operator list, select <.
- In the Expression field, enter 5.
- Click Submit.
4 Count the short, dropped calls in a Sliding Window
- On the Filter Short Calls component, click Add > Window to add a new Window component.
- On the canvas, double-click the Window component to set up the Window properties:
- In the Name field, enter Sliding 5-Day Window.
- In the Window section, confirm that the Sliding radio button is selected.
- In the Look for last field, enter 5, and then select Days in the drop-down list.
- Click Submit.
- On the Sliding 5-Day Window component, click Add > Aggregate to add a new Aggregate component.
- On the canvas, double-click the Aggregate component to set up the Aggregate properties:
- In the Name field, enter Count Short Calls.
- In the Aggregations section, click Add aggregation.
- In the first list, select Count.
- In the Aggregate column, enter CountShortCalls.
- Click Submit.
5 Filter two short, dropped calls in a 5-day Window
- On the Count Short Calls component, click Add > Filter to add a new Filter component.
- On the canvas, double-click the Filter component to set up the Filter properties:
- In the Name field, enter 2 Short Dropped Calls.
- In the Filter conditions section, click Add Condition to define a new condition.
- In the first field, select CountShortCalls.
- In the Operator list, select =.
- In the Expression field, enter 2.
- Click Submit.
6 Count all dropped calls in a Sliding Window
- On the secondary path of the Split component, click Add > Window to add a new Window component.
- On the canvas, double-click the Window component to set up the Window properties:
- In the Name field, enter Sliding 7-Day Window.
- In the Window section, confirm that the Sliding radio button is selected.
- In the Look for last field, enter 7, and then select Days in the drop-down list.
- Click Submit.
- On the Sliding 7-Day Window component, click Add > Aggregate to add a new Aggregate component.
- On the canvas, double-click the Aggregate component to set up the Aggregate properties:
- In the Name field, enter Count Calls.
- In the Aggregations section, click Add aggregation.
- In the first list, select Count.
- In the Aggregate column, enter CountCalls.
- Click Submit.
7 Filter 3 dropped calls in a 7-day Window
- On the Count Calls component, click Add > Filter to add a new Filter component.
- On the canvas, double-click the Filter component to set up the Filter properties:
- In the Name field, enter 3 Dropped Calls.
- In the Filter conditions section, click Add Condition to define a new condition.
- In the first field, select CountCalls.
- In the Operator list, select =.
- In the Expression field, enter 3.
- Click Submit.
- On the canvas, double-click the Emit component to review the Emit properties.
- In the Emit event list, select Only once for every 1 day.
Tip: When the As it happens option is selected, the events and all calculated fields are emitted as soon as they occur. The Only once option lets you emit events in a given time interval.
- In the Emit event list, select Only once for every 1 day.
- Click Submit.
- In the upper-right corner, click Save.
Confirm your work
- On the Event Strategy: Sliding Event Window rule form, in the upper-right corner, click Actions > Run to open the Run window.
- In the Run window, use the following values to send a short, dropped call to the Event Strategy:
- Number of events to send: 1
- PhoneNumber: 111-1111
- TimeOfCall: Select today
- CompletionStatus: Dropped
- Duration: 3
- In the upper-right corner, click Run to send an event to the Event Strategy, and then analyze the results:
- The Sent events (1) section now has a single page.
- The Emitted events (0) section has no pages yet.
- Advance the TimeOfCall by one day, and then click Run to send a second event to the Event Strategy.
- The Sent events (2) section now has two pages.
- The Emitted events (1) section has one emitted event. The event type is the detection of 2 short, dropped calls in a 5-day Window.
- Change the TimeOfCall to two weeks from today, and then click Run to send a third event to the Event Strategy.
- The Sent events (3) section now has three pages.
- The Emitted events (1) section has one emitted event.
- Advance the TimeOfCall by one day, and then click Run to send a fourth event to the Event Strategy.
- The Sent events (4) section now has four pages.
- The Emitted events (2) section now has a second emitted event in the new 7-day Window.
- Click Clear events, and then use the following values to send two longer dropped calls to the Event Strategy:
- Number of events to send: 2
- PhoneNumber: 222-2222
- TimeOfCall: today
- CompletionStatus: Dropped
- Duration: 20
- Click Run, and then analyze the results:
- The Sent events (2) section now has two pages.
- The Emitted events (0) section has no emitted event.
- Change the Number of events to send to 1 and the Duration to 3 to send a short, dropped call to the Event strategy, and then analyze the results:
- The Sent events (3) section now has three pages.
- The Emitted events (1) section now has an emitted event. The event type is the detection of 3 dropped calls in a 7-day Window, irrespective of the duration of the calls.
This Challenge is to practice what you learned in the following Module:
Available in the following mission:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?