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
meta_auth/auth_objects.py CHANGED
@@ -1,13 +1,20 @@
1
+ from django.conf import settings
1
2
  from edc_auth.get_app_codenames import get_app_codenames
2
3
 
3
4
  clinic_codenames = get_app_codenames(
4
5
  "meta_prn", "meta_subject", "meta_consent", list_app="meta_lists"
5
6
  )
6
7
 
8
+ add_perms = []
9
+ if not settings.LIVE_SYSTEM:
10
+ add_perms = [
11
+ "meta_screening.add_screeningpartone",
12
+ "meta_screening.add_screeningpartthree",
13
+ "meta_screening.add_screeningparttwo",
14
+ ]
15
+
7
16
  screening_codenames = [
8
- "meta_screening.add_screeningpartone",
9
- "meta_screening.add_screeningpartthree",
10
- "meta_screening.add_screeningparttwo",
17
+ *add_perms,
11
18
  "meta_screening.add_subjectrefusal",
12
19
  "meta_screening.change_screeningpartone",
13
20
  "meta_screening.change_screeningpartthree",
@@ -5,13 +5,11 @@ from edc_utils import get_utcnow
5
5
  from faker import Faker
6
6
  from model_bakery.recipe import Recipe, seq
7
7
 
8
- from .models import SubjectConsent, SubjectReconsent
8
+ from .models import SubjectConsent, SubjectConsentV1, SubjectReconsent
9
9
 
10
10
  fake = Faker()
11
11
 
12
-
13
- subjectconsent = Recipe(
14
- SubjectConsent,
12
+ opts = dict(
15
13
  assessment_score=YES,
16
14
  confirm_identity=seq("12315678"),
17
15
  consent_copy=YES,
@@ -35,6 +33,8 @@ subjectconsent = Recipe(
35
33
  user_created="erikvw",
36
34
  user_modified="erikvw",
37
35
  )
36
+ subjectconsent = Recipe(SubjectConsent, **opts)
37
+ subjectconsentv1 = Recipe(SubjectConsentV1, **opts)
38
38
 
39
39
  subjectreconsent = Recipe(
40
40
  SubjectReconsent,
meta_consent/consents.py CHANGED
@@ -4,7 +4,7 @@ from edc_constants.constants import FEMALE, MALE
4
4
  from edc_protocol.research_protocol_config import ResearchProtocolConfig
5
5
 
6
6
  consent_v1 = ConsentDefinition(
7
- model="meta_consent.subjectconsentv1",
7
+ "meta_consent.subjectconsentv1",
8
8
  version="1",
9
9
  start=ResearchProtocolConfig().study_open_datetime,
10
10
  end=ResearchProtocolConfig().study_close_datetime,
@@ -0,0 +1,151 @@
1
+ # Generated by Django 4.2.11 on 2024-03-27 19:41
2
+
3
+ import django.core.validators
4
+ from django.db import migrations
5
+ import django_crypto_fields.fields.encrypted_char_field
6
+ import edc_consent.validators
7
+
8
+
9
+ class Migration(migrations.Migration):
10
+
11
+ dependencies = [
12
+ ("meta_consent", "0024_historicalsubjectconsentv1"),
13
+ ]
14
+
15
+ operations = [
16
+ migrations.AlterField(
17
+ model_name="historicalsubjectconsent",
18
+ name="first_name",
19
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
20
+ blank=True,
21
+ help_text="Use UPPERCASE letters only. (Encryption: RSA local)",
22
+ max_length=71,
23
+ null=True,
24
+ validators=[
25
+ django.core.validators.RegexValidator(
26
+ message="Ensure name consist of letters only in upper case",
27
+ regex="^([A-Z]+$|[A-Z]+\\ [A-Z]+)$",
28
+ )
29
+ ],
30
+ ),
31
+ ),
32
+ migrations.AlterField(
33
+ model_name="historicalsubjectconsent",
34
+ name="guardian_name",
35
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
36
+ blank=True,
37
+ help_text="Required only if participant is a minor.<BR>Format is 'LASTNAME, FIRSTNAME'. All uppercase separated by a comma. (Encryption: RSA local)",
38
+ max_length=71,
39
+ null=True,
40
+ validators=[edc_consent.validators.FullNameValidator()],
41
+ verbose_name="Guardian's last and first name",
42
+ ),
43
+ ),
44
+ migrations.AlterField(
45
+ model_name="historicalsubjectconsent",
46
+ name="last_name",
47
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
48
+ blank=True,
49
+ help_text="Use UPPERCASE letters only. (Encryption: RSA local)",
50
+ max_length=71,
51
+ null=True,
52
+ validators=[
53
+ django.core.validators.RegexValidator(
54
+ message="Ensure name consist of letters only in upper case",
55
+ regex="^([A-Z]+$|[A-Z]+\\ [A-Z]+)$",
56
+ )
57
+ ],
58
+ verbose_name="Surname",
59
+ ),
60
+ ),
61
+ migrations.AlterField(
62
+ model_name="historicalsubjectconsentv1",
63
+ name="first_name",
64
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
65
+ blank=True,
66
+ help_text="Use UPPERCASE letters only. (Encryption: RSA local)",
67
+ max_length=71,
68
+ null=True,
69
+ validators=[
70
+ django.core.validators.RegexValidator(
71
+ message="Ensure name consist of letters only in upper case",
72
+ regex="^([A-Z]+$|[A-Z]+\\ [A-Z]+)$",
73
+ )
74
+ ],
75
+ ),
76
+ ),
77
+ migrations.AlterField(
78
+ model_name="historicalsubjectconsentv1",
79
+ name="guardian_name",
80
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
81
+ blank=True,
82
+ help_text="Required only if participant is a minor.<BR>Format is 'LASTNAME, FIRSTNAME'. All uppercase separated by a comma. (Encryption: RSA local)",
83
+ max_length=71,
84
+ null=True,
85
+ validators=[edc_consent.validators.FullNameValidator()],
86
+ verbose_name="Guardian's last and first name",
87
+ ),
88
+ ),
89
+ migrations.AlterField(
90
+ model_name="historicalsubjectconsentv1",
91
+ name="last_name",
92
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
93
+ blank=True,
94
+ help_text="Use UPPERCASE letters only. (Encryption: RSA local)",
95
+ max_length=71,
96
+ null=True,
97
+ validators=[
98
+ django.core.validators.RegexValidator(
99
+ message="Ensure name consist of letters only in upper case",
100
+ regex="^([A-Z]+$|[A-Z]+\\ [A-Z]+)$",
101
+ )
102
+ ],
103
+ verbose_name="Surname",
104
+ ),
105
+ ),
106
+ migrations.AlterField(
107
+ model_name="subjectconsent",
108
+ name="first_name",
109
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
110
+ blank=True,
111
+ help_text="Use UPPERCASE letters only. (Encryption: RSA local)",
112
+ max_length=71,
113
+ null=True,
114
+ validators=[
115
+ django.core.validators.RegexValidator(
116
+ message="Ensure name consist of letters only in upper case",
117
+ regex="^([A-Z]+$|[A-Z]+\\ [A-Z]+)$",
118
+ )
119
+ ],
120
+ ),
121
+ ),
122
+ migrations.AlterField(
123
+ model_name="subjectconsent",
124
+ name="guardian_name",
125
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
126
+ blank=True,
127
+ help_text="Required only if participant is a minor.<BR>Format is 'LASTNAME, FIRSTNAME'. All uppercase separated by a comma. (Encryption: RSA local)",
128
+ max_length=71,
129
+ null=True,
130
+ validators=[edc_consent.validators.FullNameValidator()],
131
+ verbose_name="Guardian's last and first name",
132
+ ),
133
+ ),
134
+ migrations.AlterField(
135
+ model_name="subjectconsent",
136
+ name="last_name",
137
+ field=django_crypto_fields.fields.encrypted_char_field.EncryptedCharField(
138
+ blank=True,
139
+ help_text="Use UPPERCASE letters only. (Encryption: RSA local)",
140
+ max_length=71,
141
+ null=True,
142
+ validators=[
143
+ django.core.validators.RegexValidator(
144
+ message="Ensure name consist of letters only in upper case",
145
+ regex="^([A-Z]+$|[A-Z]+\\ [A-Z]+)$",
146
+ )
147
+ ],
148
+ verbose_name="Surname",
149
+ ),
150
+ ),
151
+ ]
@@ -14,12 +14,13 @@ from meta_subject.models import SubjectVisit
14
14
 
