Skip to content

[HOTE-1209] feat: Reactive Results: Set TEST_PROCESSED status#408

Merged
cptiv2020 merged 41 commits intomainfrom
feature/hote-1209/test-processed-status
Apr 29, 2026
Merged

[HOTE-1209] feat: Reactive Results: Set TEST_PROCESSED status#408
cptiv2020 merged 41 commits intomainfrom
feature/hote-1209/test-processed-status

Conversation

@cptiv2020
Copy link
Copy Markdown
Contributor

@cptiv2020 cptiv2020 commented Apr 24, 2026

Description

https://nhsd-jira.digital.nhs.uk/browse/HOTE-1209

Context

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

github-actions Bot commented Apr 24, 2026

Lambdas Coverage Report

Lines Statements Branches Functions
Coverage: 98%
98.04% (2212/2256) 91.66% (616/672) 96.62% (372/385)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

UI Coverage Report

Lines Statements Branches Functions
Coverage: 96%
96.32% (5927/6153) 88.4% (724/819) 88.44% (222/251)

Base automatically changed from feature/hote-1210/order-confirmed to main April 24, 2026 12:23
…-result-processor

# Conflicts:
#	lambdas/package.json
#	lambdas/pnpm-lock.yaml
…te-1209/test-processed-status

# Conflicts:
#	lambdas/src/lib/utils/validation-result.ts
#	lambdas/src/lib/validation/index.ts
#	lambdas/src/order-result-lambda/validation-service.ts
#	lambdas/src/order-result-lambda/validation.ts
#	lambdas/src/order-status-lambda/index.test.ts
#	lambdas/src/order-status-lambda/types.ts
#	lambdas/src/order-status-lambda/utils.ts
Copilot AI review requested due to automatic review settings April 28, 2026 07:52
@cptiv2020 cptiv2020 changed the base branch from main to feature/hote-1099/hiv-result-processor April 28, 2026 07:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for a new intermediate result state (TEST_PROCESSEDRESULT_PROCESSED) and introduces a new HIV result processor lambda plus supporting shared utilities/infra for invoking lambdas internally.

Changes:

  • Extend order-status-lambda to resolve incoming test-processed business status into a new RESULT_PROCESSED result status write.
  • Add hiv-result-processor-lambda and a LambdaHttpClient implementation to invoke another lambda via the AWS Lambda API.
  • Update local Terraform, migrations, and repo tooling/docs to support the new lambda and status.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/config/gitleaks.toml Ignore pnpm store directories for secret scanning noise reduction.
