Skip to content

Commit

Permalink
ensure patient entry list is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Costello committed Sep 17, 2024
1 parent 6651007 commit 2409a2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion corehq/motech/fhir/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,11 @@ def get_patient_fhir_id(given_name, family_name, birthdate, access_token):
if response.status_code == 200:
response_json = response.json()
fhir_id = None
entry = response_json.get('entry')[0]
entry_list = response_json.get('entry')
if entry_list and len(entry_list) > 0:
entry = entry_list[0]
else:
entry = None
if entry:
resource = entry.get('resource')
if resource:
Expand Down

0 comments on commit 2409a2e

Please sign in to comment.