15
15
  from ..action_items import ReconsentAction
16
16
  from .subject_consent import SubjectConsent
17
+ from .subject_consent_v1 import SubjectConsentV1
17
18
 
18
19
 
19
20
  @receiver(
20
21
  post_save,
21
22
  weak=False,
22
- sender=SubjectConsent,
23
+ sender=SubjectConsentV1,
23
24
  dispatch_uid="subject_consent_on_post_save",
24
25
  )
25
26
  def subject_consent_on_post_save(sender, instance, raw, created, **kwargs):
@@ -85,23 +86,25 @@ def subject_consent_on_post_save(sender, instance, raw, created, **kwargs):
85
86
  @receiver(
86
87
  post_delete,
87
88
  weak=False,
88
- sender=SubjectConsent,
89
89
  dispatch_uid="subject_consent_on_post_delete",
90
90
  )
91
91
  def subject_consent_on_post_delete(sender, instance, using, **kwargs):
92
92
  """Updates/Resets subject screening."""
93
93
  # don't allow if subject visits exist. This should be caught
94
94
  # in the ModelAdmin delete view
95
- if SubjectVisit.objects.filter(subject_identifier=instance.subject_identifier).exists():
96
- raise ValidationError("Unable to delete consent. Visit data exists.")
95
+ if sender in [SubjectConsent, SubjectConsentV1]:
96
+ if SubjectVisit.objects.filter(
97
+ subject_identifier=instance.subject_identifier
98
+ ).exists():
99
+ raise ValidationError("Unable to delete consent. Visit data exists.")
97
100
 
