[HOTE-559] feat: View negative results page#173
Merged
Conversation
…est-consumer-for-get-order
…est-consumer-for-get-order
Signed-off-by: lewisbirks <lewis.birks1@nhs.net>
…to story/HOTE-611-home-test-consumer-for-get-order
Signed-off-by: lewisbirks <lewis.birks1@nhs.net>
…to story/HOTE-611-home-test-consumer-for-get-order
…est-consumer-for-get-order # Conflicts: # database/03-seed-hometest-data.sql
# Conflicts: # lambdas/src/get-results-lambda/init.ts # local-environment/infra/main.tf
TSeelig
approved these changes
Mar 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for viewing a negative HIV self-test result page in the UI, backed by a new results API/service layer, plus supporting content and end-to-end accessibility coverage.
Changes:
- Adds a new
/orders/:orderId/resultsroute and UI components for the negative result view (with redirects back to tracking when results aren’t available/eligible). - Introduces new UI query/service utilities for fetching results and centralises GUID validation.
- Updates lambda DB queries and local CORS config to support results retrieval, plus adds unit/UI/a11y tests.
Reviewed changes
Copilot reviewed 48 out of 51 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/routes/TestResultsPage.tsx | New results route logic (order/result gating + redirect). |
| ui/src/routes/OrderTrackingPage.tsx | Switches to shared GUID util + order status query hook + page content hook. |
| ui/src/lib/utils/guid.ts | Extracted GUID/UUID validation helper. |
| ui/src/lib/utils/fhir-utils.ts | Adds FHIR Observation “normal” interpretation helper. |
| ui/src/lib/utils/fhir-constants.ts | Adds constants for Observation interpretation system/code. |
| ui/src/lib/services/test-results-service.ts | New UI service to call /results and map Observation → TestResult. |
| ui/src/lib/services/supplier-service.ts | Centralised supplier link metadata lookup. |
| ui/src/lib/queries/test-results-query.ts | React Query hook for test results. |
| ui/src/lib/queries/query-keys.ts | Shared query key names for React Query. |
| ui/src/lib/queries/order-status-query.ts | React Query hook wrapper for order status. |
| ui/src/lib/models/test-result.ts | New UI model for test results. |
| ui/src/lib/models/route-paths.ts | Adds TestResultsPage route path. |
| ui/src/components/test-results/NegativeTestResult.tsx | Negative result page content component. |
| ui/src/components/test-results/MoreOptionsAndInformation.tsx | Supplementary “more options” section component. |
| ui/src/components/test-results/MedicalAbbreviationsHelp.tsx | Help link section component. |
| ui/src/components/order-status/statuses/ReadyStatus.tsx | Replaces placeholder link with router Link to results page. |
| ui/src/components/order-status/statuses/HelpLinks.tsx | Uses supplier service for contact link instead of #. |
| ui/src/components/order-status/OrderStatusHeader.tsx | Allows caller-provided heading text. |
| ui/src/components/order-status/OrderStatusContent.tsx | Passes orderId into ReadyStatus. |
| ui/src/components/order-status/OrderStatus.tsx | Passes fixed heading string to OrderStatusHeader. |
| ui/src/app.tsx | Registers new results route under guarded app routes. |
| ui/src/tests/routes/TestResultsPage.test.tsx | Unit tests for results route behaviour and redirects. |
| ui/src/tests/lib/utils/fhir-utils.test.ts | Unit tests for FHIR utility helpers. |
| ui/src/tests/lib/services/test-results-service.test.ts | Unit tests for results service request/response mapping. |
| ui/src/tests/lib/services/supplier-service.test.ts | Unit tests for supplier link lookup. |
| ui/src/tests/lib/services/la-lookup-service.test.ts | Minor test import/style adjustments. |
| ui/src/tests/components/order-status/OrderStatusHeader.test.tsx | Updates tests for new heading prop. |
| ui/src/tests/components/NegativeTestResult.test.tsx | Unit tests for negative result component rendering. |
| ui/src/tests/components/MoreOptionsAndInformation.test.tsx | Unit tests for more-options component. |
| ui/src/tests/components/MedicalAbbreviationsHelp.test.tsx | Unit tests for abbreviations help component. |
| ui/package.json | Bumps @types/node patch version. |
| ui/package-lock.json | Lockfile updates for @types/node + dependencies. |
| ui/hooks/useContent.ts | Adds test-results page content typing + overload. |
| ui/content/schema.ts | Adds TestResultsContent type (but currently has duplicate interface declarations). |
| ui/content/index.ts | Exports TestResultsContent type. |
| ui/content/content.json | Adds test-results page content (contains a title typo). |
| ui/content/ContentValidator.ts | Requires test-results page content key. |
| tests/tests/accessibility/NegativeResultsTest.spec.ts | New Playwright accessibility spec for negative results page. |
| tests/page-objects/NegativeResultPage.ts | New page object for results navigation/assertions. |
| tests/db/TestResultDbClient.ts | Import tidy-up. |
| tests/db/TestOrderDbClient.ts | Import order tidy-up. |
| tests/api/clients/HIVResultsApiResource.ts | Import/order formatting tidy-up. |
| package-lock.json | Root lockfile updates. |
| local-environment/infra/main.tf | Adds CORS allowed headers including X-Correlation-ID. |
| lambdas/src/lib/db/test-result-db-client.ts | Refactors ctor + changes SQL schema qualifiers (but JOIN condition is incorrect). |
| lambdas/src/lib/db/test-result-db-client.test.ts | Updates expected SQL (currently matches the incorrect JOIN). |
| lambdas/src/lib/db/order-db-client.ts | Refactors ctor + changes SQL schema qualifiers. |
| lambdas/src/lib/db/order-db-client.test.ts | Updates expected SQL. |
| lambdas/src/get-results-lambda/init.test.ts | Import reorder/cleanup. |
| lambdas/src/get-order-lambda/init.test.ts | Import reorder/cleanup. |
| .gitignore | Stops ignoring ui/src/components/test-results/ folder. |
Files not reviewed (1)
- ui/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
ui/content/schema.ts:364
OrderTrackingContentremoval introduced duplicate type declarations later in this file:PrivacyPolicySubsection,PrivacyPolicySection, andHomeTestPrivacyPolicyContentare each declared twice, which will cause a TypeScript "Duplicate identifier" compile error. Remove the duplicate block and keep a single set of these interfaces.
export interface PrivacyPolicySubsection {
heading?: string;
paragraphs?: string[];
list?: string[];
}
export interface PrivacyPolicySection {
id: string;
heading: string;
paragraphs: string[];
subsections?: PrivacyPolicySubsection[];
}
export interface HomeTestPrivacyPolicyContent {
title: string;
introduction: string[];
sections: PrivacyPolicySection[];
}
export interface PrivacyPolicySubsection {
heading?: string;
paragraphs?: string[];
list?: string[];
}
export interface PrivacyPolicySection {
id: string;
heading: string;
paragraphs: string[];
subsections?: PrivacyPolicySubsection[];
}
export interface HomeTestPrivacyPolicyContent {
title: string;
introduction: string[];
sections: PrivacyPolicySection[];
}
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 49 out of 52 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- ui/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)
ui/content/schema.ts:364
PrivacyPolicySubsection,PrivacyPolicySection, andHomeTestPrivacyPolicyContentare declared twice in this file (around lines 328–364), which will cause TypeScript duplicate identifier errors. Remove the duplicate set of interface declarations and keep a single canonical definition.
export interface PrivacyPolicySubsection {
heading?: string;
paragraphs?: string[];
list?: string[];
}
export interface PrivacyPolicySection {
id: string;
heading: string;
paragraphs: string[];
subsections?: PrivacyPolicySubsection[];
}
export interface HomeTestPrivacyPolicyContent {
title: string;
introduction: string[];
sections: PrivacyPolicySection[];
}
export interface PrivacyPolicySubsection {
heading?: string;
paragraphs?: string[];
list?: string[];
}
export interface PrivacyPolicySection {
id: string;
heading: string;
paragraphs: string[];
subsections?: PrivacyPolicySubsection[];
}
export interface HomeTestPrivacyPolicyContent {
title: string;
introduction: string[];
sections: PrivacyPolicySection[];
}
ui/src/routes/OrderTrackingPage.tsx:28
useOrderStatusQueryreturnsdataasundefinedwhile the query is pending, soif (!order)will render the “order not found” error during loading (and also hides query errors). Destructure and handleisPending/error(e.g., return a loading state ornullwhile pending, and throw/render an error forerror) before treatingorder === nullas the not-found case.
# Conflicts: # package-lock.json
krssw
reviewed
Mar 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 49 out of 51 changed files in this pull request and generated 6 comments.
Files not reviewed (1)
- ui/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
ui/src/routes/OrderTrackingPage.tsx:28
useOrderStatusQueryreturnsdataasundefinedwhile the request is pending, but this component treats any falsyorderas “not found”. That means the “We could not find this order.” alert will render during the initial load (and also for network/errors), which is misleading and can cause a visible flash before the real order renders. HandleisPending/isLoading(anderror) from the query separately (e.g., return null/spinner while pending, and throw/show a distinct error state whenerroris set).
krssw
approved these changes
Mar 3, 2026
billwirz1
added a commit
that referenced
this pull request
Mar 3, 2026
* feat(HOTE-611): init implementation of new lambda * feat(HOTE-611): pull status description * feat: set-up-goose-for-db-migrations * chore: set-up-scripts-and-readme-for-migrations * fix: missing-newlines * fix: missing-newlines * feat: add-seed-data-with-goose * fix: eof-errors * fix: remove-trailing-whitespace * chore: add-eof-to-pre-commit * chore: remove-keywords-from-schemas * feat: reafactor code * fix: swap-static-and-seed-data-from-migrations * feat: added unit tests * chore: line endings Signed-off-by: lewisbirks <lewis.birks1@nhs.net> * fix: broken-foreign-key * fix: comment-out-delete-sql * feat: refactoring and tests * fix: correct seed script Signed-off-by: lewisbirks <lewis.birks1@nhs.net> * feat: update local terraform with new lambda * fix: seed-data-errors * fix: remove-unused-pre-commit-hook * fix: fix after tests * fix: added cors configuration and replaced hardcoded patient data * fix: correct frommating * fix: fix ui test * fix: fix lint error * fix: corrections after review * feat(HOTE-521): initial implementation of lambda * fix: updated redeployment trigger * fix: updated trigger * feat: implemented proper sql query and observation builder, added tests * fix: use proper zip for lambda * fix: return the test type from database * fix: getting test code from database * feat: initial implementation of request to supplier api for results * fix: updated to use only supplier api for result * feat(HOTE-521): refactor code to separate classes * fix: get reduced information from db for result * fix: changes after review * feat: introduced x-correlation-id for results endpoint * chore: update packages * Add api tes for get results * feat: added initial page * fix: set the proper fields for auth context * feat: implement initial version of test result query * feat: implemented logic to show the results page only for negative result * fix: push to ensure the tests uses proper file * fix: bump package * fix: fix gitignore for missing files * fix: make props readonly * feat: introduced supplier links service * fix: refactor test * fix: follow new database connection approach * fix: update tags to align with prototype * Result page accessibility test * add negative result to fixtures * fix: fixes after review * removed testedUser checks * fix: formatting --------- Signed-off-by: lewisbirks <lewis.birks1@nhs.net> Co-authored-by: billwirz1 <bill.wirz1@nhs.net> Co-authored-by: lewisbirks <lewis.birks1@nhs.net> Co-authored-by: Masha-kainos <256341953+Masha-kainos@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
https://nhsd-jira.digital.nhs.uk/browse/HOTE-559
re-opened with new branch naming: #149
Context
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.