From c54860cb36870ffdc1acb391d587d32c91f36b39 Mon Sep 17 00:00:00 2001 From: erikvw Date: Mon, 3 Jun 2024 11:20:27 -0500 Subject: [PATCH 1/2] use default AE TMG action item classes --- effect_ae/action_items.py | 79 +++------------------------------------ 1 file changed, 6 insertions(+), 73 deletions(-) diff --git a/effect_ae/action_items.py b/effect_ae/action_items.py index 5d436e75..71ef1477 100644 --- a/effect_ae/action_items.py +++ b/effect_ae/action_items.py @@ -1,8 +1,12 @@ from django.apps import apps as django_apps from django.conf import settings -from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist +from django.core.exceptions import ObjectDoesNotExist from django.utils.html import format_html from edc_action_item import ActionWithNotification, site_action_items +from edc_adverse_event.action_items import ( + DeathReportTmgAction, + DeathReportTmgSecondAction, +) from edc_adverse_event.constants import ( AE_FOLLOWUP_ACTION, AE_INITIAL_ACTION, @@ -226,80 +230,9 @@ def get_next_actions(self): return next_actions -class DeathReportTmgAction(ActionWithNotification): - name = DEATH_REPORT_TMG_ACTION - display_name = "TMG Death Report pending" - notification_display_name = "TMG Death Report" - parent_action_names = [DEATH_REPORT_ACTION, DEATH_REPORT_TMG_ACTION] - reference_model = "effect_ae.deathreporttmg" - related_reference_model = "effect_ae.deathreport" - related_reference_fk_attr = "death_report" - priority = HIGH_PRIORITY - create_by_user = False - color_style = "info" - show_link_to_changelist = True - admin_site_name = "effect_ae_admin" - instructions = format_html("This report is to be completed by the TMG only.") - - def reopen_action_item_on_change(self): - """Do not reopen if status is CLOSED.""" - return self.reference_obj.report_status != CLOSED - - @property - def matching_cause_of_death(self): - """Returns True if cause_of_death on TMG Death Report matches - cause_of_death on Death Report. - """ - return ( - self.reference_obj.death_report.cause_of_death == self.reference_obj.cause_of_death - ) - - def close_action_item_on_save(self): - if self.matching_cause_of_death: - self.delete_children_if_new(parent_action_item=self.action_item) - return self.reference_obj.report_status == CLOSED - - def get_next_actions(self): - """Returns a second DeathReportTmgAction if the - submitted report does not match the cause of death - of the original death report. - - Also, no more than two DeathReportTmgAction can exist. - """ - next_actions = [] - try: - self.action_item_model_cls().objects.get( - parent_action_item=self.related_action_item, - related_action_item=self.related_action_item, - action_type__name=self.name, - ) - except ObjectDoesNotExist: - pass - except MultipleObjectsReturned: - # because more than one action item has the same - # parent_action_item and related_action_item. this - # only occurs for older data. - pass - else: - if ( - self.action_item_model_cls() - .objects.filter( - related_action_item=self.related_action_item, - action_type__name=self.name, - ) - .count() - < 2 - ): - if ( - self.reference_obj.cause_of_death - != self.related_action_item.reference_obj.cause_of_death - ): - next_actions = ["self"] - return next_actions - - site_action_items.register(DeathReportAction) site_action_items.register(DeathReportTmgAction) +site_action_items.register(DeathReportTmgSecondAction) site_action_items.register(AeFollowupAction) site_action_items.register(AeInitialAction) site_action_items.register(AeSusarAction) From 53f195ec668b58db3b21c14573361ac534e41562 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 7 Jun 2024 18:56:28 +0100 Subject: [PATCH 2/2] Bump to `edc==0.5.91` --- CHANGES | 4 ++++ setup.cfg | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ad468a74..e699b48c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ Changes +++++++ +0.1.54 (unreleased) +------ +- bump to edc 0.5.91 + 0.1.53 ------ - update to Subject Screening form validation to allow screening diff --git a/setup.cfg b/setup.cfg index 3e62630f..71ed82d1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,7 +26,7 @@ zip_safe = False include_package_data = True packages = find: install_requires = - edc==0.5.89 + edc==0.5.91 edc-csf==0.3.6 edc-microbiology==0.3.10 beautifulsoup4