clinicedc 2.0.37__py3-none-any.whl → 2.0.39__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of clinicedc might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clinicedc
3
- Version: 2.0.37
3
+ Version: 2.0.39
4
4
  Summary: A clinical trials data management framework built on Django
5
5
  Keywords: django,clinicedc,edc,clinical trials,research,data management,esource
6
6
  Author: Erik van Widenfelt, Jonathan Willitts
@@ -244,8 +244,8 @@ edc_adverse_event/models/signals.py,sha256=K1N0Cn_rlrX2X3xSu-eqyDinyUtqjFeni6kTa
244
244
  edc_adverse_event/navbars.py,sha256=88JxlC6a7lb_ba2Y1fPUIrfQN820SlWhi026MOm1oko,758
245
245
  edc_adverse_event/notifications.py,sha256=6yAqd-pLTwwl43zZcDQWJEn0DCLjYBhlST4b9hPzPwM,1269
246
246
  edc_adverse_event/pdf_reports/__init__.py,sha256=8_T_bOqSRwSBUttzTB-3qMwwKubfjTeCcXsAltBTmXg,84
247
- edc_adverse_event/pdf_reports/ae_pdf_report.py,sha256=vjawwSZP9HwJ0sXXcRaQpMPlK7VIQ-5YCO2C6w-stwI,9677
248
- edc_adverse_event/pdf_reports/death_pdf_report.py,sha256=pO3qD-YtHG2RmaG27P73EeOY2sVgD1s6OmAaxvM8e9M,4993
247
+ edc_adverse_event/pdf_reports/ae_pdf_report.py,sha256=kJwgkA7XN96chLs8DDhNf0S8CKXKBjiAWTT3yJNlI18,9778
248
+ edc_adverse_event/pdf_reports/death_pdf_report.py,sha256=J1hD2cnh6rmeP6cTRJDsENWeOZgLgIC6qJlR0ngiwc0,5094
249
249
  edc_adverse_event/pdf_reports/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
250
250
  edc_adverse_event/templates/edc_adverse_event/action_item_column.html,sha256=my5LmIDkfpZp8EwEY55tv0sF1F-d_Gp7-sOfa4H_rYo,376
251
251
  edc_adverse_event/templates/edc_adverse_event/admin/app_index.html,sha256=gsIWpsWD0F4H0GMIWYGWbJ2v30ip7CvdJ4AoRY8iyqo,344
@@ -267,14 +267,14 @@ edc_adverse_event/templates/edc_adverse_event/tmg/ae_initial_panel.html,sha256=N
267
267
  edc_adverse_event/templates/edc_adverse_event/tmg/ae_tmg_panel.html,sha256=7-rLoycLwbTfS_jhtrnaijz-JzXU6Lf770u3-6bhGJY,1324
268
268
  edc_adverse_event/templates/edc_adverse_event/tmg/death_report_tmg_panel.html,sha256=c0iStnWnp4cZTgfSTCUXwAArGBcTobOd6DmextuSRDQ,1056
269
269
  edc_adverse_event/templates/edc_adverse_event/tmg/tmg_ae_listboard.html,sha256=jZePFCJmw2vyOOhiEsGHajjGsC2bWIXcs1_ZaUvqiU0,1634
270
- edc_adverse_event/templates/edc_adverse_event/tmg/tmg_ae_listboard_result.html,sha256=xHhwn3eMI2eocCZoEilVC41efUxGpuDLJzX3HxBhsew,7115
270
+ edc_adverse_event/templates/edc_adverse_event/tmg/tmg_ae_listboard_result.html,sha256=oQ-H1tBdeNpL7rITVrDFIjqHT-J1aFWWwipChXdwPuw,7485
271
271
  edc_adverse_event/templates/edc_adverse_event/tmg/tmg_button_group.html,sha256=DMNRyZ7Cuw7-vypVgZGwq0turxBB03GNEOScQMfd5J4,611
272
272
  edc_adverse_event/templates/edc_adverse_event/tmg/tmg_death_listboard.html,sha256=O_C59xWQXlvEi2_LwS8O9uvpWwWqgACWnrqRG6FcGLs,3897
