edc-action-item


Nameedc-action-item JSON
Version 0.3.89 PyPI version JSON
download
home_pagehttps://github.com/clinicedc/edc-action-item
SummaryAdd patient action items to clinicedc/edc projects
upload_time2024-04-18 23:15:24
maintainerNone
docs_urlNone
authorErik van Widenfelt
requires_python>=3.11
licenseGPL license, see LICENSE
keywords django edc action items reminders clinicedc clinical trials
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            |pypi| |actions| |codecov| |downloads|


edc-action-items
----------------

Add patient `action items` to the Edc

Overview
========

Action items are reminders to submit a form.

Action items can be configured to drive data collection

* for forms that do not fit well in a visit schedule;
* for forms that are required based on some clinical event.

Action items are tracked. Each is allocated a unique `action_identifier` and maintain status (New, Open, Closed).

Actions can be chained. One action can create another action, group of actions or recreate itself.

Adverse Events, Death, OffSchedule are all good candidates.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Adverse Event reports are required based on some clinical event. Since the event must be reported, leaving the decision to report the user is not sufficient. An action item can be opened based on the clinical event and the status of the action item tracked administratively. The action item is associtaed with the AE report. Once the report is submitted, the action item closes. If additional data is required after an initial AE report is submitted, a follow-up action can automatically be opened.

See module `ambition-ae.action_items` for examples.

Defining action items
+++++++++++++++++++++

In the root of your App, define an `action_items` module. The edc-action-item site controller will `autodiscover` this module and `register` the action item classes.

Register action item classes in the `action_items` module like this

.. code-block:: python

    site_action_items.register(AeInitialAction)


A simple action item
++++++++++++++++++++

In it define actions using the `Action` class.

.. code-block:: python

    from edc_action_item.action import Action
    from edc_action_item.site_action_items import site_action_items
    from edc_constants.constants HIGH_PRIORITY
    from ambition_ae.action_items import AeFollowupAction, AeTmgAction

    class AeInitialAction(Action):

        name = AE_INITIAL_ACTION
        display_name = 'Submit AE Initial Report'
        model = 'ambition_ae.aeinitial'
        show_on_dashboard = True
        instructions = 'Complete the initial report and forward to the TMG'
        priority = HIGH_PRIORITY

The action item is associated with its model

.. code-block:: python

    from edc_action_item.model_mixins import ActionModelMixin
    from edc_identifier.model_mixins import NonUniqueSubjectIdentifierFieldMixin

    class AeInitial(ActionModelMixin, NonUniqueSubjectIdentifierFieldMixin,
                    BaseUuidModel):

    action_cls = AeInitialAction

    ... # field classes

Somewhere in your code, instantiate the action item

.. code-block:: python

    AeInitialAction(subject_identifier='12345')

This creates an `ActionItem` model instance for this subject with a `status` of `New` (if it does not exist).

Now create the associated model instance

.. code-block:: python

    AeInitial.objects.create(subject_identifier='12345', ...)

The `ActionItem` model instance now has a status of `Closed`.

Changing the criteria to close an action
++++++++++++++++++++++++++++++++++++++++

By default an action is closed once the associated model instance has been saved. For more refined behavior define `close_action_item_on_save` on the action item class


.. code-block:: python

    class AeInitialAction(Action):

    ...

    def close_action_item_on_save(self):
        self.delete_children_if_new(action_cls=self)
        return self.model_obj.report_status == CLOSED


Singleton action items
++++++++++++++++++++++

To ensure an action item does not create more than one instance per subject, use the `singleton` attribute.

.. code-block:: python

    class EnrollToSubstudyAction(Action):
        name = 'My Action'
        display_name = 'Enroll to sub-study'
        model = 'myapp.enroll'
        show_link_to_changelist = True
        admin_site_name = 'myapp_admin'
        priority = HIGH_PRIORITY
        create_by_user = False
        singleton=True


Action items that create a `next` action item
++++++++++++++++++++++++++++++++++++++++++++++

