edc-egfr


Nameedc-egfr JSON
Version 0.3.8 PyPI version JSON
download
home_pagehttps://github.com/clinicedc/edc-egfr
SummaryClasses and utils to handle eGFR collection and reporting for clinicedc/edc projects
upload_time2024-03-26 04:55:48
maintainerNone
docs_urlNone
authorErik van Widenfelt
requires_python>=3.11
licenseGPL license, see LICENSE
keywords django egfr data collection clinicedc clinical trials
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            |pypi| |actions| |codecov| |downloads|

edc-egfr
--------
Classes and utils to handle eGFR collection and reporting

Includes calculators for `CKD-EPI Creatinine equation (2009)`
and `Cockcroft-Gault`.

Calculate value, grade, percent drop, percent drop grade
========================================================

The calculators use ``edc_reportable`` to reference DAIDS tox tables.

.. code-block:: python

    egfr1 = EgfrCkdEpi(
            gender=MALE,
            ethnicity=BLACK,
            creatinine_value=53.0,
            age_in_years=30,
            creatinine_units=MICROMOLES_PER_LITER,
        )
    self.assertEqual(round(egfr1.value, 2), 156.43)

and the eGFR grade

.. code-block:: python

    self.assertEqual(egfr1.egfr_grade, 0)


Percent drop from baseline
==========================
In a trial, we are interested in the eGFR percent from baseline. Any reference value can be passed as the
baseline value.

If the baseline value is not provided, the percent drop = 0:

.. code-block:: python

    # see edc-reportable for `reference_range_collection_name`
    opts = dict(
        gender=MALE,
        age_in_years=25,
        ethnicity=BLACK,
        creatinine_value=10.15,
        creatinine_units=MILLIGRAMS_PER_DECILITER,
        report_datetime=get_utcnow(),
        reference_range_collection_name="my_reference_list",
        calculator_name="ckd-epi",
    )
    egfr = Egfr(**opts)
    self.assertEqual(egfr.egfr_drop_value, 0.0)

If a baseline value is provided, the percent drop is calculated:

.. code-block:: python

    egfr = Egfr(baseline_egfr_value=23.0, **opts)
    self.assertEqual(round(egfr.egfr_value, 2), 7.33)
    self.assertEqual(egfr.egfr_grade, 4)
    self.assertEqual(round(egfr.egfr_drop_value, 2), 68.15)
    self.assertEqual(egfr.egfr_drop_grade, 4)

Notify on percent drop
======================

We can notify when the drop is more than a given percent. ``eGFR`` uses a custom
model to be updated.

A `edc` lab result CRF is filled in, ``calling_crf``, that has the creatinine value and units.
The ``calling_crf`` has a ``subject_visit``, ``report_datetime``, ``assay_datetime``, ``creatinine_value``, and ``creatinine_units``.

.. code-block:: python

    egfr = Egfr(
        baseline_egfr_value=220.1,
        notify_on_percent_drop=20,
        calling_crf=crf,
        **opts,
    )
    self.assertEqual(round(egfr.egfr_drop_value, 2), 28.93)
    self.assertTrue(
        EgfrDropNotification.objects.filter(subject_visit=subject_visit).exists()
    )

Connecting a custom drop notification model with edc-action-item
================================================================

.. code-block:: python

    from edc_crf.crf_with_action_model_mixin import CrfWithActionModelMixin
    from edc_egfr.constants import EGFR_DROP_NOTIFICATION_ACTION
    from edc_egfr.model_mixins import EgfrDropNotificationModelMixin
    from edc_model import models as edc_models


    class EgfrDropNotification(
        EgfrDropNotificationModelMixin,
        CrfWithActionModelMixin,
        edc_models.BaseUuidModel,
    ):

        action_name = EGFR_DROP_NOTIFICATION_ACTION

        tracking_identifier_prefix = "EG"

        class Meta(edc_models.BaseUuidModel.Meta):
            verbose_name = "eGFR Drop Notification"
            verbose_name_plural = "eGFR Drop Notifications"


Adding to an EDC model.save()
=============================

For example, from the BloodResultRft model in `meta-edc`_

