meta-edc 0.3.7__py3-none-any.whl → 0.3.15__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. meta_auth/auth_objects.py +10 -3
  2. meta_consent/baker_recipes.py +4 -4
  3. meta_consent/consents.py +1 -1
  4. meta_consent/migrations/0025_alter_historicalsubjectconsent_first_name_and_more.py +151 -0
  5. meta_consent/models/signals.py +16 -13
  6. meta_consent/models/subject_consent_v1.py +1 -3
  7. meta_consent/tests/tests/test_form_validators.py +1 -1
  8. meta_dashboard/templates/meta_dashboard/bootstrap3/screening/listboard.html +4 -4
  9. meta_dashboard/templates/meta_dashboard/bootstrap3/subject/listboard.html +1 -2
  10. meta_edc/settings/debug.py +9 -9
  11. meta_edc/settings/defaults.py +25 -18
  12. meta_edc/settings/live.py +1 -9
  13. meta_edc/settings/uat.py +1 -14
  14. meta_edc/templates/meta_edc/bootstrap3/home.html +8 -5
  15. meta_edc/tests/test_settings.py +176 -0
  16. meta_edc/tests/tests/test_endpoints.py +20 -19
  17. meta_edc/urls.py +1 -1
  18. {meta_edc-0.3.7.dist-info → meta_edc-0.3.15.dist-info}/METADATA +5 -4
  19. {meta_edc-0.3.7.dist-info → meta_edc-0.3.15.dist-info}/RECORD +128 -74
  20. meta_prn/action_items.py +44 -2
  21. meta_prn/admin/__init__.py +3 -0
  22. meta_prn/admin/dm_referral_admin.py +49 -0
  23. meta_prn/admin/offschedule_dm_referral_admin.py +47 -0
  24. meta_prn/admin/onschedule_dm_referral_admin.py +39 -0
  25. meta_prn/baker_recipes.py +8 -1
  26. meta_prn/choices.py +2 -1
  27. meta_prn/constants.py +4 -1
  28. meta_prn/forms/__init__.py +2 -0
  29. meta_prn/forms/dm_referral_form.py +40 -0
  30. meta_prn/forms/offschedule_dm_referral_form.py +35 -0
  31. meta_prn/forms/offschedule_form.py +6 -0
  32. meta_prn/migrations/0057_historicalonscheduledmreferral_and_more.py +1156 -0
  33. meta_prn/migrations/0058_dmreferral_referral_note_and_more.py +29 -0
  34. meta_prn/migrations/0059_alter_historicaloffstudymedication_reason_and_more.py +53 -0
  35. meta_prn/models/__init__.py +13 -2
  36. meta_prn/models/dm_referral.py +39 -0
  37. meta_prn/models/offschedule.py +15 -1
  38. meta_prn/models/onschedule.py +6 -0
  39. meta_prn/models/signals.py +41 -1
  40. meta_prn/tests/tests/test_dm_referral.py +206 -0
  41. meta_screening/form_validators/screening_part_two.py +1 -1
  42. meta_screening/migrations/0062_remove_icpreferral_site_and_more.py +27 -0
  43. meta_screening/migrations/0063_alter_historicalscreeningpartone_fasting_duration_str_and_more.py +184 -0
  44. meta_screening/migrations/0064_remove_historicalscreeningpartone_fasting_duration_minutes_and_more.py +126 -0
  45. meta_screening/migrations/0065_auto_20240516_0352.py +31 -0
  46. meta_screening/migrations/0066_alter_historicalscreeningpartone_fasting_duration_delta_and_more.py +103 -0
  47. meta_screening/models/__init__.py +1 -1
  48. meta_screening/tests/meta_test_case_mixin.py +2 -2
  49. meta_screening/tests/options.py +3 -3
  50. meta_sites/__init__.py +0 -1
  51. meta_sites/sites.py +8 -7
  52. meta_subject/action_items.py +23 -0
  53. meta_subject/admin/__init__.py +1 -1
  54. meta_subject/admin/birth_outcome_admin.py +2 -3
  55. meta_subject/admin/delivery_admin.py +0 -1
  56. meta_subject/admin/diabetes/__init__.py +2 -0
  57. meta_subject/admin/diabetes/dm_diagnosis_admin.py +89 -0
  58. meta_subject/admin/{dm_referral_followup_admin.py → diabetes/dm_followup_admin.py} +15 -8
  59. meta_subject/admin/glucose_admin.py +1 -1
  60. meta_subject/admin/glucose_fbg_admin.py +34 -8
  61. meta_subject/admin/subject_visit_admin.py +4 -1
  62. meta_subject/baker_recipes.py +6 -0
  63. meta_subject/choices.py +8 -0
  64. meta_subject/constants.py +2 -1
  65. meta_subject/form_validators/__init__.py +2 -1
  66. meta_subject/form_validators/dm_diagnosis_form_validator.py +38 -0
  67. meta_subject/form_validators/dm_dx_result_form_validator.py +7 -0
  68. meta_subject/form_validators/{dm_referral_followup_form_validator.py → dm_followup_form_validator.py} +41 -2
  69. meta_subject/forms/__init__.py +1 -0
  70. meta_subject/forms/diabetes/__init__.py +3 -0
  71. meta_subject/forms/diabetes/dm_diagnosis_form.py +13 -0
  72. meta_subject/forms/diabetes/dm_dx_result_form.py +11 -0
  73. meta_subject/forms/diabetes/dm_followup_form.py +25 -0
  74. meta_subject/forms/glucose_fbg_form.py +38 -16
  75. meta_subject/forms/subject_visit_form.py +16 -0
  76. meta_subject/metadata_rules/metadata_rules.py +14 -0
  77. meta_subject/metadata_rules/predicates.py +22 -0
  78. meta_subject/migrations/0181_dmreferralfollowup_action_identifier_and_more.py +143 -0
  79. meta_subject/migrations/0182_rename_dmreferralfollowup_dmfollowup_and_more.py +54 -0
  80. meta_subject/migrations/0183_alter_dmfollowup_on_dm_medications_and_more.py +31 -0
  81. meta_subject/migrations/0184_alter_glucose_options_and_more.py +31 -0
  82. meta_subject/migrations/0185_alter_bloodresultsins_fasting_duration_str_and_more.py +82 -0
  83. meta_subject/migrations/0186_healtheconomicsupdate_singleton_field_and_more.py +55 -0
  84. meta_subject/migrations/0187_dmdiagnosis_historicaldmdiagnosis_dmdxresult_and_more.py +451 -0
  85. meta_subject/migrations/0188_historicaldmdxresult_dmdxresult.py +403 -0
  86. meta_subject/migrations/0189_alter_dmdxresult_options_and_more.py +116 -0
  87. meta_subject/migrations/0190_dmdiagnosis_dx_no_tmg_reason_and_more.py +65 -0
  88. meta_subject/migrations/0191_alter_dmdiagnosis_dx_no_tmg_reason_and_more.py +70 -0
  89. meta_subject/migrations/0192_rename_glucose_quantifier_glucosefbg_fbg_quantifier_and_more.py +44 -0
  90. meta_subject/migrations/0193_alter_glucosefbg_fbg_value_and_more.py +44 -0
  91. meta_subject/migrations/0194_remove_glucosefbg_assay_datetime_and_more.py +166 -0
  92. meta_subject/migrations/0195_alter_glucosefbg_fbg_datetime_and_more.py +27 -0
  93. meta_subject/migrations/0196_glucosefbg_fbg_not_performed_reason_and_more.py +49 -0
  94. meta_subject/migrations/0197_glucosefbg_fasting_duration_estimated_and_more.py +33 -0
  95. meta_subject/migrations/0198_alter_glucosefbg_fasting_duration_estimated_and_more.py +33 -0
  96. meta_subject/migrations/0199_auto_20240516_0247.py +18 -0
  97. meta_subject/migrations/0200_rename_fasting_duration_minutes_bloodresultsins_fasting_duration_delta_and_more.py +43 -0
  98. meta_subject/migrations/0201_alter_bloodresultsins_fasting_duration_delta_and_more.py +58 -0
  99. meta_subject/migrations/0202_auto_20240516_0315.py +32 -0
  100. meta_subject/migrations/0203_alter_bloodresultsins_fasting_duration_delta_and_more.py +67 -0
  101. meta_subject/migrations/0204_glucosefbg_repeat_fbg_date_and_more.py +27 -0
  102. meta_subject/migrations/0205_historicalsubjectrequisition_crf_status_and_more.py +80 -0
  103. meta_subject/migrations/0206_bloodresultsfbc_crf_status_and_more.py +62 -0
  104. meta_subject/models/__init__.py +1 -1
  105. meta_subject/models/blood_results/blood_results_fbc.py +3 -2
  106. meta_subject/models/blood_results/blood_results_hba1c.py +2 -0
  107. meta_subject/models/blood_results/blood_results_ins.py +2 -0
  108. meta_subject/models/blood_results/blood_results_lft.py +2 -0
  109. meta_subject/models/blood_results/blood_results_lipid.py +2 -0
  110. meta_subject/models/blood_results/blood_results_rft.py +2 -0
  111. meta_subject/models/diabetes/__init__.py +3 -0
  112. meta_subject/models/diabetes/dm_diagnosis.py +50 -0
  113. meta_subject/models/diabetes/dm_dx_result.py +70 -0
  114. meta_subject/models/{dm_referral_followup.py → diabetes/dm_followup.py} +18 -6
  115. meta_subject/models/glucose.py +5 -15
  116. meta_subject/models/glucose_fbg.py +40 -51
  117. meta_subject/models/health_economics/health_economics_update.py +2 -0
  118. meta_subject/models/subject_requisition.py +3 -4
  119. meta_subject/tests/tests/test_egfr.py +6 -5
  120. meta_subject/tests/tests/test_metadata_rules.py +32 -2
  121. meta_visit_schedule/constants.py +3 -1
  122. meta_visit_schedule/visit_schedules/phase_three/crfs.py +12 -1
  123. meta_visit_schedule/visit_schedules/phase_three/schedule_dm_referral.py +60 -0
  124. meta_visit_schedule/visit_schedules/phase_three/visit_schedule.py +2 -0
  125. meta_subject/forms/dm_referral_followup.py +0 -18
  126. {meta_edc-0.3.7.dist-info → meta_edc-0.3.15.dist-info}/AUTHORS +0 -0
  127. {meta_edc-0.3.7.dist-info → meta_edc-0.3.15.dist-info}/LICENSE +0 -0
  128. {meta_edc-0.3.7.dist-info → meta_edc-0.3.15.dist-info}/WHEEL +0 -0
  129. {meta_edc-0.3.7.dist-info → meta_edc-0.3.15.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,49 @@
1
+ from django.contrib import admin
2
+ from django_audit_fields.admin import audit_fieldset_tuple
3
+ from edc_action_item import ActionItemModelAdminMixin, action_fieldset_tuple
4
+ from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin
5
+ from edc_model_admin.history import SimpleHistoryAdmin
6
+ from edc_sites.admin import SiteModelAdminMixin
7
+
8
+ from ..admin_site import meta_prn_admin
9
+ from ..forms import DmReferralForm
10
+ from ..models import DmReferral
11
+
12
+
13
+ @admin.register(DmReferral, site=meta_prn_admin)
14
+ class DmReferralAdmin(
15
+ SiteModelAdminMixin,
16
+ ModelAdminSubjectDashboardMixin,
17
+ ActionItemModelAdminMixin,
18
+ SimpleHistoryAdmin,
19
+ ):
20
+ form = DmReferralForm
21
+
22
+ fieldsets = (
23
+ (None, {"fields": ("subject_identifier", "report_datetime")}),
24
+ ("Referral to Diabetes clinic", {"fields": ("referral_date",)}),
25
+ (
26
+ "Diabetes diagnosis",
27
+ {
28
+ "fields": ("referral_note",),
29
+ },
30
+ ),
31
+ action_fieldset_tuple,
32
+ audit_fieldset_tuple,
33
+ )
34
+
35
+ list_display = (
36
+ "subject_identifier",
37
+ "dashboard",
38
+ "report_datetime",
39
+ "referral_date_as_col",
40
+ )
41
+
42
+ list_filter = (
43
+ "report_datetime",
44
+ "referral_date",
45
+ )
46
+
47
+ @admin.display(description="Referral date", ordering="referral_date")
48
+ def referral_date_as_col(self, obj=None):
49
+ return obj.referral_date
@@ -0,0 +1,47 @@
1
+ from typing import Tuple
2
+
3
+ from django.contrib import admin
4
+ from django.utils.html import format_html
5
+ from django_audit_fields import audit_fieldset_tuple
6
+ from edc_action_item import ActionItemModelAdminMixin, action_fieldset_tuple
7
+ from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin
8
+ from edc_model_admin.history import SimpleHistoryAdmin
9
+ from edc_sites.admin import SiteModelAdminMixin
10
+
11
+ from ..admin_site import meta_prn_admin
12
+ from ..forms import OffScheduleDmReferralForm
13
+ from ..models import EndOfStudy, OffScheduleDmReferral
14
+
15
+
16
+ @admin.register(OffScheduleDmReferral, site=meta_prn_admin)
17
+ class OffScheduleDmReferralAdmin(
18
+ SiteModelAdminMixin,
19
+ ActionItemModelAdminMixin,
20
+ ModelAdminSubjectDashboardMixin,
21
+ SimpleHistoryAdmin,
22
+ ):
23
+ instructions = None
24
+
25
+ form = OffScheduleDmReferralForm
26
+
27
+ additional_instructions = format_html(
28
+ '<span style="color:orange;font-weight:bold">Note:</span> Detailed '
29
+ "information about study termination will be asked for on the "
30
+ f"<b>{EndOfStudy._meta.verbose_name}</b> form"
31
+ )
32
+
33
+ fieldsets = (
34
+ (None, {"fields": ("subject_identifier", "offschedule_datetime")}),
35
+ action_fieldset_tuple,
36
+ audit_fieldset_tuple,
37
+ )
38
+
39
+ def get_list_display(self, request) -> Tuple[str, ...]:
40
+ list_display = super().get_list_display(request)
41
+ custom_fields = ("subject_identifier", "dashboard", "offschedule_datetime")
42
+ return custom_fields + tuple(f for f in list_display if f not in custom_fields)
43
+
44
+ def get_list_filter(self, request) -> Tuple[str, ...]:
45
+ list_filter = super().get_list_filter(request)
46
+ custom_fields = ("offschedule_datetime",)
47
+ return custom_fields + tuple(f for f in list_filter if f not in custom_fields)
@@ -0,0 +1,39 @@
1
+ from typing import Tuple
2
+
3
+ from django.contrib import admin
4
+ from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin
5
+ from edc_model_admin.history import SimpleHistoryAdmin
6
+ from edc_sites.admin import SiteModelAdminMixin
7
+
8
+ from ..admin_site import meta_prn_admin
9
+ from ..models import OnScheduleDmReferral
10
+
11
+
12
+ @admin.register(OnScheduleDmReferral, site=meta_prn_admin)
13
+ class OnScheduleDmReferralAdmin(
14
+ SiteModelAdminMixin, ModelAdminSubjectDashboardMixin, SimpleHistoryAdmin
15
+ ):
16
+ instructions = None
17
+
18
+ fields = ("subject_identifier", "onschedule_datetime")
19
+
20
+ def get_list_display(self, request) -> Tuple[str, ...]:
21
+ list_display = super().get_list_display(request)
22
+ custom_fields = ("subject_identifier", "dashboard", "onschedule_datetime")
23
+ return custom_fields + tuple(
24
+ f for f in list_display if f not in custom_fields + ("__str__",)
25
+ )
26
+
27
+ def get_list_filter(self, request) -> Tuple[str, ...]:
28
+ list_filter = super().get_list_filter(request)
29
+ custom_fields = ("onschedule_datetime",)
30
+ return custom_fields + tuple(f for f in list_filter if f not in custom_fields)
31
+
32
+ def get_readonly_fields(self, request, obj=None) -> Tuple[str, ...]:
33
+ return (
34
+ "subject_identifier",
35
+ "onschedule_datetime",
36
+ )
37
+
38
+ def get_search_fields(self, request) -> Tuple[str, ...]:
39
+ return tuple(set(super().get_search_fields(request) + ("subject_identifier",)))
meta_prn/baker_recipes.py CHANGED
@@ -4,7 +4,7 @@ from edc_utils import get_utcnow
4
4
  from faker import Faker
5
5
  from model_bakery.recipe import Recipe
6
6
 
7
- from .models import PregnancyNotification
7
+ from .models import DmReferral, PregnancyNotification
8
8
 
9
9
  fake = Faker()
10
10
 
@@ -19,3 +19,10 @@ pregnancynotification = Recipe(
19
19
  unconfirmed_details=None,
20
20
  edd=get_utcnow() + relativedelta(months=6),
21
21
  )
22
+
23
+ dmreferral = Recipe(
24
+ DmReferral,
25
+ action_identifier=None,
26
+ subject_identifier=None,
27
+ report_datetime=get_utcnow(),
28
+ )
meta_prn/choices.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from edc_constants.constants import NOT_APPLICABLE, OTHER, PATIENT, PREGNANCY, UNKNOWN
2
2
 
3
- from .constants import CLINICIAN, INVESTIGATOR, SAE
3
+ from .constants import CLINICIAN, INVESTIGATOR, REFERRAL, SAE
4
4
 
5
5
  CLINICAL_WITHDRAWAL_REASONS = (
6
6
  ("kidney_disease", "Development of chronic kidney disease"),
@@ -95,6 +95,7 @@ WITHDRAWAL_STUDY_MEDICATION_REASONS = (
95
95
  "treatment in the clinician's opinion (specify below)",
96
96
  ),
97
97
  (INVESTIGATOR, " Investigator decision"),
98
+ (REFERRAL, "Referral to Diabetes clinic"),
98
99
  (PATIENT, "Patient decision"),
99
100
  (OTHER, "Other reason (specify below)"),
100
101
  )
meta_prn/constants.py CHANGED
@@ -2,17 +2,20 @@ CLINICAL_WITHDRAWAL = "clinical_withdrawal"
2
2
  CLINICIAN = "clinician"
3
3
  DEATH_REPORT_ACTION = "submit_death_report"
4
4
  DEVIATION = "protocol_deviation"
5
+ DM_REFFERAL_ACTION = "dm_refferal_action"
5
6
  INVESTIGATOR = "investigator"
6
7
  INVESTIGATOR_DECISION = "investigator_decision"
7
8
  LATE_EXCLUSION = "late_exclusion"
8
9
  LOSS_TO_FOLLOWUP_ACTION = "submit_loss_to_followup"
10
+ OFFSCHEDULE_DM_REFERRAL_ACTION = "offschedule_dm_referral_action"
9
11
  OFFSCHEDULE_POSTNATAL_ACTION = "offschedule_postnatal_action"
10
12
  OFFSCHEDULE_PREGNANCY_ACTION = "offschedule_pregnancy_action"
13
+ OFFSTUDY_MEDICATION_ACTION = "withdrawal_study_medication_action"
11
14
  OTHER_RX_DISCONTINUATION = "other_treatment_discontinuation"
12
15
  PREGNANCY_NOTIFICATION_ACTION = "pregancy_notification_action"
13
16
  PROTOCOL_DEVIATION_VIOLATION_ACTION = "submit-protocol-deviation-violation"
17
+ REFERRAL = "referral"
14
18
  SAE = "sae"
15
19
  UNBLINDING_REQUEST_ACTION = "unblinding-request"
16
20
  UNBLINDING_REVIEW_ACTION = "unblinding-review"
17
21
  VIOLATION = "protocol_violation"
18
- OFFSTUDY_MEDICATION_ACTION = "withdrawal_study_medication_action"
@@ -1,6 +1,8 @@
1
+ from .dm_referral_form import DmReferralForm
1
2
  from .end_of_study_form import EndOfStudyForm
2
3
  from .loss_to_followup_form import LossToFollowupForm
3
4
  from .off_study_medication_form import OffStudyMedicationForm
5
+ from .offschedule_dm_referral_form import OffScheduleDmReferralForm
4
6
  from .offschedule_form import OffScheduleForm
5
7
  from .offschedule_pregnancy_form import OffSchedulePregnancyForm
6
8
  from .pregnancy_notification_form import PregnancyNotificationForm
@@ -0,0 +1,40 @@
1
+ from django import forms
2
+ from edc_action_item.forms.action_item_form_mixin import ActionItemFormMixin
3
+ from edc_form_validators.form_validator import FormValidator
4
+ from edc_form_validators.form_validator_mixins import FormValidatorMixin
5
+ from edc_model_form.mixins import BaseModelFormMixin
6
+ from edc_offstudy.modelform_mixins import OffstudyNonCrfModelFormMixin
7
+ from edc_prn.modelform_mixins import PrnFormValidatorMixin
8
+ from edc_sites.forms import SiteModelFormMixin
9
+
10
+ from ..models import DmReferral
11
+
12
+
13
+ class DmReferralFormValidator(PrnFormValidatorMixin, FormValidator):
14
+ pass
15
+
16
+
17
+ class DmReferralForm(
18
+ SiteModelFormMixin,
19
+ OffstudyNonCrfModelFormMixin,
20
+ ActionItemFormMixin,
21
+ BaseModelFormMixin,
22
+ FormValidatorMixin,
23
+ forms.ModelForm,
24
+ ):
25
+ form_validator_cls = DmReferralFormValidator
26
+
27
+ # subject_identifier = forms.CharField(
28
+ # label="Subject Identifier",
29
+ # required=False,
30
+ # widget=forms.TextInput(attrs={"readonly": "readonly"}),
31
+ # )
32
+
33
+ class Meta:
34
+ model = DmReferral
35
+ fields = "__all__"
36
+ help_text = {"subject_identifier": "(read-only)", "action_identifier": "(read-only)"}
37
+ widgets = {
38
+ "subject_identifier": forms.TextInput(attrs={"readonly": "readonly"}),
39
+ "action_identifier": forms.TextInput(attrs={"readonly": "readonly"}),
40
+ }
@@ -0,0 +1,35 @@
1
+ from django import forms
2
+ from edc_action_item.forms.action_item_form_mixin import ActionItemFormMixin
3
+ from edc_form_validators.form_validator import FormValidator
4
+ from edc_form_validators.form_validator_mixins import FormValidatorMixin
5
+ from edc_model_form.mixins import BaseModelFormMixin
6
+ from edc_prn.modelform_mixins import PrnFormValidatorMixin
7
+ from edc_sites.forms import SiteModelFormMixin
8
+ from edc_visit_schedule.modelform_mixins import OffScheduleModelFormMixin
9
+
10
+ from ..models import OffScheduleDmReferral
11
+
12
+
13
+ class OffScheduleDmReferralFormValidator(PrnFormValidatorMixin, FormValidator):
14
+ pass
15
+
16
+
17
+ class OffScheduleDmReferralForm(
18
+ OffScheduleModelFormMixin,
19
+ SiteModelFormMixin,
20
+ ActionItemFormMixin,
21
+ BaseModelFormMixin,
22
+ FormValidatorMixin,
23
+ forms.ModelForm,
24
+ ):
25
+ form_validator_cls = OffScheduleDmReferralFormValidator
26
+
27
+ subject_identifier = forms.CharField(
28
+ label="Subject Identifier",
29
+ required=False,
30
+ widget=forms.TextInput(attrs={"readonly": "readonly"}),
31
+ )
32
+
33
+ class Meta:
34
+ model = OffScheduleDmReferral
35
+ fields = "__all__"
@@ -25,6 +25,12 @@ class OffScheduleForm(
25
25
  form_validator_cls = OffScheduleFormValidator
26
26
  report_datetime_field_attr = "offschedule_datetime"
27
27
 
28
+ subject_identifier = forms.CharField(
29
+ label="Subject Identifier",
30
+ required=False,
31
+ widget=forms.TextInput(attrs={"readonly": "readonly"}),
32
+ )
33
+
28
34
  class Meta:
29
35
  model = OffSchedule
30
36
  fields = "__all__"