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( 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