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
@@ -0,0 +1,29 @@
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-04-04 16:47
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
("meta_prn", "0057_historicalonscheduledmreferral_and_more"),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AddField(
|
14
|
+
model_name="dmreferral",
|
15
|
+
name="referral_note",
|
16
|
+
field=models.TextField(
|
17
|
+
null=True,
|
18
|
+
verbose_name="Please provide a brief history of the diabetes diagnosis that lead to this referral",
|
19
|
+
),
|
20
|
+
),
|
21
|
+
migrations.AddField(
|
22
|
+
model_name="historicaldmreferral",
|
23
|
+
name="referral_note",
|
24
|
+
field=models.TextField(
|
25
|
+
null=True,
|
26
|
+
verbose_name="Please provide a brief history of the diabetes diagnosis that lead to this referral",
|
27
|
+
),
|
28
|
+
),
|
29
|
+
]
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Generated by Django 5.0.4 on 2024-04-18 23:46
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
("meta_prn", "0058_dmreferral_referral_note_and_more"),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AlterField(
|
14
|
+
model_name="historicaloffstudymedication",
|
15
|
+
name="reason",
|
16
|
+
field=models.CharField(
|
17
|
+
choices=[
|
18
|
+
("pregnancy", "Pregnancy"),
|
19
|
+
("sae", "Participant is experiencing a serious adverse event"),
|
20
|
+
(
|
21
|
+
"clinician",
|
22
|
+
"Other condition that justifies discontinuation of treatment in the clinician's opinion (specify below)",
|
23
|
+
),
|
24
|
+
("investigator", " Investigator decision"),
|
25
|
+
("referral", "Referral to Diabetes clinic"),
|
26
|
+
("patient", "Patient decision"),
|
27
|
+
("OTHER", "Other reason (specify below)"),
|
28
|
+
],
|
29
|
+
max_length=25,
|
30
|
+
verbose_name="Reason for stopping study medication",
|
31
|
+
),
|
32
|
+
),
|
33
|
+
migrations.AlterField(
|
34
|
+
model_name="offstudymedication",
|
35
|
+
name="reason",
|
36
|
+
field=models.CharField(
|
37
|
+
choices=[
|
38
|
+
("pregnancy", "Pregnancy"),
|
39
|
+
("sae", "Participant is experiencing a serious adverse event"),
|
40
|
+
(
|
41
|
+
"clinician",
|
42
|
+
"Other condition that justifies discontinuation of treatment in the clinician's opinion (specify below)",
|
43
|
+
),
|
44
|
+
("investigator", " Investigator decision"),
|
45
|
+
("referral", "Referral to Diabetes clinic"),
|
46
|
+
("patient", "Patient decision"),
|
47
|
+
("OTHER", "Other reason (specify below)"),
|
48
|
+
],
|
49
|
+
max_length=25,
|
50
|
+
verbose_name="Reason for stopping study medication",
|
51
|
+
),
|
52
|
+
),
|
53
|
+
]
|
meta_prn/models/__init__.py
CHANGED
@@ -1,8 +1,19 @@
|
|
1
|
+
from .dm_referral import DmReferral
|
1
2
|
from .end_of_study import EndOfStudy
|
2
3
|
from .loss_to_followup import LossToFollowup
|
3
4
|
from .off_study_medication import OffStudyMedication
|
4
|
-
from .offschedule import
|
5
|
-
|
5
|
+
from .offschedule import (
|
6
|
+
OffSchedule,
|
7
|
+
OffScheduleDmReferral,
|
8
|
+
OffSchedulePostnatal,
|
9
|
+
OffSchedulePregnancy,
|
10
|
+
)
|
11
|
+
from .onschedule import (
|
12
|
+
OnSchedule,
|
13
|
+
OnScheduleDmReferral,
|
14
|
+
OnSchedulePostnatal,
|
15
|
+
OnSchedulePregnancy,
|
16
|
+
)
|
6
17
|
from .pregnancy_notification import PregnancyNotification
|
7
18
|
from .protocol_incident import ProtocolIncident
|
8
19
|
from .signals import (
|
@@ -0,0 +1,39 @@
|
|
1
|
+
from django.db import models
|
2
|
+
from edc_action_item.models import ActionModelMixin
|
3
|
+
from edc_identifier.model_mixins import UniqueSubjectIdentifierFieldMixin
|
4
|
+
from edc_model.models import BaseUuidModel
|
5
|
+
from edc_sites.model_mixins import SiteModelMixin
|
6
|
+
from edc_utils.date import get_utcnow
|
7
|
+
|
8
|
+
from ..constants import DM_REFFERAL_ACTION
|
9
|
+
|
10
|
+
|
11
|
+
class DmReferral(
|
12
|
+
SiteModelMixin,
|
13
|
+
ActionModelMixin,
|
14
|
+
UniqueSubjectIdentifierFieldMixin,
|
15
|
+
BaseUuidModel,
|
16
|
+
):
|
17
|
+
|
18
|
+
action_name = DM_REFFERAL_ACTION
|
19
|
+
|
20
|
+
report_datetime = models.DateTimeField(
|
21
|
+
verbose_name="Report date and time", default=get_utcnow
|
22
|
+
)
|
23
|
+
|
24
|
+
referral_date = models.DateField(
|
25
|
+
verbose_name="Date of referral to diabetes clinic",
|
26
|
+
)
|
27
|
+
|
28
|
+
referral_note = models.TextField(
|
29
|
+
verbose_name=(
|
30
|
+
"Please provide a brief history of the "
|
31
|
+
"diabetes diagnosis that lead to this referral"
|
32
|
+
),
|
33
|
+
null=True,
|
34
|
+
blank=False,
|
35
|
+
)
|
36
|
+
|
37
|
+
class Meta(ActionModelMixin.Meta, BaseUuidModel.Meta):
|
38
|
+
verbose_name = "Diabetes referral"
|
39
|
+
verbose_name_plural = "Diabetes referral"
|
meta_prn/models/offschedule.py
CHANGED
@@ -4,7 +4,11 @@ from edc_sites.model_mixins import SiteModelMixin
|
|
4
4
|
from edc_visit_schedule.constants import OFFSCHEDULE_ACTION
|
5
5
|
from edc_visit_schedule.model_mixins import OffScheduleModelMixin
|
6
6
|
|
7
|
-
from ..constants import
|
7
|
+
from ..constants import (
|
8
|
+
OFFSCHEDULE_DM_REFERRAL_ACTION,
|
9
|
+
OFFSCHEDULE_POSTNATAL_ACTION,
|
10
|
+
OFFSCHEDULE_PREGNANCY_ACTION,
|
11
|
+
)
|
8
12
|
|
9
13
|
|
10
14
|
class OffSchedule(SiteModelMixin, ActionModelMixin, OffScheduleModelMixin, BaseUuidModel):
|
@@ -34,3 +38,13 @@ class OffSchedulePostnatal(
|
|
34
38
|
class Meta(OffScheduleModelMixin.Meta, BaseUuidModel.Meta):
|
35
39
|
verbose_name = "Off-schedule: post-natal"
|
36
40
|
verbose_name_plural = "Off-schedule: post-natal"
|
41
|
+
|
42
|
+
|
43
|
+
class OffScheduleDmReferral(
|
44
|
+
SiteModelMixin, ActionModelMixin, OffScheduleModelMixin, BaseUuidModel
|
45
|
+
):
|
46
|
+
action_name = OFFSCHEDULE_DM_REFERRAL_ACTION
|
47
|
+
|
48
|
+
class Meta(OffScheduleModelMixin.Meta, BaseUuidModel.Meta):
|
49
|
+
verbose_name = "Off-schedule: DM Referral"
|
50
|
+
verbose_name_plural = "Off-schedule: DM Referral"
|
meta_prn/models/onschedule.py
CHANGED
@@ -18,3 +18,9 @@ class OnSchedulePregnancy(OnScheduleModelMixin, SiteModelMixin, BaseUuidModel):
|
|
18
18
|
class OnSchedulePostnatal(OnScheduleModelMixin, SiteModelMixin, BaseUuidModel):
|
19
19
|
class Meta(OnScheduleModelMixin.Meta):
|
20
20
|
pass
|
21
|
+
|
22
|
+
|
23
|
+
class OnScheduleDmReferral(OnScheduleModelMixin, SiteModelMixin, BaseUuidModel):
|
24
|
+
class Meta(OnScheduleModelMixin.Meta, BaseUuidModel.Meta):
|
25
|
+
verbose_name = "On-schedule: DM Referral"
|
26
|
+
verbose_name_plural = "On-schedule: DM Referral"
|
meta_prn/models/signals.py
CHANGED
@@ -5,8 +5,15 @@ from edc_constants.constants import YES
|
|
5
5
|
from edc_visit_schedule.site_visit_schedules import site_visit_schedules
|
6
6
|
|
7
7
|
from meta_subject.models import SubjectVisit, UrinePregnancy
|
8
|
-
from meta_visit_schedule.constants import
|
8
|
+
from meta_visit_schedule.constants import (
|
9
|
+
SCHEDULE,
|
10
|
+
SCHEDULE_DM_REFERRAL,
|
11
|
+
SCHEDULE_PREGNANCY,
|
12
|
+
VISIT_SCHEDULE,
|
13
|
+
)
|
9
14
|
|
15
|
+
from . import OffScheduleDmReferral
|
16
|
+
from .dm_referral import DmReferral
|
10
17
|
from .offschedule import OffSchedule
|
11
18
|
from .pregnancy_notification import PregnancyNotification
|
12
19
|
|
@@ -63,3 +70,36 @@ def update_urine_pregnancy_on_pregnancy_notification_on_post_save(
|
|
63
70
|
notified_datetime=instance.report_datetime,
|
64
71
|
notified=True,
|
65
72
|
)
|
73
|
+
|
74
|
+
|
75
|
+
@receiver(
|
76
|
+
post_save,
|
77
|
+
weak=False,
|
78
|
+
sender=DmReferral,
|
79
|
+
dispatch_uid="update_schedule_on_dm_referral_post_save",
|
80
|
+
)
|
81
|
+
def update_schedule_on_dm_referral_post_save(sender, instance, raw, **kwargs):
|
82
|
+
if not raw:
|
83
|
+
try:
|
84
|
+
OffScheduleDmReferral.objects.get(subject_identifier=instance.subject_identifier)
|
85
|
+
except ObjectDoesNotExist:
|
86
|
+
last_subject_visit = (
|
87
|
+
SubjectVisit.objects.filter(
|
88
|
+
subject_identifier=instance.subject_identifier,
|
89
|
+
schedule_name=SCHEDULE,
|
90
|
+
)
|
91
|
+
.order_by("report_datetime")
|
92
|
+
.last()
|
93
|
+
)
|
94
|
+
visit_schedule = site_visit_schedules.get_visit_schedule(
|
95
|
+
visit_schedule_name=VISIT_SCHEDULE
|
96
|
+
)
|
97
|
+
schedule = visit_schedule.schedules.get(SCHEDULE)
|
98
|
+
schedule.take_off_schedule(
|
99
|
+
instance.subject_identifier, last_subject_visit.report_datetime
|
100
|
+
)
|
101
|
+
schedule = visit_schedule.schedules.get(SCHEDULE_DM_REFERRAL)
|
102
|
+
schedule.put_on_schedule(
|
103
|
+
onschedule_datetime=last_subject_visit.report_datetime,
|
104
|
+
subject_identifier=instance.subject_identifier,
|
105
|
+
)
|
@@ -0,0 +1,203 @@
|
|
1
|
+
from dateutil.relativedelta import relativedelta
|
2
|
+
from django.core.exceptions import ObjectDoesNotExist
|
3
|
+
from django.test import TestCase
|
4
|
+
from edc_action_item.models import ActionItem
|
5
|
+
from edc_appointment.constants import COMPLETE_APPT
|
6
|
+
from edc_appointment.models import Appointment
|
7
|
+
from edc_constants.constants import CLOSED, FEMALE, NEW, NO, PATIENT, YES
|
8
|
+
from edc_pharmacy.constants import IN_PROGRESS_APPT
|
9
|
+
from edc_utils import get_utcnow
|
10
|
+
from edc_visit_schedule.constants import MONTH1, OFFSCHEDULE_ACTION
|
11
|
+
from edc_visit_tracking.constants import SCHEDULED
|
12
|
+
|
13
|
+
from meta_lists.models import MissedReferralReasons
|
14
|
+
from meta_prn.constants import (
|
15
|
+
OFFSCHEDULE_DM_REFERRAL_ACTION,
|
16
|
+
OFFSTUDY_MEDICATION_ACTION,
|
17
|
+
)
|
18
|
+
from meta_prn.models import DmReferral, OnScheduleDmReferral
|
19
|
+
from meta_screening.tests.meta_test_case_mixin import MetaTestCaseMixin
|
20
|
+
from meta_subject.constants import DM_FOLLOWUP_ACTION
|
21
|
+
from meta_subject.models import DmEndpoint, DmFollowup, SubjectVisit
|
22
|
+
from meta_visit_schedule.constants import DM_BASELINE, DM_FOLLOWUP, SCHEDULE_DM_REFERRAL
|
23
|
+
|
24
|
+
|
25
|
+
class TestDmReferral(MetaTestCaseMixin, TestCase):
|
26
|
+
def setUp(self):
|
27
|
+
super().setUp()
|
28
|
+
self.subject_visit = self.get_subject_visit(gender=FEMALE)
|
29
|
+
|
30
|
+
def test_dm_referral_puts_subject_on_dm_followup_schedule(self):
|
31
|
+
subject_visit = self.get_next_subject_visit(self.subject_visit)
|
32
|
+
subject_visit = self.get_next_subject_visit(subject_visit)
|
33
|
+
self.assertEqual(subject_visit.visit_code, MONTH1)
|
34
|
+
dm_referral = DmReferral.objects.create(
|
35
|
+
subject_identifier=subject_visit.subject_identifier,
|
36
|
+
report_datetime=get_utcnow(),
|
37
|
+
referral_date=get_utcnow(),
|
38
|
+
)
|
39
|
+
self.assertIsNotNone(dm_referral.report_datetime)
|
40
|
+
self.assertIsNotNone(dm_referral.referral_date)
|
41
|
+
self.assertIsNotNone(dm_referral.action_identifier)
|
42
|
+
|
43
|
+
# verify subject is on DM Followup schedule
|
44
|
+
try:
|
45
|
+
OnScheduleDmReferral.objects.get(
|
46
|
+
subject_identifier=subject_visit.subject_identifier
|
47
|
+
)
|
48
|
+
except ObjectDoesNotExist:
|
49
|
+
self.fail("OnScheduleDmReferral unexpectedly does not exist")
|
50
|
+
|
51
|
+
def test_dm_referral_action_creates_offschedule_action(self):
|
52
|
+
subject_visit = self.get_next_subject_visit(self.subject_visit)
|
53
|
+
subject_visit = self.get_next_subject_visit(subject_visit)
|
54
|
+
self.assertEqual(subject_visit.visit_code, MONTH1)
|
55
|
+
dm_referral = DmReferral.objects.create(
|
56
|
+
subject_identifier=subject_visit.subject_identifier,
|
57
|
+
report_datetime=get_utcnow(),
|
58
|
+
referral_date=get_utcnow(),
|
59
|
+
)
|
60
|
+
self.assertIsNotNone(dm_referral.report_datetime)
|
61
|
+
self.assertIsNotNone(dm_referral.referral_date)
|
62
|
+
self.assertIsNotNone(dm_referral.action_identifier)
|
63
|
+
|
64
|
+
try:
|
65
|
+
ActionItem.objects.get(
|
66
|
+
subject_identifier=subject_visit.subject_identifier,
|
67
|
+
action_type__name=OFFSCHEDULE_ACTION,
|
68
|
+
status=CLOSED,
|
69
|
+
)
|
70
|
+
except ObjectDoesNotExist:
|
71
|
+
self.fail(f"{OFFSCHEDULE_ACTION} Action item unexpectedly does not exist")
|
72
|
+
|
73
|
+
def test_dm_referral_creates_offstudy_med_action(self):
|
74
|
+
subject_visit = self.get_next_subject_visit(self.subject_visit)
|
75
|
+
subject_visit = self.get_next_subject_visit(subject_visit)
|
76
|
+
self.assertEqual(subject_visit.visit_code, MONTH1)
|
77
|
+
dm_referral = DmReferral.objects.create(
|
78
|
+
subject_identifier=subject_visit.subject_identifier,
|
79
|
+
report_datetime=get_utcnow(),
|
80
|
+
referral_date=get_utcnow(),
|
81
|
+
)
|
82
|
+
self.assertIsNotNone(dm_referral.report_datetime)
|
83
|
+
self.assertIsNotNone(dm_referral.referral_date)
|
84
|
+
self.assertIsNotNone(dm_referral.action_identifier)
|
85
|
+
|
86
|
+
# verify action items are created
|
87
|
+
try:
|
88
|
+
ActionItem.objects.get(
|
89
|
+
subject_identifier=subject_visit.subject_identifier,
|
90
|
+
action_type__name=OFFSTUDY_MEDICATION_ACTION,
|
91
|
+
status=NEW,
|
92
|
+
)
|
93
|
+
except ObjectDoesNotExist:
|
94
|
+
self.fail(f"{OFFSTUDY_MEDICATION_ACTION} Action item unexpectedly does not exist")
|
95
|
+
|
96
|
+
def test_dm_referral_creates_dm_followup_action(self):
|
97
|
+
subject_visit = self.get_next_subject_visit(self.subject_visit)
|
98
|
+
subject_visit = self.get_next_subject_visit(subject_visit)
|
99
|
+
self.assertEqual(subject_visit.visit_code, MONTH1)
|
100
|
+
dm_referral = DmReferral.objects.create(
|
101
|
+
subject_identifier=subject_visit.subject_identifier,
|
102
|
+
report_datetime=get_utcnow(),
|
103
|
+
referral_date=get_utcnow(),
|
104
|
+
)
|
105
|
+
self.assertIsNotNone(dm_referral.report_datetime)
|
106
|
+
self.assertIsNotNone(dm_referral.referral_date)
|
107
|
+
self.assertIsNotNone(dm_referral.action_identifier)
|
108
|
+
|
109
|
+
try:
|
110
|
+
ActionItem.objects.get(
|
111
|
+
subject_identifier=subject_visit.subject_identifier,
|
112
|
+
action_type__name=DM_FOLLOWUP_ACTION,
|
113
|
+
status=NEW,
|
114
|
+
)
|
115
|
+
except ObjectDoesNotExist:
|
116
|
+
self.fail(f"{DM_FOLLOWUP_ACTION} Action item unexpectedly does not exist")
|
117
|
+
|
118
|
+
def test_dm_referral2(self):
|
119
|
+
subject_visit = self.get_next_subject_visit(self.subject_visit)
|
120
|
+
subject_visit = self.get_next_subject_visit(subject_visit)
|
121
|
+
self.assertEqual(subject_visit.visit_code, MONTH1)
|
122
|
+
referral_datetime = subject_visit.report_datetime
|
123
|
+
DmReferral.objects.create(
|
124
|
+
subject_identifier=subject_visit.subject_identifier,
|
125
|
+
report_datetime=referral_datetime,
|
126
|
+
referral_date=referral_datetime.date(),
|
127
|
+
)
|
128
|
+
|
129
|
+
# Add DM Baseline
|
130
|
+
appointment = Appointment.objects.get(
|
131
|
+
subject_identifier=subject_visit.subject_identifier,
|
132
|
+
schedule_name=SCHEDULE_DM_REFERRAL,
|
133
|
+
visit_code=DM_BASELINE,
|
134
|
+
)
|
135
|
+
appointment.appt_status = IN_PROGRESS_APPT
|
136
|
+
appointment.save()
|
137
|
+
|
138
|
+
subject_visit = SubjectVisit.objects.create(
|
139
|
+
appointment=appointment,
|
140
|
+
subject_identifier=subject_visit.subject_identifier,
|
141
|
+
report_datetime=appointment.appt_datetime,
|
142
|
+
reason=SCHEDULED,
|
143
|
+
info_source=PATIENT,
|
144
|
+
)
|
145
|
+
|
146
|
+
DmEndpoint.objects.create(
|
147
|
+
subject_visit=subject_visit,
|
148
|
+
report_datetime=get_utcnow(),
|
149
|
+
dx_date=referral_datetime.date(),
|
150
|
+
dx_initiated_by="fbg_confirmed",
|
151
|
+
dx_tmg=YES,
|
152
|
+
dx_tmg_date=referral_datetime.date(),
|
153
|
+
)
|
154
|
+
|
155
|
+
# Add DM Followup
|
156
|
+
followup_datetime = referral_datetime + relativedelta(months=6)
|
157
|
+
appointment = Appointment.objects.get(
|
158
|
+
subject_identifier=subject_visit.subject_identifier,
|
159
|
+
schedule_name=SCHEDULE_DM_REFERRAL,
|
160
|
+
visit_code=DM_FOLLOWUP,
|
161
|
+
)
|
162
|
+
appointment.appt_status = IN_PROGRESS_APPT
|
163
|
+
appointment.save()
|
164
|
+
|
165
|
+
subject_visit = SubjectVisit.objects.create(
|
166
|
+
appointment=appointment,
|
167
|
+
subject_identifier=subject_visit.subject_identifier,
|
168
|
+
report_datetime=appointment.appt_datetime,
|
169
|
+
reason=SCHEDULED,
|
170
|
+
info_source=PATIENT,
|
171
|
+
)
|
172
|
+
|
173
|
+
dm_followup = DmFollowup.objects.create(
|
174
|
+
subject_visit=subject_visit,
|
175
|
+
report_datetime=followup_datetime,
|
176
|
+
referral_date=referral_datetime.date(),
|
177
|
+
attended=NO,
|
178
|
+
on_dm_medications=NO,
|
179
|
+
)
|
180
|
+
dm_followup.missed_referral_reasons.set([MissedReferralReasons.objects.all()[0]])
|
181
|
+
|
182
|
+
appointment.appt_status = COMPLETE_APPT
|
183
|
+
appointment.save()
|
184
|
+
|
185
|
+
try:
|
186
|
+
ActionItem.objects.get(
|
187
|
+
subject_identifier=subject_visit.subject_identifier,
|
188
|
+
action_type__name=DM_FOLLOWUP_ACTION,
|
189
|
+
status=CLOSED,
|
190
|
+
)
|
191
|
+
except ObjectDoesNotExist:
|
192
|
+
self.fail(f"{DM_FOLLOWUP_ACTION} Action item unexpectedly does not exist")
|
193
|
+
|
194
|
+
try:
|
195
|
+
ActionItem.objects.get(
|
196
|
+
subject_identifier=subject_visit.subject_identifier,
|
197
|
+
action_type__name=OFFSCHEDULE_DM_REFERRAL_ACTION,
|
198
|
+
status=NEW,
|
199
|
+
)
|
200
|
+
except ObjectDoesNotExist:
|
201
|
+
self.fail(
|
202
|
+
f"{OFFSCHEDULE_DM_REFERRAL_ACTION} Action item unexpectedly does not exist"
|
203
|
+
)
|
meta_reports/__init__.py
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
from .tasks import update_endpoints_table
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from .dbviews import (
|
2
|
+
GlucoseSummaryAdmin,
|
3
|
+
ImpSubstitutionsAdmin,
|
4
|
+
MissingOgttNoteModelAdmin,
|
5
|
+
MissingScreeningOgttAdmin,
|
6
|
+
OnStudyMissingLabValuesAdmin,
|
7
|
+
OnStudyMissingValuesAdmin,
|
8
|
+
PatientHistoryMissingBaselineCd4Admin,
|
9
|
+
UnattendedThreeInRow2Admin,
|
10
|
+
UnattendedThreeInRowAdmin,
|
11
|
+
UnattendedTwoInRowAdmin,
|
12
|
+
)
|
13
|
+
from .endpoints_admin import EndpointsAdmin
|
14
|
+
from .endpoints_all_admin import EndpointsAllAdmin
|
15
|
+
from .last_imp_refill_admin import LastImpRefillAdmin
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from .glucose_summary_admin import GlucoseSummaryAdmin
|
2
|
+
from .imp_substitutions_admin import ImpSubstitutionsAdmin
|
3
|
+
from .missing_screening_ogtt_admin import (
|
4
|
+
MissingOgttNoteModelAdmin,
|
5
|
+
MissingScreeningOgttAdmin,
|
6
|
+
)
|
7
|
+
from .on_study_missing_lab_values_admin import OnStudyMissingLabValuesAdmin
|
8
|
+
from .on_study_missing_values_admin import OnStudyMissingValuesAdmin
|
9
|
+
from .patient_history_missing_baseline_cd4_admin import (
|
10
|
+
PatientHistoryMissingBaselineCd4Admin,
|
11
|
+
)
|
12
|
+
from .unattended_three_in_row2_admin import UnattendedThreeInRow2Admin
|
13
|
+
from .unattended_three_in_row_admin import UnattendedThreeInRowAdmin
|
14
|
+
from .unattended_two_in_row_admin import UnattendedTwoInRowAdmin
|
@@ -0,0 +1,116 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from django.core.exceptions import ObjectDoesNotExist
|
3
|
+
from django.template.loader import render_to_string
|
4
|
+
from django.urls import reverse
|
5
|
+
from edc_constants.constants import YES
|
6
|
+
from edc_glucose.list_filters import FbgListFilter, OgttListFilter
|
7
|
+
from edc_model_admin.dashboard import ModelAdminDashboardMixin
|
8
|
+
from edc_model_admin.mixins import TemplatesModelAdminMixin
|
9
|
+
from edc_qareports.modeladmin_mixins import QaReportModelAdminMixin
|
10
|
+
from edc_sites.admin import SiteModelAdminMixin
|
11
|
+
from edc_visit_schedule.admin import ScheduleStatusListFilter
|
12
|
+
|
13
|
+
from ...admin_site import meta_reports_admin
|
14
|
+
from ...models import Endpoints, EndpointsProxy, GlucoseSummary
|
15
|
+
from ..list_filters import EndpointListFilter
|
16
|
+
|
17
|
+
|
18
|
+
@admin.register(GlucoseSummary, site=meta_reports_admin)
|
19
|
+
class GlucoseSummaryAdmin(
|
20
|
+
QaReportModelAdminMixin,
|
21
|
+
SiteModelAdminMixin,
|
22
|
+
ModelAdminDashboardMixin,
|
23
|
+
TemplatesModelAdminMixin,
|
24
|
+
admin.ModelAdmin,
|
25
|
+
):
|
26
|
+
ordering = ["site", "subject_identifier", "fbg_datetime"]
|
27
|
+
include_note_column = False
|
28
|
+
list_display = [
|
29
|
+
"dashboard",
|
30
|
+
"subject_identifier_link",
|
31
|
+
"site",
|
32
|
+
"visit",
|
33
|
+
"fasted",
|
34
|
+
"fbg_date",
|
35
|
+
"fbg_value",
|
36
|
+
"ogtt_value",
|
37
|
+
"ogtt_date",
|
38
|
+
"endpoint",
|
39
|
+
"offstudy_date",
|
40
|
+
]
|
41
|
+
|
42
|
+
list_filter = [
|
43
|
+
ScheduleStatusListFilter,
|
44
|
+
"fasted",
|
45
|
+
FbgListFilter,
|
46
|
+
OgttListFilter,
|
47
|
+
"fbg_datetime",
|
48
|
+
"ogtt_datetime",
|
49
|
+
EndpointListFilter,
|
50
|
+
]
|
51
|
+
|
52
|
+
search_fields = ["subject_identifier"]
|
53
|
+
|
54
|
+
@admin.display(description="visit", ordering="visit_code")
|
55
|
+
def visit(self, obj=None):
|
56
|
+
return f"{obj.visit_code}.{obj.visit_code_sequence}"
|
57
|
+
|
58
|
+
@admin.display(description="Endpoint")
|
59
|
+
def endpoint(self, obj=None):
|
60
|
+
try:
|
61
|
+
endpoint_obj = Endpoints.objects.get(subject_identifier=obj.subject_identifier)
|
62
|
+
except ObjectDoesNotExist:
|
63
|
+
value = None
|
64
|
+
else:
|
65
|
+
if endpoint_obj.offstudy_date:
|
66
|
+
url = reverse("meta_reports_admin:meta_reports_endpointsproxy_changelist")
|
67
|
+
title = f"Go to {EndpointsProxy._meta.verbose_name}"
|
68
|
+
else:
|
69
|
+
url = reverse("meta_reports_admin:meta_reports_endpoints_changelist")
|
70
|
+
title = f"Go to {Endpoints._meta.verbose_name}"
|
71
|
+
value = render_to_string(
|
72
|
+
"meta_reports/columns/subject_identifier_column.html",
|
73
|
+
{
|
74
|
+
"subject_identifier": obj.subject_identifier,
|
75
|
+
"url": url,
|
76
|
+
"label": YES,
|
77
|
+
"title": title,
|
78
|
+
},
|
79
|
+
)
|
80
|
+
return value
|
81
|
+
|
82
|
+
@admin.display(description="Subject Idenfifier", ordering="subject_identifier")
|
83
|
+
def subject_identifier_link(self, obj=None):
|
84
|
+
url = reverse("meta_reports_admin:meta_reports_glucosesummary_changelist")
|
85
|
+
return render_to_string(
|
86
|
+
"meta_reports/columns/subject_identifier_column.html",
|
87
|
+
{
|
88
|
+
"subject_identifier": obj.subject_identifier,
|
89
|
+
"url": url,
|
90
|
+
"title": "Click to filter for this subject only",
|
91
|
+
},
|
92
|
+
)
|
93
|
+
|
94
|
+
def get_subject_dashboard_url_kwargs(self, obj) -> dict:
|
95
|
+
return dict(
|
96
|
+
subject_identifier=obj.subject_identifier,
|
97
|
+
appointment=obj.appointment_id,
|
98
|
+
)
|
99
|
+
|
100
|
+
@admin.display(description="Fbg date", ordering="fbg_datetime")
|
101
|
+
def fbg_date(self, obj):
|
102
|
+
if obj.fbg_datetime:
|
103
|
+
return obj.fbg_datetime.date()
|
104
|
+
return None
|
105
|
+
|
106
|
+
@admin.display(description="OGTT date", ordering="ogtt_datetime")
|
107
|
+
def ogtt_date(self, obj):
|
108
|
+
if obj.ogtt_datetime:
|
109
|
+
return obj.ogtt_datetime.date()
|
110
|
+
return None
|
111
|
+
|
112
|
+
@admin.display(description="Offstudy date", ordering="offstudy_datetime")
|
113
|
+
def offstudy_date(self, obj):
|
114
|
+
if obj.offstudy_datetime:
|
115
|
+
return obj.offstudy_datetime.date()
|
116
|
+
return None
|