meta-edc 1.1.18__py3-none-any.whl → 1.1.19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of meta-edc might be problematic. Click here for more details.

Files changed (30) hide show
  1. meta_consent/admin/__init__.py +1 -0
  2. meta_consent/admin/subject_consent_spfq_admin.py +58 -0
  3. meta_consent/forms/__init__.py +2 -0
  4. meta_consent/forms/subject_consent_spfq_form.py +55 -0
  5. meta_consent/migrations/0033_historicalsubjectconsentspfq_subjectconsentspfq.py +615 -0
  6. meta_consent/models/__init__.py +2 -0
  7. meta_consent/models/subject_consent_spfq.py +103 -0
  8. {meta_edc-1.1.18.dist-info → meta_edc-1.1.19.dist-info}/METADATA +5 -5
  9. {meta_edc-1.1.18.dist-info → meta_edc-1.1.19.dist-info}/RECORD +30 -15
  10. meta_labs/list_data.py +2 -2
  11. meta_rando/migrations/0007_spfqlist.py +197 -0
  12. meta_rando/models/__init__.py +2 -0
  13. meta_rando/{models.py → models/randomization_list.py} +3 -3
  14. meta_rando/models/spfq_list.py +26 -0
  15. meta_subject/admin/__init__.py +2 -0
  16. meta_subject/admin/spfg_admin.py +103 -0
  17. meta_subject/choices.py +37 -0
  18. meta_subject/constants.py +14 -0
  19. meta_subject/forms/__init__.py +2 -0
  20. meta_subject/forms/spfq_form.py +65 -0
  21. meta_subject/migrations/0228_bloodresultshba1c_hba1c_datetime_and_more.py +1 -6780
  22. meta_subject/migrations/0229_alter_glucosefbg_consent_model_and_more.py +1918 -0
  23. meta_subject/migrations/0230_alter_historicaldelivery_action_identifier_and_more.py +1733 -0
  24. meta_subject/migrations/0231_alter_historicalmedicationadherence_consent_model_and_more.py +2054 -0
  25. meta_subject/migrations/0232_alter_patienthistory_concomitant_conditions_and_more.py +1170 -0
  26. meta_subject/migrations/0233_historicalspfq_spfq.py +1066 -0
  27. meta_subject/models/__init__.py +2 -0
  28. meta_subject/models/spfq.py +190 -0
  29. {meta_edc-1.1.18.dist-info → meta_edc-1.1.19.dist-info}/WHEEL +0 -0
  30. {meta_edc-1.1.18.dist-info → meta_edc-1.1.19.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,5 @@
1
1
  from .subject_consent_admin import SubjectConsentAdmin
2
+ from .subject_consent_spfq_admin import SubjectConsentSpfqAdmin
2
3
  from .subject_consent_v1_admin import SubjectConsentV1Admin
3
4
  from .subject_consent_v1_ext_admin import SubjectConsentV1ExtAdmin
4
5
 
@@ -0,0 +1,58 @@
1
+ from django.contrib import admin
2
+ from django.utils.translation import gettext as _
3
+ from django_audit_fields import audit_fieldset_tuple
4
+ from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin
5
+ from edc_model_admin.history import SimpleHistoryAdmin
6
+
7
+ from ..admin_site import meta_consent_admin
8
+ from ..forms import SubjectConsentSpfqForm
9
+ from ..models import SubjectConsentSpfq
10
+
11
+
12
+ @admin.register(SubjectConsentSpfq, site=meta_consent_admin)
13
+ class SubjectConsentSpfqAdmin(
14
+ ModelAdminSubjectDashboardMixin,
15
+ SimpleHistoryAdmin,
16
+ ):
17
+ form = SubjectConsentSpfqForm
18
+
19
+ fieldsets = (
20
+ (
21
+ None,
22
+ {
23
+ "fields": (
24
+ "subject_identifier",
25
+ "initials",
26
+ "gender",
27
+ "language",
28
+ "consent_datetime",
29
+ )
30
+ },
31
+ ),
32
+ (
33
+ "Review Questions",
34
+ {
35
+ "fields": (
36
+ "consent_reviewed",
37
+ "study_questions",
38
+ "assessment_score",
39
+ "consent_signature",
40
+ "consent_copy",
41
+ ),
42
+ "description": _("The following questions are directed to the interviewer."),
43
+ },
44
+ ),
45
+ audit_fieldset_tuple,
46
+ )
47
+
48
+ search_fields = ("subject_identifier",)
49
+
50
+ radio_fields = { # noqa: RUF012
51
+ "gender": admin.VERTICAL,
52
+ "assessment_score": admin.VERTICAL,
53
+ "consent_copy": admin.VERTICAL,
54
+ "consent_reviewed": admin.VERTICAL,
55
+ "consent_signature": admin.VERTICAL,
56
+ "language": admin.VERTICAL,
57
+ "study_questions": admin.VERTICAL,
58
+ }
@@ -1,10 +1,12 @@
1
1
  from .subject_consent_form import SubjectConsentForm
2
+ from .subject_consent_spfq_form import SubjectConsentSpfqForm
2
3
  from .subject_consent_v1_ext_form import SubjectConsentV1ExtForm
3
4
  from .subject_consent_v1_form import SubjectConsentV1Form
4
5
  from .subject_reconsent_form import SubjectReconsentForm
5
6
 
6
7
  __all__ = [
7
8
  "SubjectConsentForm",
9
+ "SubjectConsentSpfqForm",
8
10
  "SubjectConsentV1ExtForm",
9
11
  "SubjectConsentV1Form",
10
12
  "SubjectReconsentForm",
@@ -0,0 +1,55 @@
1
+ from django import forms
2
+ from django.core.exceptions import ObjectDoesNotExist
3
+ from edc_action_item.forms import ActionItemFormMixin
4
+ from edc_form_validators import FormValidatorMixin
5
+ from edc_registration.models import RegisteredSubject
6
+ from edc_sites.modelform_mixins import SiteModelFormMixin
7
+
8
+ from meta_consent.models import SubjectConsentSpfq
9
+ from meta_rando.models import SpfqList
10
+
11
+
12
+ class SubjectConsentSpfqForm(
13
+ SiteModelFormMixin, ActionItemFormMixin, FormValidatorMixin, forms.ModelForm
14
+ ):
15
+ def clean(self):
16
+ cleaned_data = super().clean()
17
+
18
+ try:
19
+ RegisteredSubject.objects.get(
20
+ subject_identifier=cleaned_data.get("subject_identifier"),
21
+ initials=cleaned_data.get("initials"),
22
+ gender=cleaned_data.get("gender"),
23
+ )
24
+ except ObjectDoesNotExist as e:
25
+ raise forms.ValidationError(
26
+ {
27
+ "__all__": (
28
+ "Subject not known to the META trial. "
29
+ "Check that the identifier, initials and gender match the patient "
30
+ "register from the main META trial."
31
+ )
32
+ }
33
+ ) from e
34
+ try:
35
+ SpfqList.objects.get(
36
+ subject_identifier=cleaned_data.get("subject_identifier"),
37
+ )
38
+ except ObjectDoesNotExist as e:
39
+ raise forms.ValidationError(
40
+ {
41
+ "__all__": (
42
+ "Subject not found .A subject with this identifier "
43
+ "has not been selected for the sub-study."
44
+ )
45
+ }
46
+ ) from e
47
+ return cleaned_data
48
+
49
+ class Meta:
50
+ model = SubjectConsentSpfq
51
+ fields = "__all__"
52
+ widgets = { # noqa: RUF012
53
+ "action_identifier": forms.TextInput(attrs={"readonly": "readonly"}),
54
+ "subject_identifier": forms.TextInput(attrs={"readonly": "readonly"}),
55
+ }