273
273
  edc_adverse_event/templates/edc_adverse_event/tmg/tmg_home.html,sha256=PKWAApGKIAuOie56W2v78iCGxa5RAU9Q0cy2HjHH3_c,2259
274
274
  edc_adverse_event/templates/edc_adverse_event/tmg/tmg_summary_listboard.html,sha256=xsYEOKCleUrui-qoSRmc03m5nDSX7Z_GerjFW0qKkHM,2609
275
275
  edc_adverse_event/templates/edc_adverse_event/tmg_button.html,sha256=SAmkTofVE_xJUg0uRXb2Yvrektz2Iv9NeQZDkJeLBak,259
276
276
  edc_adverse_event/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
277
- edc_adverse_event/templatetags/edc_adverse_event_extras.py,sha256=9TMw955o9Fk3nUQGf6hit6fdP21n54l0IOigMp-_xlc,10942
277
+ edc_adverse_event/templatetags/edc_adverse_event_extras.py,sha256=-2_f6j74JpsXXS82XaoqBjrqrx_XS1ck1e5DD-lNMBA,10712
278
278
  edc_adverse_event/urls.py,sha256=Ydl_1J9uwJ9LUrnj-lKcYgqShZ2d-531jApAr92bhjE,1609
279
279
  edc_adverse_event/utils.py,sha256=2Vg8QSKUn_8s5PkjdMmpIgrDpzG7-hV7MsseatGNbwk,4393
280
280
  edc_adverse_event/view_mixins/__init__.py,sha256=xoe3GWzdDZNyTnio5UG753K6wyz1hYNTvBc3a2y8acw,135
@@ -282,7 +282,7 @@ edc_adverse_event/view_mixins/ae/__init__.py,sha256=xfiZe1ODoybipoE6w63uaSIJ4eRO
282
282
  edc_adverse_event/view_mixins/ae/ae_listboard_view_mixin.py,sha256=x7FOH3lWsUrHXFxr7jDBs0tzJmlXXOfbVHIUdUUOHr8,4378
283
283
  edc_adverse_event/view_mixins/ae/death_report_listboard_view_mixin.py,sha256=TSl8tGgq5WSfPbm2TeSw0AbqbmGFMUHTqL-mPob_-aY,3985
284
284
  edc_adverse_event/view_mixins/tmg/__init__.py,sha256=MsVoPxr6Y6rqPXjCjt-VIBrroufCoxAA_puRNoHs08k,104
285
- edc_adverse_event/view_mixins/tmg/tmg_ae_listboard_view_mixin.py,sha256=N9k5rOhqRFPoN4nppTkyVHTWkDCH_JtsHiXGs4ju5Ik,3702
285
+ edc_adverse_event/view_mixins/tmg/tmg_ae_listboard_view_mixin.py,sha256=llKQRE-2M41ztZPlNAvMNzPMSA87OyO-n8PPr1pqA2M,3799
286
286
  edc_adverse_event/view_utils/__init__.py,sha256=ijpMcBLMkYTNwmvPYH1TVVzMhz2wxBSk4NLCU_Rubwg,34
287
287
  edc_adverse_event/view_utils/tmg_button.py,sha256=DlmJLfKWACFkwVmHMwn9e89uABd9-ou0i5g3I0ZmITk,3800
288
288
  edc_adverse_event/views/__init__.py,sha256=PY-nkoQmCIlBR9MHq8x3TU_jeXvryx48AM728zkhtYg,207
@@ -2097,7 +2097,7 @@ edc_pdf_reports/admin/__init__.py,sha256=YtpHY3BAzIO1dBr7apC73E63YRbaKS1tAWy89OK
2097
2097
  edc_pdf_reports/admin/actions.py,sha256=m-n4i7RTqvOykKj3ldmcQ6B3Cna0hJXk9L8rf0zkGtw,533
