Skip to content

Commit

Permalink
EMPRO opt out UI (#4335)
Browse files Browse the repository at this point in the history
https://movember.atlassian.net/browse/TN-3252
- Frontend calls the trigger api, i.e. `/api/patient/[userId]/trigger`
to retrieve the latest triggers and check if there is any that has
`_sequential_hard_trigger_count` > 1 (meaning then that it has been
asked previously) (see example triggers JSON):
```
{
 ...
  "timestamp": "2023-07-31T23:17:03+00:00",
  "triggers": {
    "domains": {
           "anxious": {
              "ironman_ss.11": "hard",
              "ironman_ss.12": "hard",
              "ironman_ss.13": "hard",
              "_sequential_hard_trigger_count": 3
            },
           "fatigue": {
              "ironman_ss.10": "hard",
              "ironman_ss.9": "hard",
              "_sequential_hard_trigger_count": 2
            },
          "general_pain": {
                "ironman_ss.1": "hard",
                "ironman_ss.2": "hard",
                "ironman_ss.3": "hard",
                "_sequential_hard_trigger_count": 3
              },
           "joint_pain": {
              "ironman_ss.4": "hard",
              "ironman_ss.5": "hard",
              "ironman_ss.6": "hard",
              "_sequential_hard_trigger_count": 2
            },
          "sad": {
            "ironman_ss.17": "hard",
            "ironman_ss.18": "hard",
            "ironman_ss.19": "hard",
            "_sequential_hard_trigger_count": 3
          },
    }
   }
...
}
```
- If it finds any qualifying domains, it will present the OPT-OUT UI
modal to the user, with the checkbox(es) that allow user to select which
domain(s) to opt out:

![OptoutInputs](https://github.com/uwcirg/truenth-portal/assets/12942714/e4679692-1f3a-4e75-bed0-27a22376d55f)

- frontend submits the domain(s) that user has chosen to opt out to the
backend API, `/api/patient/<user_id>/triggers/opt_out`, to be saved on
the database for later use (e.g. use in clinician email, adherence
report)

- One user submits the request, the EMPRO thank you modal that follows
will display which(s) domains the user has chosen to opt out:

![OptoutChosen](https://github.com/uwcirg/truenth-portal/assets/12942714/5752b438-eb89-4e4c-a113-98d9a8497a40)

---------

Co-authored-by: Amy Chen <clone@cesium.cirg.washington.edu>
Co-authored-by: Paul Bugni <pbugni@u.washington.edu>
  • Loading branch information
3 people committed Mar 21, 2024
1 parent 1055358 commit 7b16760
Show file tree
Hide file tree
Showing 9 changed files with 1,220 additions and 186 deletions.
4 changes: 4 additions & 0 deletions portal/eproms/templates/eproms/assessment_engine.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@
<div class="error error-message"></div>
</div>
{% endif %}
{%- from "eproms/assessment_engine/ae_macros.html" import empro_thankyou_modal, empro_optout_modal -%}
{{empro_optout_modal(user)}}
{{empro_thankyou_modal(user)}}

Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
<section class="portal-main portal-flex-container">
{%- block body -%}{%- endblock -%}
</section>
<div class="loading-container hide"><div class="content"><i class="fa fa-spinner fa-spin fa-2x"></i> Loading ...</div></div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- from "eproms/assessment_engine/ae_macros.html" import render_header, render_greeting, render_card_content, render_call_to_button, due_card, completed_card, empro_due, empro_completed, empro_expired, completed_cards -%}
{%- from "eproms/assessment_engine/ae_macros.html" import render_header, render_greeting, render_card_content, render_call_to_button, due_card, completed_card, empro_due, empro_completed, empro_expired, completed_cards -%}
{% extends "eproms/assessment_engine/ae_base.html" %}
<!-- baseline due -->
{% block head %}
Expand Down
78 changes: 73 additions & 5 deletions portal/eproms/templates/eproms/assessment_engine/ae_macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ <h2 class="section-title">{{_("Completed Questionnaires")}}</h2>
{% endif %}
</div>
{%- endcall -%}
{% if substudy_assessment_status.overall_status == OverallStatus.completed %}
{{empro_thankyou_modal(user)}}
{% endif %}
{%- endif -%}
{%- endmacro -%}
{%- macro empro_thankyou_card(full_name="") -%}
Expand All @@ -227,13 +224,19 @@ <h4>{{_("Your Support Team")}}</h4>

</div>
{%- endmacro -%}
{%- macro empro_no_contact_notice() -%}
<div class="no-contact-list-wrapper hide">
<b>Note:</b> You have chosen not to be contacted about <span id="noContactTriggerList"></span>. Your care team will not discuss these issues this month.
</div>
{%- endmacro -%}
{%- macro empro_modal_hardTrigger_supportTeam_block(organization="") -%}
<div class="item">
<h4>{{_("Your Support Team")}}</h4>
<p>{{_("You reported experiencing or feeling:")}}</p>
<ul class="hardTriggersDisplayList">
<!-- dynamically populated based on user trigger domain(s) -->
</ul>
{{empro_no_contact_notice()}}
<p><b>{{_("To help address any issues, we've informed your care team and they'll be in contact with you soon.")}}</b></p>
{% if organization %}
<p>{{_("In the meantime, if you have any questions or need assistance, please contact your team at %(organization)s directly. They're happy to help.", organization=organization)}}</p>
Expand Down Expand Up @@ -270,8 +273,8 @@ <h4>{{_("Your Health Tips")}}</h4>
<!--sub-study macro -->
{%- macro empro_thankyou_modal(user) -%}
<!-- sub-study modal for display domain topic(s), resources link and summary report link to the user -->
<div class="modal fade" tabindex="-1" role="dialog" id="emproModal" {% if user and user.current_encounter().auth_method == 'url_authenticated'%}data-url-authenticated="true"{% endif %}>
<div class="modal-dialog">
<div class="modal fade" role="dialog" id="emproModal" tabindex="-1" aria-hidden="true" {% if user and user.current_encounter().auth_method == 'url_authenticated'%}data-url-authenticated="true"{% endif %}>
<div class="modal-dialog modal-xl">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-label="{{_('Close')}}">
<span aria-hidden="true">&times;</span>
Expand Down Expand Up @@ -311,6 +314,71 @@ <h2 class="title">
</div>
{{empro_script()}}
{%- endmacro -%}
<!--sub-study optout modal macro -->
{%- macro empro_optout_modal(user) -%}
<!-- sub-study modal for display domain topic(s), resources link and summary report link to the user -->
<div class="modal fade" role="dialog" id="emproOptOutModal" data-backdrop="static" tabindex="-1" aria-hidden="true" {% if user and user.current_encounter().auth_method == 'url_authenticated'%}data-url-authenticated="true"{% endif %}>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<button type="button" class="close btn-dismiss" data-dismiss="modal" aria-label="{{_('Close')}}">
<span aria-hidden="true">&times;</span>
</button>
<div class="modal-body">
<div class="header-section">
<h2 class="title">{{_("We want to check with you ...")}}</h2>
<div class="subtitle" style="margin-bottom: 8px">
{{_("About your preference to be contacted by your care team for these ongoing issues.")}}
</div>
</div>
<!-- <div class="items-section">
<div class="item wrap">
<ul>
<li>anxious</li>
<li>discouraged</li>
<li>fatigue</li>
</ul>
</div>
</div> -->
<p>{{_("We’ve noticed you’re continuing to experience challenges with the issues listed below.")}}</p>
<p class="text-warning">
<b>{{_("If you prefer not to be contacted by your care team for any (or all) of these issues, please check the box(es) below.")}}</b>
</p>
<p>
{{_("Your care team will continue to contact you as usual for other identified issues.")}}<br/>
{{_("If you have any questions or need assistance, please contact your team directly at %(organization)s. They'll be happy to help.", organization=user.organizations[0].name if user else "")}}
</p>
<div class="items-wrapper">
<p><b>{{_("Please do not contact me about:")}}</b></p>
<div class="items optout-domains-checkbox-list">
<!--
<div class="item">
<input type="checkbox">
<span>anxious</span>
</div>
<div class="item">
<input type="checkbox">
<span>discouraged</span>
</div>
-->
</div>
</div>
<div class="error-message"></div>
<div class="continue-container hide">
<button class="btn btn-default continue-button">Continue</button>
</div>
</div>
<div class="modal-footer">
<div>
<button class="btn btn-empro-primary btn-submit">Submit</button>
<button class="btn btn-default btn-dismiss">Dismiss</button>
</div>
<div class="saving-indicator-container hide"><i class="fa fa-spinner fa-spin"></i> {{_("Saving your choices...")}}</div>
<div class="save-success-indicator-container text-success hide"><i class="fa fa-check"></i> {{_("Your choices are saved successfully.")}}</div>
</div>
</div>
</div>
</div>
{%- endmacro -%}
{%- macro empro_script() -%}
<script src="{{ url_for('static', filename='js/dist/empro.bundle.js') }}" defer></script>
{%- endmacro -%}

0 comments on commit 7b16760

Please sign in to comment.