Skip to content

Commit 8a37408

Browse files
committed
fix sonar issues
1 parent 69f46a0 commit 8a37408

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lambdas/shared/src/common/validator/parsers/csv_line_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def parse_csv_line(self, csv_row: str, csv_header: str) -> None:
2626
# create a key value mapping
2727
keys = list(csv.reader([csv_header]))[0]
2828
values = list(csv.reader([csv_row]))[0]
29-
self.csv_file_data = dict(map(lambda i, j: (i, j), keys, values))
29+
self.csv_file_data = dict(zip(keys, values, strict=False))
3030

3131
# Retrieves the value of a specific column name as a list.
3232
def get_key_value(self, field_name: str) -> list[str]:

lambdas/shared/src/common/validator/parsers/fhir_parser.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _locate_fhir_item_in_dict(self, fhir_resource: dict, fhir_field: str) -> boo
2929
except Exception:
3030
return False
3131

32-
def _locate_fhir_item_in_list(self, fhir_resource: list, fhir_field: str) -> dict:
32+
def _locate_fhir_item_in_list(self, fhir_resource: list, fhir_field: str) -> dict | str:
3333
"""
3434
Locates and returns the first FHIR item (dictionary) in a list that contains
3535
the specified FHIR field name or value.
@@ -43,13 +43,14 @@ def _locate_fhir_item_in_list(self, fhir_resource: list, fhir_field: str) -> dic
4343
try:
4444
while index < len(fhir_resource):
4545
for key in fhir_resource[index]:
46-
if (fhir_resource[index][key] == field_list[1]) or (key == field_list[1]):
46+
fhir_value = fhir_resource[index][key]
47+
if (
48+
fhir_value == field_list[1]
49+
or key == field_list[1]
50+
or self._locate_fhir_item_in_dict(fhir_value, field_list[1])
51+
):
4752
node_id = index
4853
break
49-
else:
50-
if self._locate_fhir_item_in_dict(fhir_resource[index][key], field_list[1]):
51-
node_id = index
52-
break
5354
index += 1
5455
except Exception:
5556
return ""

0 commit comments

Comments
 (0)