Skip to content

feat: BS Select Reference Refresh#1898

Draft
Warren-Pitterson wants to merge 10 commits intomainfrom
feat/DTOSS-9704-BS-Select-Reference-Refresh
Draft

feat: BS Select Reference Refresh#1898
Warren-Pitterson wants to merge 10 commits intomainfrom
feat/DTOSS-9704-BS-Select-Reference-Refresh

Conversation

@Warren-Pitterson
Copy link
Copy Markdown
Contributor

@Warren-Pitterson Warren-Pitterson commented Apr 30, 2026

Description

Adds a new Azure Function (ReferenceDataUpdaterFunction) that enables incremental reference data updates via Service Bus messages, eliminating the need to truncate and re-seed lookup tables.

Changes

  • New ReferenceDataUpdater function - listens on a Service Bus topic for ReferenceDataUpdateMessage payloads and inserts individual records into the database
  • ReferenceDataInsertHandler - handles deserialisation, DB insert via IDataServiceAccessor, and appends the new record to the corresponding seed data blob in blob storage
  • Supports all reference data types: BsSelectGpPractice, BsSelectOutCode, CurrentPosting, ExcludedSMULookup, LanguageCode, ScreeningLkp, GeneCodeLkp, HigherRiskReferralReasonLkp, BsoOrganisation, GenderMaster
  • Duplicate handling - gracefully handles primary key/unique constraint violations (logs warning, does not fail)
  • Blob sync - appends each inserted record to the seed data JSON blob so future migrations stay in sync
  • New model - ReferenceDataUpdateMessage (DataType, Data, CorrelationId, Timestamp)
  • Updated seed data - BsSelectGpPractice.json updated with latest GP practice records
  • Unit tests - full coverage for both the function (message handling, dead-lettering) and the insert handler (happy path, duplicates, blob failures, case-insensitive type matching)

Context

https://nhsd-jira.digital.nhs.uk/browse/DTOSS-9704

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@github-actions
Copy link
Copy Markdown

Your Pull Request title must meet the conventional commit standards, please see the following documentation - https://www.conventionalcommits.org/en/v1.0.0/#specification

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Unit Test Results

✔️ Tests 1099 / 1099 - passed in 71.5s
📝 Coverage 47.99%
📏 5340 / 11406 lines covered 🌿 1278 / 2384 branches covered
🔍 click here for more details

✏️ updated for commit 052d020

@Warren-Pitterson Warren-Pitterson changed the title Feat/DTOSS 9704 BS Select Reference Refresh feat: BS Select Reference Refresh Apr 30, 2026
Warren-Pitterson and others added 6 commits April 30, 2026 11:23
- Cache compiled delegates for InsertSingle to avoid per-call reflection
- Move environment variable access to constructor fields for fail-fast behaviour
- Use SQL error numbers for PK violation detection instead of string matching
- Add required/nullable modifiers to ReferenceDataUpdateMessage properties
- Add TestCleanup to restore environment variables after tests

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant