Skip to content

Task/ftrs 2590 toggle for search by triage code#1025

Merged
gurinder-s-brar merged 9 commits intomainfrom
task/FTRS-2590_Toggle-for-search-by-triage-code
Apr 13, 2026
Merged

Task/ftrs 2590 toggle for search by triage code#1025
gurinder-s-brar merged 9 commits intomainfrom
task/FTRS-2590_Toggle-for-search-by-triage-code

Conversation

@gurinder-s-brar
Copy link
Copy Markdown
Contributor

Description

Context

https://nhsd-jira.digital.nhs.uk/browse/FTRS-2590


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.

Copilot AI review requested due to automatic review settings March 15, 2026 20:32
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

This PR introduces a feature-flagged triage-code search endpoint for the DoS Search service, while also refactoring common Lambda runtime/response construction and standardising feature-flag guarding utilities in ftrs_common.

Changes:

  • Add a new /triage_code POST Lambda endpoint gated by dos_search_triage_code_enabled, plus supporting Terraform/APIGW wiring and monitoring.
  • Introduce functions/response_util.py to centralise Powertools runtime construction and FHIR response header/response creation.
  • Add reusable feature-flag guard/guard-chain utilities in ftrs_common.feature_flags and refactor healthcare-service endpoint to use them.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
services/dos-search/functions/response_util.py New shared runtime/headers/response factory for dos-search Lambdas.
services/dos-search/functions/dos_search_triage_code_function.py New triage-code POST endpoint with feature-flag guard chain.
services/dos-search/functions/dos_search_healthcare_service_function.py Refactors healthcare-service endpoint to use new feature-flag guard chain + response util.
services/dos-search/functions/dos_search_ods_code_function.py Refactors ODS Organization endpoint to use shared response util/runtime.
services/dos-search/functions/error_util.py Generalises service-unavailable OperationOutcome factory to accept service/status text.
services/dos-search/functions/logbase.py Adds log references for triage-code request/flag/metrics events.
services/dos-search/functions/constants.py Adds shared feature-flag log context dict.
services/dos-search/tests/unit/functions/test_response_util.py Unit tests for new response/runtime utilities.
services/dos-search/tests/unit/functions/test_dos_search_triage_code_function.py Unit tests for the new triage-code Lambda handler + flag behaviour.
services/dos-search/tests/unit/functions/test_dos_search_ods_code_function.py Updates tests to align with response util refactor (logging expectations changed).
services/dos-search/tests/unit/functions/test_dos_search_healthcare_service_function.py Updates tests for refactored healthcare-service handler and new flag evaluation approach.
services/dos-search/tests/unit/functions/test_error_util.py Adds tests for parameterised service-unavailable OperationOutcome.
application/packages/python/ftrs_common/feature_flags/feature_flag_handlers.py New shared request-guard and feature-flag guard-chain implementation.
application/packages/python/ftrs_common/feature_flags/init.py Re-exports new feature-flag guard APIs.
application/packages/python/ftrs_common/feature_flags/feature_flag_config.py Adds DOS_SEARCH_TRIAGE_CODE_ENABLED flag.
application/packages/python/ftrs_common/tests/feature_flags/test_feature_flag_handlers.py Unit tests for new guard/guard-chain utilities.
application/packages/python/ftrs_common/tests/feature_flags/test_feature_flags_client.py Test refactors/cleanup for the feature-flags client.
infrastructure/toggles/toggle-registry.yaml Registers dos_search_triage_code_enabled toggle across environments.
infrastructure/stacks/dos_search/api-gateway-rest-resource-triage-code.tf Adds APIGW resource/method/integration for POST /triage_code.
infrastructure/stacks/dos_search/api-gateway-rest-deployment.tf Ensures deployment depends on new triage-code APIGW integration/method/resource.
infrastructure/stacks/dos_search/triage_code_lambda.tf Adds new triage-code Lambda module instantiation.
infrastructure/stacks/dos_search/lambda_alarms.tf Adds triage-code Lambda to monitoring/alarms configuration.
infrastructure/stacks/dos_search/variables.tf Adds triage_code_lambda_name stack variable.
infrastructure/dos_search.tfvars Provides triage_code_lambda_name value for the stack.
services/.trivyignore Adds an additional ignored CVE entry.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread services/dos-search/functions/dos_search_triage_code_function.py Outdated
Comment thread services/dos-search/functions/dos_search_healthcare_service_function.py Outdated
mmg-nhse
mmg-nhse previously approved these changes Mar 16, 2026
@gurinder-s-brar gurinder-s-brar force-pushed the task/FTRS-2590_Toggle-for-search-by-triage-code branch from 0ea3b21 to 4456148 Compare March 19, 2026 11:45
Comment thread application/packages/python/ftrs_common/feature_flags/feature_flag_config.py Outdated
lukeb-nhs
lukeb-nhs previously approved these changes Mar 24, 2026
MatasDevs
MatasDevs previously approved these changes Mar 26, 2026
lukeb-nhs
lukeb-nhs previously approved these changes Apr 9, 2026
jack-tsien-nhse
jack-tsien-nhse previously approved these changes Apr 9, 2026
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

This PR introduces a new DoS Search endpoint scaffold for the HealthcareService/$search-by-triage-code operation, gated behind a new feature flag, and wires it into the dos-search build/deploy infrastructure (Lambda + API Gateway).

Changes:

  • Add a new healthcare_service_search_by_triage_code Lambda handler that returns 503 when the flag is disabled and 501 when enabled (stub).
  • Add the new AppConfig feature flag (registry + FeatureFlag enum) and unit tests for the handler/flag wiring.
  • Provision Terraform resources for the new Lambda package and API Gateway resource/method/integration.

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
services/dos-search/src/healthcare_service_search_by_triage_code/handler.py New POST handler for $search-by-triage-code, feature-flag gated, currently stubbed (501/503).
services/dos-search/src/healthcare_service_search_by_triage_code/init.py Package marker for new handler module.
services/dos-search/tests/unit/src/healthcare_service_search_by_triage_code/test_handler.py Unit tests covering enabled/disabled flag behavior, headers, and logging expectations.
services/dos-search/tests/unit/src/healthcare_service_search_by_triage_code/init.py Test package marker.
services/dos-search/src/common/logbase.py Adds new log references for triage-code endpoint flag and stub behavior.
services/dos-search/README.md Documents the new endpoint and updates the code structure section.
services/dos-search/Makefile Ensures the new Lambda subdir is included in packaging/build steps.
application/packages/python/ftrs_common/feature_flags/feature_flag_config.py Adds new FeatureFlag enum value for the endpoint.
application/packages/python/ftrs_common/tests/feature_flags/test_feature_flag_config.py Tests new flag name and LocalFlagsClient env var behavior.
infrastructure/toggles/toggle-registry.yaml Registers the new AppConfig flag and API Gateway toggle entry for the route.
infrastructure/dos_search.tfvars Adds tfvars for the new Lambda artefact name and handler.
infrastructure/stacks/dos_search/variables.tf Adds stack variables for the new Lambda name/handler.
infrastructure/stacks/dos_search/data.tf Adds S3 object lookup for the new Lambda package artefact.
infrastructure/stacks/dos_search/healthcare_service_search_by_triage_code_lambda.tf Adds Terraform Lambda module for the new operation.
infrastructure/stacks/dos_search/api-gateway-rest-resource-healthcare-service-search-by-triage-code.tf Adds API Gateway resource/method/integration for the new POST route.
infrastructure/stacks/dos_search/api-gateway-rest-deployment.tf Includes the new API Gateway components in deployment triggers/depends_on.

Comment thread services/dos-search/README.md Outdated
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 14 out of 16 changed files in this pull request and generated 1 comment.

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 14 out of 16 changed files in this pull request and generated 3 comments.

Comment thread services/dos-search/README.md
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 14 out of 16 changed files in this pull request and generated 3 comments.

Comment thread services/dos-search/src/healthcare_service_search_by_triage_code/handler.py Outdated
Comment thread services/dos-search/src/healthcare_service_search_by_triage_code/handler.py Outdated
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 14 out of 16 changed files in this pull request and generated 1 comment.

Comment thread services/dos-search/README.md Outdated
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 14 out of 16 changed files in this pull request and generated 1 comment.

Comment thread infrastructure/stacks/dos_search/variables.tf Outdated
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 14 out of 16 changed files in this pull request and generated no new comments.

lukeb-nhs
lukeb-nhs previously approved these changes Apr 13, 2026
Comment thread infrastructure/toggles/toggle-registry.yaml
MatasDevs
MatasDevs previously approved these changes Apr 13, 2026
Copy link
Copy Markdown
Contributor

@MatasDevs MatasDevs left a comment

Choose a reason for hiding this comment

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

All good, just one minor comment which you can resolve if you feel it's not necessary.

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.

8 participants