98
- _, schedule = site_visit_schedules.get_by_onschedule_model("meta_prn.onschedule")
99
- schedule.take_off_schedule(instance.subject_identifier, instance.consent_datetime)
101
+ _, schedule = site_visit_schedules.get_by_onschedule_model("meta_prn.onschedule")
102
+ schedule.take_off_schedule(instance.subject_identifier, instance.consent_datetime)
100
103
 
101
- # update subject screening
102
- subject_screening = SubjectScreening.objects.get(
103
- screening_identifier=instance.screening_identifier
104
- )
105
- subject_screening.consented = False
106
- subject_screening.subject_identifier = subject_screening.subject_screening_as_pk
107
- subject_screening.save()
104
+ # update subject screening
105
+ subject_screening = SubjectScreening.objects.get(
106
+ screening_identifier=instance.screening_identifier
107
+ )
108
+ subject_screening.consented = False
109
+ subject_screening.subject_identifier = subject_screening.subject_screening_as_pk
110
+ subject_screening.save()
@@ -1,15 +1,13 @@
1
1
  from edc_consent.managers import ConsentObjectsByCdefManager, CurrentSiteByCdefManager
2
2
  from edc_model.models import HistoricalRecords
3
3
 
4
- from meta_consent.models import SubjectConsent
4
+ from .subject_consent import SubjectConsent
5
5
 
6
6
 
7
7
  class SubjectConsentV1(SubjectConsent):
8
8
 
9
9
  objects = ConsentObjectsByCdefManager()
10
-
11
10
  on_site = CurrentSiteByCdefManager()
12
-
13
11
  history = HistoricalRecords()
14
12
 
15
13
  class Meta:
@@ -7,7 +7,7 @@ from edc_consent.constants import HOSPITAL_NUMBER
7
7
  from edc_constants.constants import FEMALE
8
8
  from edc_utils.date import get_utcnow
9
9
 
10
- from meta_consent.forms import SubjectConsentFormValidator
10
+ from meta_consent.form_validators import SubjectConsentFormValidator
11
11
  from meta_screening.tests.meta_test_case_mixin import MetaTestCaseMixin
12
12
 
13
13
 
@@ -3,12 +3,12 @@
3
3
  {% load edc_dashboard_extras edc_subject_dashboard_extras meta_dashboard_extras %}
4
4
 
5
5
  {% block listboard_panel %}
6
-
6
+ {# screening is now disabled for live systems #}
7
7
  <a id="subjectscreening_add"
8
8
  title="{% if perms.meta_screening.add_screeningpartone %}add screening{% else %}check your permissions{% endif %}"
9
9
  class="btn btn-sm btn-default" role="button"
10
- {% if not perms.meta_screening.add_screeningpartone %}disabled{% endif %}
11
- href="{% if perms.meta_screening.add_screeningpartone %}{{ subject_screening_add_url }}?next={{ screening_listboard_url }}{% endif %}">
10
+ {% if not perms.meta_screening.add_screeningpartone or not LIVE_SYSTEM %}disabled href="#"{% else %}
11
+ href="{% if perms.meta_screening.add_screeningpartone %}{{ subject_screening_add_url }}?next={{ screening_listboard_url }}{% endif %}"{% endif %}>
12
12
  <i class="fas fa-plus fa-sm"></i> Add Subject Screening {% if meta_version == 3 %}(META3){% endif %}
13
13
  </a>
14
14
 
@@ -51,7 +51,7 @@
51
51
 
52
52
 
53
53
  {% block listboard_table_columns %}
54
- <td>{{ result.human_readable_identifier }} </td>
54
+ <td>{{ result.human_readable_identifier }}</td>
55
55
  <td nowrap>
56
56
  {% if result.repeat_glucose_performed == 'PENDING' %}
57
57
  {% if result.repeat_due_in_days < 3 %}
@@ -26,8 +26,7 @@
26
26
  {% endblock listboard_table_button_column %}
27
27
 
28
28
  {% block listboard_table_columns %}
29
- <td>{{ result.subject_identifier }}
30
- </td>
29
+ <td>{{ result.subject_identifier }}</td>
31
30
  <td>
32
31
  {% if result.gender == MALE %}
33
32
  <i class="fas fa-male fa-lg"></i>
@@ -8,22 +8,22 @@ print(f"Settings file {__file__}")
8
8
 
9
9
  # TZ Sites:
10
10
  # SITE_ID = SiteID(default=20) # Amana
11
- # SITE_ID = SiteID(default=10) # Hindu Mandal
11
+ SITE_ID = SiteID(default=10) # Hindu Mandal
12
12
  # SITE_ID = SiteID(default=40) # Mwananyamala
13
13
  # SITE_ID = SiteID(default=50) # Mbagala
14
14
  # SITE_ID = SiteID(default=60) # Mnazi-Moja
15
- SITE_ID = SiteID(default=30) # Temeke
16
-
15
+ # SITE_ID = SiteID(default=30) # Temeke
16
+ INDEX_PAGE = "http://localhost:8000"
17
17
  EDC_SITES_UAT_DOMAIN = False
18
18
  DEBUG = True
19
19
  ALLOWED_HOSTS = [
20
20
  "localhost",
21
- "mnazi-moja.tz.meta3.clinicedc.org",
22
- "mbagala.tz.meta3.clinicedc.org",
23
- "mwananyamala.tz.meta3.clinicedc.org",
24
- "hindu-mandal.tz.meta3.clinicedc.org",
25
- "temeke.tz.meta3.clinicedc.org",
26
- "amana.tz.meta3.clinicedc.org",
21
+ "mnazi-moja.tz.meta4.clinicedc.org",
22
+ "mbagala.tz.meta4.clinicedc.org",
23
+ "mwananyamala.tz.meta4.clinicedc.org",
24
+ "hindu-mandal.tz.meta4.clinicedc.org",
25
+ "temeke.tz.meta4.clinicedc.org",
26
+ "amana.tz.meta4.clinicedc.org",
27
27
  ]
28
28
 
29
29
  SECURE_SSL_REDIRECT = False
@@ -16,7 +16,6 @@ env = environ.Env(
16
16
  CELERY_ENABLED=(bool, False),
17
17
  DATABASE_SQLITE_ENABLED=(bool, False),
18
18
  DJANGO_AUTO_CREATE_KEYS=(bool, False),
19
- DJANGO_CRYPTO_FIELDS_TEMP_PATH=(bool, False),
20
19
  DJANGO_CSRF_COOKIE_SECURE=(bool, True),
21
20
  DJANGO_DEBUG=(bool, False),
22
21
  DJANGO_EDC_BOOTSTRAP=(int, 3),
@@ -31,13 +30,9 @@ env = environ.Env(
31
30
  EDC_RANDOMIZATION_REGISTER_DEFAULT_RANDOMIZER=(bool, True),
32
31
  EDC_LABEL_BROWSER_PRINT_PAGE_AUTO_BACK=(bool, True),
33
32
  TWILIO_ENABLED=(bool, False),
33
+ EDC_SITES_DOMAIN_SUFFIX="meta4.clinicedc.org",
34
34
  )
35
35
 
36
- DEBUG = env("DJANGO_DEBUG")
37
-
38
- if LOGGING_ENABLED := env("DJANGO_LOGGING_ENABLED"):
39
- from .logging import * # noqa
40
-
41
36
  BASE_DIR = str(Path(os.path.dirname(os.path.abspath(__file__))).parent.parent)
42
37
  ENV_DIR = str(Path(os.path.dirname(os.path.abspath(__file__))).parent.parent)
43
38
 
@@ -52,8 +47,15 @@ else:
52
47
  )
53
48
  env.read_env(os.path.join(ENV_DIR, ".env"))
54
49
 
50
+
51
+ LOGGING_ENABLED = env("DJANGO_LOGGING_ENABLED")
52
+ if LOGGING_ENABLED:
53
+ from .logging import * # noqa
54
+
55
55
  META_PHASE = 3
56
56
 
57
+ EDC_SITES_DOMAIN_SUFFIX = env.str("EDC_SITES_DOMAIN_SUFFIX") # "meta4.clinicedc.org"
58
+
57
59
  DEBUG = env("DJANGO_DEBUG")
58
60
 
59
61
  SECRET_KEY = env.str("DJANGO_SECRET_KEY")
@@ -66,8 +68,9 @@ ETC_DIR = env.str("DJANGO_ETC_FOLDER")
66
68
 
67
69
  TEST_DIR = os.path.join(BASE_DIR, APP_NAME, "tests")
68
70
 
69
- # INTERNAL_IPS = ["127.0.0.1"]
70
- ALLOWED_HOSTS = ["*"] # env.list('DJANGO_ALLOWED_HOSTS')
71
+ ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS")
72
+
73
+ META3_DOMAIN_SUFFIX = "meta4.clinicedc.org"
71
74
 
72
75
  ENFORCE_RELATED_ACTION_ITEM_EXISTS = False
73
76
 
@@ -86,8 +89,8 @@ INSTALLED_APPS = [
86
89
  "django.contrib.messages",
87
90
  "django.contrib.staticfiles",
88
91
  "django.contrib.sites",
92
+ "multisite.apps.AppConfig",
89
93
  "defender",
90
- "multisite",
91
94
  "fontawesomefree",
92
95
  "django_crypto_fields.apps.AppConfig",
93
96
  "django_revision.apps.AppConfig",
@@ -99,6 +102,7 @@ INSTALLED_APPS = [
99
102
  "edc_action_item.apps.AppConfig",
100
103
  "edc_appointment.apps.AppConfig",
101
104
  "edc_auth.apps.AppConfig",
105
+ "edc_adherence.apps.AppConfig",
102
106
  "edc_adverse_event.apps.AppConfig",
103
107
  "edc_consent.apps.AppConfig",
104
108
  "edc_crf.apps.AppConfig",
@@ -146,7 +150,6 @@ INSTALLED_APPS = [
146
150
  "edc_timepoint.apps.AppConfig",
147
151
  "edc_unblinding.apps.AppConfig",
148
152
  "edc_form_describer.apps.AppConfig",
149
- "edc_adherence.apps.AppConfig",
150
153
  "edc_dx.apps.AppConfig",
151
154
  "meta_consent.apps.AppConfig",
152
155
  "meta_data_manager.apps.AppConfig",
@@ -173,6 +176,7 @@ if not DEFENDER_ENABLED:
173
176
  MIDDLEWARE = [
174
177
  "django.middleware.security.SecurityMiddleware",
175
178
  "django.contrib.sessions.middleware.SessionMiddleware",
179
+ "django.middleware.locale.LocaleMiddleware",
176
180
  "django.middleware.common.CommonMiddleware",
177
181
  "multisite.middleware.DynamicSiteMiddleware",
178
182
  "django.contrib.sites.middleware.CurrentSiteMiddleware",
@@ -238,12 +242,11 @@ if env.str("DJANGO_CACHE") == "redis":
238
242
  "default": {
239
243
  "BACKEND": "django_redis.cache.RedisCache",
240
244
  "LOCATION": "redis://127.0.0.1:6379/1",
241
- # "LOCATION": "unix://[:{DJANGO_REDIS_PASSWORD}]@/path/to/socket.sock?db=0",
242
245
  "OPTIONS": {
243
246
  "CLIENT_CLASS": "django_redis.client.DefaultClient",
244
247
  "PASSWORD": env.str("DJANGO_REDIS_PASSWORD"),
245
248
  },
246
- "KEY_PREFIX": f"{APP_NAME}",
249
+ "KEY_PREFIX": env.str("DJANGO_REDIS_KEY_PREFIX", default=APP_NAME),
247
250
  }
248
251
  }
249
252
  SESSION_ENGINE = "django.contrib.sessions.backends.cache"
@@ -292,13 +295,11 @@ USE_TZ = True
292
295
 
293
296
  LANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)
294
297
  django.conf.locale.LANG_INFO = LANG_INFO
295
- LANGUAGE_CODE = "en"
298
+
299
+ LANGUAGE_CODE = "en-gb"
296
300
  LANGUAGE_LIST = ["sw", "en-gb", "en", "mas"]
297
301
  LANGUAGES = [(code, LANG_INFO[code]["name"]) for code in LANGUAGE_LIST]
298
302
 
299
-
300
- # LANGUAGE_CODE = env.str("DJANGO_LANGUAGE_CODE") # ignored if USE_L10N = False
301
- # LANGUAGES = [x.split(":") for x in env.list("DJANGO_LANGUAGES")] or (("en", "English"),)
302
303
  TIME_ZONE = env.str("DJANGO_TIME_ZONE")
303
304
  DATE_INPUT_FORMATS = ["%Y-%m-%d", "%d/%m/%Y"]
304
305
  DATETIME_INPUT_FORMATS = [
@@ -355,8 +356,9 @@ SUBJECT_VISIT_MODEL = env.str("EDC_SUBJECT_VISIT_MODEL")
355
356
  SUBJECT_VISIT_MISSED_MODEL = env.str("EDC_SUBJECT_VISIT_MISSED_MODEL")
356
357
  SUBJECT_VISIT_MISSED_REASONS_MODEL = env.str("EDC_SUBJECT_VISIT_MISSED_REASONS_MODEL")
357
358
  SUBJECT_REFUSAL_MODEL = env.str("EDC_SUBJECT_REFUSAL_MODEL")
358
- EDC_BLOOD_RESULTS_MODEL_APP_LABEL = "meta_subject"
359
359
 
360
+ EDC_BLOOD_RESULTS_MODEL_APP_LABEL = "meta_subject"
361
+ EDC_DASHBOARD_APP_LABEL = "meta_dashboard"
360
362
  EDC_NAVBAR_DEFAULT = env("EDC_NAVBAR_DEFAULT")
361
363
 
362
364
  # dashboards
@@ -406,8 +408,10 @@ EDC_RANDOMIZATION_SKIP_VERIFY_CHECKS = True
406
408
  EDC_SITES_MODULE_NAME = env.str("EDC_SITES_MODULE_NAME")
407
409
 
408
410
  # django-multisite
409
- CACHE_MULTISITE_KEY_PREFIX = APP_NAME
411
+ CACHE_MULTISITE_KEY_PREFIX = "meta4"
410
412
  SILENCED_SYSTEM_CHECKS = ["sites.E101"]
413
+ MULTISITE_SYNC_ALIAS_MANUALLY = True
414
+ MULTISITE_REGISTER_POST_MIGRATE_SYNC_ALIAS = False
411
415
 
412
416
  # django-defender
413
417
  # see if env.str("DJANGO_CACHE") == "redis" above
@@ -469,6 +473,9 @@ DATA_DICTIONARY_APP_LABELS = [
469
473
  "edc_offstudy",
470
474
  ]
471
475
 
476
+ # edc_form_runners
477
+ EDC_FORM_RUNNERS_ENABLED = False
478
+
472
479
  # edc_protocol
473
480
  EDC_PROTOCOL = env.str("EDC_PROTOCOL")
474
481
  EDC_PROTOCOL_INSTITUTION_NAME = env.str("EDC_PROTOCOL_INSTITUTION_NAME")
meta_edc/settings/live.py CHANGED
@@ -4,16 +4,8 @@ from .defaults import * # noqa
4
4
 
5
5
  print(f"Settings file {__file__}")
6
6
 
7
-
8
7
  SITE_ID = SiteID(default=1)
9
8
  EDC_SITES_UAT_DOMAIN = False
10
- ALLOWED_HOSTS = [
11
- "amana.tz.meta3.clinicedc.org",
12
- "hindu-mandal.tz.meta3.clinicedc.org",
13
- "mbagala.tz.meta3.clinicedc.org",
14
- "mnazi-moja.tz.meta3.clinicedc.org",
15
- "mwananyamala.tz.meta3.clinicedc.org",
16
- "temeke.tz.meta3.clinicedc.org",
17
- ]
18
9
  EDC_MODEL_ADMIN_CSS_THEME = "edc_indigo"
19
10
  LIVE_SYSTEM = True
11
+ EDC_SITES_DOMAIN_SUFFIX = "meta4.clinicedc.org"
meta_edc/settings/uat.py CHANGED
@@ -1,24 +1,11 @@
1
- from importlib.metadata import version
2
-
3
1
  from multisite import SiteID
4
2
 
5
3
  from .defaults import * # noqa
6
4
 
7
5
  print(f"Settings file {__file__}")
8
- print(f"Version: {version('meta_edc')}")
9
6
 
10
7
  SITE_ID = SiteID(default=1)
11
8
  EDC_SITES_UAT_DOMAIN = True
12
- EDC_CONSENT_BYPASS_CONSENT_DATETIME_VALIDATION = True
13
- ALLOWED_HOSTS = [
14
- "amana.uat.tz.meta4.clinicedc.org",
15
- "hindu-mandal.uat.tz.meta4.clinicedc.org",
16
- "mbagala.uat.tz.meta4.clinicedc.org",
17
- "mnazi-moja.uat.tz.meta4.clinicedc.org",
18
- "mwananyamala.uat.tz.meta4.clinicedc.org",
19
- "temeke.uat.tz.meta4.clinicedc.org",
20
- ]
21
-
22
- # edc_model_admin
23
9
  EDC_MODEL_ADMIN_CSS_THEME = "edc_purple"
24
10
  LIVE_SYSTEM = False
11
+ EDC_CONSENT_BYPASS_CONSENT_DATETIME_VALIDATION = True
@@ -4,7 +4,7 @@
4
4
  {% block main %}
5
5
 
6
6
  <style>
7
-
7
+ a { cursor: pointer; }
8
8
  .bg-1 {
9
9
  background-color: #428bca; /* dark blue */
10
10
  color: #ffffff;
@@ -21,8 +21,8 @@
21
21
  </style>
22
22
 
23
23
  {{ block.super }}
24
-
25
-
24
+ <form id="switch_sites_form" method="post" action="{% url 'switch_sites_url' %}">{% csrf_token %}</form>
25
+ <form id="logout_form" method="post" action="{% url 'edc_auth_admin:logout' %}">{% csrf_token %}</form>
26
26
 
27
27
  <div class="row">
28
28
 
@@ -62,8 +62,11 @@
62
62
  {% if perms.edc_export %}
63
63
  <a href="{% url 'edc_export:home_url' %}" class="list-group-item"><i class="fas fa-file-export fa-lg fa-fw"></i>&nbsp;&nbsp;&nbsp;Export data</a>
64
64
  {% endif %}
65
- <a href="/switch_sites/" class="list-group-item"><i class="fas fa-arrows-alt fa-lg fa-fw"></i>&nbsp;&nbsp;&nbsp;Switch sites</a>
66
- <a href="{% url 'edc_auth_admin:logout' %}" class="list-group-item"><i class="fas fa-sign-out-alt fa-lg fa-fw"></i>&nbsp;&nbsp;&nbsp;Log out</a>
65
+ {% if perms.edc_auth.change_userprofile %}
66
+ <a href="{% url 'edc_auth:home_url' %}" class="list-group-item"><i class="fas fa-users fa-lg fa-fw"></i>&nbsp;&nbsp;&nbsp;Account Management</a>
67
+ {% endif %}
68
+ <a onclick="document.getElementById('switch_sites_form').submit();" class="list-group-item" title="{% url 'switch_sites_url' %}"><i class="fas fa-arrows-alt fa-lg fa-fw"></i>&nbsp;&nbsp;&nbsp;Switch sites</a>
69
+ <a onclick="document.getElementById('logout_form').submit();" class="list-group-item" title="{% url 'edc_auth_admin:logout' %}"><i class="fas fa-sign-out-alt fa-lg fa-fw"></i>&nbsp;&nbsp;&nbsp;Log out</a>
67
70
  </div>
68
71
  </div>
69
72
  </div>