Base classes for visit reports/tracking in clinicedc/edc.
Project description
[![Build Status](https://travis-ci.org/clinicedc/edc-visit-tracking.svg?branch=develop)](https://travis-ci.org/clinicedc/edc-visit-tracking) [![Coverage Status](https://coveralls.io/repos/clinicedc/edc-visit-tracking/badge.svg?branch=develop&service=github)](https://coveralls.io/github/clinicedc/edc-visit-tracking?branch=develop)
# edc-visit-tracking
Track study participant visit reports.
### Declaring a visit model
A __visit_model__ is declared using the model mixin `VisitModelMixin`. Normally, a __visit_model__ will be declared with additional model mixins, but `VisitModelMixin` must be there.
class SubjectVisit(VisitModelMixin, BaseUuidModel):
...
Also, ensure the `Meta` class attributes of `VisitModelMixin` are inherited. These include required constraints and ordering.
class SubjectVisit(VisitModelMixin, BaseUuidModel):
...
class Meta(VisitModelMixin.Meta):
pass
Among other features, `VisitModelMixin` adds a `OneToOneField` foreign key to the __visit_model__ that points to `edc_appointment.Appointment`.
> Important: A __visit model__ is a special model in the EDC. A model declared with the model mixin, `VisitModelMixin`, is the definition of a __visit model__. CRFs and Requisitions have a foreign key pointing to a __visit model__. A number of methods on CRFs and Requisitions detect their __visit model__ foreign key name, model class and value by looking for the FK declared with `VisitModelMixin`.
For a subject that requires ICF the __visit model__ would look like this:
class SubjectVisit(VisitModelMixin, OffstudyMixin, CreatesMetadataModelMixin, RequiresConsentModelMixin, BaseUuidModel):
class Meta(VisitModelMixin.Meta):
consent_model = 'myapp.subjectconsent' # for RequiresConsentModelMixin
If the subject does not require ICF, such as an infant, don't include the `RequiresConsentModelMixin`:
class InfantVisit(VisitModelMixin, OffstudyMixin, CreatesMetadataModelMixin, BaseUuidModel):
class Meta(VisitModelMixin.Meta):
pass
### Declaring a CRF
The `CrfModelMixin` is required for all CRF models. CRF models have a `OneToOneField` key to a __visit model__.
class CrfOne(CrfModelMixin, OffstudyCrfModelMixin, RequiresConsentModelMixin, UpdatesCrfMetadataModelMixin, BaseUuidModel):
subject_visit = models.OneToOneField(SubjectVisit)
f1 = models.CharField(max_length=10, default='erik')
vl = models.CharField(max_length=10, default=NO)
rdb = models.CharField(max_length=10, default=NO)
class Meta:
consent_model = 'myapp.subjectconsent' # for RequiresConsentModelMixin
### Declaring forms:
The `VisitFormMixin` includes a number of common validations in the `clean` method:
class SubjectVisitForm(VisitFormMixin, forms.ModelForm):
class Meta:
model = SubjectVisit
### `PreviousVisitModelMixin`
The `PreviousVisitModelMixin` ensures that visits are entered in sequence. It is included with the `VisitModelMixin`.
# edc-visit-tracking
Track study participant visit reports.
### Declaring a visit model
A __visit_model__ is declared using the model mixin `VisitModelMixin`. Normally, a __visit_model__ will be declared with additional model mixins, but `VisitModelMixin` must be there.
class SubjectVisit(VisitModelMixin, BaseUuidModel):
...
Also, ensure the `Meta` class attributes of `VisitModelMixin` are inherited. These include required constraints and ordering.
class SubjectVisit(VisitModelMixin, BaseUuidModel):
...
class Meta(VisitModelMixin.Meta):
pass
Among other features, `VisitModelMixin` adds a `OneToOneField` foreign key to the __visit_model__ that points to `edc_appointment.Appointment`.
> Important: A __visit model__ is a special model in the EDC. A model declared with the model mixin, `VisitModelMixin`, is the definition of a __visit model__. CRFs and Requisitions have a foreign key pointing to a __visit model__. A number of methods on CRFs and Requisitions detect their __visit model__ foreign key name, model class and value by looking for the FK declared with `VisitModelMixin`.
For a subject that requires ICF the __visit model__ would look like this:
class SubjectVisit(VisitModelMixin, OffstudyMixin, CreatesMetadataModelMixin, RequiresConsentModelMixin, BaseUuidModel):
class Meta(VisitModelMixin.Meta):
consent_model = 'myapp.subjectconsent' # for RequiresConsentModelMixin
If the subject does not require ICF, such as an infant, don't include the `RequiresConsentModelMixin`:
class InfantVisit(VisitModelMixin, OffstudyMixin, CreatesMetadataModelMixin, BaseUuidModel):
class Meta(VisitModelMixin.Meta):
pass
### Declaring a CRF
The `CrfModelMixin` is required for all CRF models. CRF models have a `OneToOneField` key to a __visit model__.
class CrfOne(CrfModelMixin, OffstudyCrfModelMixin, RequiresConsentModelMixin, UpdatesCrfMetadataModelMixin, BaseUuidModel):
subject_visit = models.OneToOneField(SubjectVisit)
f1 = models.CharField(max_length=10, default='erik')
vl = models.CharField(max_length=10, default=NO)
rdb = models.CharField(max_length=10, default=NO)
class Meta:
consent_model = 'myapp.subjectconsent' # for RequiresConsentModelMixin
### Declaring forms:
The `VisitFormMixin` includes a number of common validations in the `clean` method:
class SubjectVisitForm(VisitFormMixin, forms.ModelForm):
class Meta:
model = SubjectVisit
### `PreviousVisitModelMixin`
The `PreviousVisitModelMixin` ensures that visits are entered in sequence. It is included with the `VisitModelMixin`.
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
Built Distribution
File details
Details for the file edc-visit-tracking-0.2.13.macosx-10.13-x86_64.tar.gz
.
File metadata
- Download URL: edc-visit-tracking-0.2.13.macosx-10.13-x86_64.tar.gz
- Upload date:
- Size: 50.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c5755c6dafe6c3189b98a93ce20ef1491e2bda19e0e54ccf3b525c96292f15b |
|
MD5 | 31440b5014aae0b9c848a63cb0ec6fc2 |
|
BLAKE2b-256 | 1151e1e5b3e9e2d6f876600566fea6a70f28bdbc9f849c1b049beefb2116a6dd |
File details
Details for the file edc_visit_tracking-0.2.13-py3-none-any.whl
.
File metadata
- Download URL: edc_visit_tracking-0.2.13-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c9e1fbf4e76debb04532020a0dbe9097fc6d277938566b1817931964a8f9f47 |
|
MD5 | c52ed1ff0f7738b5e4b8ad5a1f2f8930 |
|
BLAKE2b-256 | df072c853b7fe80a648894d5545602b389ab6293743274be9ff1b1ff2dc7e9b9 |