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
20 changes: 15 additions & 5 deletions lib/reporting/identity_verification_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module Events
GPO_VERIFICATION_SUBMITTED = 'IdV: enter verify by mail code submitted'
GPO_VERIFICATION_SUBMITTED_OLD = 'IdV: GPO verification submitted'
USPS_ENROLLMENT_STATUS_UPDATED = 'GetUspsProofingResultsJob: Enrollment status updated'
FRAUD_REVIEW_PASSED = 'Fraud: Profile review passed'

def self.all_events
constants.map { |c| const_get(c) }
Expand Down Expand Up @@ -91,10 +92,11 @@ def to_csv
csv << ['Workflow completed - In-Person Pending', idv_final_resolution_in_person]
csv << ['Workflow completed - Fraud Review Pending', idv_final_resolution_fraud_review]
csv << []
csv << ['Succesfully verified', successfully_verified_users]
csv << ['Succesfully verified - Inline', idv_final_resolution_verified]
csv << ['Succesfully verified - GPO Code Entry', gpo_verification_submitted]
csv << ['Succesfully verified - In Person', usps_enrollment_status_updated]
csv << ['Successfully verified', successfully_verified_users]
csv << ['Successfully verified - Inline', idv_final_resolution_verified]
csv << ['Successfully verified - GPO Code Entry', gpo_verification_submitted]
csv << ['Successfully verified - In Person', usps_enrollment_status_updated]
csv << ['Successfully verified - Passed Fraud Review', fraud_review_passed]
end
end

Expand Down Expand Up @@ -149,7 +151,8 @@ def usps_enrollment_status_updated
end

def successfully_verified_users
idv_final_resolution_verified + gpo_verification_submitted + usps_enrollment_status_updated
idv_final_resolution_verified + gpo_verification_submitted + usps_enrollment_status_updated +
fraud_review_passed
Comment on lines 153 to +155
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In CloudWatch, I see that the Fraud: Profile review passed rows have the computed value identity_verified set to 1, so I checked whether adding the fraud_review_passed count here will double count them. Looks like identity_verified is only used for the final_resolution event, so the code should work as is. Tests pass.

end

def idv_started
Expand All @@ -175,6 +178,10 @@ def idv_doc_auth_rejected
).count
end

def fraud_review_passed
data[Events::FRAUD_REVIEW_PASSED].count
end

# rubocop:disable Layout/LineLength
# Turns query results into a hash keyed by event name, values are a count of unique users
# for that event
Expand Down Expand Up @@ -230,6 +237,7 @@ def query
],
),
idv_final_resolution: quote(Events::IDV_FINAL_RESOLUTION),
fraud_review_passed: quote(Events::FRAUD_REVIEW_PASSED),
}

format(<<~QUERY, params)
Expand All @@ -243,6 +251,8 @@ def query
or (name != %{usps_enrollment_status_updated})
| filter (name in %{gpo_verification_submitted} and properties.event_properties.success = 1 and !properties.event_properties.pending_in_person_enrollment and !properties.event_properties.fraud_check_failed)
or (name not in %{gpo_verification_submitted})
| filter (name = %{fraud_review_passed} and properties.event_properties.success = 1)
or (name != %{fraud_review_passed})
| fields
coalesce(properties.event_properties.fraud_review_pending, 0) AS fraud_review_pending
, coalesce(properties.event_properties.gpo_verification_pending, 0) AS gpo_verification_pending
Expand Down
11 changes: 7 additions & 4 deletions spec/lib/reporting/identity_verification_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{ 'user_id' => 'user3', 'name' => 'IdV: doc auth welcome submitted' },
{ 'user_id' => 'user3', 'name' => 'IdV: doc auth image upload vendor submitted', 'success' => '1' },
{ 'user_id' => 'user3', 'name' => 'IdV: final resolution', 'fraud_review_pending' => '1' },
{ 'user_id' => 'user3', 'name' => 'Fraud: Profile review passed', 'success' => '1' },

# Success through address confirmation user
{ 'user_id' => 'user4', 'name' => 'IdV: GPO verification submitted' },
Expand Down Expand Up @@ -80,10 +81,11 @@
['Workflow completed - In-Person Pending', '1'],
['Workflow completed - Fraud Review Pending', '1'],
[],
['Succesfully verified', '3'],
['Succesfully verified - Inline', '1'],
['Succesfully verified - GPO Code Entry', '1'],
['Succesfully verified - In Person', '1'],
['Successfully verified', '4'],
['Successfully verified - Inline', '1'],
['Successfully verified - GPO Code Entry', '1'],
['Successfully verified - In Person', '1'],
['Successfully verified - Passed Fraud Review', '1'],
]

aggregate_failures do
Expand Down Expand Up @@ -115,6 +117,7 @@
'IdV Reject: Doc Auth' => 3,
'IdV Reject: Phone Finder' => 1,
'IdV Reject: Verify' => 1,
'Fraud: Profile review passed' => 1,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an "event", like a literal CW event name right? so we put it up above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the guidance. I was trying to figure out the patterns here, and adding success = 1 to the query is what I was missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the code to print out the query and then tested it out in cloudwatch. Fixed one problem, thanks for the suggestion.

)
end
end
Expand Down