Skip to main content

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`.


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

edc_visit_tracking-0.2.10-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file edc-visit-tracking-0.2.10.macosx-10.13-x86_64.tar.gz.

File metadata

File hashes

Hashes for edc-visit-tracking-0.2.10.macosx-10.13-x86_64.tar.gz
Algorithm Hash digest
SHA256 1cf1537f37e1f0a3444c122d2ce2a77537f22041b2439fe3289667261aca143e
MD5 f9f99e9654e6bc758b204a7864787340
BLAKE2b-256 079b992cf1e836974980a4456a0ef800c8d8ca66e2c3c092acb7b4511fde4de9

See more details on using hashes here.

File details

Details for the file edc_visit_tracking-0.2.10-py3-none-any.whl.

File metadata

File hashes

Hashes for edc_visit_tracking-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 80d0b60e0af71e96b48b420a4e6a8466437bda4ab334f7ddc8594dadfc43498d
MD5 aefca7a3a8e76283507dc5a626139b98
BLAKE2b-256 18b7bc26671754f2c0d8e7bd99396bd6a29493564bf75e2a1b547eb820404cea

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