meta-edc 0.3.7__py3-none-any.whl → 0.3.50__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- meta_ae/action_items.py +2 -2
- meta_ae/migrations/0017_auto_20221130_2257.py +12 -7
- meta_ae/tests/holidays.csv +1 -1
- meta_analytics/README.rst +17 -0
- meta_analytics/dataframes/__init__.py +19 -0
- meta_analytics/dataframes/constants.py +33 -0
- meta_analytics/dataframes/enrolled/__init__.py +1 -0
- meta_analytics/dataframes/enrolled/get_glucose_df.py +122 -0
- meta_analytics/dataframes/get_eos_df.py +26 -0
- meta_analytics/dataframes/get_last_imp_visits_df.py +101 -0
- meta_analytics/dataframes/glucose_endpoints/__init__.py +2 -0
- meta_analytics/dataframes/glucose_endpoints/endpoint_by_date.py +183 -0
- meta_analytics/dataframes/glucose_endpoints/glucose_endpoints_by_date.py +531 -0
- meta_analytics/dataframes/screening/__init__.py +2 -0
- meta_analytics/dataframes/screening/get_glucose_tested_only_df.py +20 -0
- meta_analytics/dataframes/screening/get_screening_df.py +163 -0
- meta_analytics/dataframes/utils.py +65 -0
- meta_analytics/get_tables.py +81 -0
- meta_analytics/tables/__init__.py +2 -0
- meta_analytics/tables/eligible.py +106 -0
- meta_analytics/tables/enrolled/__init__.py +0 -0
- meta_analytics/tables/enrolled/glucose.py +28 -0
- meta_analytics/tables/has_dm.py +61 -0
- meta_analytics/tests/__init__.py +0 -0
- meta_analytics/tests/test_endpoints_by_date.py +94 -0
- meta_auth/auth_objects.py +32 -3
- meta_auth/auths.py +18 -3
- meta_consent/action_items.py +18 -1
- meta_consent/admin/__init__.py +1 -0
- meta_consent/admin/subject_consent_v1_ext_admin.py +45 -0
- meta_consent/baker_recipes.py +5 -4
- meta_consent/consents.py +21 -2
- meta_consent/constants.py +1 -0
- meta_consent/forms/__init__.py +1 -0
- meta_consent/forms/subject_consent_v1_ext_form.py +16 -0
- meta_consent/locale/lg/LC_MESSAGES/django.po +69 -0
- meta_consent/locale/sw/LC_MESSAGES/django.po +12 -12
- meta_consent/migrations/0025_alter_historicalsubjectconsent_first_name_and_more.py +151 -0
- meta_consent/migrations/0026_historicalsubjectconsentv1ext_subjectconsentv1ext.py +544 -0
- meta_consent/migrations/0027_auto_20250111_0344.py +30 -0
- meta_consent/models/__init__.py +1 -0
- meta_consent/models/signals.py +34 -13
- meta_consent/models/subject_consent_v1.py +1 -3
- meta_consent/models/subject_consent_v1_ext.py +29 -0
- meta_consent/tests/holidays.csv +1 -1
- meta_consent/tests/tests/test_form_validators.py +1 -1
- meta_dashboard/locale/lg/LC_MESSAGES/django.po +30 -0
- meta_dashboard/locale/sw/LC_MESSAGES/django.po +11 -2
- meta_dashboard/navbars.py +3 -1
- meta_dashboard/templates/meta_dashboard/bootstrap3/buttons/eligibility_button.html +1 -1
- meta_dashboard/templates/meta_dashboard/bootstrap3/buttons/screening_button.html +1 -1
- meta_dashboard/templates/meta_dashboard/bootstrap3/screening/listboard.html +4 -4
- meta_dashboard/templates/meta_dashboard/bootstrap3/subject/dashboard/sidebar.html +24 -0
- meta_dashboard/templates/meta_dashboard/bootstrap3/subject/dashboard.html +3 -0
- meta_dashboard/templates/meta_dashboard/bootstrap3/subject/listboard.html +1 -2
- meta_dashboard/templatetags/meta_dashboard_extras.py +1 -1
- meta_dashboard/tests/holidays.csv +1 -1
- meta_dashboard/tests/urls.py +0 -1
- meta_dashboard/view_utils/__init__.py +6 -0
- meta_dashboard/view_utils/subject_screening_button.py +2 -2
- meta_dashboard/views/subject/dashboard/dashboard_view.py +38 -0
- meta_edc/__init__.py +7 -0
- meta_edc/celery.py +4 -13
- meta_edc/celery_live.py +18 -0
- meta_edc/celery_uat.py +24 -0
- meta_edc/management/commands/update_forms_reference.py +6 -2
- meta_edc/migrations/__init__.py +0 -0
- meta_edc/navbars.py +2 -1
- meta_edc/settings/debug.py +17 -9
- meta_edc/settings/defaults.py +82 -60
- meta_edc/settings/live.py +1 -9
- meta_edc/settings/uat.py +1 -14
- meta_edc/templates/meta_edc/bootstrap3/home.html +13 -7
- meta_edc/tests/tests/test_endpoints.py +22 -19
- meta_edc/urls.py +5 -2
- meta_edc/wsgi.py +1 -1
- meta_edc/wsgi_live.py +1 -1
- meta_edc/wsgi_uat.py +1 -1
- meta_edc-0.3.50.dist-info/AUTHORS +0 -0
- meta_edc-0.3.50.dist-info/METADATA +766 -0
- {meta_edc-0.3.7.dist-info → meta_edc-0.3.50.dist-info}/RECORD +400 -157
- {meta_edc-0.3.7.dist-info → meta_edc-0.3.50.dist-info}/WHEEL +1 -1
- {meta_edc-0.3.7.dist-info → meta_edc-0.3.50.dist-info}/top_level.txt +1 -0
- meta_pharmacy/admin/__init__.py +2 -0
- meta_pharmacy/admin/rx_admin.py +75 -0
- meta_pharmacy/admin/substitutions_admin.py +67 -0
- meta_pharmacy/admin_site.py +9 -0
- meta_pharmacy/apps.py +5 -0
- meta_pharmacy/constants.py +10 -0
- meta_pharmacy/forms/__init__.py +2 -0
- meta_pharmacy/forms/rx_form.py +16 -0
- meta_pharmacy/forms/substitutions_form.py +54 -0
- meta_pharmacy/label_configs.py +30 -0
- meta_pharmacy/labels/__init__.py +5 -0
- meta_pharmacy/labels/draw_label_for_subject_with_barcode.py +62 -0
- meta_pharmacy/labels/draw_label_for_subject_with_code128.py +14 -0
- meta_pharmacy/labels/draw_label_with_test_data.py +26 -0
- meta_pharmacy/labels/label_data.py +14 -0
- meta_pharmacy/labels/print_sheets.py +97 -0
- meta_pharmacy/list_data.py +8 -0
- meta_pharmacy/management/__init__.py +0 -0
- meta_pharmacy/management/commands/__init__.py +0 -0
- meta_pharmacy/management/commands/update_initial_pharmacy_data.py +10 -0
- meta_pharmacy/migrations/0002_initial.py +695 -0
- meta_pharmacy/migrations/0003_auto_20240909_2335.py +64 -0
- meta_pharmacy/migrations/0004_alter_historicalsubstitutions_report_datetime_and_more.py +23 -0
- meta_pharmacy/migrations/0005_auto_20240911_0352.py +17 -0
- meta_pharmacy/migrations/0006_lotnumber_label.py +289 -0
- meta_pharmacy/migrations/0007_lotnumber_medication.py +24 -0
- meta_pharmacy/migrations/0008_remove_lotnumber_medication_and_more.py +390 -0
- meta_pharmacy/migrations/0009_remove_historicalrx_slug.py +17 -0
- meta_pharmacy/models/__init__.py +3 -0
- meta_pharmacy/models/label_data.py +38 -0
- meta_pharmacy/models/rx.py +18 -0
- meta_pharmacy/models/rx_label.py +39 -0
- meta_pharmacy/models/substitutions.py +88 -0
- meta_pharmacy/urls.py +8 -0
- meta_pharmacy/utils/__init__.py +1 -0
- meta_pharmacy/utils/update_initial_pharmacy_data.py +146 -0
- meta_prn/action_items.py +52 -2
- meta_prn/admin/__init__.py +3 -0
- meta_prn/admin/dm_referral_admin.py +49 -0
- meta_prn/admin/offschedule_dm_referral_admin.py +47 -0
- meta_prn/admin/onschedule_dm_referral_admin.py +39 -0
- meta_prn/admin/pregnancy_notification_admin.py +6 -2
- meta_prn/baker_recipes.py +8 -1
- meta_prn/choices.py +2 -1
- meta_prn/constants.py +4 -1
- meta_prn/forms/__init__.py +2 -0
- meta_prn/forms/dm_referral_form.py +40 -0
- meta_prn/forms/offschedule_dm_referral_form.py +35 -0
- meta_prn/forms/offschedule_form.py +6 -0
- meta_prn/migrations/0034_auto_20220630_1110.py +3 -3
- meta_prn/migrations/0035_auto_20220630_1140.py +59 -56
- meta_prn/migrations/0057_historicalonscheduledmreferral_and_more.py +1156 -0
- meta_prn/migrations/0058_dmreferral_referral_note_and_more.py +29 -0
- meta_prn/migrations/0059_alter_historicaloffstudymedication_reason_and_more.py +53 -0
- meta_prn/models/__init__.py +13 -2
- meta_prn/models/dm_referral.py +39 -0
- meta_prn/models/offschedule.py +15 -1
- meta_prn/models/onschedule.py +6 -0
- meta_prn/models/signals.py +41 -1
- meta_prn/tests/tests/test_dm_referral.py +203 -0
- meta_reports/__init__.py +1 -0
- meta_reports/admin/__init__.py +15 -0
- meta_reports/admin/dbviews/__init__.py +14 -0
- meta_reports/admin/dbviews/glucose_summary_admin.py +116 -0
- meta_reports/admin/dbviews/imp_substitutions_admin.py +101 -0
- meta_reports/admin/dbviews/missing_screening_ogtt_admin/__init__.py +2 -0
- meta_reports/admin/dbviews/missing_screening_ogtt_admin/note_model_admin.py +53 -0
- meta_reports/admin/dbviews/missing_screening_ogtt_admin/unmanaged_model_admin.py +84 -0
- meta_reports/admin/dbviews/on_study_missing_lab_values_admin/__init__.py +1 -0
- meta_reports/admin/dbviews/on_study_missing_lab_values_admin/unmanaged_model_admin.py +13 -0
- meta_reports/admin/dbviews/on_study_missing_values_admin/__init__.py +1 -0
- meta_reports/admin/dbviews/on_study_missing_values_admin/unmanaged_model_admin.py +13 -0
- meta_reports/admin/dbviews/patient_history_missing_baseline_cd4_admin.py +58 -0
- meta_reports/admin/dbviews/unattended_three_in_row2_admin.py +47 -0
- meta_reports/admin/dbviews/unattended_three_in_row_admin.py +35 -0
- meta_reports/admin/dbviews/unattended_two_in_row_admin.py +34 -0
- meta_reports/admin/endpoints_admin.py +14 -0
- meta_reports/admin/endpoints_all_admin.py +13 -0
- meta_reports/admin/last_imp_refill_admin.py +181 -0
- meta_reports/admin/list_filters.py +30 -0
- meta_reports/admin/modeladmin_mixins.py +112 -0
- meta_reports/admin_site.py +5 -0
- meta_reports/apps.py +1 -16
- meta_reports/forms/__init__.py +1 -0
- meta_reports/forms/missing_ogtt_note_form.py +33 -0
- meta_reports/management/__init__.py +0 -0
- meta_reports/management/commands/__init__.py +0 -0
- meta_reports/management/commands/generate_endpoints.py +13 -0
- meta_reports/migrations/0001_initial.py +87 -0
- meta_reports/migrations/0002_patienthistorymissingbaselinecd4_and_more.py +64 -0
- meta_reports/migrations/0003_auto_20240618_0505.py +12 -0
- meta_reports/migrations/0004_alter_patienthistorymissingbaselinecd4_table.py +17 -0
- meta_reports/migrations/0005_endpoints.py +47 -0
- meta_reports/migrations/0006_endpoints_baseline_datetime.py +18 -0
- meta_reports/migrations/0007_alter_endpoints_endpoint_label_and_more.py +43 -0
- meta_reports/migrations/0008_alter_endpoints_endpoint_label.py +18 -0
- meta_reports/migrations/0009_alter_endpoints_options.py +21 -0
- meta_reports/migrations/0010_alter_patienthistorymissingbaselinecd4_options_and_more.py +49 -0
- meta_reports/migrations/0011_auto_20240813_0156.py +54 -0
- meta_reports/migrations/0012_auto_20240813_1516.py +48 -0
- meta_reports/migrations/0013_auto_20240813_1516.py +48 -0
- meta_reports/migrations/0014_auto_20240813_1517.py +48 -0
- meta_reports/migrations/0015_alter_endpoints_site.py +22 -0
- meta_reports/migrations/0016_missingscreeningogtt.py +47 -0
- meta_reports/migrations/0017_auto_20240819_1711.py +166 -0
- meta_reports/migrations/0018_auto_20240819_1713.py +54 -0
- meta_reports/migrations/0019_auto_20240819_1721.py +54 -0
- meta_reports/migrations/0020_auto_20240819_1811.py +54 -0
- meta_reports/migrations/0021_auto_20240819_1817.py +54 -0
- meta_reports/migrations/0022_auto_20240819_1832.py +54 -0
- meta_reports/migrations/0023_endpoints_meta_report_subject_a56b22_idx.py +20 -0
- meta_reports/migrations/0024_glucosesummary.py +38 -0
- meta_reports/migrations/0025_auto_20240822_0115.py +87 -0
- meta_reports/migrations/0026_auto_20240822_0120.py +54 -0
- meta_reports/migrations/0027_auto_20240822_0140.py +54 -0
- meta_reports/migrations/0028_alter_glucosesummary_options.py +22 -0
- meta_reports/migrations/0029_auto_20240822_0149.py +54 -0
- meta_reports/migrations/0030_auto_20240822_1637.py +54 -0
- meta_reports/migrations/0031_endpointsproxy.py +25 -0
- meta_reports/migrations/0032_alter_endpointsproxy_options.py +21 -0
- meta_reports/migrations/0033_auto_20240823_0012.py +54 -0
- meta_reports/migrations/0034_auto_20240823_1642.py +54 -0
- meta_reports/migrations/0035_historicalmissingogttnote_missingogttnote.py +457 -0
- meta_reports/migrations/0036_historicalmissingogttnote_fasting_and_more.py +86 -0
- meta_reports/migrations/0037_historicalmissingogttnote_result_status_and_more.py +51 -0
- meta_reports/migrations/0038_alter_historicalmissingogttnote_fasting_and_more.py +33 -0
- meta_reports/migrations/0039_onstudymissingvalues.py +44 -0
- meta_reports/migrations/0040_auto_20240824_0412.py +282 -0
- meta_reports/migrations/0041_auto_20240828_2229.py +14 -0
- meta_reports/migrations/0042_onstudymissinglabvalues.py +43 -0
- meta_reports/migrations/0043_auto_20240828_2309.py +88 -0
- meta_reports/migrations/0044_auto_20240828_2323.py +93 -0
- meta_reports/migrations/0045_auto_20240829_0248.py +54 -0
- meta_reports/migrations/0046_auto_20240829_0250.py +54 -0
- meta_reports/migrations/0047_impsubstitutions.py +56 -0
- meta_reports/migrations/0048_auto_20240909_2338.py +48 -0
- meta_reports/migrations/0049_auto_20240911_0327.py +54 -0
- meta_reports/migrations/0050_alter_endpoints_created.py +19 -0
- meta_reports/migrations/0051_remove_endpoints_baseline_datetime_and_more.py +40 -0
- meta_reports/migrations/0052_lastimpvisit.py +57 -0
- meta_reports/migrations/0053_rename_lastimpvisit_lastimprefill_and_more.py +31 -0
- meta_reports/models/__init__.py +16 -0
- meta_reports/models/dbviews/README +14 -0
- meta_reports/models/dbviews/__init__.py +9 -0
- meta_reports/models/dbviews/glucose_summary/__init__.py +2 -0
- meta_reports/models/dbviews/glucose_summary/unmanaged_model.py +35 -0
- meta_reports/models/dbviews/glucose_summary/view_definition.py +28 -0
- meta_reports/models/dbviews/imp_substitutions/__init__.py +1 -0
- meta_reports/models/dbviews/imp_substitutions/unmanaged_model.py +41 -0
- meta_reports/models/dbviews/imp_substitutions/view_definition.py +21 -0
- meta_reports/models/dbviews/missing_screening_ogtt/__init__.py +2 -0
- meta_reports/models/dbviews/missing_screening_ogtt/note_model.py +57 -0
- meta_reports/models/dbviews/missing_screening_ogtt/unmanaged_model.py +41 -0
- meta_reports/models/dbviews/missing_screening_ogtt/view_definition.py +20 -0
- meta_reports/models/dbviews/on_study_missing_lab_values/__init__.py +1 -0
- meta_reports/models/dbviews/on_study_missing_lab_values/qa_cases.py +53 -0
- meta_reports/models/dbviews/on_study_missing_lab_values/unmanged_model.py +20 -0
- meta_reports/models/dbviews/on_study_missing_lab_values/view_definition.py +17 -0
- meta_reports/models/dbviews/on_study_missing_values/__init__.py +1 -0
- meta_reports/models/dbviews/on_study_missing_values/qa_cases.py +54 -0
- meta_reports/models/dbviews/on_study_missing_values/unmanged_model.py +20 -0
- meta_reports/models/dbviews/on_study_missing_values/view_definition.py +17 -0
- meta_reports/models/dbviews/patient_history_missing_baseline_cd4/__init__.py +1 -0
- meta_reports/models/dbviews/patient_history_missing_baseline_cd4/unmanaged_model.py +31 -0
- meta_reports/models/dbviews/patient_history_missing_baseline_cd4/view_definition.py +21 -0
- meta_reports/models/dbviews/unattended_three_in_row/__init__.py +1 -0
- meta_reports/models/dbviews/unattended_three_in_row/unmanaged_model.py +29 -0
- meta_reports/models/dbviews/unattended_three_in_row/view_definition.py +31 -0
- meta_reports/models/dbviews/unattended_three_in_row2/__init__.py +1 -0
- meta_reports/models/dbviews/unattended_three_in_row2/unmanaged_model.py +29 -0
- meta_reports/models/dbviews/unattended_three_in_row2/view_definition.py +50 -0
- meta_reports/models/dbviews/unattended_two_in_row/__init__.py +1 -0
- meta_reports/models/dbviews/unattended_two_in_row/unmanaged_model.py +27 -0
- meta_reports/models/dbviews/unattended_two_in_row/view_definition.py +30 -0
- meta_reports/models/endpoints.py +31 -0
- meta_reports/models/endpoints_proxy.py +11 -0
- meta_reports/models/last_imp_refill.py +34 -0
- meta_reports/tasks.py +12 -0
- meta_reports/templates/meta_reports/columns/subject_identifier_column.html +1 -0
- meta_reports/templates/meta_reports/endpoints_all_change_list_note.html +12 -0
- meta_reports/templates/meta_reports/endpoints_change_list_note.html +12 -0
- meta_reports/tests/test_sql_gen.py +5 -0
- meta_reports/urls.py +8 -0
- meta_reports/utils.py +0 -0
- meta_screening/admin/subject_screening_admin.py +1 -0
- meta_screening/form_validators/screening_part_two.py +1 -1
- meta_screening/migrations/0062_remove_icpreferral_site_and_more.py +27 -0
- meta_screening/migrations/0063_alter_historicalscreeningpartone_fasting_duration_str_and_more.py +184 -0
- meta_screening/migrations/0064_remove_historicalscreeningpartone_fasting_duration_minutes_and_more.py +126 -0
- meta_screening/migrations/0065_auto_20240516_0352.py +31 -0
- meta_screening/migrations/0066_alter_historicalscreeningpartone_fasting_duration_delta_and_more.py +103 -0
- meta_screening/migrations/0067_alter_historicalscreeningpartone_report_datetime_and_more.py +84 -0
- meta_screening/models/__init__.py +1 -1
- meta_screening/tests/holidays.csv +1 -1
- meta_screening/tests/meta_test_case_mixin.py +17 -2
- meta_screening/tests/options.py +3 -3
- meta_sites/__init__.py +0 -1
- meta_sites/sites.py +8 -7
- meta_sites/tests/test_sites.py +1 -1
- meta_subject/action_items.py +25 -2
- meta_subject/admin/__init__.py +2 -1
- meta_subject/admin/birth_outcome_admin.py +4 -3
- meta_subject/admin/blood_results/__init__.py +1 -1
- meta_subject/admin/blood_results/{blood_results_lipid_admin.py → blood_results_lipids_admin.py} +7 -7
- meta_subject/admin/delivery_admin.py +0 -1
- meta_subject/admin/diabetes/__init__.py +2 -0
- meta_subject/admin/diabetes/dm_endpoint_admin.py +35 -0
- meta_subject/admin/{dm_referral_followup_admin.py → diabetes/dm_followup_admin.py} +15 -8
- meta_subject/admin/glucose_admin.py +1 -1
- meta_subject/admin/glucose_fbg_admin.py +38 -8
- meta_subject/admin/other_arv_regimens_admin.py +2 -0
- meta_subject/admin/study_medication_admin.py +10 -0
- meta_subject/admin/subject_visit_admin.py +4 -1
- meta_subject/baker_recipes.py +6 -0
- meta_subject/choices.py +8 -0
- meta_subject/constants.py +2 -1
- meta_subject/form_validators/__init__.py +2 -1
- meta_subject/form_validators/dm_endpoint_form_validator.py +35 -0
- meta_subject/form_validators/{dm_referral_followup_form_validator.py → dm_followup_form_validator.py} +41 -2
- meta_subject/forms/__init__.py +2 -1
- meta_subject/forms/blood_results/__init__.py +1 -1
- meta_subject/forms/blood_results/{blood_results_lipid_form.py → blood_results_lipids_form.py} +5 -5
- meta_subject/forms/diabetes/__init__.py +2 -0
- meta_subject/forms/diabetes/dm_endpoint_form.py +13 -0
- meta_subject/forms/diabetes/dm_followup_form.py +25 -0
- meta_subject/forms/glucose_fbg_form.py +38 -16
- meta_subject/forms/study_medication_form.py +35 -0
- meta_subject/forms/subject_visit_form.py +16 -0
- meta_subject/locale/lg/LC_MESSAGES/django.po +470 -0
- meta_subject/locale/sw/LC_MESSAGES/django.po +191 -89
- meta_subject/metadata_rules/metadata_rules.py +21 -0
- meta_subject/metadata_rules/predicates.py +67 -8
- meta_subject/migrations/0107_auto_20220415_0043.py +28 -22
- meta_subject/migrations/0126_auto_20220719_2142.py +4 -4
- meta_subject/migrations/0131_auto_20220722_0411.py +28 -23
- meta_subject/migrations/0132_auto_20220722_1825.py +10 -6
- meta_subject/migrations/0135_auto_20220722_2212.py +39 -35
- meta_subject/migrations/0150_auto_20220914_0039.py +15 -11
- meta_subject/migrations/0181_dmreferralfollowup_action_identifier_and_more.py +143 -0
- meta_subject/migrations/0182_rename_dmreferralfollowup_dmfollowup_and_more.py +54 -0
- meta_subject/migrations/0183_alter_dmfollowup_on_dm_medications_and_more.py +31 -0
- meta_subject/migrations/0184_alter_glucose_options_and_more.py +31 -0
- meta_subject/migrations/0185_alter_bloodresultsins_fasting_duration_str_and_more.py +82 -0
- meta_subject/migrations/0186_healtheconomicsupdate_singleton_field_and_more.py +55 -0
- meta_subject/migrations/0187_dmdiagnosis_historicaldmdiagnosis_dmdxresult_and_more.py +451 -0
- meta_subject/migrations/0188_historicaldmdxresult_dmdxresult.py +403 -0
- meta_subject/migrations/0189_alter_dmdxresult_options_and_more.py +116 -0
- meta_subject/migrations/0190_dmdiagnosis_dx_no_tmg_reason_and_more.py +65 -0
- meta_subject/migrations/0191_alter_dmdiagnosis_dx_no_tmg_reason_and_more.py +70 -0
- meta_subject/migrations/0192_rename_glucose_quantifier_glucosefbg_fbg_quantifier_and_more.py +44 -0
- meta_subject/migrations/0193_alter_glucosefbg_fbg_value_and_more.py +44 -0
- meta_subject/migrations/0194_remove_glucosefbg_assay_datetime_and_more.py +166 -0
- meta_subject/migrations/0195_alter_glucosefbg_fbg_datetime_and_more.py +27 -0
- meta_subject/migrations/0196_glucosefbg_fbg_not_performed_reason_and_more.py +49 -0
- meta_subject/migrations/0197_glucosefbg_fasting_duration_estimated_and_more.py +33 -0
- meta_subject/migrations/0198_alter_glucosefbg_fasting_duration_estimated_and_more.py +33 -0
- meta_subject/migrations/0199_auto_20240516_0247.py +18 -0
- meta_subject/migrations/0200_rename_fasting_duration_minutes_bloodresultsins_fasting_duration_delta_and_more.py +43 -0
- meta_subject/migrations/0201_alter_bloodresultsins_fasting_duration_delta_and_more.py +58 -0
- meta_subject/migrations/0202_auto_20240516_0315.py +32 -0
- meta_subject/migrations/0203_alter_bloodresultsins_fasting_duration_delta_and_more.py +67 -0
- meta_subject/migrations/0204_glucosefbg_repeat_fbg_date_and_more.py +27 -0
- meta_subject/migrations/0205_historicalsubjectrequisition_crf_status_and_more.py +80 -0
- meta_subject/migrations/0206_bloodresultsfbc_crf_status_and_more.py +62 -0
- meta_subject/migrations/0207_alter_historicalphysicalexam_waist_circumference_and_more.py +46 -0
- meta_subject/migrations/0208_birthoutcomes_crf_status_and_more.py +62 -0
- meta_subject/migrations/0209_remove_historicaldmdxresult_dm_diagnosis_and_more.py +37 -0
- meta_subject/migrations/0210_remove_dmdxresult_dm_diagnosis_and_more.py +123 -0
- meta_subject/migrations/0211_dmendpoint_endpoint_reached_and_more.py +45 -0
- meta_subject/migrations/0212_auto_20240827_2222.py +23 -0
- meta_subject/migrations/0213_rename_bloodresultslipid_bloodresultslipids_and_more.py +35 -0
- meta_subject/migrations/0214_historicalstudymedication_stock_codes_and_more.py +44 -0
- meta_subject/migrations/0215_alter_historicalstudymedication_stock_codes_and_more.py +46 -0
- meta_subject/model_mixins/arv_history_model_mixin.py +3 -3
- meta_subject/models/__init__.py +3 -2
- meta_subject/models/birth_outcomes.py +6 -1
- meta_subject/models/blood_results/__init__.py +1 -1
- meta_subject/models/blood_results/blood_results_fbc.py +3 -2
- meta_subject/models/blood_results/blood_results_hba1c.py +2 -0
- meta_subject/models/blood_results/blood_results_ins.py +2 -0
- meta_subject/models/blood_results/blood_results_lft.py +2 -0
- meta_subject/models/blood_results/{blood_results_lipid.py → blood_results_lipids.py} +5 -3
- meta_subject/models/blood_results/blood_results_rft.py +2 -0
- meta_subject/models/diabetes/__init__.py +2 -0
- meta_subject/models/diabetes/dm_endpoint.py +61 -0
- meta_subject/models/{dm_referral_followup.py → diabetes/dm_followup.py} +18 -6
- meta_subject/models/glucose.py +7 -14
- meta_subject/models/glucose_fbg.py +40 -51
- meta_subject/models/health_economics/health_economics_update.py +2 -0
- meta_subject/models/physical_exam.py +1 -0
- meta_subject/models/signals.py +19 -0
- meta_subject/models/subject_requisition.py +3 -4
- meta_subject/models/todo.txt +1 -1
- meta_subject/static/meta_subject/slider.css +1 -1
- meta_subject/templates/meta_subject/endpoint_review_instructions.html +1 -1
- meta_subject/templates/meta_subject/widgets/slider.html +0 -1
- meta_subject/tests/holidays.csv +1 -1
- meta_subject/tests/tests/test_egfr.py +6 -5
- meta_subject/tests/tests/test_medication_adherence.py +5 -1
- meta_subject/tests/tests/test_metadata_rules.py +34 -4
- meta_subject/tests/tests/test_mnsi.py +212 -121
- meta_subject/tests/tests/test_sf12.py +0 -12
- meta_visit_schedule/constants.py +7 -1
- meta_visit_schedule/tests/tests/test_schedule.py +4 -0
- meta_visit_schedule/visit_schedules/phase_three/crfs.py +87 -14
- meta_visit_schedule/visit_schedules/phase_three/requisitions.py +12 -0
- meta_visit_schedule/visit_schedules/phase_three/schedule.py +65 -2
- meta_visit_schedule/visit_schedules/phase_three/schedule_dm_referral.py +60 -0
- meta_visit_schedule/visit_schedules/phase_three/visit_schedule.py +2 -0
- tests/etc/randomization_list.csv +1 -1
- {meta_edc/tests → tests}/etc/randomization_list_phase_three.csv +4 -4
- tests/holidays.csv +1 -1
- tests/test_settings.py +186 -0
- meta_edc/tests/etc/user-aes-local.key +0 -1
- meta_edc/tests/etc/user-aes-restricted.key +0 -0
- meta_edc/tests/etc/user-rsa-local-private.pem +0 -27
- meta_edc/tests/etc/user-rsa-local-public.pem +0 -9
- meta_edc/tests/etc/user-rsa-restricted-private.pem +0 -27
- meta_edc/tests/etc/user-rsa-restricted-public.pem +0 -9
- meta_edc/tests/etc/user-salt-local.key +0 -0
- meta_edc/tests/etc/user-salt-restricted.key +0 -0
- meta_edc-0.3.7.dist-info/METADATA +0 -87
- meta_reports/tests/holidays.csv +0 -15
- meta_subject/forms/dm_referral_followup.py +0 -18
- /meta_edc-0.3.7.dist-info/AUTHORS → /meta_analytics/__init__.py +0 -0
- /meta_pharmacy/models.py → /meta_analytics/constants.py +0 -0
- /meta_reports/models.py → /meta_analytics/notebooks/cleaning/__init__.py +0 -0
- {meta_edc-0.3.7.dist-info → meta_edc-0.3.50.dist-info}/LICENSE +0 -0
@@ -3,248 +3,339 @@ from zoneinfo import ZoneInfo
|
|
3
3
|
|
4
4
|
import time_machine
|
5
5
|
from dateutil.relativedelta import relativedelta
|
6
|
-
from django.
|
6
|
+
from django.core.exceptions import ObjectDoesNotExist
|
7
|
+
from django.test import TestCase, override_settings
|
7
8
|
from edc_constants.constants import NO, YES
|
8
9
|
from edc_utils import get_utcnow
|
9
10
|
from model_bakery import baker
|
10
11
|
|
11
12
|
from meta_screening.tests.meta_test_case_mixin import MetaTestCaseMixin
|
12
|
-
from
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
from meta_subject.models import SubjectVisit
|
14
|
+
from meta_visit_schedule.constants import (
|
15
|
+
MONTH1,
|
16
|
+
MONTH3,
|
17
|
+
MONTH6,
|
18
|
+
MONTH9,
|
19
|
+
MONTH12,
|
20
|
+
MONTH15,
|
21
|
+
MONTH18,
|
22
|
+
MONTH21,
|
23
|
+
MONTH24,
|
24
|
+
MONTH27,
|
25
|
+
MONTH30,
|
26
|
+
MONTH33,
|
27
|
+
MONTH36,
|
28
|
+
MONTH39,
|
29
|
+
MONTH42,
|
30
|
+
MONTH45,
|
31
|
+
MONTH48,
|
32
|
+
WEEK2,
|
33
|
+
)
|
34
|
+
|
35
|
+
test_datetime = datetime(2019, 6, 11, 8, 00, tzinfo=ZoneInfo("UTC"))
|
36
|
+
|
37
|
+
|
38
|
+
@override_settings(
|
39
|
+
EDC_PROTOCOL_STUDY_OPEN_DATETIME=test_datetime - relativedelta(years=3),
|
40
|
+
EDC_PROTOCOL_STUDY_CLOSE_DATETIME=test_datetime + relativedelta(years=3),
|
41
|
+
)
|
16
42
|
class TestMnsiRequired(MetaTestCaseMixin, TestCase):
|
17
43
|
def setUp(self):
|
18
44
|
super().setUp()
|
19
|
-
|
45
|
+
traveller = time_machine.travel(test_datetime)
|
46
|
+
traveller.start()
|
47
|
+
self.baseline_datetime = get_utcnow()
|
20
48
|
|
21
|
-
six_months_ago = self.baseline_datetime
|
22
49
|
self.subject_screening = self.get_subject_screening(
|
23
|
-
report_datetime=
|
24
|
-
eligibility_datetime=
|
50
|
+
report_datetime=self.baseline_datetime,
|
51
|
+
eligibility_datetime=self.baseline_datetime,
|
25
52
|
)
|
26
53
|
self.subject_consent = self.get_subject_consent(
|
27
54
|
self.subject_screening,
|
28
|
-
consent_datetime=
|
29
|
-
)
|
30
|
-
self.subject_visit = self.get_subject_visit(
|
31
|
-
subject_screening=self.subject_screening,
|
32
|
-
subject_consent=self.subject_consent,
|
33
|
-
appt_datetime=six_months_ago,
|
34
|
-
)
|
35
|
-
|
36
|
-
def get_week2_visit(self):
|
37
|
-
return self.get_subject_visit(
|
38
|
-
subject_screening=self.subject_screening,
|
39
|
-
subject_consent=self.subject_consent,
|
40
|
-
visit_code=WEEK2,
|
41
|
-
appt_datetime=self.baseline_datetime + relativedelta(weeks=2),
|
42
|
-
)
|
43
|
-
|
44
|
-
def get_month1_visit(self):
|
45
|
-
return self.get_subject_visit(
|
46
|
-
subject_screening=self.subject_screening,
|
47
|
-
subject_consent=self.subject_consent,
|
48
|
-
visit_code=MONTH1,
|
49
|
-
appt_datetime=self.baseline_datetime + relativedelta(months=1),
|
50
|
-
)
|
51
|
-
|
52
|
-
def get_month3_visit(self):
|
53
|
-
return self.get_subject_visit(
|
54
|
-
subject_screening=self.subject_screening,
|
55
|
-
subject_consent=self.subject_consent,
|
56
|
-
visit_code=MONTH3,
|
57
|
-
appt_datetime=self.baseline_datetime + relativedelta(months=3),
|
58
|
-
)
|
59
|
-
|
60
|
-
def get_month6_visit(self):
|
61
|
-
return self.get_subject_visit(
|
62
|
-
subject_screening=self.subject_screening,
|
63
|
-
subject_consent=self.subject_consent,
|
64
|
-
visit_code=MONTH6,
|
65
|
-
appt_datetime=self.baseline_datetime + relativedelta(months=6),
|
55
|
+
consent_datetime=self.baseline_datetime,
|
66
56
|
)
|
67
57
|
|
68
|
-
|
69
|
-
return self.get_subject_visit(
|
58
|
+
self.subject_visit = self.get_subject_visit(
|
70
59
|
subject_screening=self.subject_screening,
|
71
60
|
subject_consent=self.subject_consent,
|
72
|
-
|
73
|
-
appt_datetime=self.baseline_datetime + relativedelta(months=9),
|
61
|
+
appt_datetime=self.baseline_datetime,
|
74
62
|
)
|
63
|
+
traveller.stop()
|
64
|
+
|
65
|
+
def get_visit(self, visit_code: str):
|
66
|
+
"""Returns a scheduled visit with the specified visit code.
|
67
|
+
|
68
|
+
If the visit already exists, it will be returned. If not, it
|
69
|
+
will be created (along with any interim visits) and returned.
|
70
|
+
"""
|
71
|
+
subject_identifier = self.subject_consent.subject_identifier
|
72
|
+
try:
|
73
|
+
subject_visit = SubjectVisit.objects.get(
|
74
|
+
subject_identifier=subject_identifier,
|
75
|
+
visit_code=visit_code,
|
76
|
+
visit_code_sequence=0,
|
77
|
+
)
|
78
|
+
except ObjectDoesNotExist:
|
79
|
+
subject_visit = (
|
80
|
+
SubjectVisit.objects.filter(
|
81
|
+
subject_identifier=subject_identifier,
|
82
|
+
visit_code_sequence=0,
|
83
|
+
)
|
84
|
+
.order_by("visit_code")
|
85
|
+
.last()
|
86
|
+
)
|
87
|
+
while subject_visit.visit_code != visit_code:
|
88
|
+
subject_visit = self.get_next_subject_visit(subject_visit)
|
89
|
+
|
90
|
+
self.assertEqual(subject_visit.visit_code, visit_code)
|
91
|
+
self.assertEqual(subject_visit.visit_code_sequence, 0)
|
92
|
+
return subject_visit
|
75
93
|
|
76
94
|
@staticmethod
|
77
95
|
def set_mnsi_status(subject_visit, mnsi_performed):
|
78
96
|
visit_mnsi = baker.make(
|
79
97
|
"meta_subject.mnsi",
|
98
|
+
report_datetime=subject_visit.report_datetime,
|
80
99
|
subject_visit=subject_visit,
|
81
100
|
mnsi_performed=mnsi_performed,
|
82
101
|
)
|
83
102
|
visit_mnsi.save()
|
84
103
|
|
104
|
+
def test_mnsi_not_required_at_baseline(self):
|
105
|
+
crfs = self.get_crf_metadata(self.subject_visit)
|
106
|
+
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
107
|
+
|
85
108
|
def test_mnsi_not_required_at_2w(self):
|
86
|
-
crfs = self.get_crf_metadata(self.
|
109
|
+
crfs = self.get_crf_metadata(self.get_visit(visit_code=WEEK2))
|
87
110
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
88
111
|
|
89
112
|
def test_mnsi_required_at_1m(self):
|
90
|
-
self.
|
91
|
-
|
92
|
-
month1_visit = self.get_month1_visit()
|
93
|
-
crfs = self.get_crf_metadata(month1_visit)
|
113
|
+
crfs = self.get_crf_metadata(self.get_visit(visit_code=MONTH1))
|
94
114
|
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
95
115
|
|
96
116
|
def test_mnsi_not_required_at_3m_if_already_performed_at_1m(self):
|
97
|
-
self.get_week2_visit()
|
98
|
-
|
99
117
|
# MNSI shouldn't be required at any point after it has been performed
|
100
|
-
month1_visit = self.
|
118
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
101
119
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=YES)
|
102
120
|
|
103
|
-
month3_visit = self.
|
121
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
104
122
|
crfs = self.get_crf_metadata(month3_visit)
|
105
123
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
106
124
|
|
107
125
|
def test_mnsi_required_at_3m_if_not_performed_at_1m(self):
|
108
|
-
self.
|
109
|
-
|
110
|
-
month1_visit = self.get_month1_visit()
|
126
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
111
127
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=NO)
|
112
128
|
|
113
|
-
month3_visit = self.
|
129
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
114
130
|
crfs = self.get_crf_metadata(month3_visit)
|
115
131
|
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
116
132
|
|
117
133
|
def test_mnsi_not_required_at_6m_if_already_performed_at_1m(self):
|
118
|
-
self.get_week2_visit()
|
119
|
-
|
120
134
|
# MNSI shouldn't be required at any point after it has been performed
|
121
|
-
month1_visit = self.
|
135
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
122
136
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=YES)
|
123
137
|
|
124
|
-
month3_visit = self.
|
138
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
125
139
|
crfs = self.get_crf_metadata(month3_visit)
|
126
140
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
127
141
|
|
128
|
-
month6_visit = self.
|
142
|
+
month6_visit = self.get_visit(visit_code=MONTH6)
|
129
143
|
crfs = self.get_crf_metadata(month6_visit)
|
130
144
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
131
145
|
|
132
146
|
def test_mnsi_not_required_at_6m_if_already_performed_at_3m(self):
|
133
|
-
self.
|
134
|
-
|
135
|
-
month1_visit = self.get_month1_visit()
|
147
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
136
148
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=NO)
|
137
149
|
|
138
150
|
# MNSI shouldn't be required at any point after it has been performed
|
139
|
-
month3_visit = self.
|
151
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
140
152
|
self.set_mnsi_status(subject_visit=month3_visit, mnsi_performed=YES)
|
141
153
|
|
142
|
-
month6_visit = self.
|
154
|
+
month6_visit = self.get_visit(visit_code=MONTH6)
|
143
155
|
crfs = self.get_crf_metadata(month6_visit)
|
144
156
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
145
157
|
|
146
158
|
def test_mnsi_required_at_6m_if_not_performed_by_3m(self):
|
147
|
-
self.
|
148
|
-
|
149
|
-
month1_visit = self.get_month1_visit()
|
159
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
150
160
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=NO)
|
151
161
|
|
152
|
-
month3_visit = self.
|
162
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
153
163
|
self.set_mnsi_status(subject_visit=month3_visit, mnsi_performed=NO)
|
154
164
|
|
155
|
-
month6_visit = self.
|
165
|
+
month6_visit = self.get_visit(visit_code=MONTH6)
|
156
166
|
crfs = self.get_crf_metadata(month6_visit)
|
157
167
|
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
158
168
|
|
159
169
|
def test_mnsi_not_required_at_9m_if_already_performed_at_1m(self):
|
160
|
-
self.get_week2_visit()
|
161
|
-
|
162
170
|
# MNSI shouldn't be required at any point after it has been performed
|
163
|
-
month1_visit = self.
|
171
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
164
172
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=YES)
|
165
173
|
|
166
|
-
month3_visit = self.
|
174
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
167
175
|
crfs = self.get_crf_metadata(month3_visit)
|
168
176
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
169
177
|
|
170
|
-
month6_visit = self.
|
178
|
+
month6_visit = self.get_visit(visit_code=MONTH6)
|
171
179
|
crfs = self.get_crf_metadata(month6_visit)
|
172
180
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
173
181
|
|
174
|
-
month9_visit = self.
|
182
|
+
month9_visit = self.get_visit(visit_code=MONTH9)
|
175
183
|
crfs = self.get_crf_metadata(month9_visit)
|
176
184
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
177
185
|
|
178
186
|
def test_mnsi_not_required_at_9m_if_already_performed_at_3m(self):
|
179
|
-
self.
|
180
|
-
|
181
|
-
month1_visit = self.get_month1_visit()
|
187
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
182
188
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=NO)
|
183
189
|
|
184
190
|
# MNSI shouldn't be required at any point after it has been performed
|
185
|
-
month3_visit = self.
|
191
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
186
192
|
self.set_mnsi_status(subject_visit=month3_visit, mnsi_performed=YES)
|
187
193
|
|
188
|
-
month6_visit = self.
|
194
|
+
month6_visit = self.get_visit(visit_code=MONTH6)
|
189
195
|
crfs = self.get_crf_metadata(month6_visit)
|
190
196
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
191
197
|
|
192
|
-
month9_visit = self.
|
198
|
+
month9_visit = self.get_visit(visit_code=MONTH9)
|
193
199
|
crfs = self.get_crf_metadata(month9_visit)
|
194
200
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
195
201
|
|
196
202
|
def test_mnsi_not_required_at_9m_if_already_performed_at_6m(self):
|
197
|
-
self.
|
198
|
-
|
199
|
-
month1_visit = self.get_month1_visit()
|
203
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
200
204
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=NO)
|
201
205
|
|
202
|
-
month3_visit = self.
|
206
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
203
207
|
self.set_mnsi_status(subject_visit=month3_visit, mnsi_performed=NO)
|
204
208
|
|
205
209
|
# MNSI shouldn't be required at any point after it has been performed
|
206
|
-
month6_visit = self.
|
210
|
+
month6_visit = self.get_visit(visit_code=MONTH6)
|
207
211
|
self.set_mnsi_status(subject_visit=month6_visit, mnsi_performed=YES)
|
208
212
|
|
209
|
-
month9_visit = self.
|
213
|
+
month9_visit = self.get_visit(visit_code=MONTH9)
|
210
214
|
crfs = self.get_crf_metadata(month9_visit)
|
211
215
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
212
216
|
|
213
|
-
def
|
214
|
-
self.
|
217
|
+
def test_mnsi_not_required_between_9m_and_33m_when_performed_in_first_6m(self):
|
218
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
219
|
+
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=NO)
|
220
|
+
|
221
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
222
|
+
self.set_mnsi_status(subject_visit=month3_visit, mnsi_performed=YES)
|
215
223
|
|
216
|
-
|
224
|
+
for visit_code in [
|
225
|
+
MONTH9,
|
226
|
+
MONTH12,
|
227
|
+
MONTH15,
|
228
|
+
MONTH18,
|
229
|
+
MONTH21,
|
230
|
+
MONTH24,
|
231
|
+
MONTH27,
|
232
|
+
MONTH30,
|
233
|
+
MONTH33,
|
234
|
+
]:
|
235
|
+
with self.subTest(visit_code=visit_code):
|
236
|
+
subject_visit = self.get_visit(visit_code=visit_code)
|
237
|
+
self.assertEqual(subject_visit.visit_code, visit_code)
|
238
|
+
self.assertEqual(subject_visit.visit_code_sequence, 0)
|
239
|
+
crfs = self.get_crf_metadata(subject_visit)
|
240
|
+
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
241
|
+
|
242
|
+
def test_mnsi_not_required_between_9m_and_33m_even_if_not_performed_first_6m(self):
|
243
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
217
244
|
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=NO)
|
218
245
|
|
219
|
-
month3_visit = self.
|
246
|
+
month3_visit = self.get_visit(visit_code=MONTH3)
|
220
247
|
self.set_mnsi_status(subject_visit=month3_visit, mnsi_performed=NO)
|
221
248
|
|
222
|
-
month6_visit = self.
|
249
|
+
month6_visit = self.get_visit(visit_code=MONTH6)
|
223
250
|
self.set_mnsi_status(subject_visit=month6_visit, mnsi_performed=NO)
|
224
251
|
|
225
|
-
|
226
|
-
|
227
|
-
|
252
|
+
for visit_code in [
|
253
|
+
MONTH9,
|
254
|
+
MONTH12,
|
255
|
+
MONTH15,
|
256
|
+
MONTH18,
|
257
|
+
MONTH21,
|
258
|
+
MONTH24,
|
259
|
+
MONTH27,
|
260
|
+
MONTH30,
|
261
|
+
MONTH33,
|
262
|
+
]:
|
263
|
+
with self.subTest(visit_code=visit_code):
|
264
|
+
subject_visit = self.get_visit(visit_code=visit_code)
|
265
|
+
self.assertEqual(subject_visit.visit_code, visit_code)
|
266
|
+
self.assertEqual(subject_visit.visit_code_sequence, 0)
|
267
|
+
crfs = self.get_crf_metadata(subject_visit)
|
268
|
+
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
269
|
+
|
270
|
+
def test_mnsi_required_between_36m_and_45m(self):
|
271
|
+
traveller = time_machine.travel(datetime(2024, 12, 17, tzinfo=ZoneInfo("UTC")))
|
272
|
+
traveller.start()
|
273
|
+
self.get_subject_consent_extended(self.subject_consent, consent_datetime=get_utcnow())
|
274
|
+
traveller.stop()
|
275
|
+
|
276
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
277
|
+
traveller = time_machine.travel(month1_visit.report_datetime)
|
278
|
+
traveller.start()
|
279
|
+
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=YES)
|
228
280
|
|
229
|
-
|
230
|
-
|
281
|
+
for visit_code in [MONTH36, MONTH39, MONTH42, MONTH45]:
|
282
|
+
with self.subTest(visit_code=visit_code):
|
283
|
+
subject_visit = self.get_visit(visit_code=visit_code)
|
284
|
+
crfs = self.get_crf_metadata(subject_visit)
|
285
|
+
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
286
|
+
self.set_mnsi_status(subject_visit=subject_visit, mnsi_performed=NO)
|
287
|
+
traveller.stop()
|
288
|
+
|
289
|
+
def test_mnsi_only_required_once_between_36m_and_45m(self):
|
290
|
+
traveller = time_machine.travel(datetime(2024, 12, 17, tzinfo=ZoneInfo("UTC")))
|
291
|
+
traveller.start()
|
292
|
+
self.get_subject_consent_extended(self.subject_consent, consent_datetime=get_utcnow())
|
293
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
294
|
+
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=YES)
|
231
295
|
|
232
|
-
|
233
|
-
self.
|
296
|
+
month36_visit = self.get_visit(visit_code=MONTH36)
|
297
|
+
crfs = self.get_crf_metadata(month36_visit)
|
298
|
+
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
299
|
+
self.set_mnsi_status(subject_visit=month36_visit, mnsi_performed=NO)
|
234
300
|
|
235
|
-
|
236
|
-
self.
|
301
|
+
month39_visit = self.get_next_subject_visit(month36_visit)
|
302
|
+
crfs = self.get_crf_metadata(month39_visit)
|
303
|
+
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
304
|
+
self.set_mnsi_status(subject_visit=month39_visit, mnsi_performed=NO)
|
237
305
|
|
238
|
-
|
239
|
-
self.
|
306
|
+
month42_visit = self.get_next_subject_visit(month39_visit)
|
307
|
+
crfs = self.get_crf_metadata(month42_visit)
|
308
|
+
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
309
|
+
self.set_mnsi_status(subject_visit=month42_visit, mnsi_performed=YES)
|
240
310
|
|
241
|
-
self.
|
311
|
+
month45_visit = self.get_next_subject_visit(month42_visit)
|
312
|
+
crfs = self.get_crf_metadata(month45_visit)
|
313
|
+
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
314
|
+
traveller.stop()
|
242
315
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
)
|
249
|
-
|
316
|
+
def test_mnsi_required_at_48m(self):
|
317
|
+
traveller = time_machine.travel(datetime(2024, 12, 16, tzinfo=ZoneInfo("UTC")))
|
318
|
+
traveller.start()
|
319
|
+
self.get_subject_consent_extended(self.subject_consent, consent_datetime=get_utcnow())
|
320
|
+
month1_visit = self.get_visit(visit_code=MONTH1)
|
321
|
+
crfs = self.get_crf_metadata(month1_visit)
|
322
|
+
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
323
|
+
self.set_mnsi_status(subject_visit=month1_visit, mnsi_performed=YES)
|
324
|
+
|
325
|
+
month3_visit = self.get_next_subject_visit(month1_visit)
|
326
|
+
crfs = self.get_crf_metadata(month3_visit)
|
250
327
|
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
328
|
+
|
329
|
+
month36_visit = self.get_visit(visit_code=MONTH36)
|
330
|
+
crfs = self.get_crf_metadata(month36_visit)
|
331
|
+
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
332
|
+
self.set_mnsi_status(subject_visit=month36_visit, mnsi_performed=YES)
|
333
|
+
|
334
|
+
month39_visit = self.get_next_subject_visit(month36_visit)
|
335
|
+
crfs = self.get_crf_metadata(month39_visit)
|
336
|
+
self.assertNotIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
337
|
+
|
338
|
+
month48_visit = self.get_visit(visit_code=MONTH48)
|
339
|
+
crfs = self.get_crf_metadata(month48_visit)
|
340
|
+
self.assertIn("meta_subject.mnsi", [o.model for o in crfs.all()])
|
341
|
+
traveller.stop()
|
@@ -9,7 +9,6 @@ from django.test import TestCase
|
|
9
9
|
from edc_constants.constants import COMPLETE, YES
|
10
10
|
from edc_metadata import KEYED, NOT_REQUIRED, REQUIRED
|
11
11
|
from edc_metadata.metadata import CrfMetadataGetter
|
12
|
-
from edc_metadata.metadata_handler import MetadataHandlerError
|
13
12
|
from edc_qol.constants import ALL_OF_THE_TIME, NONE_OF_THE_TIME, SOME_OF_THE_TIME
|
14
13
|
from edc_visit_schedule.constants import MONTH1, MONTH3, WEEK2
|
15
14
|
|
@@ -42,17 +41,6 @@ class TestSf12(MetaTestCaseMixin, TestCase):
|
|
42
41
|
site=Site.objects.get(id=settings.SITE_ID),
|
43
42
|
)
|
44
43
|
|
45
|
-
def test_baseline_not_required(self):
|
46
|
-
form = Sf12Form(data=self.data)
|
47
|
-
form.is_valid()
|
48
|
-
self.assertEqual({}, form._errors)
|
49
|
-
self.assertRaises(MetadataHandlerError, form.save)
|
50
|
-
|
51
|
-
crf_metadata_getter = CrfMetadataGetter(appointment=self.subject_visit.appointment)
|
52
|
-
self.assertFalse(
|
53
|
-
crf_metadata_getter.metadata_objects.filter(model="meta_subject.sf12").exists()
|
54
|
-
)
|
55
|
-
|
56
44
|
def test_1005_required(self):
|
57
45
|
subject_visit = self.get_next_subject_visit(self.subject_visit)
|
58
46
|
self.assertEqual(subject_visit.visit_code, WEEK2)
|
meta_visit_schedule/constants.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
DAY1 = "1000"
|
2
2
|
DELIVERY = "2000"
|
3
|
+
DM_BASELINE = "3000"
|
4
|
+
DM_FOLLOWUP = "3060"
|
3
5
|
MONTH1 = "1010"
|
4
6
|
MONTH12 = "1120"
|
5
7
|
MONTH15 = "1150"
|
@@ -11,10 +13,14 @@ MONTH3 = "1030"
|
|
11
13
|
MONTH30 = "1300"
|
12
14
|
MONTH33 = "1330"
|
13
15
|
MONTH36 = "1360"
|
16
|
+
MONTH39 = "1390"
|
17
|
+
MONTH42 = "1420"
|
18
|
+
MONTH45 = "1450"
|
19
|
+
MONTH48 = "1480"
|
14
20
|
MONTH6 = "1060"
|
15
21
|
MONTH9 = "1090"
|
16
|
-
POSTNATAL = "3000"
|
17
22
|
SCHEDULE = "schedule"
|
23
|
+
SCHEDULE_DM_REFERRAL = "schedule_dm_referral"
|
18
24
|
SCHEDULE_POSTNATAL = "schedule_postnatal"
|
19
25
|
SCHEDULE_PREGNANCY = "schedule_pregnancy"
|
20
26
|
VISIT_SCHEDULE = "visit_schedule"
|