Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion application/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions application/quality_checker/search_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions test/integration/features/F008_Quality_Checker.feature
Original file line number Diff line number Diff line change
@@ -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 <service_count> <service_status> services of type <service_type> for an odscode starting with A
When the quality checker is run
Expand All @@ -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 <service_count> <service_status> services of type <service_type> for an odscode starting with A
When the quality checker is run
Expand All @@ -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 <service_type> for a <character_count> character odscode starting with A
And the service in DoS supports palliative care
Expand All @@ -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 <service_count> <service_status> services of type <service_type> for an odscode starting with A
And the DoS service has <commissioned_service> Z code
Expand All @@ -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 <service_count> <service_status> services of type <service_type> for an odscode starting with A
And the DoS service has <commissioned_service> Z code
Expand All @@ -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 <service_type> for a <character_count> character odscode starting with A
And the service in DoS supports palliative care
Expand Down
Loading