Skip to content

Commit 52c02ac

Browse files
committed
VED-350: making _elements optional, removing pre-validation to see response without the params
1 parent 4228d03 commit 52c02ac

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

backend/src/fhir_controller.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ def _validate_identifier_system(self, _id: str, _element: str) -> Optional[dict]
490490
severity=Severity.error,
491491
code=Code.invalid,
492492
diagnostics=(
493-
"Search parameter immunization.identifier must have one value and must be in the format of "
494-
'"immunization.identifier.system|immunization.identifier.value" '
493+
"Search parameter identifier must have one value and must be in the format of "
494+
'"identifier.system|identifier.value" '
495495
'e.g. "http://xyz.org/vaccs|2345-gh3s-r53h7-12ny"'
496496
),
497497
)
@@ -501,18 +501,12 @@ def _validate_identifier_system(self, _id: str, _element: str) -> Optional[dict]
501501
severity=Severity.error,
502502
code=Code.invalid,
503503
diagnostics=(
504-
"Search parameter immunization.identifier must be in the format of "
505-
'"immunization.identifier.system|immunization.identifier.value" '
504+
"Search parameter identifier must be in the format of "
505+
'"identifier.system|identifier.value" '
506506
'e.g. "http://xyz.org/vaccs|2345-gh3s-r53h7-12ny"'
507507
),
508508
)
509-
if not _element:
510-
return create_operation_outcome(
511-
resource_id=str(uuid.uuid4()),
512-
severity=Severity.error,
513-
code=Code.invalid,
514-
diagnostics="_element must be one or more of the following: id,meta",
515-
)
509+
516510
element_lower = _element.lower()
517511
result = element_lower.split(",")
518512
is_present = all(key in ["id", "meta"] for key in result)
@@ -521,7 +515,7 @@ def _validate_identifier_system(self, _id: str, _element: str) -> Optional[dict]
521515
resource_id=str(uuid.uuid4()),
522516
severity=Severity.error,
523517
code=Code.invalid,
524-
diagnostics="_element must be one or more of the following: id,meta",
518+
diagnostics="_elements must be one or more of the following: id,meta",
525519
)
526520

527521
def _create_bad_request(self, message):

backend/src/fhir_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def get_immunization_by_identifier(
6262
) -> Optional[dict]:
6363
"""
6464
Get an Immunization by its ID. Return None if not found. If the patient doesn't have an NHS number,
65-
return the Immunization without calling PDS or checking S flag.
65+
return the Immunization.
6666
"""
6767
imms_resp = self.immunization_repo.get_immunization_by_identifier(
6868
identifier_pk, imms_vax_type_perms
@@ -79,7 +79,7 @@ def get_immunization_by_identifier(
7979
def get_immunization_by_id(self, imms_id: str, imms_vax_type_perms: list[str]) -> Optional[dict]:
8080
"""
8181
Get an Immunization by its ID. Return None if it is not found. If the patient doesn't have an NHS number,
82-
return the Immunization without calling PDS or checking S flag.
82+
return the Immunization.
8383
"""
8484
if not (imms_resp := self.immunization_repo.get_immunization_by_id(imms_id, imms_vax_type_perms)):
8585
return None
@@ -95,7 +95,7 @@ def get_immunization_by_id(self, imms_id: str, imms_vax_type_perms: list[str]) -
9595
def get_immunization_by_id_all(self, imms_id: str, imms: dict) -> Optional[dict]:
9696
"""
9797
Get an Immunization by its ID. Return None if not found. If the patient doesn't have an NHS number,
98-
return the Immunization without calling PDS or checking S flag.
98+
return the Immunization.
9999
"""
100100
imms["id"] = imms_id
101101
try:

0 commit comments

Comments
 (0)