For an action item to open another action item(s) once closed, set `next_actions`.

.. code-block:: python

    class AeInitialAction(Action):

        name = AE_INITIAL_ACTION
        display_name = 'Submit AE Initial Report'
        model = 'ambition_ae.aeinitial'
        show_on_dashboard = True
        instructions = 'Complete the initial report and forward to the TMG'
        priority = HIGH_PRIORITY
        next_actions = [AeFollowupAction]

If the criteria for the next action is based on some other information declare `get_next_actions` on the action item and return the list of action items needed.

.. code-block:: python

    class AeInitialAction(Action):

    ...

    def get_next_actions(self):
        next_actions = []
        try:
            self.reference_model_cls().objects.get(
                ae_initial=self.model_obj.ae_initial)
        except MultipleObjectsReturned:
            pass
        else:
            if (self.model_obj.ae_initial.ae_classification
                    != self.model_obj.ae_classification):
                next_actions = [self]
        return next_actions


Action items with a notification
++++++++++++++++++++++++++++++++

An action item can be associated with a notification from ``edc_notification`` so that when an action is created a notification (email or sms) is sent to those registered to receive it.

A subclass of ''Action``, ``ActionWithNotification``` adds notifications to the action. The notification for the action is automatically registered when the action is registered by ``site_action_items``.

For example:

.. code-block:: python

    class AeTmgAction(ActionWithNotification):
        name = AE_TMG_ACTION
        display_name = "TMG AE Report pending"
        notification_display_name = "TMG AE Report"
        parent_action_names = [AE_INITIAL_ACTION],
        reference_model = "ambition_ae.aetmg"
        related_reference_model = "ambition_ae.aeinitial"
        related_reference_fk_attr = "ae_initial"
        show_link_to_changelist = True
        admin_site_name = "ambition_ae_admin"




.. |pypi| image:: https://img.shields.io/pypi/v/edc-action-item.svg
  :target: https://pypi.python.org/pypi/edc-action-item

.. |actions| image:: https://github.com/clinicedc/edc-action-item/actions/workflows/build.yml/badge.svg
  :target: https://github.com/clinicedc/edc-action-item/actions/workflows/build.yml

.. |codecov| image:: https://codecov.io/gh/clinicedc/edc-action-item/branch/develop/graph/badge.svg
  :target: https://codecov.io/gh/clinicedc/edc-action-item

.. |downloads| image:: https://pepy.tech/badge/edc-action-item
  :target: https://pepy.tech/project/edc-action-item


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/clinicedc/edc-action-item",
    "name": "edc-action-item",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "django Edc action items reminders, clinicedc, clinical trials",
    "author": "Erik van Widenfelt",
    "author_email": "ew2789@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/68/70/6ff792cf45cbe436e819eff671a7d9243ee578513ebe79d6f5f2fcc28531/edc_action_item-0.3.89.tar.gz",
    "platform": null,
    "description": "|pypi| |actions| |codecov| |downloads|\n\n\nedc-action-items\n----------------\n\nAdd patient `action items` to the Edc\n\nOverview\n========\n\nAction items are reminders to submit a form.\n\nAction items can be configured to drive data collection\n\n* for forms that do not fit well in a visit schedule;\n* for forms that are required based on some clinical event.\n\nAction items are tracked. Each is allocated a unique `action_identifier` and maintain status (New, Open, Closed).\n\nActions can be chained. One action can create another action, group of actions or recreate itself.\n\nAdverse Events, Death, OffSchedule are all good candidates.\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nAdverse Event reports are required based on some clinical event. Since the event must be reported, leaving the decision to report the user is not sufficient. An action item can be opened based on the clinical event and the status of the action item tracked administratively. The action item is associtaed with the AE report. Once the report is submitted, the action item closes. If additional data is required after an initial AE report is submitted, a follow-up action can automatically be opened.\n\nSee module `ambition-ae.action_items` for examples.\n\nDefining action items\n+++++++++++++++++++++\n\nIn the root of your App, define an `action_items` module. The edc-action-item site controller will `autodiscover` this module and `register` the action item classes.\n\nRegister action item classes in the `action_items` module like this\n\n.. code-block:: python\n\n    site_action_items.register(AeInitialAction)\n\n\nA simple action item\n++++++++++++++++++++\n\nIn it define actions using the `Action` class.\n\n.. code-block:: python\n\n    from edc_action_item.action import Action\n    from edc_action_item.site_action_items import site_action_items\n    from edc_constants.constants HIGH_PRIORITY\n    from ambition_ae.action_items import AeFollowupAction, AeTmgAction\n\n    class AeInitialAction(Action):\n\n        name = AE_INITIAL_ACTION\n        display_name = 'Submit AE Initial Report'\n        model = 'ambition_ae.aeinitial'\n        show_on_dashboard = True\n        instructions = 'Complete the initial report and forward to the TMG'\n        priority = HIGH_PRIORITY\n\nThe action item is associated with its model\n\n.. code-block:: python\n\n    from edc_action_item.model_mixins import ActionModelMixin\n    from edc_identifier.model_mixins import NonUniqueSubjectIdentifierFieldMixin\n\n    class AeInitial(ActionModelMixin, NonUniqueSubjectIdentifierFieldMixin,\n                    BaseUuidModel):\n\n    action_cls = AeInitialAction\n\n    ... # field classes\n\nSomewhere in your code, instantiate the action item\n\n.. code-block:: python\n\n    AeInitialAction(subject_identifier='12345')\n\nThis creates an `ActionItem` model instance for this subject with a `status` of `New` (if it does not exist).\n\nNow create the associated model instance\n\n.. code-block:: python\n\n    AeInitial.objects.create(subject_identifier='12345', ...)\n\nThe `ActionItem` model instance now has a status of `Closed`.\n\nChanging the criteria to close an action\n++++++++++++++++++++++++++++++++++++++++\n\nBy default an action is closed once the associated model instance has been saved. For more refined behavior define `close_action_item_on_save` on the action item class\n\n\n.. code-block:: python\n\n    class AeInitialAction(Action):\n\n    ...\n\n    def close_action_item_on_save(self):\n        self.delete_children_if_new(action_cls=self)\n        return self.model_obj.report_status == CLOSED\n\n\nSingleton action items\n++++++++++++++++++++++\n\nTo ensure an action item does not create more than one instance per subject, use the `singleton` attribute.\n\n.. code-block:: python\n\n    class EnrollToSubstudyAction(Action):\n        name = 'My Action'\n        display_name = 'Enroll to sub-study'\n        model = 'myapp.enroll'\n        show_link_to_changelist = True\n        admin_site_name = 'myapp_admin'\n        priority = HIGH_PRIORITY\n        create_by_user = False\n        singleton=True\n\n\nAction items that create a `next` action item\n++++++++++++++++++++++++++++++++++++++++++++++\n\nFor an action item to open another action item(s) once closed, set `next_actions`.\n\n.. code-block:: python\n\n    class AeInitialAction(Action):\n\n        name = AE_INITIAL_ACTION\n        display_name = 'Submit AE Initial Report'\n        model = 'ambition_ae.aeinitial'\n        show_on_dashboard = True\n        instructions = 'Complete the initial report and forward to the TMG'\n        priority = HIGH_PRIORITY\n        next_actions = [AeFollowupAction]\n\nIf the criteria for the next action is based on some other information declare `get_next_actions` on the action item and return the list of action items needed.\n\n.. code-block:: python\n\n    class AeInitialAction(Action):\n\n    ...\n\n    def get_next_actions(self):\n        next_actions = []\n        try:\n            self.reference_model_cls().objects.get(\n                ae_initial=self.model_obj.ae_initial)\n        except MultipleObjectsReturned:\n            pass\n        else:\n            if (self.model_obj.ae_initial.ae_classification\n                    != self.model_obj.ae_classification):\n                next_actions = [self]\n        return next_actions\n\n\nAction items with a notification\n++++++++++++++++++++++++++++++++\n\nAn action item can be associated with a notification from ``edc_notification`` so that when an action is created a notification (email or sms) is sent to those registered to receive it.\n\nA subclass of ''Action``, ``ActionWithNotification``` adds notifications to the action. The notification for the action is automatically registered when the action is registered by ``site_action_items``.\n\nFor example:\n\n.. code-block:: python\n\n    class AeTmgAction(ActionWithNotification):\n        name = AE_TMG_ACTION\n        display_name = \"TMG AE Report pending\"\n        notification_display_name = \"TMG AE Report\"\n        parent_action_names = [AE_INITIAL_ACTION],\n        reference_model = \"ambition_ae.aetmg\"\n        related_reference_model = \"ambition_ae.aeinitial\"\n        related_reference_fk_attr = \"ae_initial\"\n        show_link_to_changelist = True\n        admin_site_name = \"ambition_ae_admin\"\n\n\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/edc-action-item.svg\n  :target: https://pypi.python.org/pypi/edc-action-item\n\n.. |actions| image:: https://github.com/clinicedc/edc-action-item/actions/workflows/build.yml/badge.svg\n  :target: https://github.com/clinicedc/edc-action-item/actions/workflows/build.yml\n\n.. |codecov| image:: https://codecov.io/gh/clinicedc/edc-action-item/branch/develop/graph/badge.svg\n  :target: https://codecov.io/gh/clinicedc/edc-action-item\n\n.. |downloads| image:: https://pepy.tech/badge/edc-action-item\n  :target: https://pepy.tech/project/edc-action-item\n\n",
    "bugtrack_url": null,
    "license": "GPL license, see LICENSE",
    "summary": "Add patient action items to clinicedc/edc projects",
    "version": "0.3.89",
    "project_urls": {
        "Homepage": "https://github.com/clinicedc/edc-action-item"
    },
    "split_keywords": [
        "django edc action items reminders",
        " clinicedc",
        " clinical trials"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "94086812227ff21b28294320c19e77b36932a892d2789b58b09b341f1f176939",
                "md5": "ece811779fe6cbdb061985dc63e19522",
                "sha256": "dcc3c79c6bfdb39b65aed06c4925f28fd5b8af31dfbe436d9ee212bf51e2b704"
            },
            "downloads": -1,
            "filename": "edc_action_item-0.3.89-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ece811779fe6cbdb061985dc63e19522",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 116128,
            "upload_time": "2024-04-18T23:15:21",
            "upload_time_iso_8601": "2024-04-18T23:15:21.844005Z",
            "url": "https://files.pythonhosted.org/packages/94/08/6812227ff21b28294320c19e77b36932a892d2789b58b09b341f1f176939/edc_action_item-0.3.89-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68706ff792cf45cbe436e819eff671a7d9243ee578513ebe79d6f5f2fcc28531",
                "md5": "3dae83016d947ab0b10f415969a45006",
                "sha256": "9acd2c9c89e2e85788d80d3b8f3a9e645b44c475c6880f5a1f0c8841aa1635b7"
            },
            "downloads": -1,
            "filename": "edc_action_item-0.3.89.tar.gz",
            "has_sig": false,
            "md5_digest": "3dae83016d947ab0b10f415969a45006",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 79831,
            "upload_time": "2024-04-18T23:15:24",
            "upload_time_iso_8601": "2024-04-18T23:15:24.847463Z",
            "url": "https://files.pythonhosted.org/packages/68/70/6ff792cf45cbe436e819eff671a7d9243ee578513ebe79d6f5f2fcc28531/edc_action_item-0.3.89.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-18 23:15:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "clinicedc",
    "github_project": "edc-action-item",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "edc-action-item"
}
        
Elapsed time: 0.68136s