Skip to main content

Base classes for CRFs in clinicedc/edc projects

Project description

pypi actions codecov downloads

edc_crf

In longitudinal clinical trials, CRFs (case report forms) are the most common data collection forms required in the data collection schedule.

In addition to the logic checks that you will add for a specfic CRF, you also need to validate a few general conditions. Most of these conditions are checked relative to the report_datetime of the CRF data being submitted. Some examples are:

  • that a participant is consented and that their consent is still valid on the report_datetime;

  • that the CRF report_datetime makes sense relative to the covering visit report report_datetime;

  • that the participant is enrolled to the schedule (onschedule) on or after the report_datetime and has not been taken off the schedule (offschedule) on or before the report_datetime;

  • that the participant has not been taken off study on or before the report_datetime.

CRF forms

The CrfModelFormMixin is used for all CRF modelforms. With this single mixin the form:

  • Checks for the consent relative to report datetime and this schedule (edc_consent);

  • checks if participant is on/off schedule relative to report datetime and this schedule (edc_visit_schedule);

  • validates subject_visit report datetime (edc_visit_tracking);

  • checks if participant is offstudy relative to report datetime (edc_offstudy).

If any of the above conditions fail, a forms.ValidationError is raised.

The mixin imports mixins functionality from edc_consent, edc_visit_schedule, edc_visit_tracking, and edc_offstudy.

from django import forms
from edc_crf.modelform_mixins import CrfModelFormMixin
from edc_form_validators import FormValidator

from ..models import FollowupVitals


class MyCrfFormValidator(FormValidator):
    pass


class MyCrfForm(CrfModelFormMixin, forms.ModelForm):

    form_validator_cls = MyCrfFormValidator

    class Meta:
        model = MyCrf
        fields = "__all__"

CRF models

Similar to the CrfModelFormMixin, the CrfModelMixin is used for all CRF models and checks for the same conditions. However, if any of the conditions is met, an exception is raised. You should render CRF models with a modelform class using the CRFModelFormMixin to catch these exceptions on the form where the user can respond.

class MyCrf(CrfModelMixin, BaseUuidModel):

    weight_determination = models.CharField(
        verbose_name="Is weight estimated or measured?",
        max_length=15,
        choices=WEIGHT_DETERMINATION,
    )

    class Meta(CrfModelMixin.Meta, BaseUuidModel.Meta):
        verbose_name = "My CRF"
        verbose_name_plural = "My CRFs"

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

edc-crf-0.3.39.tar.gz (38.3 kB view details)

Uploaded Source

Built Distribution

edc_crf-0.3.39-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file edc-crf-0.3.39.tar.gz.

File metadata

  • Download URL: edc-crf-0.3.39.tar.gz
  • Upload date:
  • Size: 38.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for edc-crf-0.3.39.tar.gz
Algorithm Hash digest
SHA256 27b52d81f2c9a8397c92afa94dda4252aa11170c0f40e75a4ebb60c0b0e838a7
MD5 bfcbc3b2a9021bc6e767f543d9c4d11e
BLAKE2b-256 decf1252a02c20e43b81a29a3c529da2bbb355aef50dc6b3e2f15c82cf95aade

See more details on using hashes here.

File details

Details for the file edc_crf-0.3.39-py3-none-any.whl.

File metadata

  • Download URL: edc_crf-0.3.39-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for edc_crf-0.3.39-py3-none-any.whl
Algorithm Hash digest
SHA256 e767a0492895d0c6ddd7d2ec878e0afd3f071f2dc3e380df5044fc61bda6ca48
MD5 48c4ca1c65e1774da6d14cc5e571c10b
BLAKE2b-256 cd0d6d51604a070715431959923f1695d2f0ed2b073347a6d2bc8d171bc8ef00

See more details on using hashes here.

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