diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5aa0e4e0c..9d6ee79db 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,5 @@ -/.github @nhsd-exeter/maintainers -/build/automation/lib @nhsd-exeter/maintainers -/build/automation/init.mk @nhsd-exeter/maintainers -/.gitignore @nhsd-exeter/maintainers -/project.code-workspace @nhsd-exeter/maintainers +/.github @NHSDigital/data-sourcing-ftrs/maintainers +/build/automation/lib @NHSDigital/data-sourcing-ftrs/maintainers +/build/automation/init.mk @NHSDigital/data-sourcing-ftrs/maintainers +/.gitignore @NHSDigital/data-sourcing-ftrs/maintainers +/project.code-workspace @NHSDigital/data-sourcing-ftrs/maintainers diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 797e5f3e0..4d5925959 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -34,8 +34,8 @@ jobs: projectBaseDir: . args: > -Dsonar.sources=application,infrastructure,scripts,test,build/docker - -Dsonar.organization=nhsd-exeter - -Dsonar.projectKey=uec-dos-int + -Dsonar.organization=nhsdigital + -Dsonar.projectKey=nhsdigital_dos-integration -Dsonar.coverage.exclusions=tests/**,**/tests/**,infrastructure,application/dos_db_handler/**,test/**,scripts/**,application/conftest.py -Dsonar.python.coverage.reportPaths=coverage.xml -Dsonar.python.version=3.12 @@ -48,7 +48,7 @@ jobs: with: fetch-depth: 0 - name: Check Markdown format - uses: DavidAnson/markdownlint-cli2-action@v13 + uses: DavidAnson/markdownlint-cli2-action@v20 with: config: .github/workflows/configs/markdownlint/.markdownlint.json - name: Check Markdown links diff --git a/.github/workflows/update-pull-request-description.yml b/.github/workflows/update-pull-request-description.yml index 430de105c..8165bc606 100644 --- a/.github/workflows/update-pull-request-description.yml +++ b/.github/workflows/update-pull-request-description.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Get Branch Name - uses: mdecoleman/pr-branch-name@2.0.0 + uses: mdecoleman/pr-branch-name@v3.0.0 id: branch_name with: repo-token: ${{ secrets.GITHUB_TOKEN }} @@ -30,7 +30,7 @@ jobs: run: echo "TEMPLATE_NAME=$(cat .github/PULL_REQUEST_TEMPLATE/${{ env.BRANCH_DESIGNATOR }}_pull_request_template.md > /dev/null 2>&1 && echo ${{ env.BRANCH_DESIGNATOR }}_pull_request_template.md || echo task_pull_request_template.md)" >> $GITHUB_ENV - name: Render Pull Request template id: template - uses: chuhlomin/render-template@v1.5 + uses: chuhlomin/render-template@v1.10 with: template: .github/PULL_REQUEST_TEMPLATE/${{ env.TEMPLATE_NAME }} vars: | diff --git a/Makefile b/Makefile index be1b8d23a..a57b05359 100644 --- a/Makefile +++ b/Makefile @@ -272,7 +272,7 @@ tag-commit-to-destroy-environment: # Tag git commit to destroy deployment - mand fi get-environment-from-pr: - ENVIRONMENT=$$(gh pr list -s merged --json number,mergeCommit,headRefName --repo=nhsd-exeter/dos-integration | jq --raw-output '.[] | select(.number == $(PR_NUMBER)) | .headRefName | sub( ".*:*/DS-(?.[0-9]*).*"; "ds-\(.x)") ') + ENVIRONMENT=$$(gh pr list -s merged --json number,mergeCommit,headRefName --repo=NHSDigital/dos-integration | jq --raw-output '.[] | select(.number == $(PR_NUMBER)) | .headRefName | sub( ".*:*/DS-(?.[0-9]*).*"; "ds-\(.x)") ') echo $$ENVIRONMENT is-environment-deployed: diff --git a/README.md b/README.md index 2d3c0e795..330f7af0a 100644 --- a/README.md +++ b/README.md @@ -102,13 +102,13 @@ The main components you will need for _basic_ development work, are your OS vers - Git - Python (The project currently runs on 3.12) - AWS CLI -- Docker +- Docker/Podman ### Clone Repository Clone the repository - git clone git@github.com:nhsd-exeter/dos-integration.git + git clone git@github.com:NHSDigital/dos-integration.git cd ./dos-integration ### AWS Authentication @@ -192,7 +192,7 @@ To run ruff on you branch: List all the type of test suites included and provide instructions how to execute them -- Unit +- Unit Testing - Integration - Performance @@ -240,7 +240,7 @@ This testing is generally done by a tester Prerequisites assume # Granted assume AWS Role - Sign into Non-Prod VPN # To connect to lambdas within the VPC + Sign into Non-Prod VPN # To connect to lambdas within the VPC IP is in the IP Allow List # To connect to the API Gateway make tester-build diff --git a/application/change_event_dlq_handler/requirements.txt b/application/change_event_dlq_handler/requirements.txt index e27f685d9..cfb1c4805 100644 --- a/application/change_event_dlq_handler/requirements.txt +++ b/application/change_event_dlq_handler/requirements.txt @@ -1 +1 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 diff --git a/application/common/constants.py b/application/common/constants.py index 5cd5d870d..57ab02435 100644 --- a/application/common/constants.py +++ b/application/common/constants.py @@ -2,7 +2,8 @@ CLOSED_AND_HIDDEN_STATUSES = ["HIDDEN", "CLOSED"] -PHARMACY_SERVICE_TYPE_IDS = [13, 131, 132, 134, 137, 148, 149] +DISTANCE_SELLING_PHARMACY_ID = 134 +PHARMACY_SERVICE_TYPE_IDS = [13, 131, 132, DISTANCE_SELLING_PHARMACY_ID, 137, 148, 149] PHARMACY_ORGANISATION_SUB_TYPES = ["Community", "DistanceSelling"] PHARMACY_ODSCODE_LENGTH = 5 PHARMACY_SERVICE_TYPE_ID = 13 diff --git a/application/dos_db_handler/requirements.txt b/application/dos_db_handler/requirements.txt index a5f3571d4..69d278fcb 100644 --- a/application/dos_db_handler/requirements.txt +++ b/application/dos_db_handler/requirements.txt @@ -1,2 +1,2 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 psycopg[binary] diff --git a/application/dos_db_update_dlq_handler/requirements.txt b/application/dos_db_update_dlq_handler/requirements.txt index e27f685d9..cfb1c4805 100644 --- a/application/dos_db_update_dlq_handler/requirements.txt +++ b/application/dos_db_update_dlq_handler/requirements.txt @@ -1 +1 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 diff --git a/application/event_replay/requirements.txt b/application/event_replay/requirements.txt index a56853a73..6d1940542 100644 --- a/application/event_replay/requirements.txt +++ b/application/event_replay/requirements.txt @@ -1,2 +1,2 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 simplejson diff --git a/application/ingest_change_event/requirements.txt b/application/ingest_change_event/requirements.txt index 5cf839387..6221c3047 100644 --- a/application/ingest_change_event/requirements.txt +++ b/application/ingest_change_event/requirements.txt @@ -1 +1 @@ -aws-lambda-powertools[tracer, validation] ~= 2.43.0 +aws-lambda-powertools[tracer, validation] ~= 3.20.0 diff --git a/application/quality_checker/requirements.txt b/application/quality_checker/requirements.txt index 39387a7d8..1becb7954 100644 --- a/application/quality_checker/requirements.txt +++ b/application/quality_checker/requirements.txt @@ -1,2 +1,2 @@ -aws-lambda-powertools[tracer, validation] ~= 2.43.0 +aws-lambda-powertools[tracer, validation] ~= 3.20.0 psycopg[binary] diff --git a/application/quality_checker/search_dos.py b/application/quality_checker/search_dos.py index 8b16a49b1..f759fda67 100644 --- a/application/quality_checker/search_dos.py +++ b/application/quality_checker/search_dos.py @@ -3,8 +3,8 @@ from aws_lambda_powertools.logging import Logger from psycopg import Connection -from common.commissioned_service_type import CommissionedServiceType -from common.constants import DOS_ACTIVE_STATUS_ID, PHARMACY_SERVICE_TYPE_IDS +from common.commissioned_service_type import PALLIATIVE_CARE, CommissionedServiceType +from common.constants import DISTANCE_SELLING_PHARMACY_ID, DOS_ACTIVE_STATUS_ID, PHARMACY_SERVICE_TYPE_IDS from common.dos import DoSService from common.dos_db_connection import query_dos_db @@ -83,6 +83,9 @@ def search_for_incorrectly_profiled_z_code_on_incorrect_type( list[DoSService]: List of matching services. """ matchable_service_types = PHARMACY_SERVICE_TYPE_IDS.copy() + if service_type == PALLIATIVE_CARE: + # Remove DSPs from check, as it's valid for the palliative z-code to be present on them + matchable_service_types.remove(DISTANCE_SELLING_PHARMACY_ID) matchable_service_types.remove(service_type.DOS_TYPE_ID) starting_character = getenv("ODSCODE_STARTING_CHARACTER") or "f" cursor = query_dos_db( diff --git a/application/send_email/requirements.txt b/application/send_email/requirements.txt index e27f685d9..cfb1c4805 100644 --- a/application/send_email/requirements.txt +++ b/application/send_email/requirements.txt @@ -1 +1 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 diff --git a/application/service_matcher/requirements.txt b/application/service_matcher/requirements.txt index 6c5b01dad..0a79a142c 100644 --- a/application/service_matcher/requirements.txt +++ b/application/service_matcher/requirements.txt @@ -1,3 +1,3 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 psycopg[binary] pytz diff --git a/application/service_sync/requirements.txt b/application/service_sync/requirements.txt index 6c5b01dad..0a79a142c 100644 --- a/application/service_sync/requirements.txt +++ b/application/service_sync/requirements.txt @@ -1,3 +1,3 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 psycopg[binary] pytz diff --git a/application/slack_messenger/requirements.txt b/application/slack_messenger/requirements.txt index 589fc68bf..29dd94270 100644 --- a/application/slack_messenger/requirements.txt +++ b/application/slack_messenger/requirements.txt @@ -1,2 +1,2 @@ -aws-lambda-powertools[tracer] ~= 2.43.0 +aws-lambda-powertools[tracer] ~= 3.20.0 requests diff --git a/build/automation/lib/docker.mk b/build/automation/lib/docker.mk index 07a199ba3..e2b41d783 100644 --- a/build/automation/lib/docker.mk +++ b/build/automation/lib/docker.mk @@ -580,7 +580,7 @@ docker-run-sonar-scanner-cli: ### Run sonar-scanner-cli container - mandatory: C mkdir -p $(TMP_DIR)/.sonar/cache image=$$([ -n "$(IMAGE)" ] && echo $(IMAGE) || echo sonarsource/sonar-scanner-cli:$(DOCKER_SONAR_SCANNER_CLI_VERSION)) container=$$([ -n "$(CONTAINER)" ] && echo $(CONTAINER) || echo node-$(BUILD_COMMIT_HASH)-$(BUILD_ID)-$$(date --date=$$(date -u +"%Y-%m-%dT%H:%M:%S%z") -u +"%Y%m%d%H%M%S" 2> /dev/null)-$$(make secret-random LENGTH=8)) - docker run --interactive $(_TTY) --rm \ + $(DOCKER_CMD) run --interactive $(_TTY) --rm \ --name $$container \ --user $$(id -u):$$(id -g) \ --env-file <(make _list-variables PATTERN="^(AWS|TX|TEXAS|NHSD|TERRAFORM)") \ diff --git a/build/automation/var/project.mk b/build/automation/var/project.mk index 297f43a26..3a4961307 100644 --- a/build/automation/var/project.mk +++ b/build/automation/var/project.mk @@ -1,4 +1,4 @@ -ORG_NAME = nhsd-exeter +ORG_NAME = NHSDigital PROGRAMME = uec PROJECT_GROUP = uec/dos PROJECT_GROUP_SHORT = uec-dos @@ -26,7 +26,7 @@ TF_VAR_environment = $(ENVIRONMENT) TF_VAR_aws_account_name = $(AWS_ACCOUNT_NAME) TF_VAR_deployment_secrets = $(DEPLOYMENT_SECRETS) PROJECT_DEPLOYMENT_SECRETS = $(DEPLOYMENT_SECRETS) -TF_VAR_github_owner = nhsd-exeter +TF_VAR_github_owner = NHSDigital TF_VAR_github_repo = dos-integration PARALLEL_TEST_COUNT := $(or $(PARALLEL_TEST_COUNT), auto) @@ -45,11 +45,13 @@ TF_VAR_cicd_blue_green_deployment_pipeline_name := $(PROJECT_ID)-$(ENVIRONMENT)- TF_VAR_cicd_shared_resources_deployment_pipeline_name := $(PROJECT_ID)-$(ENVIRONMENT)-cicd-shared-resources-deployment-pipeline TF_VAR_blue_green_deployment_new_version_parameter_name := $(PROJECT_ID)-$(ENVIRONMENT)-blue-green-deployment-new-version TF_VAR_development_tools_encryption_key_alias := $(PROJECT_ID)-$(ENVIRONMENT)-development-tools-encryption-key -TF_VAR_github_url := https://github.com/nhsd-exeter/dos-integration.git +TF_VAR_github_url := https://github.com/NHSDigital/dos-integration.git TF_VAR_pipeline_topic_name := $(PROJECT_ID)-$(ENVIRONMENT)-pipeline-topic TF_VAR_pipeline_notification_name := $(PROJECT_ID)-$(ENVIRONMENT)-pipeline-notification TF_VAR_cicd_blue_green_deployment_pipeline_nofitication_name := $(PROJECT_ID)-$(ENVIRONMENT)-blue-green-pipeline-notification TF_VAR_cicd_shared_resources_deployment_pipeline_nofitication_name := $(PROJECT_ID)-$(ENVIRONMENT)-shared-resources-pipeline-notification +TF_VAR_cicd_blue_green_deployment_pipeline_eventbridge_rule_name := $(PROJECT_ID)-$(ENVIRONMENT)-trigger-blue-green-pipeline +TF_VAR_cicd_shared_resources_deployment_pipeline_eventbridge_rule_name := $(PROJECT_ID)-$(ENVIRONMENT)-trigger-shared-resources-pipeline TF_VAR_pipeline_chatbot_channel := $(PROJECT_ID)-cicd-slk-channel TF_VAR_nightly_rule_name := $(PROJECT_ID)-$(ENVIRONMENT)-performance-pipeline-nightly-rule diff --git a/infrastructure/modules/eventbridge_pipeline_trigger/main.tf b/infrastructure/modules/eventbridge_pipeline_trigger/main.tf new file mode 100644 index 000000000..1c321ddf7 --- /dev/null +++ b/infrastructure/modules/eventbridge_pipeline_trigger/main.tf @@ -0,0 +1,22 @@ +resource "aws_cloudwatch_event_rule" "trigger_pipeline" { + name = var.rule_name + description = var.description + event_pattern = < services of type for an odscode starting with A When the quality checker is run @@ -11,7 +11,7 @@ Feature: F008. Check DoS data quality | 2 | active | 148 | Multiple 'Pharmacy' type services found (type 148) | | 2 | active | 149 | Multiple 'Pharmacy' type services found (type 149) | - @complete @slack_and_infrastructure + @complete @slack_and_infrastructure @quality_checker Scenario Outline: F008SX02. Check for not too many services Given services of type for an odscode starting with A When the quality checker is run @@ -24,7 +24,7 @@ Feature: F008. Check DoS data quality | 2 | closed | 149 | Multiple 'Pharmacy' type services found (type 149) | | 2 | commissioning | 149 | Multiple 'Pharmacy' type services found (type 149) | - @complete @slack_and_infrastructure + @complete @slack_and_infrastructure @quality_checker Scenario Outline: F008SX03. Palliative on correct service type with incorrect odscode length Given an active service of type for a character odscode starting with A And the service in DoS supports palliative care @@ -36,7 +36,7 @@ Feature: F008. Check DoS data quality | 13 | 6 | Palliative Care ZCode is on the correct service type, but the service is incorrectly profiled | - @complete @slack_and_infrastructure + @complete @slack_and_infrastructure @quality_checker Scenario Outline: F008SX04. Blood Pressure/Contraception/Palliative Care on a non-blood pressure/non-contraception/non-palliative care service type does report Given services of type for an odscode starting with A And the DoS service has Z code @@ -59,13 +59,12 @@ Feature: F008. Check DoS data quality | contraception | 148 | 1 | active | Contraception ZCode is on invalid service type | | palliative care | 131 | 1 | active | Palliative Care ZCode is on invalid service type | | palliative care | 132 | 1 | active | Palliative Care ZCode is on invalid service type | - | palliative care | 134 | 1 | active | Palliative Care ZCode is on invalid service type | | palliative care | 137 | 1 | active | Palliative Care ZCode is on invalid service type | | palliative care | 148 | 1 | active | Palliative Care ZCode is on invalid service type | | palliative care | 149 | 1 | active | Palliative Care ZCode is on invalid service type | - @complete @slack_and_infrastructure + @complete @slack_and_infrastructure @quality_checker Scenario Outline: F008SX05. Blood Pressure/Contraception on a blood pressure/contraception service type does not report Given services of type for an odscode starting with A And the DoS service has Z code @@ -77,9 +76,10 @@ Feature: F008. Check DoS data quality | blood pressure | 148 | 1 | active | Blood Pressure ZCode is on invalid service type | | contraception | 149 | 1 | active | Contraception ZCode is on invalid service type | | palliative care | 13 | 1 | active | Palliative Care ZCode is on invalid service type | + | palliative care | 134 | 1 | active | Palliative Care ZCode is on invalid service type | - @complete @slack_and_infrastructure + @complete @slack_and_infrastructure @quality_checker Scenario Outline: F008SX06. Palliative on correct service type with correct odscode length does not report Given an active service of type for a character odscode starting with A And the service in DoS supports palliative care