Skip to main content

Classes and utils to handle eGFR collection and reporting for clinicedc/edc projects

Project description

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.

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

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:

# 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:

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.

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

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

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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edc-egfr-0.1.13.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

edc_egfr-0.1.13-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

File details

Details for the file edc-egfr-0.1.13.tar.gz.

File metadata

  • Download URL: edc-egfr-0.1.13.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for edc-egfr-0.1.13.tar.gz
Algorithm Hash digest
SHA256 347a8d13b7e1d725f3442dcfd8731f0e1ca30d6d1f66b52a500501cec535eb10
MD5 b15aa2a561ef1a8dddd58025e6157f62
BLAKE2b-256 cd8425886270114374be9e4721d8f7d4612634e8acd1dd11c5c3c5483b2b9568

See more details on using hashes here.

Provenance

File details

Details for the file edc_egfr-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: edc_egfr-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 42.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for edc_egfr-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 e36f68a73521e4196e0fedf6308d9599cb86aaa4e79d1e56ea2c40710dfb44e8
MD5 36aa7ca11d80b35e0bbbe4615edbeaa1
BLAKE2b-256 1937b101e28853727c62eec7e912d9f561b85c06b436e839506e7e58041a0ae6

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page