Skip to content

Commit

Permalink
Merge branch 'release/0.3.69' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Jan 25, 2024
2 parents 9402f8e + c841047 commit d0cb165
Show file tree
Hide file tree
Showing 13 changed files with 318 additions and 201 deletions.
9 changes: 0 additions & 9 deletions edc_adverse_event/auth_objects.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
from .utils import get_adverse_event_app_label, get_hospitalization_model_app_label

AE = "AE"
AE_REVIEW = "AE_REVIEW"
AE_ROLE = "ae_role"
AE_SUPER = "AE_SUPER"

TMG = "TMG"
TMG_REVIEW = "TMG_REVIEW"
TMG_ROLE = "tmg"

ae_codenames = [
"edc_adverse_event.nav_ae_section",
"edc_adverse_event.view_ae_listboard",
Expand Down
8 changes: 1 addition & 7 deletions edc_adverse_event/auths.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@
from edc_auth.utils import remove_default_model_permissions_from_edc_permissions

from .auth_objects import (
AE,
AE_REVIEW,
AE_ROLE,
AE_SUPER,
TMG,
TMG_REVIEW,
TMG_ROLE,
ae_codenames,
ae_dashboard_tuples,
ae_navbar_tuples,
tmg_codenames,
tmg_dashboard_tuples,
tmg_navbar_tuples,
)
from .constants import AE, AE_REVIEW, AE_ROLE, AE_SUPER, TMG, TMG_REVIEW, TMG_ROLE

site_auths.add_post_update_func(
"edc_adverse_event", remove_default_model_permissions_from_edc_permissions
Expand Down
9 changes: 9 additions & 0 deletions edc_adverse_event/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@
RECOVERING = "recovering"
STUDY_TERMINATION_CONCLUSION_ACTION = "submit-study-termination-conclusion"
UNLIKELY_RELATED = "unlikely_related"

# roles
AE = "AE"
AE_REVIEW = "AE_REVIEW"
AE_ROLE = "ae_role"
AE_SUPER = "AE_SUPER"
TMG = "TMG"
TMG_REVIEW = "TMG_REVIEW"
TMG_ROLE = "tmg"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django import forms

from ..form_validators import AeTmgFormValidator
from .ae_modelform_mixin import AeModelFormMixin
from . import AeModelFormMixin


class AeTmgModelFormMixin(AeModelFormMixin):
Expand Down
3 changes: 1 addition & 2 deletions edc_adverse_event/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from edc_notification.models import Notification
from edc_utils import get_utcnow

from .auth_objects import TMG
from .constants import AE_TMG_ACTION, DEATH_REPORT_TMG_ACTION
from .constants import AE_TMG_ACTION, DEATH_REPORT_TMG_ACTION, TMG
from .utils import get_ae_model

AeInitial = get_ae_model("AeInitial")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% load i18n %}

<div class="list-group-item list-group-item-{{ panel_color }}">
<a class="btn btn-sm btn-{% if reference_obj %}success{% else%}warning{% endif %}"
title="{% if reference_obj %}{% if view_only %}View{% elif may_access_tmg_obj %}Edit{% else %}May only be edited by {{ reference_obj.user_created }}{% endif %}{% else %}Add{% endif %}" data-toggle="tooltip" role="button" id="reference_obj-{{ counter }}"
{% if not disabled %} href="{{ reference_obj.get_absolute_url }}?next=edc_adverse_event:open_tmg_ae_listboard_url" {% endif %} {{ disabled }}>
<i class="fas {{ fa_icon }} fa-fw"></i> {{ label }}
</a>
&nbsp;{{ action_item.display_name|cut:"Submit"|cut:"pending" }} {{ action_item.identifier|default:"New" }}
&nbsp;{% if report_status == OPEN %}<span class="label label-danger">OPEN</span>{% endif %}
<a class="btn btn-sm btn-{{ btn.color }}" title="{{ btn.title }}" data-toggle="tooltip" role="button" id="reference_obj-{{ btn.id }}" {% if not btn.disabled %} href="{{ btn.url }}" {% endif %} {{ btn.disabled }} >
<i class="fas {{ btn.fa_icon }} fa-fw"></i> {{ btn.label }}
</a>&nbsp;
{{ panel_label }} {% if report_status == OPEN %}<span class="label label-danger" data-toggle="tooltip" title="{% trans "This report is open" %}">OPEN</span>{% endif %}
</div>
{% if reference_obj %}
<div class="list-group-item"><b>{% trans "Created" %}:</b> {{ reference_obj.user_created|default:"---" }}&nbsp;{{ reference_obj.created|date:"SHORT_DATETIME_FORMAT"|default:"---" }}</div>
<div class="list-group-item"><b>{% trans "Last modified" %}:</b> {{ reference_obj.user_modified|default:"---" }}&nbsp;{{ reference_obj.modified|date:"SHORT_DATETIME_FORMAT"|default:"---" }}</div>
{% if reference_obj.report_status == CLOSED %}
<div class="list-group-item"><b>{% trans "Report closed" %}:</b> {{ reference_obj.report_closed_datetime|date:"SHORT_DATETIME_FORMAT"|default:"---" }}</div>
{% endif %}
{% endif %}
<div class="list-group-item"><B>Action first created:</B> {{ action_item.report_datetime|date:"SHORT_DATETIME_FORMAT" }}</div>
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@
</div> <!--end panel heading -->
</div>


x
<!-- begin new tab -->
{# results in qs of ActionItem #}

{% if status == NEW %}
{% tmg_listboard_results results "There are no new reports to submit for this site." %}
{% get_empty_qs_message "new" search_term as msg %}
{% tmg_listboard_results results msg %}
{% elif status == OPEN %}
{% tmg_listboard_results results "There are no open reports to submit for this site." %}
{% get_empty_qs_message "open" search_term as msg %}
{% tmg_listboard_results results msg %}
{% elif status == CLOSED %}
{% tmg_listboard_results results "There are no closed reports for this site." %}
{% get_empty_qs_message "closed" search_term as msg %}
{% tmg_listboard_results results msg %}
{% endif %}
<!-- end new tab -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,81 @@
{% load static %}
{% load edc_adverse_event_extras %}

<div class="col-md-12">
<div class="row">
{% if not results %}
<div class="alert alert-success"><h6><i class="fas fa-thumbs-up fa-lg"></i> {{ empty_message }}</h6></div>
{% endif %}
{% has_perms_for_tmg_role as may_access_page %}
{% if may_access_page %}
{% for result in results %}
<div class="panel panel-default">
<div class="panel-heading"><h5><span class="badge">{{ forloop.counter }}</span> <span class="text text-uppercase">{{ result.subject_identifier }}</span> {% copy_string_to_clipboard_button result.subject_identifier %} <span class="text text-muted small">{{ utc_date|timeuntil:result.report_datetime.date }} ago</span></h5></div>
<div class="panel-body">
<div class="row">
<div class="col-md-4">
{% has_perms_for_tmg_role as may_access_page %}
{% if may_access_page %}
<div class="col-md-12">
<div class="row">
{% if not results %}
<div class="alert alert-success"><i class="fas fa-thumbs-up fa-lg"></i> {{ empty_message }}</div>
{% endif %}
{% has_perms_for_tmg_role as may_access_page %}
{% if may_access_page %}
{% for result in results %}
<div class="panel panel-default">
<div class="panel-heading"><h5><span class="badge">{{ forloop.counter }}</span> <span class="text text-uppercase">{{ result.subject_identifier }}</span> {% copy_string_to_clipboard_button result.subject_identifier %} <span class="text text-muted small">{{ utc_date|timeuntil:result.report_datetime.date }} ago</span></h5></div>
<div class="panel-body">
<div class="row">
<div class="col-md-4">

<div class="list-group">
{% render_tmg_panel action_item=result change=True by_user_created_only=True counter=forloop.counter report_status=result.report_status %}
</div>
<div class="list-group">
{# AE TMG #}
{% render_tmg_panel action_item=result by_user_created_only=True counter=forloop.counter report_status=result.reference_obj.report_status %}
</div>

{% death_report_tmg_queryset action_item=result as qs %}
{% for death_report_tmg in qs %}
{% render_tmg_panel reference_obj=death_report_tmg change=True by_user_created_only=True counter=forloop.counter %}
{% endfor %}
{% death_report_tmg_queryset action_item=result as qs %}
{% for death_report_tmg in qs %}
{% render_tmg_panel reference_obj=death_report_tmg by_user_created_only=True counter=forloop.counter %}
{% endfor %}

{% death_report_tmg2_queryset action_item=result as qs %}
{% for death_report_tmg2 in qs %}
{% render_tmg_panel reference_obj=death_report_tmg2 change=True by_user_created_only=True counter=forloop.counter %}
{% endfor %}
{% death_report_tmg2_queryset action_item=result as qs %}
{% for death_report_tmg2 in qs %}
{% render_tmg_panel reference_obj=death_report_tmg2 by_user_created_only=True counter=forloop.counter %}
{% endfor %}

</div>
</div>

<div class="col-md-4">
<div class="list-group">
{% render_tmg_panel action_item=result.parent_action_item view_only=True counter=forloop.counter %}
{% if result.parent_action_item.reference_obj.action_identifier != result.related_action_item.reference_obj.action_identifier %}
{% render_tmg_panel action_item=result.related_action_item view_only=True counter=forloop.counter %}
{% endif %}
<div class="col-md-4">
<div class="list-group">
{# AE INTIAL #}
{% render_tmg_panel action_item=result.parent_action_item counter=forloop.counter %}
{% if result.parent_action_item.reference_obj.action_identifier != result.related_action_item.reference_obj.action_identifier %}
{% render_tmg_panel action_item=result.related_action_item counter=forloop.counter %}
{% endif %}
</div>
</div>
</div>

<div class="col-md-4">
<div class="col-md-4">

{% ae_followup_queryset ae_initial=result.parent_action_item.reference_obj as qs %}
{% if qs.count == 0 %}<div class="list-group-item">There are no follow-ups to this AE</div>{% endif %}
{% for ae_followup in qs %}
{% render_tmg_panel reference_obj=ae_followup view_only=True counter=forloop.counter %}
{% endfor %}
{% ae_followup_queryset ae_initial=result.parent_action_item.reference_obj as qs %}
{% if qs.count == 0 %}<div class="list-group-item">There are no follow-ups to this AE</div>{% endif %}
{% for ae_followup in qs %}
{% render_tmg_panel reference_obj=ae_followup counter=forloop.counter %}
{% endfor %}

{% death_report_queryset subject_identifier=result.subject_identifier as qs %}
{% for death_report in qs %}
{% render_tmg_panel reference_obj=death_report view_only=True counter=forloop.counter %}
{% endfor %}
{% death_report_queryset subject_identifier=result.subject_identifier as qs %}
{% for death_report in qs %}
{% render_tmg_panel reference_obj=death_report counter=forloop.counter %}
{% endfor %}

<div class="list-group-item">
<a class="btn btn-sm btn-primary" role="button" title="go to list of reported visits for this subject" href="{% url subject_review_listboard_url|default:"subject_review_listboard_url_cannot_be_none" %}?q={{ result.subject_identifier }}">Subject Review <i class="fas fa-share"></i></a>
</div>
<div class="list-group-item">
<a class="btn btn-sm btn-primary" role="button" title="go to list of reported visits for this subject" href="{% url subject_review_listboard_url|default:"subject_review_listboard_url_cannot_be_none" %}?q={{ result.subject_identifier }}">Subject Review <i class="fas fa-share"></i></a>
</div>

<div class="list-group-item">
<a class="btn btn-sm btn-default" role="button" title="Go to action item" href="{{ result.get_absolute_url }}?next=edc_adverse_event:open_tmg_ae_listboard_url">{{ result.identifier }}</a> {{ result.display_name }}
</div>
<div class="list-group-item">
<a class="btn btn-sm btn-default" role="button" title="Go to action item" href="{{ result.get_absolute_url }}?next=edc_adverse_event:open_tmg_ae_listboard_url">{{ result.identifier }}</a> {{ result.display_name }}
</div>

</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="alert alert-danger">
<i class="fas fa-hand-paper fa-lg"></i> You do not have permissions to view this page. Only users with the TMG Role are allowed access. Check with your administrator.
</div>
{% endfor %}
{% else %}
<div class="alert alert-danger">
<i class="fas fa-hand-paper fa-lg"></i> You do not have permissions to view this page. Only users with the TMG Role are allowed access. Check with your administrator.
</div>
{% endif %}
<div class="well">{% paginator_row %}</div>
{% endif %}
<div class="well">{% paginator_row %}</div>
</div>
</div>
</div>
{% endif %}
Loading

0 comments on commit d0cb165

Please sign in to comment.