2098
2098
  edc_pdf_reports/admin/modeladmin_mixins.py,sha256=OG3GVzN_Acb86eVeMbUdAEHbJyJO5NVCijEexVj3UwE,885
2099
2099
  edc_pdf_reports/apps.py,sha256=BHgFODyOf_RrElr2DnRQYsM1rDqtdYoQ9AQ18oD_YMM,118
2100
- edc_pdf_reports/crf_pdf_report.py,sha256=nkG3twM83eZVDHLA2iUM1YmoA0R_Rrl3NbqBQHrRVjo,10854
2100
+ edc_pdf_reports/crf_pdf_report.py,sha256=4ZoTSrdffKXdO6Y4aKLlS-xTNmdgxVpF2vhx2Tc8VMM,10884
2101
2101
  edc_pdf_reports/flowables/__init__.py,sha256=Tbn-fvpDb0N6nhA3wxGisf5BCuZAVN4eSf152a0AKY0,117
2102
2102
  edc_pdf_reports/flowables/checkbox.py,sha256=tFbq-qNbcvkPoCKRwXX4-nB5Ln31RmhSOsUmMo_xbCo,851
2103
2103
  edc_pdf_reports/flowables/textbox.py,sha256=u_AgwkWDCqNsOeZo-yNToVL27SDgMkzf7BJmTB-F4KI,1502
@@ -3397,7 +3397,7 @@ edc_vitals/models/fields/waist_circumference.py,sha256=fZcHFDdEwWLjIVLktKrFCD9UU
3397
3397
  edc_vitals/models/fields/weight.py,sha256=zo9_9e3Cpu0UqoRbWS-iDkcDo6fK80b1dDQy4x4MyxE,921
3398
3398
  edc_vitals/utils.py,sha256=vXid44KUXxeaSyund_y5MNXc5DFJs052_PwUAjszE2k,1384
3399
3399
  edc_vitals/validators.py,sha256=vNiElWMs0rRnHRNuVoPLRf0rW_C_0xcfUyep1Y_Si5s,156
3400
- clinicedc-2.0.37.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
3401
- clinicedc-2.0.37.dist-info/WHEEL,sha256=n2u5OFBbdZvCiUKAmfnY1Po2j3FB_NWfuUlt5WiAjrk,79
3402
- clinicedc-2.0.37.dist-info/METADATA,sha256=NQYdpqREY9cdtC9i2ZZyQbgCFq-jxheITxaRdkdCqMQ,15786
3403
- clinicedc-2.0.37.dist-info/RECORD,,
3400
+ clinicedc-2.0.39.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
3401
+ clinicedc-2.0.39.dist-info/WHEEL,sha256=n2u5OFBbdZvCiUKAmfnY1Po2j3FB_NWfuUlt5WiAjrk,79
3402
+ clinicedc-2.0.39.dist-info/METADATA,sha256=E4rU_JnaoIL39C_nqa7BaEa3cI1UKCyOrYzvSY2OIUM,15786
3403
+ clinicedc-2.0.39.dist-info/RECORD,,
@@ -1,14 +1,14 @@
1
1
  from textwrap import fill
2
2
 
3
3
  import inflect
4
+ from django.conf import settings
5
+ from edc_constants.constants import OTHER, YES
6
+ from edc_pdf_reports.crf_pdf_report import CrfPdfReport
4
7
  from reportlab.lib import colors
5
8
  from reportlab.lib.units import cm
6
9
  from reportlab.platypus import Paragraph, Table
7
10
  from reportlab.platypus.flowables import KeepTogether, Spacer
8
11
 
9
- from edc_constants.constants import OTHER, YES
10
- from edc_pdf_reports.crf_pdf_report import CrfPdfReport
11
-
12
12
  from ..utils import get_adverse_event_app_label, get_ae_model
13
13
 
14
14
  p = inflect.engine()
@@ -20,6 +20,7 @@ class AePdfReport(CrfPdfReport):
20
20
  f"{get_adverse_event_app_label()}_admin:{get_adverse_event_app_label()}_"
21
21
  "aeinitial_changelist"
22
22
  )
