Skip to content

Commit 716bfe4

Browse files
committed
removed PDS
1 parent 7e2e42a commit 716bfe4

File tree

9 files changed

+22
-510
lines changed

9 files changed

+22
-510
lines changed

backend/src/authentication.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

backend/src/fhir_controller.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from botocore.config import Config
88
from decimal import Decimal
99
from typing import Optional
10-
from authentication import AppRestrictedAuth, Service
1110
import boto3
1211
from aws_lambda_typing.events import APIGatewayProxyEventV1
1312
from botocore.config import Config
@@ -36,7 +35,6 @@
3635
from models.utils.generic_utils import check_keys_in_sources
3736
from models.utils.permissions import get_supplier_permissions
3837
from models.utils.permission_checker import ApiOperationCode, validate_permissions, _expand_permissions
39-
from pds_service import PdsService
4038
from parameter_parser import process_params, process_search_params, create_query_string
4139
import urllib.parse
4240

@@ -45,23 +43,15 @@
4543

4644

4745
def make_controller(
48-
pds_env: str = os.getenv("PDS_ENV", "int"),
4946
immunization_env: str = os.getenv("IMMUNIZATION_ENV"),
5047
):
5148
endpoint_url = "http://localhost:4566" if immunization_env == "local" else None
5249
imms_repo = ImmunizationRepository(create_table(endpoint_url=endpoint_url))
5350
boto_config = Config(region_name="eu-west-2")
5451
cache = Cache(directory="/tmp")
55-
authenticator = AppRestrictedAuth(
56-
service=Service.PDS,
57-
secret_manager_client=boto3.client("secretsmanager", config=boto_config),
58-
environment=pds_env,
59-
cache=cache,
60-
)
61-
pds_service = PdsService(authenticator, pds_env)
6252

6353
authorizer = Authorization()
64-
service = FhirService(imms_repo=imms_repo, pds_service=pds_service)
54+
service = FhirService(imms_repo=imms_repo)
6555

6656
return FhirController(authorizer=authorizer, fhir_service=service)
6757

backend/src/fhir_service.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from models.utils.generic_utils import nhs_number_mod11_check, get_occurrence_datetime, create_diagnostics, form_json, get_contained_patient
2424
from models.constants import Constants
2525
from models.errors import MandatoryError
26-
from pds_service import PdsService
2726
from timer import timed
2827
from filter import Filter
2928

@@ -53,11 +52,9 @@ class FhirService:
5352
def __init__(
5453
self,
5554
imms_repo: ImmunizationRepository,
56-
pds_service: PdsService,
5755
validator: ImmunizationValidator = ImmunizationValidator(),
5856
):
5957
self.immunization_repo = imms_repo
60-
self.pds_service = pds_service
6158
self.validator = validator
6259

6360
def get_immunization_by_identifier(
@@ -344,10 +341,10 @@ def search_immunizations(
344341
@timed
345342
def _validate_patient(self, imms: dict) -> dict:
346343
"""
347-
Get the NHS number from the contained Patient resource and validate it with PDS.
344+
Get the NHS number from the contained Patient resource and validate it.
348345
349346
If the NHS number doesn't exist, return an empty dict.
350-
If the NHS number exists, get the patient details from PDS and return the patient details.
347+
If the NHS number exists, check it's valid, and return the patient details.
351348
"""
352349
try:
353350
contained_patient = get_contained_patient(imms)
@@ -358,28 +355,7 @@ def _validate_patient(self, imms: dict) -> dict:
358355
if not nhs_number:
359356
return {}
360357

361-
if os.getenv("PDS_CHECK_ENABLED") == "false":
362-
logger.warning("Skipping PDS check")
363-
return contained_patient
364-
365-
# JW: PoC
366-
# the above pre-validation code is valid I think, it's just a question of
367-
# removing the PDS call below
368-
# TODO: we then have to tweak the tests, possibly write new ones
369-
# -
370358
if nhs_number_mod11_check(nhs_number):
371359
return contained_patient
372360

373-
'''
374-
patient = self.pds_service.get_patient_details(nhs_number)
375-
# To check whether the Superseded NHS number present in PDS
376-
if patient:
377-
pds_nhs_number = patient["identifier"][0]["value"]
378-
if pds_nhs_number != nhs_number:
379-
diagnostics_error = create_diagnostics()
380-
return diagnostics_error
381-
382-
return patient
383-
'''
384-
385361
raise InvalidPatientId(patient_identifier=nhs_number)

backend/src/pds_service.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)