local-environment/infra/outputs.tf Expose HIV results processor lambda name as a Terraform output.
local-environment/infra/main.tf Add invoke permissions + define HIV results processor lambda and env vars.
lambdas/src/result-status-lambda/index.ts Add extra success log after DB updates.
lambdas/src/order-status-lambda/validation/task-validation.ts New request body parsing + Zod validation helper.
lambdas/src/order-status-lambda/validation/task-validation.test.ts Unit tests for task validation helper.
lambdas/src/order-status-lambda/validation/patient-validation.ts New patient ownership validation helper.
lambdas/src/order-status-lambda/validation/patient-validation.test.ts Unit tests for patient ownership validation.
lambdas/src/order-status-lambda/validation/correlation-id-validation.ts New correlation-id extraction/validation helper.
lambdas/src/order-status-lambda/validation/correlation-id-validation.test.ts Unit tests for correlation-id validation helper.
lambdas/src/order-status-lambda/utils.ts Remove local utility/mapping in favour of shared/more structured modules.
lambdas/src/order-status-lambda/models/types.ts Add TEST_PROCESSED business status + introduce StatusKind.
lambdas/src/order-status-lambda/models/schemas.ts Move order-status task schema into a dedicated module.
lambdas/src/order-status-lambda/models/mappings.ts Add mapping to resolve incoming business status into order vs result status updates.
lambdas/src/order-status-lambda/init.ts Wire in new DB command for inserting result statuses.
lambdas/src/order-status-lambda/init.test.ts Update init wiring assertions/mocks for new dependency.
lambdas/src/order-status-lambda/index.ts Refactor handler to use validation helpers + support result status updates.
lambdas/src/order-status-lambda/index.test.ts Remove previous handler-level tests.
lambdas/src/order-status-lambda/db/commands/insert-result-status.ts Add DB command to insert result_status rows idempotently.
lambdas/src/order-status-lambda/db/commands/insert-result-status.test.ts Unit tests for insert-result-status command SQL/params.
lambdas/src/order-result-lambda/validation-service.ts Move FHIR observation field extraction into shared lib module; reuse shared validation types.
lambdas/src/order-result-lambda/index.ts Update interpretation extraction call site to use shared extractor.
lambdas/src/lib/validation/index.ts Fix import path and formatting in shared validation module.
lambdas/src/lib/utils/fhir-utils.ts Introduce shared extractIdFromReference helper.
lambdas/src/lib/types/status.ts Add Result_Processed to the shared ResultStatus enum.
lambdas/src/lib/http/lambda-http-client.ts New HttpClient implementation that invokes another lambda via InvokeCommand.
lambdas/src/lib/http/lambda-http-client.test.ts Unit tests for LambdaHttpClient request/response/error behaviour.
lambdas/src/lib/fhir-observation-extractors/index.ts New shared observation field extractors (moved from order-result-lambda).
lambdas/src/lib/fhir-observation-extractors/index.test.ts Unit tests for shared observation extractors.
lambdas/src/lib/db/test-result-db-client.ts Formatting-only refactor of query invocation.
lambdas/src/hiv-result-processor-lambda/services/result-status-lambda-service.ts Service wrapper to call result-status lambda via HttpClient.
lambdas/src/hiv-result-processor-lambda/services/result-status-lambda-service.test.ts Unit tests for the service wrapper.
lambdas/src/hiv-result-processor-lambda/models/interpretation.ts Add InterpretationCode enum for HIV processor decisioning.
lambdas/src/hiv-result-processor-lambda/init.ts New init wiring for LambdaClient + LambdaHttpClient + service.
lambdas/src/hiv-result-processor-lambda/init.test.ts Unit tests for init wiring and singleton behaviour.
lambdas/src/hiv-result-processor-lambda/index.ts New lambda handler to process HIV observation and invoke status lambda.
lambdas/src/hiv-result-processor-lambda/index.test.ts Unit tests for HIV processor handler branches and error handling.
lambdas/src/hiv-result-processor-lambda/builders/task-builder.ts Build a FHIR Task payload from an Observation for downstream status update.
lambdas/src/hiv-result-processor-lambda/builders/task-builder.test.ts Unit tests for task builder output and failure modes.
lambdas/pnpm-lock.yaml Lockfile updates for new AWS SDK Lambda client dependency.
lambdas/package.json Add @aws-sdk/client-lambda dependency.
lambdas/README.md Document local invocation of lambdas via AWS CLI (LocalStack).
database/migrations/000011_add_result_processed_status.sql Seed new RESULT_PROCESSED into result_type.
.pre-commit-config.yaml Exclude pnpm artifacts from formatting/lint hooks.
.gitignore Ignore pnpm store/artifacts and pnpm error/debug logs.
.github/instructions/lambdas.instructions.md Update internal lambda docs (invocation modes, HttpClient guidance, middleware notes).

Comment thread lambdas/src/order-status-lambda/index.ts Outdated
Comment thread lambdas/src/order-status-lambda/index.ts Outdated
Comment thread lambdas/src/order-status-lambda/index.ts Outdated
Comment thread lambdas/src/order-status-lambda/index.ts
…te-1209/test-processed-status

# Conflicts:
#	lambdas/goose-migrator-lambda/migrations/000011_add_result_processed_status.sql
Base automatically changed from feature/hote-1099/hiv-result-processor to main April 28, 2026 12:57
Copilot AI review requested due to automatic review settings April 28, 2026 13:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.

Comment thread lambdas/src/order-status-lambda/index.ts Outdated
Comment thread lambdas/src/order-status-lambda/index.ts
Comment thread lambdas/src/order-status-lambda/validation/task-validation.ts
Comment thread lambdas/src/order-status-lambda/validation/patient-validation.ts
Comment thread tests/tests/api/OrderStatusUpdate.spec.ts
@sonarqubecloud
Copy link
Copy Markdown

@cptiv2020 cptiv2020 merged commit 30837ac into main Apr 29, 2026
15 checks passed
@cptiv2020 cptiv2020 deleted the feature/hote-1209/test-processed-status branch April 29, 2026 09:12
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.

9 participants