23
+ draw_logo = getattr(settings, "EDC_PDF_REPORTS_DRAW_LOGO", True)
23
24
 
24
25
  def get_report_story(self, **kwargs):
25
26
  story = []
@@ -1,16 +1,16 @@
1
1
  from textwrap import fill
2
2
 
3
3
  import inflect
4
+ from django.conf import settings
4
5
  from django.contrib.auth import get_user_model
6
+ from edc_constants.constants import OTHER
7
+ from edc_pdf_reports.crf_pdf_report import CrfPdfReport
5
8
  from reportlab.lib import colors
6
9
  from reportlab.lib.units import cm
7
10
  from reportlab.platypus.flowables import Spacer
8
11
  from reportlab.platypus.para import Paragraph
9
12
  from reportlab.platypus.tables import Table
10
13
 
11
- from edc_constants.constants import OTHER
12
- from edc_pdf_reports.crf_pdf_report import CrfPdfReport
13
-
14
14
  from ..utils import get_adverse_event_app_label, get_ae_model
15
15
 
16
16
  User = get_user_model()
@@ -25,6 +25,7 @@ class DeathPdfReport(CrfPdfReport):
25
25
  )
26
26
 
27
27
  not_reported_text = "not reported"
28
+ draw_logo = getattr(settings, "EDC_PDF_REPORTS_DRAW_LOGO", True)
28
29
 
29
30
  def get_report_story(self, **kwargs):
30
31
  story = []
@@ -13,12 +13,15 @@
13
13
  {% has_perms_for_tmg_role as may_access_page %}
14
14
  {% if may_access_page %}
15
15
  {% for result in results %}
16
+ {% with results_loop=forloop %}
16
17
  <div class="panel panel-default">
17
18
  <div class="panel-heading clearfix">
