Base classes for visit reports/tracking in clinicedc/edc.
Project description
|pypi| |travis| |coverage|
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.
.. code-block:: python
class SubjectVisit(VisitModelMixin, BaseUuidModel):
...
Also, ensure the `Meta` class attributes of `VisitModelMixin` are inherited. These include required constraints and ordering.
.. code-block:: python
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:
.. code-block:: python
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`:
.. code-block:: python
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**.
.. code-block:: python
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:
.. code-block:: python
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`.
.. |pypi| image:: https://img.shields.io/pypi/v/edc-visit-tracking.svg
:target: https://pypi.python.org/pypi/edc-visit-tracking
.. |travis| image:: https://travis-ci.org/clinicedc/edc-visit-tracking.svg?branch=develop
:target: https://travis-ci.org/clinicedc/edc-visit-tracking
.. |coverage| image:: https://coveralls.io/repos/github/clinicedc/edc-visit-tracking/badge.svg?branch=develop
:target: 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.
.. code-block:: python
class SubjectVisit(VisitModelMixin, BaseUuidModel):
...
Also, ensure the `Meta` class attributes of `VisitModelMixin` are inherited. These include required constraints and ordering.
.. code-block:: python
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:
.. code-block:: python
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`:
.. code-block:: python
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**.
.. code-block:: python
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:
.. code-block:: python
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`.
.. |pypi| image:: https://img.shields.io/pypi/v/edc-visit-tracking.svg
:target: https://pypi.python.org/pypi/edc-visit-tracking
.. |travis| image:: https://travis-ci.org/clinicedc/edc-visit-tracking.svg?branch=develop
:target: https://travis-ci.org/clinicedc/edc-visit-tracking
.. |coverage| image:: https://coveralls.io/repos/github/clinicedc/edc-visit-tracking/badge.svg?branch=develop
:target: https://coveralls.io/github/clinicedc/edc-visit-tracking?branch=develop
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.17.macosx-10.13-x86_64.tar.gz
.
File metadata
- Download URL: edc-visit-tracking-0.2.17.macosx-10.13-x86_64.tar.gz
- Upload date:
- Size: 50.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 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 | b961e4f389bb034b0faa9940f86c76e9b99c0dd182f0e550aeca396427dc5892 |
|
MD5 | 366ad9f114c84745c9a18fabd29af62c |
|
BLAKE2b-256 | 95c3765030453a01841b1e8c45b198eaa22f06d632968b0f9bb74287e1b4ea7e |
File details
Details for the file edc_visit_tracking-0.2.17-py3-none-any.whl
.
File metadata
- Download URL: edc_visit_tracking-0.2.17-py3-none-any.whl
- Upload date:
- Size: 32.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 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 | 47b2b0079ef723095efd3485c2f7f9a9d526acd0cfbc7c6099e122710ff868ab |
|
MD5 | ef20d069242d7b52f84a3310f57c93fa |
|
BLAKE2b-256 | 4a082a9173e3bdb0751a4750a2425522d572ef4506832ddfa5eb51caa4178583 |