Skip to content

Commit

Permalink
populate data.rows from SQLA row object (not as simple as i had hoped).
Browse files Browse the repository at this point in the history
  • Loading branch information
pbugni committed Oct 1, 2024
1 parent b0876e8 commit 33a42a4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions portal/views/patients.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def page_of_patients():
# build set of org ids the user has permission to view
viewable_orgs = set()
for org in user.organizations:
ids = OrgTree.here_and_below_id(org.id)
ids = OrgTree().here_and_below_id(org.id)
viewable_orgs.update(ids)

# TODO apply filter to viewable orgs
Expand All @@ -131,7 +131,22 @@ def page_of_patients():
# { "id": int, "column": value},
# { "id": int, "column": value},
# ]}
data = {"total": total, "totalNotFiltered": total, "rows": [dict(row) for row in query]}
data = {"total": total, "totalNotFiltered": total, "rows": []}
for row in query:
data['rows'].append({
"id": row.id,
"first_name": row.first_name,
"last_name": row.last_name,
"birthdate": row.birthdate,
"email": row.email,
"questionnaire_status": row.questionnaire_status,
"visit": row.visit,
"study_id": row.study_id,
"consent_date": row.consent_date,
"sites": row.sites,
"deleted": row.deleted,
"test_role": row.test_role,
})
return jsonify(data)


Expand Down

0 comments on commit 33a42a4

Please sign in to comment.