Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 28 additions & 43 deletions lib/reporting/drop_off_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ module Events
IDV_ENTER_PASSWORD_SUBMITTED = 'idv_enter_password_submitted'
OLD_IDV_ENTER_PASSWORD_SUBMITTED = 'IdV: review complete'
IDV_PERSONAL_KEY_SUBMITTED = 'IdV: personal key submitted'
IDV_FINAL_RESOLUTION = 'IdV: final resolution'

def self.all_events
constants.map { |c| const_get(c) }
end
end

module Results
IDV_FINAL_RESOLUTION_VERIFIED = 'IdV: final resolution - Verified'
end

def as_emailable_reports
[
Reporting::EmailableReport.new(
title: 'Proofing Funnel Definitions',
table: proofing_definition_table,
),
Reporting::EmailableReport.new(
title: 'Step Definitions',
table: step_definition_table,
Expand Down Expand Up @@ -215,20 +216,6 @@ def dropoff_metrics_table
denominator: idv_started,
),
],
[
'USPS letter enqueued (event)',
idv_pending_gpo,
dropoff = idv_enter_password_submitted -
idv_pending_gpo,
percent(
numerator: dropoff,
denominator: idv_enter_password_submitted,
),
percent(
numerator: idv_pending_gpo,
denominator: idv_started,
),
],
[
'Verified (event)',
idv_personal_key_submitted,
Expand All @@ -243,34 +230,21 @@ def dropoff_metrics_table
denominator: idv_started,
),
],
]
end

# rubocop:disable Layout/LineLength
def proofing_definition_table
[
['Term', 'Description', 'Definition', 'Calculated'],
[
'Blanket Proofing',
'Full funnel: People who started proofing from welcome screen, successfully got verified credential and encrypted account',
'Percentage of users that successfully proofed over the total number of users that began the proofing process',
'Steps: "Verified" divided by "User agreement"',
],
[
'Actual Proofing',
'Proofing funnel: People that submit and get verified',
'Percentage of users who submitted documents, passed instant verify and phone finder',
'Steps: "Encrypt account: enter password" divided by "Document submitted"',
],
[
'Verified Proofing',
'Proofing + encryption: People that get verified, encypt account and are passed back to Service Provider',
'Number of users who submitted documents, passed instant verify and phone finder, encrypted account, and sent to consent screen for sharing data with Service Provider',
'Steps: "Verified" divided by "Document submitted"',
'Workflow Complete - Total Pending',
idv_final_resolution_total_pending,
],
]
end
# rubocop:enable Layout/LineLength

def idv_final_resolution_total_pending
@idv_final_resolution_total_pending ||=
(data[Events::IDV_FINAL_RESOLUTION] - data[Results::IDV_FINAL_RESOLUTION_VERIFIED]).count
end

def idv_final_resolution_verified
data[Results::IDV_FINAL_RESOLUTION_VERIFIED].count
end

def step_definition_table
[
Expand Down Expand Up @@ -319,6 +293,10 @@ def step_definition_table
'Verified (event)',
'Users who confirm their personal key and complete setting up their verified account',
],
[
'Workflow Complete - Total Pending',
'Total count of users who are pending IDV',
],
]
end

Expand Down Expand Up @@ -374,7 +352,6 @@ def idv_pending_gpo

def as_tables
[
proofing_definition_table,
step_definition_table,
overview_table,
dropoff_metrics_table,
Expand Down Expand Up @@ -427,6 +404,14 @@ def data

fetch_results.each do |row|
event_users[row['name']] << row['user_id']

event = row['name']
case event
when Events::IDV_FINAL_RESOLUTION
if row['identity_verified'] == '1'
event_users[Results::IDV_FINAL_RESOLUTION_VERIFIED] << user_id
end
end
end

event_users
Expand Down
5 changes: 2 additions & 3 deletions spec/lib/reporting/drop_off_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
describe '#to_csvs' do
it 'generates a csv' do
csv_string_list = report.to_csvs
expect(csv_string_list.count).to be 4
expect(csv_string_list.count).to be 3

csvs = csv_string_list.map { |csv| CSV.parse(csv) }

Expand Down Expand Up @@ -135,7 +135,6 @@
def expected_tables(strings: false)
[
# these two tables are static
report.proofing_definition_table,
report.step_definition_table,
[
['Report Timeframe', "#{time_range.begin} to #{time_range.end}"],
Expand All @@ -155,8 +154,8 @@ def expected_tables(strings: false)
['Phone finder (page view)'] + string_or_num(strings, 2, 0, 0.0, 0.4),
['Encrypt account: enter password (page view)'] + string_or_num(strings, 1, 1, 0.5, 0.2),
['Personal key input (page view)'] + string_or_num(strings, 1, 0, 0.0, 0.2),
['USPS letter enqueued (event)'] + string_or_num(strings, 0, 1, 1.0, 0.0),
['Verified (event)'] + string_or_num(strings, 1, 0, 0.0, 0.2),
['Workflow Complete - Total Pending'] + string_or_num(strings, 0),
],
]
end
Expand Down