class Migration(migrations.Migration):

    dependencies = [
        ("sites", "0002_alter_domain_unique"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("inte_screening", "0006_auto_20200703_0014"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalDailyClosingLog",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text="System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True, max_length=10)),
                ("device_modified", models.CharField(blank=True, max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("log_identifier", models.CharField(db_index=True, max_length=50)),
                (
                    "log_date",
                    models.DateField(
                        default=edc_utils.date.get_utcnow, verbose_name="Clinic date"
                    ),
                ),
                (
                    "clinic_services",
                    models.CharField(
                        choices=[
                            (
                                "integrated",
                                "Integrated care day (HIV, Diabetes, Hypertension)",
                            ),
                            ("ncd", "NCD day (Diabetes + Hypertension"),
                            ("HIV", "HIV only Day"),
                            ("diabetes", "Diabetes only day"),
                            ("hypertension", "Hypertension only day"),
                        ],
                        max_length=25,
                        verbose_name="Which services are being offered at the clinic today?",
                    ),
                ),
                (
                    "attended",
                    models.IntegerField(
                        verbose_name="Total number of patients who attended the clinic today"
                    ),
                ),
                (
                    "selection_method",
                    models.CharField(
                        choices=[
                            ("random_sampling", "Random sampling"),
                            ("purposively_selected", "Purposively selected"),
                        ],
                        max_length=25,
                        verbose_name="How were patients selected to be approached?",
                    ),
                ),
                (
                    "approached",
                    models.IntegerField(
                        verbose_name="Number of patients who were approached by the study team"
                    ),
                ),
                (
                    "agreed_to_screen",
                    models.IntegerField(
                        verbose_name="Of those approached, number of patients who agreed to be screened"
                    ),
                ),
                (
                    "comment",
                    models.TextField(
                        blank=True, null=True, verbose_name="Additional Comments"
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Subject Refusal",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="DailyClosingLog",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text="System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True, max_length=10)),
                ("device_modified", models.CharField(blank=True, max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("log_identifier", models.CharField(max_length=50, unique=True)),
                (
                    "log_date",
                    models.DateField(
                        default=edc_utils.date.get_utcnow, verbose_name="Clinic date"
                    ),
                ),
                (
                    "clinic_services",
                    models.CharField(
                        choices=[
                            (
                                "integrated",
                                "Integrated care day (HIV, Diabetes, Hypertension)",
                            ),
                            ("ncd", "NCD day (Diabetes + Hypertension"),
                            ("HIV", "HIV only Day"),
                            ("diabetes", "Diabetes only day"),
                            ("hypertension", "Hypertension only day"),
                        ],
                        max_length=25,
                        verbose_name="Which services are being offered at the clinic today?",
                    ),
                ),
                (
                    "attended",
                    models.IntegerField(
                        verbose_name="Total number of patients who attended the clinic today"
                    ),
                ),
                (
                    "selection_method",
                    models.CharField(
                        choices=[
                            ("random_sampling", "Random sampling"),
                            ("purposively_selected", "Purposively selected"),
                        ],
                        max_length=25,
                        verbose_name="How were patients selected to be approached?",
                    ),
                ),
                (
                    "approached",
                    models.IntegerField(
                        verbose_name="Number of patients who were approached by the study team"
                    ),
                ),
                (
                    "agreed_to_screen",
                    models.IntegerField(
                        verbose_name="Of those approached, number of patients who agreed to be screened"
                    ),
                ),
                (
                    "comment",
                    models.TextField(
                        blank=True, null=True, verbose_name="Additional Comments"
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "Subject Refusal",
                "verbose_name_plural": "Subject Refusals",
                "unique_together": {("log_date", "site")},
            },
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
    ]
Example #2
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("edc_action_item", "0026_auto_20200729_2240"),
        ("sites", "0002_alter_domain_unique"),
        (
            "inte_prn",
            "0006_historicaloffschedulehiv_historicaloffschedulencd_offschedulehiv_offschedulencd",
        ),
    ]

    operations = [
        migrations.CreateModel(
            name="LossToFollowupHiv",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("inte_prn.losstofollowup", ),
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
        migrations.CreateModel(
            name="LossToFollowupNcd",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("inte_prn.losstofollowup", ),
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
        migrations.AlterModelOptions(
            name="historicaloffschedulehiv",
            options={
                "get_latest_by": "history_date",
                "ordering": ("-history_date", "-history_id"),
                "verbose_name": "historical End of Study (HIV)",
            },
        ),
        migrations.AlterModelOptions(
            name="historicaloffschedulencd",
            options={
                "get_latest_by": "history_date",
                "ordering": ("-history_date", "-history_id"),
                "verbose_name": "historical End of Study (NCD)",
            },
        ),
        migrations.AlterModelOptions(
            name="offschedulehiv",
            options={
                "verbose_name": "End of Study (HIV)",
                "verbose_name_plural": "End of Study (HIV)",
            },
        ),
        migrations.AlterModelOptions(
            name="offschedulencd",
            options={
                "verbose_name": "End of Study (NCD)",
                "verbose_name_plural": "End of Study (NCD)",
            },
        ),
        migrations.AddField(
            model_name="endofstudy",
            name="schedule_name",
            field=models.CharField(default="-", editable=False, max_length=25),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="endofstudy",
            name="visit_schedule_name",
            field=models.CharField(
                default="-",
                editable=False,
                help_text=
                'the name of the visit schedule used to find the "schedule"',
                max_length=25,
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicalendofstudy",
            name="schedule_name",
            field=models.CharField(default="-", editable=False, max_length=25),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicalendofstudy",
            name="visit_schedule_name",
            field=models.CharField(
                default="-",
                editable=False,
                help_text=
                'the name of the visit schedule used to find the "schedule"',
                max_length=25,
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicallosstofollowup",
            name="schedule_name",
            field=models.CharField(default="-", editable=False, max_length=25),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicallosstofollowup",
            name="visit_schedule_name",
            field=models.CharField(
                default="-",
                editable=False,
                help_text=
                'the name of the visit schedule used to find the "schedule"',
                max_length=25,
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicaloffschedulehiv",
            name="schedule_name",
            field=models.CharField(default="-", editable=False, max_length=25),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicaloffschedulehiv",
            name="visit_schedule_name",
            field=models.CharField(
                default="_",
                editable=False,
                help_text=
                'the name of the visit schedule used to find the "schedule"',
                max_length=25,
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicaloffschedulencd",
            name="schedule_name",
            field=models.CharField(default="-", editable=False, max_length=25),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicaloffschedulencd",
            name="visit_schedule_name",
            field=models.CharField(
                default="-",
                editable=False,
                help_text=
                'the name of the visit schedule used to find the "schedule"',
                max_length=25,
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="losstofollowup",
            name="schedule_name",
            field=models.CharField(default="-", editable=False, max_length=25),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="losstofollowup",
            name="visit_schedule_name",
            field=models.CharField(
                default="-",
                editable=False,
                help_text=
                'the name of the visit schedule used to find the "schedule"',
                max_length=25,
            ),
            preserve_default=False,
        ),
        migrations.CreateModel(
            name="HistoricalLossToFollowupNcd",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("subject_identifier", models.CharField(max_length=50)),
                ("tracking_identifier",
                 models.CharField(db_index=True, max_length=30)),
                ("action_identifier",
                 models.CharField(db_index=True, max_length=50)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "visit_schedule_name",
                    models.CharField(
                        editable=False,
                        help_text=
                        'the name of the visit schedule used to find the "schedule"',
                        max_length=25,
                    ),
                ),
                ("schedule_name",
                 models.CharField(editable=False, max_length=25)),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        validators=[
                            edc_protocol.validators.date_not_before_study_start
                        ],
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "last_seen_datetime",
                    models.DateField(
                        validators=[
                            edc_protocol.validators.date_not_before_study_start
                        ],
                        verbose_name="Date participant last seen",
                    ),
                ),
                (
                    "number_consecutive_missed_visits",
                    models.IntegerField(
                        null=True,
                        verbose_name="Number of consecutive visits missed"),
                ),
                (
                    "last_missed_visit_datetime",
                    models.DateField(
                        null=True,
                        verbose_name=
                        "Date of last missed visit report submitted",
                    ),
                ),
                (
                    "phone",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        null=True,
                        verbose_name="Was contact by phone attempted",
                    ),
                ),
                (
                    "phone_attempts",
                    models.IntegerField(
                        default=0,
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                        verbose_name=
                        ("If YES, how many attempts were made to contact the participant by phone",
                         ),
                    ),
                ),
                (
                    "home_visited",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        verbose_name="Was a home visit attempted",
                    ),
                ),
                (
                    "home_visit_detail",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name=
                        "If YES, provide any further details of the home visit",
                    ),
                ),
                (
                    "loss_category_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "comment",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name=
                        "If any, please give additional details of the circumstances that led to this decision.",
                    ),
                ),
                (
                    "loss_category",
                    models.CharField(
                        choices=[
                            ("unknown_address",
                             "Changed to an unknown address"),
                            ("never_returned",
                             "Did not return despite reminders"),
                            ("bad_contact_details",
                             "Inaccurate contact details"),
                            ("OTHER", "Other"),
                        ],
                        max_length=25,
                        verbose_name="Category of loss to follow up",
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical loss to followup ncd",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalLossToFollowupHiv",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("subject_identifier", models.CharField(max_length=50)),
                ("tracking_identifier",
                 models.CharField(db_index=True, max_length=30)),
                ("action_identifier",
                 models.CharField(db_index=True, max_length=50)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "visit_schedule_name",
                    models.CharField(
                        editable=False,
                        help_text=
                        'the name of the visit schedule used to find the "schedule"',
                        max_length=25,
                    ),
                ),
                ("schedule_name",
                 models.CharField(editable=False, max_length=25)),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        validators=[
                            edc_protocol.validators.date_not_before_study_start
                        ],
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "last_seen_datetime",
                    models.DateField(
                        validators=[
                            edc_protocol.validators.date_not_before_study_start
                        ],
                        verbose_name="Date participant last seen",
                    ),
                ),
                (
                    "number_consecutive_missed_visits",
                    models.IntegerField(
                        null=True,
                        verbose_name="Number of consecutive visits missed"),
                ),
                (
                    "last_missed_visit_datetime",
                    models.DateField(
                        null=True,
                        verbose_name=
                        "Date of last missed visit report submitted",
                    ),
                ),
                (
                    "phone",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        null=True,
                        verbose_name="Was contact by phone attempted",
                    ),
                ),
                (
                    "phone_attempts",
                    models.IntegerField(
                        default=0,
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                        verbose_name=
                        ("If YES, how many attempts were made to contact the participant by phone",
                         ),
                    ),
                ),
                (
                    "home_visited",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        verbose_name="Was a home visit attempted",
                    ),
                ),
                (
                    "home_visit_detail",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name=
                        "If YES, provide any further details of the home visit",
                    ),
                ),
                (
                    "loss_category_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "comment",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name=
                        "If any, please give additional details of the circumstances that led to this decision.",
                    ),
                ),
                (
                    "loss_category",
                    models.CharField(
                        choices=[
                            ("unknown_address",
                             "Changed to an unknown address"),
                            ("never_returned",
                             "Did not return despite reminders"),
                            ("bad_contact_details",
                             "Inaccurate contact details"),
                            ("OTHER", "Other"),
                        ],
                        max_length=25,
                        verbose_name="Category of loss to follow up",
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical loss to followup hiv",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ("inte_lists", "0008_auto_20201002_0403"),
        ("sites", "0002_alter_domain_unique"),
        ("edc_action_item", "0026_auto_20200729_2240"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("inte_prn", "0005_auto_20201021_0610"),
    ]

    operations = [
        migrations.CreateModel(
            name="OffScheduleHiv",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("inte_prn.endofstudy", ),
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
                ("objects",
                 edc_identifier.managers.SubjectIdentifierManager()),
            ],
        ),
        migrations.CreateModel(
            name="OffScheduleNcd",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("inte_prn.endofstudy", ),
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
                ("objects",
                 edc_identifier.managers.SubjectIdentifierManager()),
            ],
        ),
        migrations.CreateModel(
            name="HistoricalOffScheduleNcd",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("subject_identifier",
                 models.CharField(db_index=True, max_length=50)),
                ("tracking_identifier",
                 models.CharField(db_index=True, max_length=30)),
                ("action_identifier",
                 models.CharField(db_index=True, max_length=50)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("report_datetime", models.DateTimeField(editable=False)),
                (
                    "offschedule_datetime",
                    models.DateTimeField(
                        null=True,
                        validators=[
                            edc_model.models.validators.date.
                            datetime_not_future
                        ],
                        verbose_name=
                        "Date patient was terminated from the study",
                    ),
                ),
                (
                    "last_study_fu_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name=
                        "Date of last research follow up (if different):",
                    ),
                ),
                (
                    "other_offschedule_reason",
                    models.TextField(
                        blank=True,
                        max_length=500,
                        null=True,
                        verbose_name="If OTHER, please specify",
                    ),
                ),
                (
                    "ltfu_last_alive_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name=
                        "If lost to followup, date last known to be alive",
                    ),
                ),
                (
                    "death_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name="If deceased, date of death",
                    ),
                ),
                (
                    "ltfu_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name="Date lost to followup, if applicable",
                    ),
                ),
                (
                    "transferred_consent",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name=
                        "If transferred, has the patient provided consent to be followed-up?",
                    ),
                ),
                (
                    "comment",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="Comments"),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "offschedule_reason",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="inte_lists.OffstudyReasons",
                        verbose_name=
                        "Reason patient was terminated from the study",
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical off schedule ncd",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalOffScheduleHiv",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("subject_identifier",
                 models.CharField(db_index=True, max_length=50)),
                ("tracking_identifier",
                 models.CharField(db_index=True, max_length=30)),
                ("action_identifier",
                 models.CharField(db_index=True, max_length=50)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("report_datetime", models.DateTimeField(editable=False)),
                (
                    "offschedule_datetime",
                    models.DateTimeField(
                        null=True,
                        validators=[
                            edc_model.models.validators.date.
                            datetime_not_future
                        ],
                        verbose_name=
                        "Date patient was terminated from the study",
                    ),
                ),
                (
                    "last_study_fu_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name=
                        "Date of last research follow up (if different):",
                    ),
                ),
                (
                    "other_offschedule_reason",
                    models.TextField(
                        blank=True,
                        max_length=500,
                        null=True,
                        verbose_name="If OTHER, please specify",
                    ),
                ),
                (
                    "ltfu_last_alive_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name=
                        "If lost to followup, date last known to be alive",
                    ),
                ),
                (
                    "death_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name="If deceased, date of death",
                    ),
                ),
                (
                    "ltfu_date",
                    models.DateField(
                        blank=True,
                        null=True,
                        validators=[
                            edc_model.models.validators.date.date_not_future
                        ],
                        verbose_name="Date lost to followup, if applicable",
                    ),
                ),
                (
                    "transferred_consent",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name=
                        "If transferred, has the patient provided consent to be followed-up?",
                    ),
                ),
                (
                    "comment",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="Comments"),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "offschedule_reason",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="inte_lists.OffstudyReasons",
                        verbose_name=
                        "Reason patient was terminated from the study",
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical off schedule hiv",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
Example #4
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("mocca_lists", "0001_initial"),
        ("sites", "0002_alter_domain_unique"),
        ("mocca_screening", "0001_initial"),
    ]

    operations = [
        migrations.AlterModelManagers(
            name="moccaregister",
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
                ("objects", mocca_screening.models.mocca_register.Manager()),
            ],
        ),
        migrations.AddField(
            model_name="moccaregister",
            name="site",
            field=models.ForeignKey(
                editable=False,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="+",
                to="sites.Site",
            ),
        ),
        migrations.AlterField(
            model_name="historicalsubjectscreening",
            name="mocca_study_identifier",
            field=models.CharField(
                db_index=True,
                help_text=
                "Format must match original identifier. e.g. 12-3456 for UG, 123456 for TZ",
                max_length=25,
                validators=[
                    django.core.validators.RegexValidator(
                        "0[0-9]{1}\\-0[0-9]{3}|[0-9]{6}",
                        "Invalid format. Expected 12-3456 for UG, 123456 for TZ",
                    )
                ],
                verbose_name="Original MOCCA study identifier",
            ),
        ),
        migrations.AlterField(
            model_name="moccaregister",
            name="initials",
            field=django_crypto_fields.fields.encrypted_char_field.
            EncryptedCharField(
                blank=True,
                help_text=
                "Use UPPERCASE letters only. May be 2 or 3 letters. (Encryption: RSA local)",
                max_length=71,
                null=True,
                validators=[
                    django.core.validators.RegexValidator(
                        "[A-Z]{1,3}", "Invalid format"),
                    django.core.validators.MinLengthValidator(2),
                    django.core.validators.MaxLengthValidator(3),
                ],
            ),
        ),
        migrations.AlterField(
            model_name="subjectscreening",
            name="mocca_study_identifier",
            field=models.CharField(
                help_text=
                "Format must match original identifier. e.g. 12-3456 for UG, 123456 for TZ",
                max_length=25,
                unique=True,
                validators=[
                    django.core.validators.RegexValidator(
                        "0[0-9]{1}\\-0[0-9]{3}|[0-9]{6}",
                        "Invalid format. Expected 12-3456 for UG, 123456 for TZ",
                    )
                ],
                verbose_name="Original MOCCA study identifier",
            ),
        ),
        migrations.CreateModel(
            name="HistoricalMoccaRegister",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(default=edc_utils.date.get_utcnow),
                ),
                (
                    "mocca_screening_identifier",
                    models.CharField(
                        blank=True,
                        help_text="If known",
                        max_length=15,
                        null=True,
                        verbose_name="MOCCA (original) screening identifier",
                    ),
                ),
                (
                    "mocca_study_identifier",
                    models.CharField(
                        help_text=
                        "Format must match original identifier. e.g. 12-3456 for UG, 123456 for TZ",
                        max_length=25,
                        validators=[
                            django.core.validators.RegexValidator(
                                "0[0-9]{1}\\-0[0-9]{3}|[0-9]{6}",
                                "Invalid format. Expected 12-3456 for UG, 123456 for TZ",
                            )
                        ],
                        verbose_name="MOCCA (original) study identifier",
                    ),
                ),
                (
                    "mocca_country",
                    models.CharField(
                        choices=[("uganda", "Uganda"),
                                 ("tanzania", "Tanzania")],
                        max_length=25,
                    ),
                ),
                (
                    "first_name",
                    django_crypto_fields.fields.firstname_field.FirstnameField(
                        blank=True,
                        help_text=" (Encryption: RSA local)",
                        max_length=71,
                        null=True,
                    ),
                ),
                (
                    "last_name",
                    django_crypto_fields.fields.lastname_field.LastnameField(
                        blank=True,
                        help_text=" (Encryption: RSA local)",
                        max_length=71,
                        null=True,
                    ),
                ),
                (
                    "initials",
                    django_crypto_fields.fields.encrypted_char_field.
                    EncryptedCharField(
                        blank=True,
                        help_text=
                        "Use UPPERCASE letters only. May be 2 or 3 letters. (Encryption: RSA local)",
                        max_length=71,
                        null=True,
                        validators=[
                            django.core.validators.RegexValidator(
                                "[A-Z]{1,3}", "Invalid format"),
                            django.core.validators.MinLengthValidator(2),
                            django.core.validators.MaxLengthValidator(3),
                        ],
                    ),
                ),
                (
                    "gender",
                    models.CharField(choices=[("M", "Male"), ("F", "Female")],
                                     max_length=10),
                ),
                (
                    "age_in_years",
                    models.IntegerField(
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(18),
                            django.core.validators.MaxValueValidator(110),
                        ],
                    ),
                ),
                (
                    "birth_year",
                    models.IntegerField(
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(1900),
                            django.core.validators.MaxValueValidator(2002),
                        ],
                    ),
                ),
                ("dob", models.DateField(blank=True, null=True)),
                (
                    "survival_status",
                    models.CharField(
                        choices=[
                            ("alive", "Alive"),
                            ("dead", "Deceased"),
                            ("unknown", "Unknown"),
                        ],
                        default="unknown",
                        max_length=25,
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "mocca_site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        limit_choices_to=mocca_screening.mocca_original_sites.
                        get_mocca_site_limited_to,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="mocca_lists.MoccaOriginalSites",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical MOCCA Patient Register",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
Example #5
0
class Migration(migrations.Migration):

    dependencies = [
        ("sites", "0002_alter_domain_unique"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("inte_prn", "0001_initial"),
    ]

    operations = [
        migrations.AlterModelOptions(
            name="historicallosstofollowup",
            options={
                "get_latest_by": "history_date",
                "ordering": ("-history_date", "-history_id"),
                "verbose_name": "historical Loss to Follow Up",
            },
        ),
        migrations.AlterModelOptions(
            name="losstofollowup",
            options={
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
                "get_latest_by":
                "modified",
                "ordering": ("-modified", "-created"),
                "verbose_name":
                "Loss to Follow Up",
                "verbose_name_plural":
                "Loss to Follow Ups",
            },
        ),
        migrations.AlterModelOptions(
            name="protocoldeviationviolation",
            options={
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
                "get_latest_by":
                "modified",
                "ordering": ("-modified", "-created"),
                "verbose_name":
                "Protocol Deviation/Violation",
                "verbose_name_plural":
                "Protocol Deviations/Violations",
            },
        ),
        migrations.AlterModelOptions(
            name="unblindingrequest",
            options={
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
                "get_latest_by":
                "modified",
                "ordering": ("-modified", "-created"),
                "verbose_name":
                "Unblinding Request",
                "verbose_name_plural":
                "Unblinding Requests",
            },
        ),
        migrations.AlterModelOptions(
            name="unblindingreview",
            options={
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
                "get_latest_by":
                "modified",
                "ordering": ("-modified", "-created"),
                "verbose_name":
                "Unblinding Review",
                "verbose_name_plural":
                "Unblinding Reviews",
            },
        ),
        migrations.CreateModel(
            name="IntegratedCareClinicRegistration",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "date_opened",
                    models.DateField(
                        verbose_name="Date integrated clinic opened"),
                ),
                (
                    "comment",
                    models.TextField(
                        help_text="Optional",
                        null=True,
                        verbose_name=
                        "Please give a brief summary of the opportunities and challenges in getting this clinic open.",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name":
                "Integrated Care Clinic Registration",
                "verbose_name_plural":
                "Integrated Care Clinic Registration",
                "ordering": ("-modified", "-created"),
                "get_latest_by":
                "modified",
                "abstract":
                False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
            },
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
        migrations.CreateModel(
            name="HistoricalIntegratedCareClinicRegistration",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "date_opened",
                    models.DateField(
                        verbose_name="Date integrated clinic opened"),
                ),
                (
                    "comment",
                    models.TextField(
                        help_text="Optional",
                        null=True,
                        verbose_name=
                        "Please give a brief summary of the opportunities and challenges in getting this clinic open.",
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name":
                "historical Integrated Care Clinic Registration",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddConstraint(
            model_name="integratedcareclinicregistration",
            constraint=models.UniqueConstraint(fields=("site", ),
                                               name="unique_icc_registration"),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ("sites", "0002_alter_domain_unique"),
        ("inte_lists", "0009_auto_20210122_2323"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("edc_action_item", "0027_auto_20210120_0005"),
        ("inte_prn", "0010_auto_20201124_0548"),
    ]

    operations = [
        migrations.CreateModel(
            name="SubjectTransfer",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("subject_identifier",
                 models.CharField(max_length=50, unique=True)),
                ("tracking_identifier",
                 models.CharField(max_length=30, unique=True)),
                ("action_identifier",
                 models.CharField(max_length=50, unique=True)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "transfer_date",
                    models.DateField(default=edc_utils.date.get_utcnow,
                                     verbose_name="Transfer date"),
                ),
                (
                    "initiated_by",
                    models.CharField(
                        choices=[
                            ("patient", "Patient"),
                            ("clinician",
                             "Attending Clinician / Healthcare worker"),
                            ("OTHER", "Other"),
                        ],
                        max_length=25,
                        verbose_name="Who initiated the transfer request",
                    ),
                ),
                (
                    "initiated_by_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "transfer_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "may_return",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("not_sure", "Not sure"),
                        ],
                        max_length=15,
                        verbose_name=
                        "Is the participant likely to transfer back before the end of their stay in the trial?",
                    ),
                ),
                (
                    "may_contact",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        verbose_name=
                        "Is the participant willing to be contacted at the end of the study?",
                    ),
                ),
                (
                    "comment",
                    django_crypto_fields.fields.encrypted_text_field.
                    EncryptedTextField(
                        blank=True,
                        help_text=" (Encryption: AES local)",
                        max_length=71,
                        verbose_name="Additional Comments",
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "transfer_reason",
                    models.ManyToManyField(
                        to="inte_lists.TransferReasons",
                        verbose_name="Reason for transfer",
                    ),
                ),
            ],
            options={
                "verbose_name":
                "Subject Transfer",
                "verbose_name_plural":
                "Subject Transfers",
                "ordering": ("-modified", "-created"),
                "get_latest_by":
                "modified",
                "abstract":
                False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
            },
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
        migrations.CreateModel(
            name="HistoricalSubjectTransferNcd",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("subject_identifier",
                 models.CharField(db_index=True, max_length=50)),
                ("tracking_identifier",
                 models.CharField(db_index=True, max_length=30)),
                ("action_identifier",
                 models.CharField(db_index=True, max_length=50)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "transfer_date",
                    models.DateField(default=edc_utils.date.get_utcnow,
                                     verbose_name="Transfer date"),
                ),
                (
                    "initiated_by",
                    models.CharField(
                        choices=[
                            ("patient", "Patient"),
                            ("clinician",
                             "Attending Clinician / Healthcare worker"),
                            ("OTHER", "Other"),
                        ],
                        max_length=25,
                        verbose_name="Who initiated the transfer request",
                    ),
                ),
                (
                    "initiated_by_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "transfer_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "may_return",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("not_sure", "Not sure"),
                        ],
                        max_length=15,
                        verbose_name=
                        "Is the participant likely to transfer back before the end of their stay in the trial?",
                    ),
                ),
                (
                    "may_contact",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        verbose_name=
                        "Is the participant willing to be contacted at the end of the study?",
                    ),
                ),
                (
                    "comment",
                    django_crypto_fields.fields.encrypted_text_field.
                    EncryptedTextField(
                        blank=True,
                        help_text=" (Encryption: AES local)",
                        max_length=71,
                        verbose_name="Additional Comments",
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Subject Transfer (NCD)",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalSubjectTransferHiv",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("subject_identifier",
                 models.CharField(db_index=True, max_length=50)),
                ("tracking_identifier",
                 models.CharField(db_index=True, max_length=30)),
                ("action_identifier",
                 models.CharField(db_index=True, max_length=50)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "transfer_date",
                    models.DateField(default=edc_utils.date.get_utcnow,
                                     verbose_name="Transfer date"),
                ),
                (
                    "initiated_by",
                    models.CharField(
                        choices=[
                            ("patient", "Patient"),
                            ("clinician",
                             "Attending Clinician / Healthcare worker"),
                            ("OTHER", "Other"),
                        ],
                        max_length=25,
                        verbose_name="Who initiated the transfer request",
                    ),
                ),
                (
                    "initiated_by_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "transfer_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "may_return",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("not_sure", "Not sure"),
                        ],
                        max_length=15,
                        verbose_name=
                        "Is the participant likely to transfer back before the end of their stay in the trial?",
                    ),
                ),
                (
                    "may_contact",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        verbose_name=
                        "Is the participant willing to be contacted at the end of the study?",
                    ),
                ),
                (
                    "comment",
                    django_crypto_fields.fields.encrypted_text_field.
                    EncryptedTextField(
                        blank=True,
                        help_text=" (Encryption: AES local)",
                        max_length=71,
                        verbose_name="Additional Comments",
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Subject Transfer (HIV)",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalSubjectTransfer",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                ("subject_identifier",
                 models.CharField(db_index=True, max_length=50)),
                ("tracking_identifier",
                 models.CharField(db_index=True, max_length=30)),
                ("action_identifier",
                 models.CharField(db_index=True, max_length=50)),
                (
                    "parent_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to parent reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                (
                    "related_action_identifier",
                    models.CharField(
                        help_text=
                        "action identifier that links to related reference model instance.",
                        max_length=30,
                        null=True,
                    ),
                ),
                ("action_item_reason",
                 models.TextField(editable=False, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "transfer_date",
                    models.DateField(default=edc_utils.date.get_utcnow,
                                     verbose_name="Transfer date"),
                ),
                (
                    "initiated_by",
                    models.CharField(
                        choices=[
                            ("patient", "Patient"),
                            ("clinician",
                             "Attending Clinician / Healthcare worker"),
                            ("OTHER", "Other"),
                        ],
                        max_length=25,
                        verbose_name="Who initiated the transfer request",
                    ),
                ),
                (
                    "initiated_by_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "transfer_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "may_return",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("not_sure", "Not sure"),
                        ],
                        max_length=15,
                        verbose_name=
                        "Is the participant likely to transfer back before the end of their stay in the trial?",
                    ),
                ),
                (
                    "may_contact",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=15,
                        verbose_name=
                        "Is the participant willing to be contacted at the end of the study?",
                    ),
                ),
                (
                    "comment",
                    django_crypto_fields.fields.encrypted_text_field.
                    EncryptedTextField(
                        blank=True,
                        help_text=" (Encryption: AES local)",
                        max_length=71,
                        verbose_name="Additional Comments",
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "parent_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "related_action_item",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="edc_action_item.ActionItem",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Subject Transfer",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="ClinicalNote",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("subject_identifier", models.CharField(max_length=50)),
                ("tracking_identifier",
                 models.CharField(max_length=30, unique=True)),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        verbose_name="Report Date and Time",
                    ),
                ),
                (
                    "subjective",
                    models.TextField(
                        verbose_name="Subjective / Pertinant history"),
                ),
                (
                    "note",
                    django_crypto_fields.fields.encrypted_text_field.
                    EncryptedTextField(
                        blank=True,
                        help_text=" (Encryption: AES local)",
                        max_length=71,
                        verbose_name="Clinical Note",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
            ],
            options={
                "verbose_name":
                "Clinical Note",
                "verbose_name_plural":
                "Clinical Notes",
                "ordering": ("-modified", "-created"),
                "get_latest_by":
                "modified",
                "abstract":
                False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
            },
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
                ("objects",
                 edc_identifier.managers.SubjectIdentifierManager()),
            ],
        ),
        migrations.CreateModel(
            name="SubjectTransferHiv",
            fields=[],
            options={
                "verbose_name": "Subject Transfer (HIV)",
                "verbose_name_plural": "Subject Transfers (HIV)",
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("inte_prn.subjecttransfer", ),
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
        migrations.CreateModel(
            name="SubjectTransferNcd",
            fields=[],
            options={
                "verbose_name": "Subject Transfer (NCD)",
                "verbose_name_plural": "Subject Transfers (NCD)",
                "proxy": True,
                "indexes": [],
                "constraints": [],
            },
            bases=("inte_prn.subjecttransfer", ),
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
        migrations.AddIndex(
            model_name="clinicalnote",
            index=models.Index(
                fields=["tracking_identifier", "site", "id"],
                name="inte_prn_cl_trackin_33bffa_idx",
            ),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ("inte_prn", "0003_auto_20200818_2043"),
    ]

    operations = [
        migrations.AlterModelManagers(
            name="endofstudy",
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
                ("objects", edc_identifier.managers.SubjectIdentifierManager()),
            ],
        ),
        migrations.AlterModelManagers(
            name="losstofollowup",
            managers=[
                ("on_site", edc_sites.models.CurrentSiteManager()),
            ],
        ),
        migrations.AddField(
            model_name="endofstudy",
            name="ltfu_date",
            field=models.DateField(
                blank=True,
                null=True,
                validators=[edc_model.models.validators.date.date_not_future],
                verbose_name="Date lost to followup, if applicable",
            ),
        ),
        migrations.AddField(
            model_name="historicalendofstudy",
            name="ltfu_date",
            field=models.DateField(
                blank=True,
                null=True,
                validators=[edc_model.models.validators.date.date_not_future],
                verbose_name="Date lost to followup, if applicable",
            ),
        ),
        migrations.AddField(
            model_name="historicallosstofollowup",
            name="last_missed_visit_datetime",
            field=models.DateField(
                null=True, verbose_name="Date of last missed visit report submitted"
            ),
        ),
        migrations.AddField(
            model_name="historicallosstofollowup",
            name="loss_category_other",
            field=edc_model.models.fields.other_charfield.OtherCharField(
                blank=True,
                max_length=35,
                null=True,
                verbose_name="If other, please specify ...",
            ),
        ),
        migrations.AddField(
            model_name="historicallosstofollowup",
            name="number_consecutive_missed_visits",
            field=models.IntegerField(
                null=True, verbose_name="Number of consecutive visits missed"
            ),
        ),
        migrations.AddField(
            model_name="historicallosstofollowup",
            name="phone",
            field=models.CharField(
                choices=[("Yes", "Yes"), ("No", "No")],
                max_length=15,
                null=True,
                verbose_name="Was contact by phone attempted",
            ),
        ),
        migrations.AddField(
            model_name="losstofollowup",
            name="last_missed_visit_datetime",
            field=models.DateField(
                null=True, verbose_name="Date of last missed visit report submitted"
            ),
        ),
        migrations.AddField(
            model_name="losstofollowup",
            name="loss_category_other",
            field=edc_model.models.fields.other_charfield.OtherCharField(
                blank=True,
                max_length=35,
                null=True,
                verbose_name="If other, please specify ...",
            ),
        ),
        migrations.AddField(
            model_name="losstofollowup",
            name="number_consecutive_missed_visits",
            field=models.IntegerField(
                null=True, verbose_name="Number of consecutive visits missed"
            ),
        ),
        migrations.AddField(
            model_name="losstofollowup",
            name="phone",
            field=models.CharField(
                choices=[("Yes", "Yes"), ("No", "No")],
                max_length=15,
                null=True,
                verbose_name="Was contact by phone attempted",
            ),
        ),
        migrations.AlterField(
            model_name="historicallosstofollowup",
            name="comment",
            field=models.TextField(
                blank=True,
                null=True,
                verbose_name="If any, please give additional details of the circumstances that led to this decision.",
            ),
        ),
        migrations.AlterField(
            model_name="historicallosstofollowup",
            name="home_visit_detail",
            field=models.TextField(
                blank=True,
                null=True,
                verbose_name="If YES, provide any further details of the home visit",
            ),
        ),
        migrations.AlterField(
            model_name="historicallosstofollowup",
            name="home_visited",
            field=models.CharField(
                choices=[("Yes", "Yes"), ("No", "No")],
                max_length=15,
                verbose_name="Was a home visit attempted",
            ),
        ),
        migrations.AlterField(
            model_name="historicallosstofollowup",
            name="last_seen_datetime",
            field=models.DateField(
                validators=[edc_protocol.validators.date_not_before_study_start],
                verbose_name="Date participant last seen",
            ),
        ),
        migrations.AlterField(
            model_name="historicallosstofollowup",
            name="loss_category",
            field=models.CharField(
                choices=[
                    ("unknown_address", "Changed to an unknown address"),
                    ("never_returned", "Did not return despite reminders"),
                    ("bad_contact_details", "Inaccurate contact details"),
                    ("OTHER", "Other"),
                ],
                max_length=25,
                verbose_name="Category of loss to follow up",
            ),
        ),
        migrations.AlterField(
            model_name="historicallosstofollowup",
            name="phone_attempts",
            field=models.IntegerField(
                default=0,
                validators=[django.core.validators.MinValueValidator(0)],
                verbose_name=(
                    "If YES, how many attempts were made to contact the participant by phone",
                ),
            ),
        ),
        migrations.AlterField(
            model_name="historicallosstofollowup",
            name="report_datetime",
            field=models.DateTimeField(
                default=edc_utils.date.get_utcnow,
                validators=[edc_protocol.validators.date_not_before_study_start],
                verbose_name="Report Date and Time",
            ),
        ),
        migrations.AlterField(
            model_name="losstofollowup",
            name="comment",
            field=models.TextField(
                blank=True,
                null=True,
                verbose_name="If any, please give additional details of the circumstances that led to this decision.",
            ),
        ),
        migrations.AlterField(
            model_name="losstofollowup",
            name="home_visit_detail",
            field=models.TextField(
                blank=True,
                null=True,
                verbose_name="If YES, provide any further details of the home visit",
            ),
        ),
        migrations.AlterField(
            model_name="losstofollowup",
            name="home_visited",
            field=models.CharField(
                choices=[("Yes", "Yes"), ("No", "No")],
                max_length=15,
                verbose_name="Was a home visit attempted",
            ),
        ),
        migrations.AlterField(
            model_name="losstofollowup",
            name="last_seen_datetime",
            field=models.DateField(
                validators=[edc_protocol.validators.date_not_before_study_start],
                verbose_name="Date participant last seen",
            ),
        ),
        migrations.AlterField(
            model_name="losstofollowup",
            name="loss_category",
            field=models.CharField(
                choices=[
                    ("unknown_address", "Changed to an unknown address"),
                    ("never_returned", "Did not return despite reminders"),
                    ("bad_contact_details", "Inaccurate contact details"),
                    ("OTHER", "Other"),
                ],
                max_length=25,
                verbose_name="Category of loss to follow up",
            ),
        ),
        migrations.AlterField(
            model_name="losstofollowup",
            name="phone_attempts",
            field=models.IntegerField(
                default=0,
                validators=[django.core.validators.MinValueValidator(0)],
                verbose_name=(
                    "If YES, how many attempts were made to contact the participant by phone",
                ),
            ),
        ),
        migrations.AlterField(
            model_name="losstofollowup",
            name="report_datetime",
            field=models.DateTimeField(
                default=edc_utils.date.get_utcnow,
                validators=[edc_protocol.validators.date_not_before_study_start],
                verbose_name="Report Date and Time",
            ),
        ),
    ]