.. code-block:: python

    class BloodResultsRft(
        CrfModelMixin,
        CreatinineModelMixin,
        EgfrModelMixin,
        EgfrDropModelMixin,
        CrfWithRequisitionModelMixin,
        BloodResultsModelMixin,
        edc_models.BaseUuidModel,
    ):
        lab_panel = rft_panel
        egfr_formula_name = "ckd-epi"

        class Meta(CrfWithActionModelMixin.Meta, edc_models.BaseUuidModel.Meta):
            verbose_name = "Blood Result: RFT"
            verbose_name_plural = "Blood Results: RFT"





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

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

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

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

.. _meta-edc: https://github.com/meta-trial/meta-edc/blob/develop/meta_subject/models/blood_results/blood_results_rft.py

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/clinicedc/edc-egfr",
    "name": "edc-egfr",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "django eGFR data collection clinicedc clinical trials",
    "author": "Erik van Widenfelt",
    "author_email": "ew2789@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/08/55/47aa100fb7610bfecbbfabca599604d56c72697bc469501263a5784942df/edc-egfr-0.3.8.tar.gz",
    "platform": null,
    "description": "|pypi| |actions| |codecov| |downloads|\n\nedc-egfr\n--------\nClasses and utils to handle eGFR collection and reporting\n\nIncludes calculators for `CKD-EPI Creatinine equation (2009)`\nand `Cockcroft-Gault`.\n\nCalculate value, grade, percent drop, percent drop grade\n========================================================\n\nThe calculators use ``edc_reportable`` to reference DAIDS tox tables.\n\n.. code-block:: python\n\n    egfr1 = EgfrCkdEpi(\n            gender=MALE,\n            ethnicity=BLACK,\n            creatinine_value=53.0,\n            age_in_years=30,\n            creatinine_units=MICROMOLES_PER_LITER,\n        )\n    self.assertEqual(round(egfr1.value, 2), 156.43)\n\nand the eGFR grade\n\n.. code-block:: python\n\n    self.assertEqual(egfr1.egfr_grade, 0)\n\n\nPercent drop from baseline\n==========================\nIn a trial, we are interested in the eGFR percent from baseline. Any reference value can be passed as the\nbaseline value.\n\nIf the baseline value is not provided, the percent drop = 0:\n\n.. code-block:: python\n\n    # see edc-reportable for `reference_range_collection_name`\n    opts = dict(\n        gender=MALE,\n        age_in_years=25,\n        ethnicity=BLACK,\n        creatinine_value=10.15,\n        creatinine_units=MILLIGRAMS_PER_DECILITER,\n        report_datetime=get_utcnow(),\n        reference_range_collection_name=\"my_reference_list\",\n        calculator_name=\"ckd-epi\",\n    )\n    egfr = Egfr(**opts)\n    self.assertEqual(egfr.egfr_drop_value, 0.0)\n\nIf a baseline value is provided, the percent drop is calculated:\n\n.. code-block:: python\n\n    egfr = Egfr(baseline_egfr_value=23.0, **opts)\n    self.assertEqual(round(egfr.egfr_value, 2), 7.33)\n    self.assertEqual(egfr.egfr_grade, 4)\n    self.assertEqual(round(egfr.egfr_drop_value, 2), 68.15)\n    self.assertEqual(egfr.egfr_drop_grade, 4)\n\nNotify on percent drop\n======================\n\nWe can notify when the drop is more than a given percent. ``eGFR`` uses a custom\nmodel to be updated.\n\nA `edc` lab result CRF is filled in, ``calling_crf``, that has the creatinine value and units.\nThe ``calling_crf`` has a ``subject_visit``, ``report_datetime``, ``assay_datetime``, ``creatinine_value``, and ``creatinine_units``.\n\n.. code-block:: python\n\n    egfr = Egfr(\n        baseline_egfr_value=220.1,\n        notify_on_percent_drop=20,\n        calling_crf=crf,\n        **opts,\n    )\n    self.assertEqual(round(egfr.egfr_drop_value, 2), 28.93)\n    self.assertTrue(\n        EgfrDropNotification.objects.filter(subject_visit=subject_visit).exists()\n    )\n\nConnecting a custom drop notification model with edc-action-item\n================================================================\n\n.. code-block:: python\n\n    from edc_crf.crf_with_action_model_mixin import CrfWithActionModelMixin\n    from edc_egfr.constants import EGFR_DROP_NOTIFICATION_ACTION\n    from edc_egfr.model_mixins import EgfrDropNotificationModelMixin\n    from edc_model import models as edc_models\n\n\n    class EgfrDropNotification(\n        EgfrDropNotificationModelMixin,\n        CrfWithActionModelMixin,\n        edc_models.BaseUuidModel,\n    ):\n\n        action_name = EGFR_DROP_NOTIFICATION_ACTION\n\n        tracking_identifier_prefix = \"EG\"\n\n        class Meta(edc_models.BaseUuidModel.Meta):\n            verbose_name = \"eGFR Drop Notification\"\n            verbose_name_plural = \"eGFR Drop Notifications\"\n\n\nAdding to an EDC model.save()\n=============================\n\nFor example, from the BloodResultRft model in `meta-edc`_\n\n.. code-block:: python\n\n    class BloodResultsRft(\n        CrfModelMixin,\n        CreatinineModelMixin,\n        EgfrModelMixin,\n        EgfrDropModelMixin,\n        CrfWithRequisitionModelMixin,\n        BloodResultsModelMixin,\n        edc_models.BaseUuidModel,\n    ):\n        lab_panel = rft_panel\n        egfr_formula_name = \"ckd-epi\"\n\n        class Meta(CrfWithActionModelMixin.Meta, edc_models.BaseUuidModel.Meta):\n            verbose_name = \"Blood Result: RFT\"\n            verbose_name_plural = \"Blood Results: RFT\"\n\n\n\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/edc-egfr.svg\n    :target: https://pypi.python.org/pypi/edc-egfr\n\n.. |actions| image:: https://github.com/clinicedc/edc-egfr/actions/workflows/build.yml/badge.svg\n  :target: https://github.com/clinicedc/edc-egfr/actions/workflows/build.yml\n\n.. |codecov| image:: https://codecov.io/gh/clinicedc/edc-egfr/branch/develop/graph/badge.svg\n  :target: https://codecov.io/gh/clinicedc/edc-egfr\n\n.. |downloads| image:: https://pepy.tech/badge/edc-egfr\n   :target: https://pepy.tech/project/edc-egfr\n\n.. _meta-edc: https://github.com/meta-trial/meta-edc/blob/develop/meta_subject/models/blood_results/blood_results_rft.py\n",
    "bugtrack_url": null,
    "license": "GPL license, see LICENSE",
    "summary": "Classes and utils to handle eGFR collection and reporting for clinicedc/edc projects",
    "version": "0.3.8",
    "project_urls": {
        "Homepage": "https://github.com/clinicedc/edc-egfr"
    },
    "split_keywords": [
        "django",
        "egfr",
        "data",
        "collection",
        "clinicedc",
        "clinical",
        "trials"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c03d77668bf794e6924ed3882797df340f15dd825c18ece8941fb9fb8c61f4d",
                "md5": "d5c4518d46e59c560c1dde2a5e50f94c",
                "sha256": "64b81a311ef0db1d69d2010b1f5e2731a93090bc48dc9fe41508069b7566ef92"
            },
            "downloads": -1,
            "filename": "edc_egfr-0.3.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d5c4518d46e59c560c1dde2a5e50f94c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 43141,
            "upload_time": "2024-03-26T04:55:46",
            "upload_time_iso_8601": "2024-03-26T04:55:46.992792Z",
            "url": "https://files.pythonhosted.org/packages/5c/03/d77668bf794e6924ed3882797df340f15dd825c18ece8941fb9fb8c61f4d/edc_egfr-0.3.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "085547aa100fb7610bfecbbfabca599604d56c72697bc469501263a5784942df",
                "md5": "0f4dd82ca3a6e8beddf530368a96ecf8",
                "sha256": "2433300c8b701d5925b7ded6269e703c72cc2ac6be8589ce0668f7df2b5ec95d"
            },
            "downloads": -1,
            "filename": "edc-egfr-0.3.8.tar.gz",
            "has_sig": false,
            "md5_digest": "0f4dd82ca3a6e8beddf530368a96ecf8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 40060,
            "upload_time": "2024-03-26T04:55:48",
            "upload_time_iso_8601": "2024-03-26T04:55:48.911002Z",
            "url": "https://files.pythonhosted.org/packages/08/55/47aa100fb7610bfecbbfabca599604d56c72697bc469501263a5784942df/edc-egfr-0.3.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-26 04:55:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "clinicedc",
    "github_project": "edc-egfr",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "edc-egfr"
}
        
Elapsed time: 0.21242s