Skip to content

Commit

Permalink
fix bugs in address and telecom
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiagoTrabach committed Sep 2, 2023
1 parent 8c85797 commit 3df9117
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fhir_utils/fhir/patient/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def format_name(self, name):

def format_cep(self):
if type(self.address) is list:
for i in self.address:
for i, _ in enumerate(self.address):
try:
self.address[i]["postalCode"] = keep_numeric_characters(self.address[i]["postalCode"])
except:
Expand All @@ -89,7 +89,7 @@ def format_cep(self):
def format_phone(self):
# TODO: add DDI and DDD if no present
if type(self.telecom) is list:
for i in self.address:
for i, _ in enumerate(self.telecom):
if self.telecom[i]["system"] == "phone":
self.telecom[i]["value"] = keep_numeric_characters(self.telecom[i]["value"])

Expand Down Expand Up @@ -128,7 +128,7 @@ def check_address(self):
if type(self.address) is list:
keys = ["use", "type", "line", "city", "state", "postalCode"]

for i in self.address:
for i, _ in enumerate(self.address):
# if all must have keys are present
if not all(key in self.address[i] for key in keys):
self._is_valid = False
Expand Down Expand Up @@ -164,7 +164,7 @@ def check_telecom(self):
if type(self.telecom) is list:
keys = ["system", "value", "use"]

for i in self.telecom:
for i, _ in enumerate(self.telecom):
# if all must have keys are present
if not all(key in self.telecom[i] for key in keys):
self._is_valid = False
Expand Down

0 comments on commit 3df9117

Please sign in to comment.