meta-edc 0.3.15__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 +22 -0
- 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 +1 -0
- meta_consent/consents.py +20 -1
- 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/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 +18 -0
- meta_consent/models/subject_consent_v1_ext.py +29 -0
- meta_consent/tests/holidays.csv +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/subject/dashboard/sidebar.html +24 -0
- meta_dashboard/templates/meta_dashboard/bootstrap3/subject/dashboard.html +3 -0
- 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 +10 -2
- meta_edc/settings/defaults.py +58 -43
- meta_edc/templates/meta_edc/bootstrap3/home.html +5 -2
- meta_edc/tests/tests/test_endpoints.py +2 -0
- meta_edc/urls.py +4 -1
- 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.15.dist-info → meta_edc-0.3.50.dist-info}/RECORD +316 -127
- {meta_edc-0.3.15.dist-info → meta_edc-0.3.50.dist-info}/WHEEL +1 -1
- {meta_edc-0.3.15.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 +9 -1
- meta_prn/admin/pregnancy_notification_admin.py +6 -2
- meta_prn/migrations/0034_auto_20220630_1110.py +3 -3
- meta_prn/migrations/0035_auto_20220630_1140.py +59 -56
- meta_prn/tests/tests/test_dm_referral.py +3 -6
- 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/migrations/0067_alter_historicalscreeningpartone_report_datetime_and_more.py +84 -0
- meta_screening/tests/holidays.csv +1 -1
- meta_screening/tests/meta_test_case_mixin.py +15 -0
- meta_sites/tests/test_sites.py +1 -1
- meta_subject/action_items.py +2 -2
- meta_subject/admin/__init__.py +2 -1
- meta_subject/admin/birth_outcome_admin.py +2 -0
- 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/diabetes/__init__.py +1 -1
- meta_subject/admin/diabetes/dm_endpoint_admin.py +35 -0
- meta_subject/admin/glucose_fbg_admin.py +4 -0
- meta_subject/admin/other_arv_regimens_admin.py +2 -0
- meta_subject/admin/study_medication_admin.py +10 -0
- meta_subject/form_validators/__init__.py +1 -1
- meta_subject/form_validators/dm_endpoint_form_validator.py +35 -0
- meta_subject/forms/__init__.py +2 -2
- 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 +1 -2
- meta_subject/forms/diabetes/dm_endpoint_form.py +13 -0
- meta_subject/forms/study_medication_form.py +35 -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 +7 -0
- meta_subject/metadata_rules/predicates.py +45 -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/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_lipid.py → blood_results_lipids.py} +3 -3
- meta_subject/models/diabetes/__init__.py +1 -2
- meta_subject/models/diabetes/dm_endpoint.py +61 -0
- meta_subject/models/glucose.py +4 -1
- meta_subject/models/physical_exam.py +1 -0
- meta_subject/models/signals.py +19 -0
- 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_medication_adherence.py +5 -1
- meta_subject/tests/tests/test_metadata_rules.py +2 -2
- meta_subject/tests/tests/test_mnsi.py +212 -121
- meta_subject/tests/tests/test_sf12.py +0 -12
- meta_visit_schedule/constants.py +4 -0
- meta_visit_schedule/tests/tests/test_schedule.py +4 -0
- meta_visit_schedule/visit_schedules/phase_three/crfs.py +75 -13
- 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 +1 -1
- tests/etc/randomization_list.csv +1 -1
- {meta_edc/tests → tests}/etc/randomization_list_phase_three.csv +4 -4
- tests/holidays.csv +1 -1
- {meta_edc/tests → tests}/test_settings.py +16 -6
- 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.15.dist-info/METADATA +0 -88
- meta_reports/tests/holidays.csv +0 -15
- meta_subject/admin/diabetes/dm_diagnosis_admin.py +0 -89
- meta_subject/form_validators/dm_diagnosis_form_validator.py +0 -38
- meta_subject/form_validators/dm_dx_result_form_validator.py +0 -7
- meta_subject/forms/diabetes/dm_diagnosis_form.py +0 -13
- meta_subject/forms/diabetes/dm_dx_result_form.py +0 -11
- meta_subject/models/diabetes/dm_diagnosis.py +0 -50
- meta_subject/models/diabetes/dm_dx_result.py +0 -70
- /meta_edc-0.3.15.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.15.dist-info → meta_edc-0.3.50.dist-info}/LICENSE +0 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from django_audit_fields import audit_fieldset_tuple
|
3
|
+
from edc_qareports.modeladmin_mixins import NoteModelAdminMixin
|
4
|
+
|
5
|
+
from ....admin_site import meta_reports_admin
|
6
|
+
from ....forms import MissingOgttNoteForm
|
7
|
+
from ....models import MissingOgttNote
|
8
|
+
|
9
|
+
|
10
|
+
@admin.register(MissingOgttNote, site=meta_reports_admin)
|
11
|
+
class MissingOgttNoteModelAdmin(
|
12
|
+
NoteModelAdminMixin,
|
13
|
+
admin.ModelAdmin,
|
14
|
+
):
|
15
|
+
"""A modeladmin class for the Note model."""
|
16
|
+
|
17
|
+
form = MissingOgttNoteForm
|
18
|
+
note_template_name = "edc_qareports/qa_report_note.html"
|
19
|
+
|
20
|
+
fieldsets = (
|
21
|
+
(
|
22
|
+
None,
|
23
|
+
{"fields": ("subject_identifier", "report_datetime", "result_status")},
|
24
|
+
),
|
25
|
+
(
|
26
|
+
"OGTT",
|
27
|
+
{
|
28
|
+
"fields": (
|
29
|
+
"fasting",
|
30
|
+
"ogtt_base_datetime",
|
31
|
+
"ogtt_datetime",
|
32
|
+
"ogtt_value",
|
33
|
+
"ogtt_units",
|
34
|
+
)
|
35
|
+
},
|
36
|
+
),
|
37
|
+
(
|
38
|
+
"Note",
|
39
|
+
{
|
40
|
+
"fields": (
|
41
|
+
"note",
|
42
|
+
"report_model",
|
43
|
+
)
|
44
|
+
},
|
45
|
+
),
|
46
|
+
audit_fieldset_tuple,
|
47
|
+
)
|
48
|
+
|
49
|
+
radio_fields = {
|
50
|
+
"ogtt_units": admin.VERTICAL,
|
51
|
+
"result_status": admin.VERTICAL,
|
52
|
+
"fasting": admin.VERTICAL,
|
53
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from django.template.loader import render_to_string
|
3
|
+
from django.urls import reverse
|
4
|
+
from django.utils.translation import gettext as _
|
5
|
+
from edc_model_admin.dashboard import ModelAdminDashboardMixin
|
6
|
+
from edc_model_admin.mixins import TemplatesModelAdminMixin
|
7
|
+
from edc_qareports.modeladmin_mixins import (
|
8
|
+
NoteStatusListFilter as BaseNoteStatusListFilter,
|
9
|
+
)
|
10
|
+
from edc_qareports.modeladmin_mixins import QaReportModelAdminMixin
|
11
|
+
from edc_sites.admin import SiteModelAdminMixin
|
12
|
+
from edc_visit_schedule.admin import ScheduleStatusListFilter
|
13
|
+
|
14
|
+
from ....admin_site import meta_reports_admin
|
15
|
+
from ....models import NOTE_STATUSES, MissingScreeningOgtt
|
16
|
+
|
17
|
+
|
18
|
+
class NoteStatusListFilter(BaseNoteStatusListFilter):
|
19
|
+
note_model_status_choices = NOTE_STATUSES
|
20
|
+
|
21
|
+
|
22
|
+
@admin.register(MissingScreeningOgtt, site=meta_reports_admin)
|
23
|
+
class MissingScreeningOgttAdmin(
|
24
|
+
QaReportModelAdminMixin,
|
25
|
+
SiteModelAdminMixin,
|
26
|
+
ModelAdminDashboardMixin,
|
27
|
+
TemplatesModelAdminMixin,
|
28
|
+
admin.ModelAdmin,
|
29
|
+
):
|
30
|
+
note_model = "meta_reports.missingogttnote"
|
31
|
+
note_status_list_filter = NoteStatusListFilter
|
32
|
+
note_template = "edc_qareports/columns/notes_column.html"
|
33
|
+
include_note_column = True
|
34
|
+
|
35
|
+
ordering = ["site", "subject_identifier"]
|
36
|
+
|
37
|
+
list_display = [
|
38
|
+
"dashboard",
|
39
|
+
"subject_identifier",
|
40
|
+
"site",
|
41
|
+
"screening_date",
|
42
|
+
"fbg_date",
|
43
|
+
"fbg_value",
|
44
|
+
"ogtt_value",
|
45
|
+
"repeated",
|
46
|
+
"p3_ltfu",
|
47
|
+
"fbg2_value",
|
48
|
+
"ogtt2_value",
|
49
|
+
"fbg2_datetime",
|
50
|
+
"ogtt2_datetime",
|
51
|
+
"consented",
|
52
|
+
]
|
53
|
+
|
54
|
+
list_filter = [
|
55
|
+
ScheduleStatusListFilter,
|
56
|
+
"screening_datetime",
|
57
|
+
"fbg_datetime",
|
58
|
+
"repeated",
|
59
|
+
"p3_ltfu",
|
60
|
+
]
|
61
|
+
|
62
|
+
search_fields = ["subject_identifier"]
|
63
|
+
|
64
|
+
def dashboard(self, obj=None, label=None) -> str:
|
65
|
+
url = self.get_subject_dashboard_url(obj=obj)
|
66
|
+
if not url:
|
67
|
+
url = reverse(
|
68
|
+
"meta_screening_admin:meta_screening_subjectscreening_change",
|
69
|
+
args=(obj.original_id,),
|
70
|
+
)
|
71
|
+
context = dict(title=_("Go to subject screening"), url=url, label=label)
|
72
|
+
return render_to_string("dashboard_button.html", context=context)
|
73
|
+
|
74
|
+
@admin.display(description="Screen date", ordering="screening_datetime")
|
75
|
+
def screening_date(self, obj):
|
76
|
+
if obj.screening_datetime:
|
77
|
+
return obj.screening_datetime.date()
|
78
|
+
return None
|
79
|
+
|
80
|
+
@admin.display(description="Fbg date", ordering="fbg_datetime")
|
81
|
+
def fbg_date(self, obj):
|
82
|
+
if obj.fbg_datetime:
|
83
|
+
return obj.fbg_datetime.date()
|
84
|
+
return None
|
@@ -0,0 +1 @@
|
|
1
|
+
from .unmanaged_model_admin import OnStudyMissingLabValuesAdmin
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from edc_qareports.modeladmin_mixins import OnStudyMissingValuesModelAdminMixin
|
3
|
+
|
4
|
+
from ....admin_site import meta_reports_admin
|
5
|
+
from ....models import OnStudyMissingLabValues
|
6
|
+
|
7
|
+
|
8
|
+
@admin.register(OnStudyMissingLabValues, site=meta_reports_admin)
|
9
|
+
class OnStudyMissingLabValuesAdmin(OnStudyMissingValuesModelAdminMixin, admin.ModelAdmin):
|
10
|
+
|
11
|
+
include_note_column: bool = True
|
12
|
+
|
13
|
+
instructions = ["ello"]
|
@@ -0,0 +1 @@
|
|
1
|
+
from .unmanaged_model_admin import OnStudyMissingValuesAdmin
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from edc_qareports.modeladmin_mixins import OnStudyMissingValuesModelAdminMixin
|
3
|
+
|
4
|
+
from ....admin_site import meta_reports_admin
|
5
|
+
from ....models import OnStudyMissingValues
|
6
|
+
|
7
|
+
|
8
|
+
@admin.register(OnStudyMissingValues, site=meta_reports_admin)
|
9
|
+
class OnStudyMissingValuesAdmin(OnStudyMissingValuesModelAdminMixin, admin.ModelAdmin):
|
10
|
+
|
11
|
+
include_note_column: bool = True
|
12
|
+
project_reports_admin: str = "meta_reports_admin"
|
13
|
+
project_subject_admin: str = "meta_subject_admin"
|
@@ -0,0 +1,58 @@
|
|
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 django.utils.translation import gettext_lazy as _
|
6
|
+
from edc_appointment.models import Appointment
|
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
|
+
from edc_visit_schedule.constants import DAY1
|
13
|
+
|
14
|
+
from ...admin_site import meta_reports_admin
|
15
|
+
from ...models import PatientHistoryMissingBaselineCd4
|
16
|
+
|
17
|
+
|
18
|
+
@admin.register(PatientHistoryMissingBaselineCd4, site=meta_reports_admin)
|
19
|
+
class PatientHistoryMissingBaselineCd4Admin(
|
20
|
+
QaReportModelAdminMixin,
|
21
|
+
SiteModelAdminMixin,
|
22
|
+
ModelAdminDashboardMixin,
|
23
|
+
TemplatesModelAdminMixin,
|
24
|
+
admin.ModelAdmin,
|
25
|
+
):
|
26
|
+
ordering = ["site", "subject_identifier"]
|
27
|
+
list_display = [
|
28
|
+
"dashboard",
|
29
|
+
"subject_identifier",
|
30
|
+
"cd4",
|
31
|
+
"cd4_date",
|
32
|
+
"site",
|
33
|
+
"user_created",
|
34
|
+
"user_modified",
|
35
|
+
"modified",
|
36
|
+
]
|
37
|
+
|
38
|
+
list_filter = [ScheduleStatusListFilter]
|
39
|
+
|
40
|
+
search_fields = ["subject_identifier"]
|
41
|
+
|
42
|
+
def dashboard(self, obj=None, label=None) -> str:
|
43
|
+
kwargs = self.get_subject_dashboard_url_kwargs(obj)
|
44
|
+
try:
|
45
|
+
kwargs.update(
|
46
|
+
appointment=str(
|
47
|
+
Appointment.objects.get(
|
48
|
+
subject_identifier=obj.subject_identifier,
|
49
|
+
visit_code=DAY1,
|
50
|
+
visit_code_sequence=0,
|
51
|
+
).id
|
52
|
+
)
|
53
|
+
)
|
54
|
+
except ObjectDoesNotExist:
|
55
|
+
pass
|
56
|
+
url = reverse(self.get_subject_dashboard_url_name(obj=obj), kwargs=kwargs)
|
57
|
+
context = dict(title=_("Go to subject's dashboard@1000"), url=url, label=label)
|
58
|
+
return render_to_string("dashboard_button.html", context=context)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from edc_model_admin.dashboard import ModelAdminDashboardMixin
|
3
|
+
from edc_model_admin.mixins import TemplatesModelAdminMixin
|
4
|
+
from edc_qareports.modeladmin_mixins import QaReportModelAdminMixin
|
5
|
+
from edc_sites.admin import SiteModelAdminMixin
|
6
|
+
from edc_visit_schedule.admin import ScheduleStatusListFilter
|
7
|
+
|
8
|
+
from ...admin_site import meta_reports_admin
|
9
|
+
from ...models import UnattendedThreeInRow2
|
10
|
+
|
11
|
+
|
12
|
+
@admin.register(UnattendedThreeInRow2, site=meta_reports_admin)
|
13
|
+
class UnattendedThreeInRow2Admin(
|
14
|
+
QaReportModelAdminMixin,
|
15
|
+
SiteModelAdminMixin,
|
16
|
+
ModelAdminDashboardMixin,
|
17
|
+
TemplatesModelAdminMixin,
|
18
|
+
admin.ModelAdmin,
|
19
|
+
):
|
20
|
+
ordering = ["site", "subject_identifier"]
|
21
|
+
|
22
|
+
list_display = [
|
23
|
+
"dashboard",
|
24
|
+
"subject",
|
25
|
+
"first_value",
|
26
|
+
"second_value",
|
27
|
+
"third_value",
|
28
|
+
"interval_days",
|
29
|
+
"from_now_days",
|
30
|
+
"site",
|
31
|
+
"missed_count",
|
32
|
+
"created",
|
33
|
+
]
|
34
|
+
|
35
|
+
list_filter = [
|
36
|
+
"missed_count",
|
37
|
+
ScheduleStatusListFilter,
|
38
|
+
"first_value",
|
39
|
+
"second_value",
|
40
|
+
"third_value",
|
41
|
+
]
|
42
|
+
|
43
|
+
search_fields = ["id", "subject_identifier", "first_value", "second_value", "third_value"]
|
44
|
+
|
45
|
+
@admin.display(description="Subject", ordering="subject_identifier")
|
46
|
+
def subject(self, obj):
|
47
|
+
return obj.subject_identifier
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from edc_model_admin.dashboard import ModelAdminDashboardMixin
|
3
|
+
from edc_model_admin.mixins import TemplatesModelAdminMixin
|
4
|
+
from edc_qareports.modeladmin_mixins import QaReportModelAdminMixin
|
5
|
+
from edc_sites.admin import SiteModelAdminMixin
|
6
|
+
from edc_visit_schedule.admin import ScheduleStatusListFilter
|
7
|
+
|
8
|
+
from ...admin_site import meta_reports_admin
|
9
|
+
from ...models import UnattendedThreeInRow
|
10
|
+
|
11
|
+
|
12
|
+
@admin.register(UnattendedThreeInRow, site=meta_reports_admin)
|
13
|
+
class UnattendedThreeInRowAdmin(
|
14
|
+
QaReportModelAdminMixin,
|
15
|
+
SiteModelAdminMixin,
|
16
|
+
ModelAdminDashboardMixin,
|
17
|
+
TemplatesModelAdminMixin,
|
18
|
+
admin.ModelAdmin,
|
19
|
+
):
|
20
|
+
ordering = ["site", "subject_identifier"]
|
21
|
+
list_display = [
|
22
|
+
"dashboard",
|
23
|
+
"subject_identifier",
|
24
|
+
"first_value",
|
25
|
+
"second_value",
|
26
|
+
"third_value",
|
27
|
+
"interval_days",
|
28
|
+
"from_now_days",
|
29
|
+
"site",
|
30
|
+
"created",
|
31
|
+
]
|
32
|
+
|
33
|
+
list_filter = [ScheduleStatusListFilter, "first_value", "second_value", "third_value"]
|
34
|
+
|
35
|
+
search_fields = ["subject_identifier", "first_value", "second_value", "third_value"]
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from edc_model_admin.dashboard import ModelAdminDashboardMixin
|
3
|
+
from edc_model_admin.mixins import TemplatesModelAdminMixin
|
4
|
+
from edc_qareports.modeladmin_mixins import QaReportModelAdminMixin
|
5
|
+
from edc_sites.admin import SiteModelAdminMixin
|
6
|
+
from edc_visit_schedule.admin import ScheduleStatusListFilter
|
7
|
+
|
8
|
+
from ...admin_site import meta_reports_admin
|
9
|
+
from ...models import UnattendedTwoInRow
|
10
|
+
|
11
|
+
|
12
|
+
@admin.register(UnattendedTwoInRow, site=meta_reports_admin)
|
13
|
+
class UnattendedTwoInRowAdmin(
|
14
|
+
QaReportModelAdminMixin,
|
15
|
+
SiteModelAdminMixin,
|
16
|
+
ModelAdminDashboardMixin,
|
17
|
+
TemplatesModelAdminMixin,
|
18
|
+
admin.ModelAdmin,
|
19
|
+
):
|
20
|
+
ordering = ["site", "subject_identifier"]
|
21
|
+
list_display = [
|
22
|
+
"dashboard",
|
23
|
+
"subject_identifier",
|
24
|
+
"first_value",
|
25
|
+
"second_value",
|
26
|
+
"interval_days",
|
27
|
+
"from_now_days",
|
28
|
+
"site",
|
29
|
+
"created",
|
30
|
+
]
|
31
|
+
|
32
|
+
list_filter = [ScheduleStatusListFilter, "first_value", "second_value"]
|
33
|
+
|
34
|
+
search_fields = ["subject_identifier", "first_value", "second_value"]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from django.template.loader import render_to_string
|
3
|
+
|
4
|
+
from ..admin_site import meta_reports_admin
|
5
|
+
from ..models import Endpoints
|
6
|
+
from .modeladmin_mixins import EndpointsModelAdminMixin
|
7
|
+
|
8
|
+
|
9
|
+
@admin.register(Endpoints, site=meta_reports_admin)
|
10
|
+
class EndpointsAdmin(EndpointsModelAdminMixin, admin.ModelAdmin):
|
11
|
+
queryset_filter = dict(offstudy_date__isnull=True)
|
12
|
+
|
13
|
+
def rendered_change_list_note(self):
|
14
|
+
return render_to_string("meta_reports/endpoints_change_list_note.html")
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from django.template.loader import render_to_string
|
3
|
+
|
4
|
+
from ..admin_site import meta_reports_admin
|
5
|
+
from ..models import EndpointsProxy
|
6
|
+
from .modeladmin_mixins import EndpointsModelAdminMixin
|
7
|
+
|
8
|
+
|
9
|
+
@admin.register(EndpointsProxy, site=meta_reports_admin)
|
10
|
+
class EndpointsAllAdmin(EndpointsModelAdminMixin, admin.ModelAdmin):
|
11
|
+
|
12
|
+
def rendered_change_list_note(self):
|
13
|
+
return render_to_string("meta_reports/endpoints_all_change_list_note.html")
|
@@ -0,0 +1,181 @@
|
|
1
|
+
from django.contrib import admin, messages
|
2
|
+
from django.core.exceptions import FieldDoesNotExist
|
3
|
+
from django.db import models
|
4
|
+
from django.db.models import QuerySet
|
5
|
+
from django.utils.html import format_html
|
6
|
+
from edc_model_admin.dashboard import ModelAdminDashboardMixin
|
7
|
+
from edc_model_admin.list_filters import PastDateListFilter
|
8
|
+
from edc_model_admin.mixins import TemplatesModelAdminMixin
|
9
|
+
from edc_pdutils.actions import export_to_csv
|
10
|
+
from edc_qareports.modeladmin_mixins import QaReportModelAdminMixin
|
11
|
+
from edc_sites.admin import SiteModelAdminMixin
|
12
|
+
from edc_sites.admin.list_filters import SiteListFilter
|
13
|
+
from edc_utils import get_utcnow
|
14
|
+
|
15
|
+
from meta_analytics.dataframes import get_last_imp_visits_df
|
16
|
+
|
17
|
+
from ..admin_site import meta_reports_admin
|
18
|
+
from ..models import LastImpRefill
|
19
|
+
|
20
|
+
|
21
|
+
class ImpVisitDateListFilter(PastDateListFilter):
|
22
|
+
title = "IMP visit date"
|
23
|
+
|
24
|
+
parameter_name = "imp_visit_date"
|
25
|
+
field_name = "imp_visit_date"
|
26
|
+
|
27
|
+
|
28
|
+
class NextApptDateListFilter(PastDateListFilter):
|
29
|
+
title = "Next appt date"
|
30
|
+
|
31
|
+
parameter_name = "next_appt_date"
|
32
|
+
field_name = "next_appt_date"
|
33
|
+
|
34
|
+
|
35
|
+
def update_report(modeladmin, request, queryset):
|
36
|
+
now = get_utcnow()
|
37
|
+
modeladmin.model.objects.all().delete()
|
38
|
+
df = get_last_imp_visits_df()
|
39
|
+
if not df.empty:
|
40
|
+
data = [
|
41
|
+
modeladmin.model(
|
42
|
+
subject_identifier=row["subject_identifier"],
|
43
|
+
site_id=row["site_id"],
|
44
|
+
imp_visit_date=row["imp_visit_date"],
|
45
|
+
imp_visit_code=row["imp_visit_code"],
|
46
|
+
next_appt_date=row["next_appt_datetime"],
|
47
|
+
next_visit_code=row["next_visit_code"],
|
48
|
+
days_since=row["days_since"].days,
|
49
|
+
days_until=row["days_until"].days,
|
50
|
+
visit_code=str(int(row["imp_visit_code"])),
|
51
|
+
visit_code_sequence=row["imp_visit_code"] % 1,
|
52
|
+
report_model=modeladmin.model._meta.label_lower,
|
53
|
+
created=now,
|
54
|
+
)
|
55
|
+
for _, row in df.iterrows()
|
56
|
+
]
|
57
|
+
created = len(modeladmin.model.objects.bulk_create(data))
|
58
|
+
messages.success(request, "{} records were successfully created.".format(created))
|
59
|
+
|
60
|
+
|
61
|
+
@admin.register(LastImpRefill, site=meta_reports_admin)
|
62
|
+
class LastImpRefillAdmin(
|
63
|
+
QaReportModelAdminMixin,
|
64
|
+
SiteModelAdminMixin,
|
65
|
+
ModelAdminDashboardMixin,
|
66
|
+
TemplatesModelAdminMixin,
|
67
|
+
admin.ModelAdmin,
|
68
|
+
):
|
69
|
+
include_note_column = False
|
70
|
+
|
71
|
+
change_list_title = "List of most recent IMP refills per subject"
|
72
|
+
|
73
|
+
change_list_note = format_html(
|
74
|
+
"""
|
75
|
+
This report fetches the most recent Study Medication report where IMP was
|
76
|
+
refilled and adds the subject's next visit. Subjects taken "Off Schedule"
|
77
|
+
are not included in this report. To update ALL rows in this report, tick
|
78
|
+
at least one row and select 'Update report' action below.
|
79
|
+
<BR><BR>
|
80
|
+
This report has additional search features for numeric columns:
|
81
|
+
<code>days_since</code>, <code>days_until</code>, <code>imp_visit_code</code>
|
82
|
+
and <code>next_visit_code</code>.
|
83
|
+
<BR><BR>For example, type <code>days_until>=25</code> in the search below
|
84
|
+
to show rows for subjects who have an appointment 25 or more days from the
|
85
|
+
date this report was created. You might also try typing
|
86
|
+
<code>days_since>365</code> or <code>days_until<0</code>.
|
87
|
+
<BR><BR>
|
88
|
+
This also works: <code>next_visit_code>=1060</code>.
|
89
|
+
"""
|
90
|
+
)
|
91
|
+
|
92
|
+
actions = [update_report, export_to_csv]
|
93
|
+
|
94
|
+
list_display = [
|
95
|
+
"dashboard",
|
96
|
+
"subject_identifier",
|
97
|
+
"imp_visit_code",
|
98
|
+
"imp_visit_date",
|
99
|
+
"days_since",
|
100
|
+
"next_visit_code",
|
101
|
+
"next_appt_date",
|
102
|
+
"days_until",
|
103
|
+
"created",
|
104
|
+
]
|
105
|
+
|
106
|
+
list_filter = [
|
107
|
+
ImpVisitDateListFilter,
|
108
|
+
NextApptDateListFilter,
|
109
|
+
"imp_visit_code",
|
110
|
+
"next_visit_code",
|
111
|
+
SiteListFilter,
|
112
|
+
]
|
113
|
+
|
114
|
+
search_fields = ["subject_identifier"]
|
115
|
+
|
116
|
+
def get_queryset(self, request) -> QuerySet:
|
117
|
+
qs = super().get_queryset(request)
|
118
|
+
if qs.count() == 0:
|
119
|
+
update_report(self, request, None)
|
120
|
+
qs = super().get_queryset(request)
|
121
|
+
return qs
|
122
|
+
|
123
|
+
def dataframe_to_model(self):
|
124
|
+
now = get_utcnow()
|
125
|
+
self.model.objects.all().delete()
|
126
|
+
created = 0
|
127
|
+
df = get_last_imp_visits_df()
|
128
|
+
if not df.empty:
|
129
|
+
data = [
|
130
|
+
self.model(
|
131
|
+
subject_identifier=row["subject_identifier"],
|
132
|
+
site_id=row["site_id"],
|
133
|
+
imp_visit_date=row["imp_visit_date"],
|
134
|
+
imp_visit_code=row["imp_visit_code"],
|
135
|
+
next_appt_date=row["next_appt_datetime"],
|
136
|
+
next_visit_code=row["next_visit_code"],
|
137
|
+
days_since=row["days_since"],
|
138
|
+
days_until=row["days_until"],
|
139
|
+
visit_code=str(int(row["imp_visit_code"])),
|
140
|
+
visit_code_sequence=row["imp_visit_code"] % 1,
|
141
|
+
report_model=self.model._meta.label_lower,
|
142
|
+
created=now,
|
143
|
+
)
|
144
|
+
for _, row in df.iterrows()
|
145
|
+
]
|
146
|
+
created = len(self.model.objects.bulk_create(data))
|
147
|
+
return created
|
148
|
+
|
149
|
+
def get_search_results(self, request, queryset, search_term):
|
150
|
+
value = None
|
151
|
+
fldname = None
|
152
|
+
search_term = search_term.replace(" ", "")
|
153
|
+
operators = {">=": "gte", "<=": "lte", "<": "lt", ">": "gt"}
|
154
|
+
if op := [op for op in operators if op in search_term]:
|
155
|
+
op = op[0]
|
156
|
+
fldname, value = search_term.split(op)
|
157
|
+
try:
|
158
|
+
fldcls = self.model._meta.get_field(fldname)
|
159
|
+
except FieldDoesNotExist:
|
160
|
+
fldname = None
|
161
|
+
else:
|
162
|
+
if isinstance(fldcls, (models.IntegerField,)):
|
163
|
+
try:
|
164
|
+
value = int(value)
|
165
|
+
except ValueError:
|
166
|
+
value = None
|
167
|
+
elif isinstance(fldcls, (models.FloatField,)):
|
168
|
+
try:
|
169
|
+
value = float(value)
|
170
|
+
except ValueError:
|
171
|
+
value = None
|
172
|
+
if (
|
173
|
+
value is not None
|
174
|
+
and fldname
|
175
|
+
and fldname in ["days_until", "days_since", "imp_visit_code", "next_visit_code"]
|
176
|
+
):
|
177
|
+
queryset, use_distinct = super().get_search_results(request, queryset, None)
|
178
|
+
queryset = queryset.filter(**{f"{fldname}__{operators[op]}": value})
|
179
|
+
else:
|
180
|
+
queryset, use_distinct = super().get_search_results(request, queryset, search_term)
|
181
|
+
return queryset, use_distinct
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from django.contrib.admin import SimpleListFilter
|
2
|
+
from edc_constants.constants import NO, YES
|
3
|
+
|
4
|
+
from meta_reports.models import Endpoints
|
5
|
+
|
6
|
+
|
7
|
+
class EndpointListFilter(SimpleListFilter):
|
8
|
+
title = "Endpoint"
|
9
|
+
parameter_name = "endpoint"
|
10
|
+
|
11
|
+
def lookups(self, request, model_admin):
|
12
|
+
return (
|
13
|
+
(YES, YES),
|
14
|
+
(NO, NO),
|
15
|
+
)
|
16
|
+
|
17
|
+
def queryset(self, request, queryset):
|
18
|
+
if self.value() == YES:
|
19
|
+
return queryset.filter(
|
20
|
+
subject_identifier__in=Endpoints.objects.values_list(
|
21
|
+
"subject_identifier", flat=True
|
22
|
+
)
|
23
|
+
)
|
24
|
+
if self.value() == YES:
|
25
|
+
return queryset.exclude(
|
26
|
+
subject_identifier__in=Endpoints.objects.values_list(
|
27
|
+
"subject_identifier", flat=True
|
28
|
+
)
|
29
|
+
)
|
30
|
+
return queryset
|