Skip to main content

Creating an Event Strategy that detects dropped calls

7 Tasks

15 mins

Visible to: All users
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.

 

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Create the Dropped Calls Event Strategy

  1. Log in as the system architect:
    1. In the User name field, enter SystemArchitect.
    2. In the Password field, enter rules.
  2. In the navigation pane of Dev Studio, click App to open the Application Explorer.
  3. In the Application Explorer, search for the Sample-Data-CallDetailRecords Class.
  4. In the Application Explorer, right-click on Sample-Data-CallDetailRecords Class, then select Create > Decision> Event Strategy.
  5. On the Create Event Strategy tab, create a new Event Strategy:
    1. In the Label field, enter Detect Dropped Calls.
    2. In the upper-right corner, click Create and open.
  6. On the canvas, double-click the Real-time data component to set up the Real-time data properties:
    1. In the Name field, enter Call Detail Records Stream.
    2. In the Event key list, select PhoneNumber.
    3. In the Event timestamp section, select the Event time radio button, and then, in the Field field, select TimeOfCall.
    4. Click Submit.
      Event Strategy step 1

2 Filter dropped calls

  1. On the canvas, on the first component, click Add > Filter to add a new Filter component.
  2. On the canvas, double-click the Filter component to set up the Filter properties:
    1. In the Name field, enter Filter Dropped Calls.
    2. In the Filter conditions section, click Add Condition to define a new condition.
    3. In the first field, select CompletionStatus.
    4. In the Operator list, select =.
    5. In the Expression field, enter "Dropped".
  3. Click Submit.
    Event Strategy step 2

3 Add a Split component to apply multiple windows

  1. 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.
  1. On the Split component, in the primary path, click Add > Filter to add a new Filter component.
    Event Strategy step 3
  2. On the canvas, double-click the Filter component to set up the Filter properties:
    1. In the Name field, enter Filter Short Calls.
    2. In the Filter conditions section, click Add Condition to define a new condition.
    3. In the first field, select Duration.
    4. In the Operator list, select <.
    5. In the Expression field, enter 5.
  3. Click Submit.
    Event Strategy step 4

4 Count the short, dropped calls in a Sliding Window

  1. On the Filter Short Calls component, click Add > Window to add a new Window component.
  2. On the canvas, double-click the Window component to set up the Window properties:
    1. In the Name field, enter Sliding 5-Day Window.
    2. In the Window section, confirm that the Sliding radio button is selected.
    3. In the Look for last field, enter 5, and then select Days in the drop-down list.
  3. Click Submit.
    Event Strategy step 5
  4. On the Sliding 5-Day Window component, click Add > Aggregate to add a new Aggregate component.
  5. On the canvas, double-click the Aggregate component to set up the Aggregate properties:
    1. In the Name field, enter Count Short Calls.
    2. In the Aggregations section, click Add aggregation.
    3. In the first list, select Count.
    4. In the Aggregate column, enter CountShortCalls.
  6. Click Submit.
    Event Strategy step 6

5 Filter two short, dropped calls in a 5-day Window

  1. On the Count Short Calls component, click Add > Filter to add a new Filter component.
  2. On the canvas, double-click the Filter component to set up the Filter properties:
    1. In the Name field, enter 2 Short Dropped Calls.
    2. In the Filter conditions section, click Add Condition to define a new condition.
    3. In the first field, select CountShortCalls.
    4. In the Operator list, select =.
    5. In the Expression field, enter 2.
  3. Click Submit.
    Event Strategy step 7

6 Count all dropped calls in a Sliding Window

  1. On the secondary path of the Split component, click Add > Window to add a new Window component.
  2. On the canvas, double-click the Window component to set up the Window properties:
    1. In the Name field, enter Sliding 7-Day Window.
    2. In the Window section, confirm that the Sliding radio button is selected.
    3. In the Look for last field, enter 7, and then select Days in the drop-down list.
  3. Click Submit.
    Event Strategy step 8
  4. On the Sliding 7-Day Window component, click Add > Aggregate to add a new Aggregate component.
  5. On the canvas, double-click the Aggregate component to set up the Aggregate properties:
    1. In the Name field, enter Count Calls.
    2. In the Aggregations section, click Add aggregation.
    3. In the first list, select Count.
    4. In the Aggregate column, enter CountCalls.
  6. Click Submit.
    Event Strategy step 9

7 Filter 3 dropped calls in a 7-day Window

  1. On the Count Calls component, click Add > Filter to add a new Filter component.
  2. On the canvas, double-click the Filter component to set up the Filter properties:
    1. In the Name field, enter 3 Dropped Calls.
    2. In the Filter conditions section, click Add Condition to define a new condition.
    3. In the first field, select CountCalls.
    4. In the Operator list, select =.
    5. In the Expression field, enter 3.
  3. Click Submit.
    Event Strategy step 10
  4. On the canvas, double-click the Emit component to review the Emit properties.
    1. 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.
  1. Click Submit.
  2. In the upper-right corner, click Save.

Confirm your work

  1. On the Event Strategy: Sliding Event Window rule form, in the upper-right corner, click Actions > Run to open the Run window.
  2. In the Run window, use the following values to send a short, dropped call to the Event Strategy:
    1. Number of events to send: 1
    2. PhoneNumber: 111-1111
    3. TimeOfCall: Select today
    4. CompletionStatus: Dropped
    5. Duration: 3
  3. In the upper-right corner, click Run to send an event to the Event Strategy, and then analyze the results:
    1. The Sent events (1) section now has a single page.
    2. The Emitted events (0) section has no pages yet.
  4. Advance the TimeOfCall by one day, and then click Run to send a second event to the Event Strategy.
    1. The Sent events (2) section now has two pages.
    2. 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.
      2 short dropped calls
  5. Change the TimeOfCall to two weeks from today, and then click Run to send a third event to the Event Strategy.
    1. The Sent events (3) section now has three pages.
    2. The Emitted events (1) section has one emitted event.
  6. Advance the TimeOfCall by one day, and then click Run to send a fourth event to the Event Strategy.
    1. The Sent events (4) section now has four pages.
    2. The Emitted events (2) section now has a second emitted event in the new 7-day Window.
      New Window
  7. Click Clear events, and then use the following values to send two longer dropped calls to the Event Strategy:
    1. Number of events to send: 2
    2. PhoneNumber: 222-2222
    3. TimeOfCall: today
    4. CompletionStatus: Dropped
    5. Duration: 20
  8. Click Run, and then analyze the results:
    1. The Sent events (2) section now has two pages.
    2. The Emitted events (0) section has no emitted event.
  9. 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:
    1. The Sent events (3) section now has three pages.
    2. 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.
      3 dropped 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.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice