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
30 changes: 27 additions & 3 deletions lib/reporting/identity_verification_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module Events
IDV_DOC_AUTH_WELCOME_SUBMITTED = 'IdV: doc auth welcome submitted'
IDV_DOC_AUTH_GETTING_STARTED = 'IdV: doc auth getting_started visited'
IDV_DOC_AUTH_IMAGE_UPLOAD = 'IdV: doc auth image upload vendor submitted'
IDV_DOC_AUTH_SOCURE_VERIFICATION_DATA = 'idv_socure_verification_data_requested'
IDV_DOC_AUTH_VERIFY_RESULTS = 'IdV: doc auth verify proofing results'
IDV_PHONE_FINDER_RESULTS = 'IdV: phone confirmation vendor'
IDV_FINAL_RESOLUTION = 'IdV: final resolution'
Expand Down Expand Up @@ -116,6 +117,7 @@ def as_csv
csv << ['IDV started', idv_started]
csv << ['Welcome Submitted', idv_doc_auth_welcome_submitted]
csv << ['Image Submitted', idv_doc_auth_image_vendor_submitted]
csv << ['Socure Verification Data Requested', idv_doc_auth_socure_verification_data_requested]
csv << []
csv << ['Workflow completed', idv_final_resolution]
csv << ['Workflow completed - With Phone Number', idv_final_resolution_verified]
Expand Down Expand Up @@ -172,7 +174,8 @@ def intent_proofing_rate
end

def actual_proofing_rate
successfully_verified_users.to_f / idv_doc_auth_image_vendor_submitted
denom = idv_doc_auth_image_vendor_submitted + idv_doc_auth_socure_verification_data_requested
successfully_verified_users.to_f / denom
end

def industry_proofing_rate
Expand Down Expand Up @@ -280,6 +283,10 @@ def idv_doc_auth_image_vendor_submitted
data[Events::IDV_DOC_AUTH_IMAGE_UPLOAD].count
end

def idv_doc_auth_socure_verification_data_requested
data[Events::IDV_DOC_AUTH_SOCURE_VERIFICATION_DATA].count
end

def idv_doc_auth_welcome_submitted
data[Events::IDV_DOC_AUTH_WELCOME_SUBMITTED].count
end
Expand Down Expand Up @@ -338,7 +345,24 @@ def data

case event
when Events::IDV_FINAL_RESOLUTION
users[Results::IDV_FINAL_RESOLUTION_VERIFIED] << user_id if row['identity_verified'] == '1'
# We are counting users for each of the final resolution events, but we need to consider
# the various combinations of pending states and fraud review status.
# The logic is as follows (listed in the order they are checked):
#
# | fraud_review_pending | gpo_verification_pending | in_person_verification_pending | IDV_FINAL_RESOLUTION_ |
# |----------------------|--------------------------|--------------------------------|----------------------------|
# | false | false | false | VERIFIED |
# | true | false | false | FRAUD_REVIEW |
# | false | true | false | GPO |
# | true | true | false | GPO_FRAUD_REVIEW |
# | false | false | true | IN_PERSON |
# | true | false | true | IN_PERSON_FRAUD_REVIEW |
# | false | true | true | GPO_IN_PERSON |
# | true | true | true | GPO_IN_PERSON_FRAUD_REVIEW |
#
# The `profile_not_pending` flag indicates that the three pending possibilities are
# all false AND there is not a deactivation reason recorded.
users[Results::IDV_FINAL_RESOLUTION_VERIFIED] << user_id if row['profile_not_pending'] == '1'

if !gpo_verification_pending && !in_person_verification_pending
users[Results::IDV_FINAL_RESOLUTION_FRAUD_REVIEW] << user_id if fraud_review_pending
Expand Down Expand Up @@ -426,7 +450,7 @@ def query
, ispresent(properties.event_properties.deactivation_reason) AS has_other_deactivation_reason
, properties.event_properties.success = '0' AND properties.event_properties.doc_auth_result NOT IN ['Failed', 'Attention'] AS doc_auth_failed_non_fraud
| fields
!fraud_review_pending and !gpo_verification_pending and !in_person_verification_pending and !has_other_deactivation_reason AS identity_verified
!fraud_review_pending and !gpo_verification_pending and !in_person_verification_pending and !has_other_deactivation_reason AS profile_not_pending
| limit 10000
QUERY
end
Expand Down
1 change: 1 addition & 0 deletions lib/reporting/proofing_rate_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def as_csv
csv << ['IDV Started', *reports.map(&:idv_started)]
csv << ['Welcome Submitted', *reports.map(&:idv_doc_auth_welcome_submitted)]
csv << ['Image Submitted', *reports.map(&:idv_doc_auth_image_vendor_submitted)]
csv << ['Socure', *reports.map(&:idv_doc_auth_socure_verification_data_requested)]
csv << ['Successfully Verified', *reports.map(&:successfully_verified_users)]
csv << ['IDV Rejected (Non-Fraud)', *reports.map(&:idv_doc_auth_rejected)]
csv << ['IDV Rejected (Fraud)', *reports.map(&:idv_fraud_rejected)]
Expand Down
17 changes: 10 additions & 7 deletions spec/lib/reporting/identity_verification_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
{ 'user_id' => 'user1', 'name' => 'IdV: doc auth verify proofing results', 'success' => '1' },
{ 'user_id' => 'user1', 'name' => 'IdV: phone confirmation vendor', 'success' => '0' },
{ 'user_id' => 'user1', 'name' => 'IdV: phone confirmation vendor', 'success' => '1' },
{ 'user_id' => 'user1', 'name' => 'IdV: final resolution', 'identity_verified' => '1' },
{ 'user_id' => 'user1', 'name' => 'IdV: final resolution', 'profile_not_pending' => '1' },

