Conversation
ad81571 to
8572e51
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new result-status-lambda intended to accept a FHIR Task and record a “result available” status update for an order.
Changes:
- Introduces
result-status-lambdahandler, request validation schema, and unit tests. - Adds
ResultServiceDB helper for insertingresult_statusrecords. - Extends
OrderServicewith a query to fetch the patient UID for an order (for ownership checks).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| lambdas/src/result-status-lambda/models.ts | Adds Zod schema for validating incoming FHIR Task payloads for result status updates. |
| lambdas/src/result-status-lambda/init.ts | Wires up commons + Postgres client + ResultService/OrderService dependencies. |
| lambdas/src/result-status-lambda/init.test.ts | Adds init wiring/unit tests for environment construction and singleton behaviour. |
| lambdas/src/result-status-lambda/index.ts | Implements the result status endpoint handler (parse/validate, authorise, write status). |
| lambdas/src/result-status-lambda/index.test.ts | Adds handler unit tests covering parsing, validation, auth, DB error paths, and success. |
| lambdas/src/lib/db/result-db.ts | Adds DB helper to insert into result_status. |
| lambdas/src/lib/db/result-db.test.ts | Unit tests for ResultService.updateResultStatus. |
| lambdas/src/lib/db/order-db.ts | Adds OrderPatientReference type and retrievePatientIdFromOrder query method. |
| lambdas/src/lib/db/order-db.test.ts | Unit tests for the new retrievePatientIdFromOrder method. |
Comments suppressed due to low confidence (1)
lambdas/src/result-status-lambda/init.test.ts:151
- Leaving
//TODOnotes in committed tests (and missing the common init-module "rejection retry" test seen in other lambdas) makes the suite incomplete; add the rejection-retry coverage (e.g., assert init can be called again afterbuildEnvironment()throws) and remove the TODOs.
describe("singleton behavior", () => {
it("should return the same Environment instance on multiple calls to init", () => {
const env1 = init();
const env2 = init();
expect(env1).toBe(env2);
});
});
});
b44938f to
d663a2b
Compare
d663a2b to
85e3399
Compare
85e3399 to
27ea63b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
lambdas/src/lib/db/order-db.ts:103
updateOrderStatusAndResultStatushascorrelationIdavailable but the error log omits it; this makes failed status updates harder to trace across services/log aggregation.
console.error("order-db", "Failed to update order and result status", {
error,
orderUid,
});
throw error;
|
Raised NHSDigital/hometest-mgmt-terraform#99 for hometest-mgmt-terraform update |
9edd59a to
fd0d011
Compare
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
| orderId = result.order_uid; | ||
| patientId = result.patient_uid; | ||
| correlationId = randomUUID(); | ||
| console.log(`Created test order with ID: ${orderId}`); |
There was a problem hiding this comment.
Avoid console.log in Playwright tests; use the shared Logger utility (tests/utils/Logger.ts) or remove the log line to keep test output clean and consistent.
|



Description
HOTE-1100 - Reactive Results: Enabler 1 - Create Result Status Lambda
Introduces new lambda to update result status. Currently only accepts result available.
Context
Implements 1 of 3 lambdas required for epic: Reactive result after clinician contact - Result Available
Type of changes
Checklist
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.