Skip to content

feat: DTOSS-10704 - Replace NEMS Subscriptions with new Caas based updates. Added ManageCaasSubscription function#1575

Merged
SamAinsworth-NHS merged 60 commits intomainfrom
feat/nems-replacement-mesh-branch
Sep 5, 2025
Merged

feat: DTOSS-10704 - Replace NEMS Subscriptions with new Caas based updates. Added ManageCaasSubscription function#1575
SamAinsworth-NHS merged 60 commits intomainfrom
feat/nems-replacement-mesh-branch

Conversation

@SamAinsworth-NHS
Copy link
Copy Markdown
Contributor

@SamAinsworth-NHS SamAinsworth-NHS commented Sep 2, 2025

Description

This branch introduces a new MESH-based CaaS subscription capability and shared MESH infrastructure, plus related infra/config updates and tests. The summary below reflects only changes unique to this branch compared with origin/main.

  • New Azure Function app: ManageCaasSubscription
    • Endpoints: Subscribe, Unsubscribe (stub), CheckSubscriptionStatus, NemsSubscriptionDataService (pass-through), and a nightly PollMeshMailbox timer.
    • Sends a CAAS subscription request over MESH (Parquet payload with nhs_number) via a new shared sender. In dev, a stubbed sender can be used via IsStubbed.
    • Persists a record to NEMS_SUBSCRIPTION with SubscriptionSource = MESH.
  • Shared MESH infrastructure under Shared/Common:
    • MeshMailboxExtension, MeshConfig/MailboxConfig to register the MESH client and mailboxes (supports Key Vault or local certs and server CA chain).
    • IMeshSendCaasSubscribe + MeshSendCaasSubscribe and MeshSendCaasSubscribeStub for local/dev.
    • IMeshPoller + MeshPoller for mailbox handshake validation.
    • CertificateHelper moved to Shared/Common/Utilities and reused by MESH-enabled functions.
  • Database and model updates:
    • Migration adds nullable SUBSCRIPTION_SOURCE to dbo.NEMS_SUBSCRIPTION; new enum SubscriptionSource { NEMS = 1, MESH = 2 }; EF model updated.
    • ManageNemsSubscription updated to save new subscriptions with SubscriptionSource = NEMS.
  • Function updates/alignment:
    • NemsSubscriptionService/NemsMeshRetrieval and CaasIntegration/RetrieveMeshFile updated to use the shared certificate parsing helper and cleaned imports.
  • Transform service adjustments (no web changes):
    • Removed CurrentPosting lookup dependency from transform config/facade; updated transformRules.json to rely on PrimaryCareProvider/null checks and refined SMU/Welsh logic.
  • Local/dev and infra configuration:
    • .env.example gains optional CAAS_SUBSCRIBE_TO_MAILBOX/CAAS_SUBSCRIBE_FROM_MAILBOX overrides for the new function.
    • compose.core.yaml adds a manage-caas-subscription service (disabled by default, with example env); compose.cohort-distribution.yaml removes CurrentPostingUrl.
    • Terraform env files add ManageCaasSubscription function app (stubbed by default) and remove obsolete CurrentPostingUrl wiring.
    • GitHub workflow stage-2-test.yaml ensures artifact upload runs with if: always() and ignores missing files. This means if a test fails the report is still uploaded to aid investigation.
  • Tests:
    • Unit tests for MeshPoller, MeshSendCaasSubscribe, and ManageCaasSubscription.
    • Integration tests for the CAAS/MESH subscribe flow (Parquet assertions).
    • Playwright test data cleanup around older CAAS scenarios; test harness tweaks.

Context

This work progresses the move toward a MESH-based CaaS subscription path, standardising MESH client setup via shared infrastructure, adding a nightly mailbox handshake to validate connectivity, and recording subscription source for observability. It also removes a transform-time dependency on reference data (CurrentPosting) in favour of rule changes and primary-care-provider checks.

DTOSS-10704

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.

MWClayson-NHS and others added 30 commits August 27, 2025 17:59
…rvice and CheckSubscriptionStatus into ManageCaasSubscription
@SamAinsworth-NHS SamAinsworth-NHS changed the title feat: Replace NEMS Subscriptions with new Caas based updates. Added ManageCaasSubscription function feat: DTOSS-10704 - Replace NEMS Subscriptions with new Caas based updates. Added ManageCaasSubscription function Sep 2, 2025
@SamAinsworth-NHS SamAinsworth-NHS marked this pull request as ready for review September 2, 2025 15:26
Comment thread infrastructure/tf-core/environments/development.tfvars Outdated
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 4, 2025

@SamAinsworth-NHS SamAinsworth-NHS added this pull request to the merge queue Sep 5, 2025
Merged via the queue into main with commit 736ff2c Sep 5, 2025
66 checks passed
@SamAinsworth-NHS SamAinsworth-NHS deleted the feat/nems-replacement-mesh-branch branch September 5, 2025 14:28
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.

4 participants