# Letter requested user (incomplete)
{ 'user_id' => 'user2', 'name' => 'IdV: doc auth welcome visited' },
{ 'user_id' => 'user2', 'name' => 'IdV: doc auth welcome submitted' },
{ 'user_id' => 'user2',
'name' => 'IdV: doc auth image upload vendor submitted',
'name' => 'idv_socure_verification_data_requested',
'success' => '1' },
{ 'user_id' => 'user2',
'name' => 'IdV: final resolution',
Expand Down Expand Up @@ -113,7 +113,8 @@
[],
['IDV started', 7],
['Welcome Submitted', 6],
['Image Submitted', 6],
['Image Submitted', 5],
['Socure Verification Data Requested', 1],
[],
['Workflow completed', 5],
['Workflow completed - With Phone Number', 1],
Expand Down Expand Up @@ -157,7 +158,8 @@
[],
['IDV started', '7'],
['Welcome Submitted', '6'],
['Image Submitted', '6'],
['Image Submitted', '5'],
['Socure Verification Data Requested', '1'],
[],
['Workflow completed', '5'],
['Workflow completed - With Phone Number', '1'],
Expand Down Expand Up @@ -194,7 +196,8 @@
expect(report.data.transform_values(&:count)).to eq(
# events
'GetUspsProofingResultsJob: Enrollment status updated' => 1,
'IdV: doc auth image upload vendor submitted' => 6,
'IdV: doc auth image upload vendor submitted' => 5,
'idv_socure_verification_data_requested' => 1,
'IdV: doc auth verify proofing results' => 1,
'IdV: doc auth welcome submitted' => 6,
'IdV: doc auth welcome visited' => 7,
Expand Down Expand Up @@ -421,11 +424,11 @@
[
{ 'user_id' => 'user1',
'name' => 'IdV: final resolution',
'identity_verified' => '1',
'profile_not_pending' => '1',
'service_provider' => 'issuer1' },
{ 'user_id' => 'user2',
'name' => 'IdV: final resolution',
'identity_verified' => '1',
'profile_not_pending' => '1',
'service_provider' => 'issuer2' },
{ 'user_id' => 'user4',
'name' => 'IdV: final resolution',
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/reporting/proofing_rate_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
industry_proofing_rate: 0.5,
idv_started: 4,
idv_doc_auth_welcome_submitted: 3,
idv_doc_auth_socure_verification_data_requested: 0,
idv_doc_auth_image_vendor_submitted: 2,
successfully_verified_users: 1,
idv_doc_auth_rejected: 1,
Expand All @@ -35,6 +36,7 @@
industry_proofing_rate: 0.6666666666666666,
idv_started: 5,
idv_doc_auth_welcome_submitted: 4,
idv_doc_auth_socure_verification_data_requested: 0,
idv_doc_auth_image_vendor_submitted: 3,
successfully_verified_users: 2,
idv_doc_auth_rejected: 1,
Expand All @@ -50,6 +52,7 @@
idv_started: 6,
idv_doc_auth_welcome_submitted: 5,
idv_doc_auth_image_vendor_submitted: 4,
idv_doc_auth_socure_verification_data_requested: 0,
successfully_verified_users: 3,
idv_doc_auth_rejected: 1,
idv_fraud_rejected: 2,
Expand All @@ -68,6 +71,7 @@
['IDV Started', 4, 5, 6],
['Welcome Submitted', 3, 4, 5],
['Image Submitted', 2, 3, 4],
['Socure', 0, 0, 0],
['Successfully Verified', 1, 2, 3],
['IDV Rejected (Non-Fraud)', 1, 1, 1],
['IDV Rejected (Fraud)', 0, 1, 2],
Expand Down