Skip to content

LG-16022 Create daily ssa accounts report capability#12083

Merged
kevinsmaster5 merged 11 commits intomainfrom
kmas-lg-16022-create-daily-ssa-accounts-report
Apr 23, 2025
Merged

LG-16022 Create daily ssa accounts report capability#12083
kevinsmaster5 merged 11 commits intomainfrom
kmas-lg-16022-create-daily-ssa-accounts-report

Conversation

@kevinsmaster5
Copy link
Copy Markdown
Contributor

@kevinsmaster5 kevinsmaster5 commented Apr 17, 2025

🎫 Ticket

LG-16022

🛠 Summary of changes

Adds a manually-run Rake report that generates a CSV and outputs a comma separated list of accounts that have logged in "yesterday", and share the same ssn_signature (assumed in part to mean they have the same ssn)

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Create at least 2 idv test accounts in your local environment. When those are set up add their identity verification using the same mock SSN.
  • Open the rails console and pick one of those test accounts. Update its last_authenticated_at value to Date.yesterday.middle_of_day
userfoo.identities.last.update(last_authenticated_at: Date.yesterday.middle_of_day)
userfoo.save
  • Take note of the service_provider string on the profile and exit the console
  • run the rake task: rake "duplicate_accounts:report["urn:gov:gsa:openidconnect:sp:sinatra"]"
  • Expect an output to the terminal and a CSV be created in the <site_root>/tmp/duplicate_accounts directory

👀 Screenshots

Screenshot 2025-04-22 at 9 25 15 AM (2)

Screenshot 2025-04-22 at 9 28 24 AM (2)

@kevinsmaster5 kevinsmaster5 marked this pull request as ready for review April 22, 2025 13:31
@kevinsmaster5 kevinsmaster5 requested a review from a team April 22, 2025 13:31
Copy link
Copy Markdown
Contributor

@vrajmohan vrajmohan left a comment

Choose a reason for hiding this comment

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

Made some comments.

query = <<-SQL
WITH non_unique_ssn_signatures AS (
SELECT ssn_signature
FROM profiles
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 was missed out in the original story - we only need active profiles.

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.

added active: true f2ac0cc

SELECT
i.service_provider,
u.uuid,
u.updated_at,
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.

Shouldn't this be i.last_authenticated_at?

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 had left i.last_authenticated_at in the WHERE filter and am grabbing u.updated_at thinking that's more closely tied to latest_activity_at in the story description. I can change that to last_authenticated if you think that's more to the point.

Copy link
Copy Markdown
Contributor

@vrajmohan vrajmohan Apr 22, 2025

Choose a reason for hiding this comment

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

The user could have authenticated to some other service provider, besides the service provider of interest. Wouldn't that mess with the updated_at?

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'm not sure what the effect would be. I have modified the query to use i.last_authenticated_at with c8cf502

@kevinsmaster5 kevinsmaster5 requested a review from vrajmohan April 23, 2025 14:20
Copy link
Copy Markdown
Contributor

@vrajmohan vrajmohan left a comment

Choose a reason for hiding this comment

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

Looks good.

@kevinsmaster5 kevinsmaster5 force-pushed the kmas-lg-16022-create-daily-ssa-accounts-report branch from c8cf502 to 31fb27a Compare April 23, 2025 16:44
@kevinsmaster5 kevinsmaster5 merged commit 006fa18 into main Apr 23, 2025
1 check passed
@kevinsmaster5 kevinsmaster5 deleted the kmas-lg-16022-create-daily-ssa-accounts-report branch April 23, 2025 16:58
vrajmohan added a commit that referenced this pull request Oct 2, 2025
This reverts commit 006fa18.

1. The report, as implemented is not runnable.
2. The report is no longer needed.
vrajmohan added a commit that referenced this pull request Oct 2, 2025
#12552)

This reverts commit 006fa18.

1. The report, as implemented is not runnable.
2. The report is no longer needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants