Skip to content

Commit

Permalink
TN-3101 correct default (prior to initiation) status for EMPRO questi…
Browse files Browse the repository at this point in the history
…onnaires (#4159)

* TN-3101 default (prior to initiation) status for EMPRO questionnaires should show as "Not yet available".  Default of "expired" left in place for global study.

* Match case of other columns, i.e. "Not Yet Available"

* Correct comment as per default status change.

* Apply TN-3101 fix for "Not Yet Available" EMPRO status within adherence report.

* Update portal/models/reporting.py

Co-authored-by: Ivan Cvitkovic <ivanc@uw.edu>
  • Loading branch information
pbugni and ivan-c authored Nov 24, 2021
1 parent d9ab5f3 commit d71d1c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions portal/models/qb_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,8 @@ def qb_status_visit_name(user_id, research_study_id, as_of_date):
``QB_StatusCacheKey.current()`` for as_of_date parameter, to avoid
a new lookup with each passing moment.
If no data is available for the user, returns
If no data is available for the user, `status` of `Not Yet Available` for
the EMPRO study, `expired` for all others, as part of:
{'status': 'expired', 'visit_name': None, 'action_state': 'not applicable'}
:returns: dictionary with key/values for:
Expand All @@ -1269,8 +1270,11 @@ def qb_status_visit_name(user_id, research_study_id, as_of_date):
assert isinstance(research_study_id, int)
assert isinstance(as_of_date, datetime)

default_status = (
"Not Yet Available" if research_study_id == EMPRO_RS_ID
else OverallStatus.expired)
results = {
'status': OverallStatus.expired,
'status': default_status,
'visit_name': None,
'action_state': 'not applicable'
}
Expand Down
6 changes: 5 additions & 1 deletion portal/models/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ def adherence_report(
# if no current, try previous (as current may be expired)
last_viable = qb_stats.current_qbd(
even_if_withdrawn=True) or qb_stats.prev_qbd
if last_viable:
if not last_viable:
# Global study default pre-started is Expired. See TN-3101
if row['status'] == "Expired":
row['status'] = "Not Yet Available"
else:
row['qb'] = last_viable.questionnaire_bank.name
row['visit'] = visit_name(last_viable)
if row['status'] == 'Completed':
Expand Down

0 comments on commit d71d1c2

Please sign in to comment.