From 600afcf25dd79f86d49b26c70e5bf79fd9876bbc Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 14 Aug 2024 16:28:45 +0100 Subject: [PATCH] Add ConfirmedSerumCragDate (note) model, refactor effect_reports to use NoteModel(Admin)Mixin, fix SQL defined report_models, fix imports for refactored QaReportModelMixin --- .../admin/confirmed_serum_crag_date_admin.py | 106 +++++ .../admin/consented_serum_crag_date_admin.py | 36 +- ...792_kw_in_current_sx_gte_g3_other_admin.py | 4 +- .../rm792_kw_in_current_sx_other_admin.py | 4 +- effect_reports/forms/__init__.py | 1 + .../forms/confirmed_serum_crag_date_form.py | 28 ++ ...storicalconfirmedserumcragdate_and_more.py | 389 ++++++++++++++++++ .../models/confirmed_serum_crag_date.py | 31 ++ .../models/consented_serum_crag_date.py | 2 +- .../rm792_kw_in_current_sx_gte_g3_other.py | 2 +- .../rm792_kw_in_current_sx_gte_g3_other.sql | 6 +- .../unmanaged/rm792_kw_in_current_sx_other.py | 2 +- .../rm792_kw_in_current_sx_other.sql | 6 +- .../unmanaged/rm792_si_sx_list_candidates.sql | 6 +- 14 files changed, 605 insertions(+), 18 deletions(-) create mode 100644 effect_reports/admin/confirmed_serum_crag_date_admin.py create mode 100644 effect_reports/forms/confirmed_serum_crag_date_form.py create mode 100644 effect_reports/migrations/0003_historicalconfirmedserumcragdate_and_more.py create mode 100644 effect_reports/models/confirmed_serum_crag_date.py diff --git a/effect_reports/admin/confirmed_serum_crag_date_admin.py b/effect_reports/admin/confirmed_serum_crag_date_admin.py new file mode 100644 index 00000000..bac6e009 --- /dev/null +++ b/effect_reports/admin/confirmed_serum_crag_date_admin.py @@ -0,0 +1,106 @@ +from django.contrib import admin +from django.template.loader import render_to_string +from django.urls import NoReverseMatch, reverse +from django.utils.html import format_html +from django_audit_fields import ModelAdminAuditFieldsMixin, audit_fieldset_tuple +from django_revision.modeladmin_mixin import ModelAdminRevisionMixin +from edc_model_admin.dashboard import ModelAdminDashboardMixin +from edc_model_admin.mixins import ( + ModelAdminFormAutoNumberMixin, + ModelAdminFormInstructionsMixin, + ModelAdminInstitutionMixin, + ModelAdminNextUrlRedirectMixin, + TemplatesModelAdminMixin, +) +from edc_sites.admin import SiteModelAdminMixin + +from ..admin_site import effect_reports_admin +from ..forms import ConfirmedSerumCragDateForm +from ..models import ConfirmedSerumCragDate + + +@admin.register(ConfirmedSerumCragDate, site=effect_reports_admin) +class ConfirmedSerumCragDateAdmin( + SiteModelAdminMixin, + ModelAdminDashboardMixin, + ModelAdminAuditFieldsMixin, + ModelAdminFormAutoNumberMixin, + ModelAdminFormInstructionsMixin, + ModelAdminRevisionMixin, # add + ModelAdminInstitutionMixin, # add + ModelAdminNextUrlRedirectMixin, + TemplatesModelAdminMixin, + admin.ModelAdmin, +): + + form = ConfirmedSerumCragDateForm + ordering = ["site", "subject_identifier"] + + note_template_name = "edc_qareports/qa_report_note.html" + + fieldsets = ( + ( + "Screening Serum CrAg Date", + {"fields": ("confirmed_serum_crag_date",)}, + ), + ( + "Notes", + { + "fields": ( + "note", + "status", + "subject_identifier", + "report_model", + "report_datetime", + ) + }, + ), + audit_fieldset_tuple, + ) + + list_display = [ + "dashboard", + "subject_identifier", + "report", + "status", + "confirmed_serum_crag_date", + "report_note", + "report_datetime", + ] + + radio_fields = {"status": admin.VERTICAL} + + list_filter = [ + "confirmed_serum_crag_date", + "status", + "report_datetime", + "report_model", + "user_created", + "user_modified", + ] + + search_fields = ["subject_identifier", "name"] + + @admin.display(description="Report", ordering="report_name") + def report(self, obj=None): + app_label, model = obj.report_model_cls._meta.label_lower.split(".") + changelist_url = "_".join([app_label, model, "changelist"]) + try: + # assume admin site naming convention + url = reverse(f"{app_label}_admin:{changelist_url}") + except NoReverseMatch: + # TODO: find the admin site where this model is registered + url = "#" + return format_html( + '{}', + *(url, obj.subject_identifier, obj.report_model_cls._meta.verbose_name), + ) + + @admin.display(description="QA Note", ordering="note") + def report_note(self, obj=None): + context = dict(note=obj.note) + return render_to_string(self.note_template_name, context) + + def redirect_url(self, request, obj, post_url_continue=None) -> str | None: + redirect_url = super().redirect_url(request, obj, post_url_continue=post_url_continue) + return f"{redirect_url}?q={obj.subject_identifier}" diff --git a/effect_reports/admin/consented_serum_crag_date_admin.py b/effect_reports/admin/consented_serum_crag_date_admin.py index 711ee18f..02aacc4c 100644 --- a/effect_reports/admin/consented_serum_crag_date_admin.py +++ b/effect_reports/admin/consented_serum_crag_date_admin.py @@ -1,8 +1,12 @@ +from django.apps import apps as django_apps from django.contrib import admin +from django.utils.html import format_html from edc_model_admin.dashboard import ModelAdminDashboardMixin from edc_model_admin.mixins import TemplatesModelAdminMixin -from edc_qareports.admin import QaReportWithNoteModelAdminMixin +from edc_qareports.admin import NoteModelAdminMixin +from edc_qareports.utils import truncate_string from edc_sites.admin import SiteModelAdminMixin +from edc_utils import escape_braces from ..admin_site import effect_reports_admin from ..consented_serum_crag_date_df import ConsentedSerumCragDateDf @@ -11,12 +15,16 @@ @admin.register(ConsentedSerumCragDate, site=effect_reports_admin) class ConsentedSerumCragDateAdmin( - QaReportWithNoteModelAdminMixin, + NoteModelAdminMixin, SiteModelAdminMixin, ModelAdminDashboardMixin, TemplatesModelAdminMixin, admin.ModelAdmin, ): + qa_report_list_display_insert_pos = 5 + + note_model_cls = django_apps.get_model("effect_reports.confirmedserumcragdate") + ordering = ("subject_identifier",) list_display = [ "dashboard", @@ -48,6 +56,30 @@ def screening(self, obj=None): def subject(self, obj=None): return obj.subject_identifier + @admin.display(description="Conf. ser CrAg Date") + def notes(self, obj=None): + """Returns url to add or edit qa_report model note""" + return super().notes(obj=obj) + + def get_notes_label(self, obj=None, field_name=None): + if not obj: + label = "Add" + else: + date = obj.confirmed_serum_crag_date + note = obj.note + if date and not note: + label = date + elif date and note: + label = format_html( + f"{date.strftime('%-d %b %Y')}
" + f"({escape_braces(truncate_string(note, max_length=35))})" + ) + elif note: + label = truncate_string(note, max_length=35) + else: + label = "Edit" + return label + def get_queryset(self, request): cls = ConsentedSerumCragDateDf() cls.to_model() diff --git a/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_gte_g3_other_admin.py b/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_gte_g3_other_admin.py index 16ab1040..05cd70d7 100644 --- a/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_gte_g3_other_admin.py +++ b/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_gte_g3_other_admin.py @@ -7,7 +7,7 @@ from edc_appointment.models import Appointment from edc_model_admin.dashboard import ModelAdminDashboardMixin from edc_model_admin.mixins import TemplatesModelAdminMixin -from edc_qareports.admin import QaReportWithNoteModelAdminMixin +from edc_qareports.admin import NoteModelAdminMixin from edc_sites.admin import SiteModelAdminMixin from edc_visit_schedule.admin import ScheduleStatusListFilter @@ -17,7 +17,7 @@ @admin.register(Rm792KwInCurrentSxGteG3Other, site=effect_reports_admin) class Rm792KwInCurrentSxGteG3OtherAdmin( - QaReportWithNoteModelAdminMixin, + NoteModelAdminMixin, SiteModelAdminMixin, ModelAdminDashboardMixin, TemplatesModelAdminMixin, diff --git a/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_other_admin.py b/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_other_admin.py index 73b44859..9c46646a 100644 --- a/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_other_admin.py +++ b/effect_reports/admin/unmanaged/rm792_kw_in_current_sx_other_admin.py @@ -7,7 +7,7 @@ from edc_appointment.models import Appointment from edc_model_admin.dashboard import ModelAdminDashboardMixin from edc_model_admin.mixins import TemplatesModelAdminMixin -from edc_qareports.admin import QaReportWithNoteModelAdminMixin +from edc_qareports.admin import NoteModelAdminMixin from edc_sites.admin import SiteModelAdminMixin from edc_visit_schedule.admin import ScheduleStatusListFilter @@ -17,7 +17,7 @@ @admin.register(Rm792KwInCurrentSxOther, site=effect_reports_admin) class Rm792KwInCurrentSxOtherAdmin( - QaReportWithNoteModelAdminMixin, + NoteModelAdminMixin, SiteModelAdminMixin, ModelAdminDashboardMixin, TemplatesModelAdminMixin, diff --git a/effect_reports/forms/__init__.py b/effect_reports/forms/__init__.py index e69de29b..58051e19 100644 --- a/effect_reports/forms/__init__.py +++ b/effect_reports/forms/__init__.py @@ -0,0 +1 @@ +from .confirmed_serum_crag_date_form import ConfirmedSerumCragDateForm diff --git a/effect_reports/forms/confirmed_serum_crag_date_form.py b/effect_reports/forms/confirmed_serum_crag_date_form.py new file mode 100644 index 00000000..c8e65037 --- /dev/null +++ b/effect_reports/forms/confirmed_serum_crag_date_form.py @@ -0,0 +1,28 @@ +from django import forms +from edc_form_validators import FormValidatorMixin +from edc_model_form.mixins import BaseModelFormMixin +from edc_sites.modelform_mixins import SiteModelFormMixin +from effect_form_validators.effect_reports import ConfirmedSerumCragDateFormValidator + +from ..models import ConfirmedSerumCragDate + + +class ConfirmedSerumCragDateForm( + SiteModelFormMixin, + BaseModelFormMixin, + FormValidatorMixin, + forms.ModelForm, +): + + report_datetime_field_attr = "report_datetime" + form_validator_cls = ConfirmedSerumCragDateFormValidator + + class Meta: + model = ConfirmedSerumCragDate + fields = "__all__" + help_text = {"subject_identifier": "(read-only)", "name": "(read-only)"} + widgets = { + "report_model": forms.TextInput(attrs={"readonly": "readonly"}), + "subject_identifier": forms.TextInput(attrs={"readonly": "readonly"}), + "name": forms.TextInput(attrs={"readonly": "readonly"}), + } diff --git a/effect_reports/migrations/0003_historicalconfirmedserumcragdate_and_more.py b/effect_reports/migrations/0003_historicalconfirmedserumcragdate_and_more.py new file mode 100644 index 00000000..f9669b72 --- /dev/null +++ b/effect_reports/migrations/0003_historicalconfirmedserumcragdate_and_more.py @@ -0,0 +1,389 @@ +# Generated by Django 4.2.11 on 2024-08-09 12:10 + +import uuid + +import _socket +import django.db.models.deletion +import django.db.models.manager +import django_audit_fields.fields.hostname_modification_field +import django_audit_fields.fields.userfield +import django_audit_fields.fields.uuid_auto_field +import django_audit_fields.models.audit_model_mixin +import django_revision.revision_field +import edc_model.validators.date +import edc_sites.managers +import edc_utils.date +import simple_history.models +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ("sites", "0002_alter_domain_unique"), + ("effect_reports", "0002_auto_20240626_1725"), + ] + + operations = [ + migrations.CreateModel( + name="HistoricalConfirmedSerumCragDate", + 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, + verbose_name="Hostname created", + ), + ), + ( + "hostname_modified", + django_audit_fields.fields.hostname_modification_field.HostnameModificationField( + blank=True, + help_text="System field. (modified on every save)", + max_length=50, + verbose_name="Hostname modified", + ), + ), + ( + "device_created", + models.CharField(blank=True, max_length=10, verbose_name="Device created"), + ), + ( + "device_modified", + models.CharField( + blank=True, max_length=10, verbose_name="Device modified" + ), + ), + ( + "locale_created", + models.CharField( + blank=True, + help_text="Auto-updated by Modeladmin", + max_length=10, + null=True, + verbose_name="Locale created", + ), + ), + ( + "locale_modified", + models.CharField( + blank=True, + help_text="Auto-updated by Modeladmin", + max_length=10, + null=True, + verbose_name="Locale modified", + ), + ), + ( + "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)), + ("report_model", models.CharField(max_length=150)), + ("report_datetime", models.DateTimeField(default=edc_utils.date.get_utcnow)), + ("note", models.TextField(blank=True, null=True)), + ( + "status", + models.CharField( + choices=[("New", "New"), ("feedback", "Feedback")], + default="New", + max_length=25, + ), + ), + ( + "confirmed_serum_crag_date", + models.DateField( + blank=True, + help_text="Please enter first collection date in episode. Test must have been performed within 21 days of screening.", + null=True, + validators=[edc_model.validators.date.date_not_future], + verbose_name="Confirmed serum/plasma CrAg sample collection date", + ), + ), + ( + "history_id", + models.UUIDField( + default=uuid.uuid4, editable=False, primary_key=True, serialize=False + ), + ), + ("history_date", models.DateTimeField(db_index=True)), + ("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, + null=True, + on_delete=django.db.models.deletion.DO_NOTHING, + related_name="+", + to="sites.site", + ), + ), + ], + options={ + "verbose_name": "historical Redmine #488.2 Confirmed Serum Crag Date", + "verbose_name_plural": "historical Redmine #488.2 Confirmed Serum Crag Dates", + "ordering": ("-history_date", "-history_id"), + "get_latest_by": ("history_date", "history_id"), + }, + bases=(simple_history.models.HistoricalChanges, models.Model), + ), + migrations.CreateModel( + name="ConsentedSerumCragDate", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, primary_key=True, serialize=False, verbose_name="ID" + ), + ), + ("report_model", models.CharField(max_length=50)), + ("subject_identifier", models.CharField(max_length=25)), + ("created", models.DateTimeField()), + ( + "screening_identifier", + models.CharField(max_length=50, null=True, verbose_name="Screening ID"), + ), + ("serum_crag_date", models.DateField(null=True)), + ("eligibility_date", models.DateField(null=True)), + ( + "serum_crag_value", + models.CharField(max_length=50, null=True, verbose_name="CrAg"), + ), + ( + "site", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, to="sites.site" + ), + ), + ], + options={ + "verbose_name": "Redmine #488.1 Consented Serum Crag Date", + "verbose_name_plural": "Redmine #488.1 Consented Serum Crag Dates", + "abstract": False, + }, + ), + migrations.CreateModel( + name="ConfirmedSerumCragDate", + 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, + verbose_name="Hostname created", + ), + ), + ( + "hostname_modified", + django_audit_fields.fields.hostname_modification_field.HostnameModificationField( + blank=True, + help_text="System field. (modified on every save)", + max_length=50, + verbose_name="Hostname modified", + ), + ), + ( + "device_created", + models.CharField(blank=True, max_length=10, verbose_name="Device created"), + ), + ( + "device_modified", + models.CharField( + blank=True, max_length=10, verbose_name="Device modified" + ), + ), + ( + "locale_created", + models.CharField( + blank=True, + help_text="Auto-updated by Modeladmin", + max_length=10, + null=True, + verbose_name="Locale created", + ), + ), + ( + "locale_modified", + models.CharField( + blank=True, + help_text="Auto-updated by Modeladmin", + max_length=10, + null=True, + verbose_name="Locale modified", + ), + ), + ( + "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)), + ("report_model", models.CharField(max_length=150)), + ("report_datetime", models.DateTimeField(default=edc_utils.date.get_utcnow)), + ("note", models.TextField(blank=True, null=True)), + ( + "status", + models.CharField( + choices=[("New", "New"), ("feedback", "Feedback")], + default="New", + max_length=25, + ), + ), + ( + "confirmed_serum_crag_date", + models.DateField( + blank=True, + help_text="Please enter first collection date in episode. Test must have been performed within 21 days of screening.", + null=True, + validators=[edc_model.validators.date.date_not_future], + verbose_name="Confirmed serum/plasma CrAg sample collection date", + ), + ), + ( + "site", + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="sites.site", + ), + ), + ], + options={ + "verbose_name": "Redmine #488.2 Confirmed Serum Crag Date", + "verbose_name_plural": "Redmine #488.2 Confirmed Serum Crag Dates", + "abstract": False, + "default_permissions": ("add", "change", "delete", "view", "export", "import"), + "default_manager_name": "objects", + "indexes": [ + models.Index( + fields=["modified", "created"], name="effect_repo_modifie_d5494c_idx" + ), + models.Index( + fields=["user_modified", "user_created"], + name="effect_repo_user_mo_f47e8e_idx", + ), + ], + }, + managers=[ + ("on_site", edc_sites.managers.CurrentSiteManager()), + ("objects", django.db.models.manager.Manager()), + ], + ), + ] diff --git a/effect_reports/models/confirmed_serum_crag_date.py b/effect_reports/models/confirmed_serum_crag_date.py new file mode 100644 index 00000000..51938fe0 --- /dev/null +++ b/effect_reports/models/confirmed_serum_crag_date.py @@ -0,0 +1,31 @@ +from django.db import models +from edc_identifier.model_mixins import UniqueSubjectIdentifierFieldMixin +from edc_model.models import BaseUuidModel, HistoricalRecords +from edc_model.validators import date_not_future +from edc_qareports.model_mixins import NoteModelMixin + + +class ConfirmedSerumCragDate( + UniqueSubjectIdentifierFieldMixin, + NoteModelMixin, +): + + history = HistoricalRecords() + + confirmed_serum_crag_date = models.DateField( + verbose_name="Confirmed serum/plasma CrAg sample collection date", + validators=[date_not_future], + null=True, + blank=True, + help_text=( + "Please enter first collection date in episode. " + "Test must have been performed within 21 days of screening." + ), + ) + + def __str__(self) -> str: + return f"{self._meta.verbose_name}: {self.subject_identifier}" + + class Meta(UniqueSubjectIdentifierFieldMixin.Meta, BaseUuidModel.Meta): + verbose_name = "Redmine #488.2 Confirmed Serum Crag Date" + verbose_name_plural = "Redmine #488.2 Confirmed Serum Crag Dates" diff --git a/effect_reports/models/consented_serum_crag_date.py b/effect_reports/models/consented_serum_crag_date.py index 55b134c4..692a6204 100644 --- a/effect_reports/models/consented_serum_crag_date.py +++ b/effect_reports/models/consented_serum_crag_date.py @@ -1,5 +1,5 @@ from django.db import models -from edc_qareports.models import QaReportModelMixin +from edc_qareports.model_mixins import QaReportModelMixin class ConsentedSerumCragDate(QaReportModelMixin, models.Model): diff --git a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.py b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.py index 36b1cba6..d4e7400a 100644 --- a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.py +++ b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.py @@ -1,5 +1,5 @@ from django.db import models -from edc_qareports.models import QaReportModelMixin +from edc_qareports.model_mixins import QaReportModelMixin class Rm792KwInCurrentSxGteG3Other(QaReportModelMixin, models.Model): diff --git a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.sql b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.sql index cb210695..08a2837b 100644 --- a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.sql +++ b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_gte_g3_other.sql @@ -1,9 +1,9 @@ create view rm792_kw_in_current_sx_gte_g3_other as ( select - uuid() as `id`, - now() as `created`, - 'effect_reports.rm792_kw_in_current_sx_gte_g3_other' as `report_model`, + uuid() as `id`, + now() as `created`, + 'effect_reports.rm792kwincurrentsxgteg3other' as `report_model`, `sv`.`site_id`, `sv`.`subject_identifier`, `sv`.`visit_code`, diff --git a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.py b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.py index 6d544368..777ed40b 100644 --- a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.py +++ b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.py @@ -1,5 +1,5 @@ from django.db import models -from edc_qareports.models import QaReportModelMixin +from edc_qareports.model_mixins import QaReportModelMixin class Rm792KwInCurrentSxOther(QaReportModelMixin, models.Model): diff --git a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.sql b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.sql index a5d71149..b5782fa2 100644 --- a/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.sql +++ b/effect_reports/models/unmanaged/rm792_kw_in_current_sx_other.sql @@ -1,9 +1,9 @@ create view rm792_kw_in_current_sx_other as ( select - uuid() as `id`, - now() as `created`, - 'effect_reports.rm792_kw_in_current_sx_other' as `report_model`, + uuid() as `id`, + now() as `created`, + 'effect_reports.rm792kwincurrentsxother' as `report_model`, `sv`.`site_id`, `sv`.`subject_identifier`, `sv`.`visit_code`, diff --git a/effect_reports/models/unmanaged/rm792_si_sx_list_candidates.sql b/effect_reports/models/unmanaged/rm792_si_sx_list_candidates.sql index c1633d22..c4231ebd 100644 --- a/effect_reports/models/unmanaged/rm792_si_sx_list_candidates.sql +++ b/effect_reports/models/unmanaged/rm792_si_sx_list_candidates.sql @@ -1,9 +1,9 @@ create view rm792_si_sx_list_candidates as ( select - uuid() as `id`, - now() as `created`, - 'effect_reports.rm792_si_sx_list_candidates' as `report_model`, + uuid() as `id`, + now() as `created`, + 'effect_reports.rm792sisxlistcandidates' as `report_model`, sv.site_id, crf.current_sx_other