Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Pull in EVL total numbers from the spreadsheet
Browse files Browse the repository at this point in the history
Previously, we were only taking the successful numbers. We need the
totals in order to calculate completion rate.
  • Loading branch information
alexmuller committed Aug 27, 2013
1 parent 0e63644 commit 6de9441
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
21 changes: 14 additions & 7 deletions backdrop/contrib/evl_upload_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ def failure(service_type, reason, failures, description, timestamp):

def channel_volumetrics(rows):
rows = list(rows)
yield ["_timestamp", "_id", "successful_agent", "successful_ivr",
"successful_web"]
yield ["_timestamp", "_id",
"successful_agent", "successful_ivr", "successful_web",
"total_agent", "total_ivr", "total_web"]

for column in range(1, 8):
all = rows[5][column]
Expand All @@ -106,12 +107,18 @@ def channel_volumetrics(rows):
return

date = rows[1][column]
agent = rows[2][column]
ivr = rows[3][column]
web = rows[4][column]

yield [date, parse_time_as_utc(date).date().isoformat(), agent, ivr,
web]
agent_successful = rows[2][column]
ivr_successful = rows[3][column]
web_successful = rows[4][column]

agent_total = rows[6][column]
ivr_total = rows[7][column]
web_total = rows[8][column]

yield [date, parse_time_as_utc(date).date().isoformat(),
agent_successful, ivr_successful, web_successful,
agent_total, ivr_total, web_total]


def customer_satisfaction(rows):
Expand Down
4 changes: 2 additions & 2 deletions features/contrib/evl_upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Feature: EVL Upload
then the platform should have "2" items stored in "evl_channel_volumetrics"
and the "evl_channel_volumetrics" bucket should have items:
"""
{"_timestamp": "2013-07-29T00:00:00+00:00", "_id": "2013-07-29", "successful_agent": 100.0, "successful_ivr": 101.0, "successful_web": 102.0}
{"_timestamp": "2013-07-30T00:00:00+00:00", "_id": "2013-07-30", "successful_agent": 101.0, "successful_ivr": 102.0, "successful_web": 103.0}
{"_timestamp": "2013-07-29T00:00:00+00:00", "_id": "2013-07-29", "successful_agent": 100.0, "successful_ivr": 101.0, "successful_web": 102.0, "total_agent": 200.0, "total_ivr": 201.0, "total_web": 202.0}
{"_timestamp": "2013-07-30T00:00:00+00:00", "_id": "2013-07-30", "successful_agent": 101.0, "successful_ivr": 102.0, "successful_web": 103.0, "total_agent": 201.0, "total_ivr": 202.0, "total_web": 203.0}
"""

Scenario: Upload customer satisfaction
Expand Down
10 changes: 7 additions & 3 deletions tests/contrib/test_evl_upload_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,17 @@ def test_converts_channel_volumetrics_raw_data_to_normalised_data(self):
[["IVR successful", 30, 40, '']] + \
[["WEB successful", 40, 50, '']] + \
[["Total successful all channels", 40, 50, 0]] + \
[["Agent total", 60, 30, '']] + \
[["IVR total", 20, 40, '']] + \
[["Web total", 70, 10, '']] + \
[["Total all channels", 150, 80, 0]] + \
self.ignore_rows(17)

data = list(channel_volumetrics(volumetrics_raw_data))

assert_that(data, is_([["_timestamp", "_id", "successful_agent", "successful_ivr", "successful_web"],
[monday, "2013-07-29", 10, 30, 40],
[tuesday, "2013-07-30", 20, 40, 50]]))
assert_that(data, is_([["_timestamp", "_id", "successful_agent", "successful_ivr", "successful_web", "total_agent", "total_ivr", "total_web"],
[monday, "2013-07-29", 10, 30, 40, 60, 20, 70],
[tuesday, "2013-07-30", 20, 40, 50, 30, 40, 10]]))

def test_converts_customer_satisfaction_raw_data_to_normalised_data(self):
may = d_tz(2013, 5, 1)
Expand Down

0 comments on commit 6de9441

Please sign in to comment.