Skip to content

Commit

Permalink
TN-3281 add opted_out_domains column to adherence report
Browse files Browse the repository at this point in the history
  • Loading branch information
pbugni committed Apr 16, 2024
1 parent 46d63dd commit f2d8d58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions portal/models/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def empro_row_detail(row, ts_reporting):
or "")
ht = ts_reporting.hard_triggers_for_visit(visit_month)
row['hard_trigger_domains'] = ', '.join(ht) if ht else ""
oo = ts_reporting.soft_triggers_for_visit(visit_month)
row['opted_out_domains'] = ', '.join(oo) if oo else ""
st = ts_reporting.soft_triggers_for_visit(visit_month)
row['soft_trigger_domains'] = ', '.join(st) if st else ""
da = ts_reporting.domains_accessed(visit_month)
Expand Down Expand Up @@ -447,6 +449,7 @@ def patient_generator():
'EMPRO_questionnaire_completion_date',
'soft_trigger_domains',
'hard_trigger_domains',
'opted_out_domains',
'content_domains_accessed',
'clinician',
'clinician_status',
Expand Down
11 changes: 11 additions & 0 deletions portal/trigger_states/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ def soft_triggers_for_visit(self, visit_month):
if ts:
return ts.soft_trigger_list()

def opted_out_domains_for_visit(self, visit_month):
"""Return list of opted-out domains for given visit month
:param visit_month: zero indexed month value
:returns list of domains user opted-out of, or None if n/a
"""
ts = self.latest_by_visit[visit_month]
if ts:
return ts.opted_out_domains()


def rebuild_trigger_states(patient):
"""If a user's consent moves, need to re-build the trigger states for user
Expand Down

0 comments on commit f2d8d58

Please sign in to comment.