Skip to content

[MDS-6764] - NRIS duplicate entries#3807

Merged
matbusby-fw merged 1 commit intodevelopfrom
mds-6764-nris-duplicates
Jan 27, 2026
Merged

[MDS-6764] - NRIS duplicate entries#3807
matbusby-fw merged 1 commit intodevelopfrom
mds-6764-nris-duplicates

Conversation

@matbusby-fw
Copy link
Collaborator

Our NRIS api was creating multiple records from the raw data with new internal ids, but the same external one which shouldn't happen. Updated it to ensure idempotency of the records.

Objective

MDS-6764

Why are you making this change? Provide a short explanation and/or screenshots

…ess.

- Implemented counters for processed, missing, and deleted assessments.
- Added logic to avoid creation of duplicate database entities.
- Enhanced data cleanliness by resetting relational fields prior to updates.
- Improved log output to include ETL processing summaries for better traceability.
inspection = Inspection(external_id=_parse_element_text(assessment_id))
# Find or create the inspection
inspection = db.session.query(Inspection).filter_by(external_id=external_id).first()
if inspection is None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the core of the change. Checking for an inspection within the session that already contains the external_id and updating it if necessary. The rest of the changes generally follow on this behaviour to ensure idempotency.

@matbusby-fw matbusby-fw added the 👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback. label Jan 26, 2026
@matbusby-fw matbusby-fw merged commit 6547780 into develop Jan 27, 2026
7 checks passed
@matbusby-fw matbusby-fw deleted the mds-6764-nris-duplicates branch January 27, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants