meta-edc 0.3.47__py3-none-any.whl → 0.3.49__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.
Files changed (51) hide show
  1. meta_ae/tests/holidays.csv +1 -1
  2. meta_analytics/dataframes/screening/get_screening_df.py +1 -0
  3. meta_analytics/tables/enrolled/glucose.py +3 -1
  4. meta_consent/action_items.py +18 -1
  5. meta_consent/admin/__init__.py +1 -0
  6. meta_consent/admin/subject_consent_v1_ext_admin.py +45 -0
  7. meta_consent/baker_recipes.py +1 -0
  8. meta_consent/consents.py +14 -1
  9. meta_consent/constants.py +1 -0
  10. meta_consent/forms/__init__.py +1 -0
  11. meta_consent/forms/subject_consent_v1_ext_form.py +16 -0
  12. meta_consent/migrations/0026_historicalsubjectconsentv1ext_subjectconsentv1ext.py +544 -0
  13. meta_consent/migrations/0027_auto_20250111_0344.py +27 -0
  14. meta_consent/models/__init__.py +1 -0
  15. meta_consent/models/signals.py +18 -0
  16. meta_consent/models/subject_consent_v1_ext.py +29 -0
  17. meta_consent/tests/holidays.csv +1 -1
  18. meta_dashboard/templates/meta_dashboard/bootstrap3/buttons/eligibility_button.html +1 -1
  19. meta_dashboard/templates/meta_dashboard/bootstrap3/buttons/screening_button.html +1 -1
  20. meta_dashboard/templates/meta_dashboard/bootstrap3/subject/dashboard/sidebar.html +24 -0
  21. meta_dashboard/templates/meta_dashboard/bootstrap3/subject/dashboard.html +3 -0
  22. meta_dashboard/tests/holidays.csv +1 -1
  23. meta_dashboard/views/subject/dashboard/dashboard_view.py +11 -0
  24. meta_edc/celery_live.py +1 -3
  25. meta_edc/celery_uat.py +1 -3
  26. meta_edc/management/commands/update_forms_reference.py +6 -2
  27. meta_edc/settings/debug.py +2 -2
  28. meta_edc-0.3.49.dist-info/AUTHORS +0 -0
  29. {meta_edc-0.3.47.dist-info → meta_edc-0.3.49.dist-info}/METADATA +3 -3
  30. {meta_edc-0.3.47.dist-info → meta_edc-0.3.49.dist-info}/RECORD +51 -44
  31. {meta_edc-0.3.47.dist-info → meta_edc-0.3.49.dist-info}/WHEEL +1 -1
  32. meta_prn/tests/tests/test_dm_referral.py +1 -4
  33. meta_reports/templates/meta_reports/columns/subject_identifier_column.html +1 -1
  34. meta_reports/templates/meta_reports/endpoints_all_change_list_note.html +1 -1
  35. meta_reports/templates/meta_reports/endpoints_change_list_note.html +1 -1
  36. meta_screening/tests/holidays.csv +1 -1
  37. meta_screening/tests/meta_test_case_mixin.py +15 -0
  38. meta_subject/models/todo.txt +1 -1
  39. meta_subject/static/meta_subject/slider.css +1 -1
  40. meta_subject/templates/meta_subject/endpoint_review_instructions.html +1 -1
  41. meta_subject/templates/meta_subject/widgets/slider.html +0 -1
  42. meta_subject/tests/holidays.csv +1 -1
  43. meta_subject/tests/tests/test_medication_adherence.py +5 -1
  44. meta_subject/tests/tests/test_mnsi.py +33 -9
  45. meta_visit_schedule/visit_schedules/phase_three/schedule.py +2 -2
  46. tests/etc/randomization_list.csv +1 -1
  47. tests/etc/randomization_list_phase_three.csv +1 -1
  48. tests/holidays.csv +1 -1
  49. /meta_edc-0.3.47.dist-info/AUTHORS → /meta_analytics/notebooks/cleaning/__init__.py +0 -0
  50. {meta_edc-0.3.47.dist-info → meta_edc-0.3.49.dist-info}/LICENSE +0 -0
  51. {meta_edc-0.3.47.dist-info → meta_edc-0.3.49.dist-info}/top_level.txt +0 -0
@@ -12,4 +12,4 @@
12
12
  2019-12-01,Mawlid Day,tanzania
13
13
  2019-12-09,Independence Day,tanzania
14
14
  2019-12-25,Christmas Day,tanzania
15
- 2019-12-26,Boxing Day,tanzania
15
+ 2019-12-26,Boxing Day,tanzania
@@ -149,6 +149,7 @@ def get_screening_df(df: pd.DataFrame | None = None) -> pd.DataFrame:
149
149
  on="subject_identifier",
150
150
  how="left",
151
151
  )
152
+ df.reset_index(drop=True, inplace=True)
152
153
  # set waist_circumference=waist_circumference_baseline
153
154
  # if `waist_circumference` is none and `waist_circumference_baseline` is not
154
155
  df.loc[
@@ -17,10 +17,12 @@ class GlucoseTable(Table):
17
17
  super().__init__(colname="", main_df=main_df, title="Glucose (enrolled)")
18
18
 
19
19
  def build_table_df(self) -> None:
20
+ super().build_table_df()
20
21
  df = self.main_df
21
22
  s = df.groupby("subject_identifier")[["age_in_years", "gender"]].value_counts()
22
23
  df_tmp = s.to_frame()
23
24
  df_tmp = df_tmp.reset_index()
24
25
  gender_tbl = GenderTable(main_df=df_tmp).table_df
25
26
  age_tbl = AgeTable(main_df=df_tmp).table_df
26
- return pd.concat([gender_tbl, age_tbl])
27
+ self.table_df = pd.concat([self.table_df, gender_tbl, age_tbl])
28
+ self.table_df.reset_index(drop=True, inplace=True)
@@ -1,7 +1,7 @@
1
1
  from edc_action_item import Action, site_action_items
2
2
  from edc_constants.constants import HIGH_PRIORITY
3
3
 
4
- from .constants import RECONSENT_ACTION
4
+ from .constants import CONSENT_V1_EXTENSION_ACTION, RECONSENT_ACTION
5
5
 
6
6
 
7
7
  class ReconsentAction(Action):
@@ -23,4 +23,21 @@ class ReconsentAction(Action):
23
23
  return False
24
24
 
25
25
 
26
+ class ConsentV1ExtensionAction(Action):
27
+ name = CONSENT_V1_EXTENSION_ACTION
28
+ display_name = "Ask to extend followup (required)"
29
+ reference_model = "meta_consent.subjectconsentv1ext"
30
+ priority = HIGH_PRIORITY
31
+ show_on_dashboard = True
32
+ show_link_to_changelist = True
33
+ admin_site_name = "meta_consent_admin"
34
+ create_by_user = False
35
+ singleton = True
36
+ instructions = "Participant must complete as soon as able. "
37
+
38
+ def reopen_action_item_on_change(self):
39
+ return False
40
+
41
+
26
42
  site_action_items.register(ReconsentAction)
43
+ site_action_items.register(ConsentV1ExtensionAction)
@@ -1,2 +1,3 @@
1
1
  from .subject_consent_admin import SubjectConsentAdmin
2
2
  from .subject_consent_v1_admin import SubjectConsentV1Admin
3
+ from .subject_consent_v1_ext_admin import SubjectConsentV1ExtAdmin
@@ -0,0 +1,45 @@
1
+ from django.contrib import admin
2
+ from django_audit_fields import audit_fieldset_tuple
3
+ from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin
4
+ from edc_model_admin.history import SimpleHistoryAdmin
5
+
6
+ from ..admin_site import meta_consent_admin
7
+ from ..forms import SubjectConsentV1ExtForm
8
+ from ..models import SubjectConsentV1Ext
9
+
10
+
11
+ @admin.register(SubjectConsentV1Ext, site=meta_consent_admin)
12
+ class SubjectConsentV1ExtAdmin(
13
+ ModelAdminSubjectDashboardMixin,
14
+ SimpleHistoryAdmin,
15
+ ):
16
+ form = SubjectConsentV1ExtForm
17
+
18
+ fieldsets = (
19
+ (
20
+ None,
21
+ {
22
+ "fields": (
23
+ "subject_consent",
24
+ "report_datetime",
25
+ "agrees_to_extension",
26
+ )
27
+ },
28
+ ),
29
+ audit_fieldset_tuple,
30
+ )
31
+
32
+ radio_fields = {"agrees_to_extension": admin.VERTICAL}
33
+
34
+ def get_readonly_fields(self, request, obj=None) -> tuple[str, ...]:
35
+ if obj:
36
+ return ("subject_consent",)
37
+ return ()
38
+
39
+ def formfield_for_foreignkey(self, db_field, request, **kwargs):
40
+ if db_field.name == "subject_consent":
41
+ subject_identifier = request.GET.get("subject_identifier")
42
+ kwargs["queryset"] = db_field.related_model.objects.filter(
43
+ subject_identifier=subject_identifier
44
+ )
45
+ return super().formfield_for_foreignkey(db_field, request, **kwargs)
@@ -35,6 +35,7 @@ opts = dict(
35
35
  )
36
36
  subjectconsent = Recipe(SubjectConsent, **opts)
37
37
  subjectconsentv1 = Recipe(SubjectConsentV1, **opts)
38
+ # subjectconsentv1ext = Recipe(SubjectConsentV1Ext, **opts)
38
39
 
39
40
  subjectreconsent = Recipe(
40
41
  SubjectReconsent,
meta_consent/consents.py CHANGED
@@ -1,4 +1,8 @@
1
+ from datetime import datetime
2
+ from zoneinfo import ZoneInfo
3
+
1
4
  from edc_consent.consent_definition import ConsentDefinition
5
+ from edc_consent.consent_definition_extension import ConsentDefinitionExtension
2
6
  from edc_consent.site_consents import site_consents
3
7
  from edc_constants.constants import FEMALE, MALE
4
8
  from edc_protocol.research_protocol_config import ResearchProtocolConfig
@@ -18,6 +22,15 @@ consent_v1 = ConsentDefinition(
18
22
  "meta_screening.screeningparttwo",
19
23
  "meta_screening.screeningpartthree",
20
24
  ],
25
+ timepoints=list(range(1, 14 + 1)),
26
+ )
27
+
28
+ consent_v1_ext = ConsentDefinitionExtension(
29
+ "meta_consent.subjectconsentv1ext",
30
+ version="1.1",
31
+ start=datetime(2024, 12, 16, tzinfo=ZoneInfo("UTC")),
32
+ extends=consent_v1,
33
+ timepoints=[15, 16, 17, 18],
21
34
  )
22
35
 
23
- site_consents.register(consent_v1)
36
+ site_consents.register(consent_v1, extended_by=consent_v1_ext)
meta_consent/constants.py CHANGED
@@ -1 +1,2 @@
1
1
  RECONSENT_ACTION = "reconsent"
2
+ CONSENT_V1_EXTENSION_ACTION = "consent_v1_ext"
@@ -1,3 +1,4 @@
1
1
  from .subject_consent_form import SubjectConsentForm
2
+ from .subject_consent_v1_ext_form import SubjectConsentV1ExtForm
2
3
  from .subject_consent_v1_form import SubjectConsentV1Form
3
4
  from .subject_reconsent_form import SubjectReconsentForm
@@ -0,0 +1,16 @@
1
+ from django import forms
2
+ from edc_form_validators import FormValidatorMixin
3
+ from edc_sites.forms import SiteModelFormMixin
4
+
5
+ from ..models import SubjectConsentV1Ext
6
+
7
+
8
+ class SubjectConsentV1ExtForm(SiteModelFormMixin, FormValidatorMixin, forms.ModelForm):
9
+
10
+ widgets = {
11
+ "subject_identifier": forms.TextInput(attrs={"readonly": "readonly"}),
12
+ }
13
+
14
+ class Meta:
15
+ model = SubjectConsentV1Ext
16
+ fields = "__all__"