18
- <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>
19
+ <span class="badge">{{ results_loop.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>
19
20
  <span class="pull-right">
20
21
  <div class="btn-group">
21
- <a class="btn btn-sm btn-default" role="button" title="Go to action item" href="{{ result.get_absolute_url }}?next={{ listboard_filter_url }},subject_identifier&subject_identifier={{ result.subject_identifier }}">{{ result.identifier }}</a>
22
+ {% if result.identifier %}
23
+ <a class="btn btn-sm btn-default" role="button" title="Go to action item" href="{{ result.get_absolute_url }}?next={{ listboard_filter_url }},subject_identifier&subject_identifier={{ result.subject_identifier }}">{{ result.identifier }}</a>
24
+ {% endif %}
22
25
  <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" subject_identifier=result.subject_identifier %}?q={{ result.subject_identifier }}">Subject Review <i class="fas fa-share fa-fw"></i></a>
23
26
  </div>
24
27
  </span>
@@ -30,19 +33,18 @@
30
33
  <div class="list-group">
31
34
  <div class="list-group-item list-group-item-default"><i class="fa-solid fa-folder-tree fa-fw"></i> TMG documents in workflow </div>
32
35
 
33
- {# {% render_tmg_panel action_item=result by_user_created_only=True counter=forloop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %} #}
36
+ {# {% render_tmg_panel action_item=result by_user_created_only=True counter=results_loop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %} #}
34
37
 
35
38
  {# AE TMG #}
36
- {% ae_tmg_queryset subject_identifier=result.subject_identifier as qs %}
37
- {% if qs.count == 0 %}
38
- {% ae_tmg_action_item subject_identifier=result.subject_identifier as tmg_action_item %}
39
- {% if tmg_action_item %}
40
- {% render_tmg_panel action_item=tmg_action_item by_user_created_only=True counter=forloop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %}
41
- {% endif %}
42
- {% else %}
43
- {% for ae_tmg in qs %}
44
- {% render_tmg_panel reference_obj=ae_tmg by_user_created_only=True counter=forloop.counter next_url_name=listboard_filter_url %}
45
- {% endfor %}
39
+ {% ae_tmg_action_item_queryset result.subject_identifier status as ae_tmg_action_item_qs %}
40
+ {% for ae_tmg_action_item in ae_tmg_action_item_qs %}
41
+ {% render_tmg_panel action_item=ae_tmg_action_item by_user_created_only=True counter=results_loop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %}
42
+ {% endfor %}
43
+ {% if status != NEW %}
44
+ {% ae_tmg_queryset subject_identifier=result.subject_identifier as ae_tmg_qs %}
45
+ {% for ae_tmg in ae_tmg_qs %}
46
+ {% render_tmg_panel reference_obj=ae_tmg by_user_created_only=True counter=results_loop.counter next_url_name=listboard_filter_url %}
47
+ {% endfor %}
46
48
  {% endif %}
47
49
 
48
50
  {# DEATH REPORT TMG #}
@@ -50,11 +52,11 @@
50
52
  {% if qs.count == 0 %}
51
53
  {% death_report_tmg_action_item subject_identifier=result.subject_identifier as tmg_action_item %}
52
54
  {% if tmg_action_item %}
53
- {% render_tmg_panel action_item=tmg_action_item by_user_created_only=True counter=forloop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %}
55
+ {% render_tmg_panel action_item=tmg_action_item by_user_created_only=True counter=results_loop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %}
54
56
  {% endif %}
55
57
  {% else %}
56
58
  {% for death_report_tmg in qs %}
57
- {% render_tmg_panel reference_obj=death_report_tmg by_user_created_only=True counter=forloop.counter next_url_name=listboard_filter_url %}
59
+ {% render_tmg_panel reference_obj=death_report_tmg by_user_created_only=True counter=results_loop.counter next_url_name=listboard_filter_url %}
58
60
  {% endfor %}
59
61
  {% endif %}
60
62
 
@@ -63,11 +65,11 @@
63
65
  {% if qs.count == 0 %}
64
66
  {% death_report_tmg_second_action_item subject_identifier=result.subject_identifier as tmg_action_item %}
65
67
  {% if tmg_action_item %}
66
- {% render_tmg_panel action_item=tmg_action_item by_user_created_only=True counter=forloop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %}
68
+ {% render_tmg_panel action_item=tmg_action_item by_user_created_only=True counter=results_loop.counter report_status=result.reference_obj.report_status next_url_name=listboard_filter_url %}
67
69
  {% endif %}
68
70
  {% else %}
69
71
  {% for death_report_tmg in qs %}
70
- {% render_tmg_panel reference_obj=death_report_tmg by_user_created_only=True counter=forloop.counter next_url_name=listboard_filter_url %}
72
+ {% render_tmg_panel reference_obj=death_report_tmg by_user_created_only=True counter=results_loop.counter next_url_name=listboard_filter_url %}
71
73
  {% endfor %}
72
74
  {% endif %}
73
75
 
@@ -80,12 +82,13 @@
80
82
  <div class="list-group">
81
83
  {# AE INTIAL #}
82
84
  <div class="list-group-item"><i class="fa-regular fa-file fa-fw"></i> First document in workflow</div>
83
- {% if result.parent_action_item %}
84
- {% render_tmg_panel action_item=result.parent_action_item counter=forloop.counter next_url_name=listboard_filter_url %}
85
+ {% ae_tmg_action_item_queryset result.subject_identifier status as ae_tmg_action_item_qs %}
86
+ {% for ae_tmg_action_item in ae_tmg_action_item_qs %}
87
+ {% render_tmg_panel action_item=ae_tmg_action_item.parent_action_item counter=results_loop.counter next_url_name=listboard_filter_url %}
88
+ {% endfor %}
85
89
  {% if result.related_action_item and result.parent_action_item.reference_obj.action_identifier != result.related_action_item.reference_obj.action_identifier %}
86
- {% render_tmg_panel action_item=result.related_action_item counter=forloop.counter next_url_name=listboard_filter_url %}
90
+ {% render_tmg_panel action_item=result.related_action_item counter=results_loop.counter next_url_name=listboard_filter_url %}
87
91
  {% endif %}
88
- {% endif %}
89
92
  </div>
90
93
  </div>
91
94
 
@@ -97,12 +100,12 @@
97
100
  {% ae_followup_queryset ae_initial=result.parent_action_item.reference_obj as qs %}
98
101
  {% if qs.count == 0 %}<div class="list-group-item">There are no follow-ups to this AE</div>{% endif %}
99
102
  {% for ae_followup in qs %}
100
- {% render_tmg_panel reference_obj=ae_followup counter=forloop.counter next_url_name=listboard_filter_url %}
103
+ {% render_tmg_panel reference_obj=ae_followup counter=results_loop.counter next_url_name=listboard_filter_url %}
101
104
  {% endfor %}
102
105
 
103
106
  {% death_report_queryset subject_identifier=result.subject_identifier as qs %}
104
107
  {% for death_report in qs %}
105
- {% render_tmg_panel reference_obj=death_report counter=forloop.counter next_url_name=listboard_filter_url %}
108
+ {% render_tmg_panel reference_obj=death_report counter=results_loop.counter next_url_name=listboard_filter_url %}
106
109
  {% endfor %}
107
110
  </div>
108
111
 
@@ -110,6 +113,7 @@
110
113
  </div>
111
114
  </div>
112
115
  </div>
116
+ {% endwith %}
113
117
  {% endfor %}
114
118
  {% else %}
115
119
  <div class="alert alert-danger">
@@ -88,15 +88,13 @@ def format_ae_description(context, ae_initial, wrap_length):
88
88
  context["YES"] = YES
89
89
  context["ae_initial"] = ae_initial
90
90
  try:
91
- context["sae_reason"] = format_html(
92
- "{}",
93
- mark_safe(wrapx(escape_braces(ae_initial.sae_reason.name), wrap_length)), # nosec B703, B308
91
+ context["sae_reason"] = mark_safe( # noqa: S308
92
+ wrapx(escape_braces(ae_initial.sae_reason.name), wrap_length)
94
93
  )
95
94
  except AttributeError:
96
95
  context["sae_reason"] = ""
97
- context["ae_description"] = format_html(
98
- "{}",
99
- mark_safe(wrapx(escape_braces(ae_initial.ae_description), wrap_length)), # nosec B703, B308
96
+ context["ae_description"] = mark_safe(
97
+ wrapx(escape_braces(ae_initial.ae_description), wrap_length)
100
98
  )
101
99
  return context
102
100
 
@@ -111,11 +109,8 @@ def format_ae_followup_description(context, ae_followup, wrap_length):
111
109
  context["ae_followup"] = ae_followup
112
110
  context["ae_initial"] = ae_followup.ae_initial
113
111
  try:
114
- context["sae_reason"] = format_html(
115
- "{}",
116
- mark_safe(
117
- wrapx(escape_braces(ae_followup.ae_initial.sae_reason.name), wrap_length)
118
- ), # nosec B703, B308
112
+ context["sae_reason"] = mark_safe( # noqa: S308
113
+ wrapx(escape_braces(ae_followup.ae_initial.sae_reason.name), wrap_length)
119
114
  )
120
115
  except AttributeError:
121
116
  context["sae_reason"] = ""
@@ -177,55 +172,47 @@ def render_death_report_tmg_panel(context, action_item: ActionItem = None):
177
172
 
178
173
 
179
174
  @register.simple_tag
180
- def ae_tmg_queryset(subject_identifier: str = None) -> QuerySet[DeathReportTmgModel]:
175
+ def ae_tmg_queryset(subject_identifier) -> QuerySet[DeathReportTmgModel]:
181
176
  return get_ae_model("aetmg").objects.filter(subject_identifier=subject_identifier)
182
177
 
183
178
 
184
179
  @register.simple_tag
185
- def death_report_tmg_queryset(
186
- subject_identifier: str = None,
187
- ) -> QuerySet[DeathReportTmgModel]:
180
+ def death_report_tmg_queryset(subject_identifier: str) -> QuerySet[DeathReportTmgModel]:
188
181
  return get_ae_model("deathreporttmg").objects.filter(subject_identifier=subject_identifier)
189
182
 
190
183
 
191
184
  @register.simple_tag
192
- def death_report_tmg2_queryset(
193
- subject_identifier: str = None,
194
- ) -> QuerySet[DeathReportTmgSecondModel]:
185
+ def death_report_tmg2_queryset(subject_identifier: str) -> QuerySet[DeathReportTmgSecondModel]:
195
186
  return get_ae_model("deathreporttmgsecond").objects.filter(
196
187
  subject_identifier=subject_identifier
197
188
  )
198
189
 
199
190
 
200
191
  @register.simple_tag
201
- def death_report_queryset(
202
- subject_identifier: str = None,
203
- ) -> QuerySet[DeathReportTmgSecondModel]:
192
+ def death_report_queryset(subject_identifier: str) -> QuerySet[DeathReportTmgSecondModel]:
204
193
  return get_ae_model("deathreport").objects.filter(subject_identifier=subject_identifier)
205
194
 
206
195
 
207
196
  @register.simple_tag
208
197
  def ae_followup_queryset(
209
198
  ae_initial: AeInitialModel = None,
210
- ) -> QuerySet[AeFollowupModel] | None:
199
+ ) -> QuerySet[AeFollowupModel]:
211
200
  if ae_initial:
212
201
  return get_ae_model("aefollowup").objects.filter(ae_initial_id=ae_initial.id)
213
- return None
202
+ return get_ae_model("aefollowup").objects.none()
214
203
 
215
204
 
216
205
  @register.simple_tag
217
- def ae_tmg_action_item(subject_identifier: str = None) -> ActionItem:
218
- try:
219
- obj = django_apps.get_model("edc_action_item.actionitem").objects.get(
220
- subject_identifier=subject_identifier, action_type__name=AE_TMG_ACTION
221
- )
222
- except ObjectDoesNotExist:
223
- obj = None
224
- return obj
206
+ def ae_tmg_action_item_queryset(subject_identifier: str, *status) -> QuerySet[ActionItem]:
207
+ return django_apps.get_model("edc_action_item.actionitem").objects.filter(
208
+ subject_identifier=subject_identifier,
209
+ action_type__name=AE_TMG_ACTION,
210
+ status__in=status,
211
+ )
225
212
 
226
213
 
227
214
  @register.simple_tag
228
- def death_report_tmg_action_item(subject_identifier: str = None) -> ActionItem:
215
+ def death_report_tmg_action_item(subject_identifier: str) -> ActionItem:
229
216
  try:
230
217
  obj = django_apps.get_model("edc_action_item.actionitem").objects.get(
231
218
  subject_identifier=subject_identifier,
@@ -237,7 +224,7 @@ def death_report_tmg_action_item(subject_identifier: str = None) -> ActionItem:
237
224
 
238
225
 
239
226
  @register.simple_tag
240
- def death_report_tmg_second_action_item(subject_identifier: str = None) -> ActionItem:
227
+ def death_report_tmg_second_action_item(subject_identifier: str) -> ActionItem:
241
228
  try:
242
229
  obj = django_apps.get_model("edc_action_item.actionitem").objects.get(
243
230
  subject_identifier=subject_identifier,
@@ -265,7 +252,7 @@ def render_tmg_panel(
265
252
  reference_obj = reference_obj or get_reference_obj(action_item)
266
253
  if not action_item and reference_obj:
267
254
  action_item = reference_obj.action_item
268
- disable_all = True if not has_valid_tmg_perms(request=context["request"]) else False
255
+ disable_all = bool(not has_valid_tmg_perms(request=context["request"]))
269
256
  if action_item:
270
257
  params = dict(
271
258
  user=context["request"].user,
@@ -7,6 +7,7 @@ from django.utils import timezone
7
7
 
8
8
  from edc_constants.constants import CLOSED, NEW, OPEN
9
9
  from edc_dashboard.view_mixins import EdcViewMixin
10
+ from edc_export.constants import CANCELLED
10
11
  from edc_listboard.view_mixins import ListboardFilterViewMixin, SearchFormViewMixin
11
12
  from edc_listboard.views import ListboardView as BaseListboardView
12
13
  from edc_navbar import NavbarViewMixin
@@ -51,24 +52,26 @@ class TmgAeListboardViewMixin(
51
52
  ordering = "-report_datetime"
52
53
  paginate_by = 10
53
54
  search_form_url = "tmg_ae_listboard_url"
54
- action_type_names = [
55
+ action_type_names = (
55
56
  AE_TMG_ACTION,
56
57
  DEATH_REPORT_TMG_ACTION,
57
58
  DEATH_REPORT_TMG_SECOND_ACTION,
58
- ]
59
+ )
59
60
 
60
- search_fields = [
61
+ search_fields = (
61
62
  "subject_identifier",
62
63
  "action_identifier",
63
64
  "parent_action_item__action_identifier",
64
65
  "related_action_item__action_identifier",
65
66
  "user_created",
66
67
  "user_modified",
67
- ]
68
+ )
68
69
 
69
70
  def get_context_data(self, **kwargs) -> dict[str, Any]:
70
71
  kwargs.update(
71
72
  AE_TMG_ACTION=AE_TMG_ACTION,
73
+ NEW=NEW,
74
+ CANCELLED=CANCELLED,
72
75
  utc_date=timezone.now().date(),
73
76
  subject_identifier=self.kwargs.get("subject_identifier"),
74
77
  )
@@ -9,14 +9,6 @@ from django.apps import apps as django_apps
9
9
  from django.contrib.auth import get_user_model
10
10
  from django.core.exceptions import ObjectDoesNotExist
11
11
  from django.utils.text import slugify
12
- from reportlab.lib import colors
13
- from reportlab.lib.pagesizes import A4
14
- from reportlab.lib.units import cm
15
- from reportlab.lib.utils import ImageReader
16
- from reportlab.platypus import Paragraph, TableStyle
17
- from reportlab.platypus.flowables import KeepTogether, Spacer
18
- from reportlab.platypus.tables import Table
19
-
20
12
  from edc_data_manager.get_longitudinal_value import (
21
13
  DataDictionaryError,
22
14
  get_longitudinal_value,
@@ -26,13 +18,19 @@ from edc_randomization.auth_objects import RANDO_UNBLINDED
26
18
  from edc_utils.age import formatted_age
27
19
  from edc_utils.date import to_local
28
20
  from edc_utils.get_static_file import get_static_file
21
+ from reportlab.lib import colors
22
+ from reportlab.lib.pagesizes import A4
23
+ from reportlab.lib.units import cm
24
+ from reportlab.lib.utils import ImageReader
25
+ from reportlab.platypus import Paragraph, TableStyle
26
+ from reportlab.platypus.flowables import KeepTogether, Spacer
27
+ from reportlab.platypus.tables import Table
29
28
 
30
29
  from .report import Report
31
30
 
32
31
  if TYPE_CHECKING:
33
32
  from django.contrib.auth.models import User
34
33
  from django.core.handlers.wsgi import WSGIRequest
35
-
36
34
  from edc_crf.model_mixins import CrfModelMixin
37
35
  from edc_identifier.model_mixins import UniqueSubjectIdentifierModelMixin
38
36
 
@@ -50,7 +48,7 @@ class CrfPdfReport(Report):
50
48
  report_url: str = None
51
49
  changelist_url: str = None
52
50
 
53
- default_page = dict(
51
+ default_page = dict( # noqa: RUF012
54
52
  rightMargin=1.5 * cm,
55
53
  leftMargin=1.5 * cm,
56
54
  topMargin=2.0 * cm,
@@ -66,7 +64,7 @@ class CrfPdfReport(Report):
66
64
 
67
65
  open_label = True
68
66
 
69
- logo_data = {
67
+ logo_data = { # noqa: RUF012
70
68
  "app_label": "edc_pdf_reports",
71
69
  "filename": "clinicedc_logo.jpg",
72
70
  "first_page": (0.83 * cm, 0.83 * cm),