Skip to content

Prevent duplicate consumer account numbers#45

Merged
schbetsy merged 5 commits intomainfrom
collection
Mar 23, 2026
Merged

Prevent duplicate consumer account numbers#45
schbetsy merged 5 commits intomainfrom
collection

Conversation

@schbetsy
Copy link
Copy Markdown
Collaborator

@schbetsy schbetsy commented Mar 20, 2026

Internal ticket number: 1003

For a single Metro2 event, files may be provided from multiple sources, which means consumer account numbers may not be unique. This PR attempts to prevent account number collision by adding a 'collection' parameter to the parsing process, which will be prepended to each consumer account number. This means that each source or collection of metro2 files will need to be parsed separately. When the collection parameter is omitted, the parser will behave the same as before.

Changes

  • Update parse management command to accept new collection parameter
  • Update initiate_parsing methods to accept the collection param and send them along to the parser
  • Update the parser to send the collection parameter to the parse_from_segment method on the AccountActivity model, where it gets prepended onto the consumer account number for each record.
  • Add tests for the updates to the parser and initiate_parsing.py

Testing

  1. python manage.py test

Notes

  • I updated the parsing wiki to add a collections section that describes how to use this feature.

Todos

  • Add to the parsing documentation to explain how this feature is used.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated
  • Reviewers requested with the Reviewers tool ➡️

@schbetsy schbetsy requested a review from willbarton March 20, 2026 15:37
@schbetsy schbetsy removed the request for review from willbarton March 23, 2026 13:53
@schbetsy schbetsy marked this pull request as ready for review March 23, 2026 18:14
@schbetsy schbetsy requested a review from willbarton March 23, 2026 18:14
Copy link
Copy Markdown
Member

@willbarton willbarton left a comment

Choose a reason for hiding this comment

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

I think this is a really elegant solution to the possibilities of duplicate unrelated account numbers in a single event, without adding complexity to 🎉.

@schbetsy schbetsy merged commit b63dc7f into main Mar 23, 2026
1 check passed
@schbetsy schbetsy deleted the collection branch March 23, 2026 20:10
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.

2 participants