From e965e4a0bf0d5c2a65e61ca9ceec7b0a087e87a4 Mon Sep 17 00:00:00 2001 From: Matthew Begley <60427904+mabe13@users.noreply.github.com> Date: Thu, 10 Jul 2025 13:04:56 +0100 Subject: [PATCH 1/2] Added line to remove DSPs from pallative z-code quality checks --- application/common/constants.py | 3 ++- application/quality_checker/search_dos.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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/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( From 36c2833fbcb02f915a1feee6534f28b2c02bff52 Mon Sep 17 00:00:00 2001 From: Matthew Begley <60427904+mabe13@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:42:06 +0100 Subject: [PATCH 2/2] Update quality checker integration tests --- .../features/F008_Quality_Checker.feature | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/integration/features/F008_Quality_Checker.feature b/test/integration/features/F008_Quality_Checker.feature index d01f307f2..19d9698f3 100644 --- a/test/integration/features/F008_Quality_Checker.feature +++ b/test/integration/features/F008_Quality_Checker.feature @@ -1,6 +1,6 @@ Feature: F008. Check DoS data quality - @complete @slack_and_infrastructure + @complete @slack_and_infrastructure @quality_checker Scenario Outline: F008SX01. Check for too many services Given 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