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,54 @@
|
|
1
|
+
# Generated by Django 5.0.8 on 2024-08-28 23:50
|
2
|
+
|
3
|
+
import django_db_views.migration_functions
|
4
|
+
import django_db_views.operations
|
5
|
+
from django.db import migrations
|
6
|
+
|
7
|
+
|
8
|
+
class Migration(migrations.Migration):
|
9
|
+
|
10
|
+
dependencies = [
|
11
|
+
("meta_reports", "0045_auto_20240829_0248"),
|
12
|
+
]
|
13
|
+
|
14
|
+
operations = [
|
15
|
+
django_db_views.operations.ViewRunPython(
|
16
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
17
|
+
"select *, uuid() as id, now() as `created`, 'onstudy_missing_values_view' as `report_model` from (SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No HIV Diagnosis date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.hiv_diagnosis_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL value or VL date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load IS NULL OR crf.viral_load_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No CD4 value or CD4 date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.cd4 IS NULL OR crf.cd4_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date but previous ARV is YES' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.has_previous_arv_regimen = 'Yes' AND crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'Other current ARV regimen missing' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id LEFT JOIN meta_lists_arvregimens AS arvregimen ON crf.current_arv_regimen_id = arvregimen.id WHERE crf.other_current_arv_regimen IS NULL AND arvregimen.name = 'OTHER' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.glucose' AS label_lower, 'FBG/OGTT: missing OGTT' AS label, COUNT(*) AS records FROM meta_subject_glucose AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE (NOT crf.fbg_value IS NULL AND crf.ogtt_value IS NULL) AND ogtt_performed = 'Yes' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified) as A ORDER BY subject_identifier, site_id",
|
18
|
+
"onstudy_missing_values_view",
|
19
|
+
engine="django.db.backends.mysql",
|
20
|
+
),
|
21
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
22
|
+
"select *, uuid() as id, now() as `created`, 'onstudy_missing_values_view' as `report_model` from (SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No HIV Diagnosis date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.hiv_diagnosis_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL value' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No CD4 value' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.cd4 IS NULL OR crf.cd4_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date but previous ARV is YES' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.has_previous_arv_regimen = 'Yes' AND crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'Other current ARV regimen missing' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id LEFT JOIN meta_lists_arvregimens AS arvregimen ON crf.current_arv_regimen_id = arvregimen.id WHERE crf.other_current_arv_regimen IS NULL AND arvregimen.name = 'OTHER' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.glucose' AS label_lower, 'FBG/OGTT: missing OGTT' AS label, COUNT(*) AS records FROM meta_subject_glucose AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE (NOT crf.fbg_value IS NULL AND crf.ogtt_value IS NULL) AND ogtt_performed = 'Yes' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified) as A ORDER BY subject_identifier, site_id",
|
23
|
+
"onstudy_missing_values_view",
|
24
|
+
engine="django.db.backends.mysql",
|
25
|
+
),
|
26
|
+
atomic=False,
|
27
|
+
),
|
28
|
+
django_db_views.operations.ViewRunPython(
|
29
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
30
|
+
"select *, get_random_uuid() as id, now() as created, 'onstudy_missing_values_view' as report_model from (SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No HIV Diagnosis date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.hiv_diagnosis_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL value or VL date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load IS NULL OR crf.viral_load_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No CD4 value or CD4 date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.cd4 IS NULL OR crf.cd4_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date but previous ARV is YES' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.has_previous_arv_regimen = 'Yes' AND crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'Other current ARV regimen missing' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id LEFT JOIN meta_lists_arvregimens AS arvregimen ON crf.current_arv_regimen_id = arvregimen.id WHERE crf.other_current_arv_regimen IS NULL AND arvregimen.name = 'OTHER' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.glucose' AS label_lower, 'FBG/OGTT: missing OGTT' AS label, COUNT(*) AS records FROM meta_subject_glucose AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE (NOT crf.fbg_value IS NULL AND crf.ogtt_value IS NULL) AND ogtt_performed = 'Yes' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified) as A ORDER BY subject_identifier, site_id",
|
31
|
+
"onstudy_missing_values_view",
|
32
|
+
engine="django.db.backends.postgresql",
|
33
|
+
),
|
34
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
35
|
+
"select *, get_random_uuid() as id, now() as created, 'onstudy_missing_values_view' as report_model from (SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No HIV Diagnosis date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.hiv_diagnosis_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL value' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No CD4 value' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.cd4 IS NULL OR crf.cd4_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date but previous ARV is YES' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.has_previous_arv_regimen = 'Yes' AND crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'Other current ARV regimen missing' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id LEFT JOIN meta_lists_arvregimens AS arvregimen ON crf.current_arv_regimen_id = arvregimen.id WHERE crf.other_current_arv_regimen IS NULL AND arvregimen.name = 'OTHER' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.glucose' AS label_lower, 'FBG/OGTT: missing OGTT' AS label, COUNT(*) AS records FROM meta_subject_glucose AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE (NOT crf.fbg_value IS NULL AND crf.ogtt_value IS NULL) AND ogtt_performed = 'Yes' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified) as A ORDER BY subject_identifier, site_id",
|
36
|
+
"onstudy_missing_values_view",
|
37
|
+
engine="django.db.backends.postgresql",
|
38
|
+
),
|
39
|
+
atomic=False,
|
40
|
+
),
|
41
|
+
django_db_views.operations.ViewRunPython(
|
42
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
43
|
+
"select *, uuid() as id, datetime() as created, 'onstudy_missing_values_view' as report_model from (SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No HIV Diagnosis date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.hiv_diagnosis_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL value or VL date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load IS NULL OR crf.viral_load_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No CD4 value or CD4 date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.cd4 IS NULL OR crf.cd4_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date but previous ARV is YES' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.has_previous_arv_regimen = 'Yes' AND crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'Other current ARV regimen missing' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id LEFT JOIN meta_lists_arvregimens AS arvregimen ON crf.current_arv_regimen_id = arvregimen.id WHERE crf.other_current_arv_regimen IS NULL AND arvregimen.name = 'OTHER' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.glucose' AS label_lower, 'FBG/OGTT: missing OGTT' AS label, COUNT(*) AS records FROM meta_subject_glucose AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE (NOT crf.fbg_value IS NULL AND crf.ogtt_value IS NULL) AND ogtt_performed = 'Yes' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified) as A ORDER BY subject_identifier, site_id",
|
44
|
+
"onstudy_missing_values_view",
|
45
|
+
engine="django.db.backends.sqlite3",
|
46
|
+
),
|
47
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
48
|
+
"select *, uuid() as id, datetime() as created, 'onstudy_missing_values_view' as report_model from (SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No HIV Diagnosis date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.hiv_diagnosis_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL value' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No VL date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.viral_load_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No CD4 value' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.cd4 IS NULL OR crf.cd4_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'No current ARV start date but previous ARV is YES' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE crf.has_previous_arv_regimen = 'Yes' AND crf.current_arv_regimen_start_date IS NULL GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.patienthistory' AS label_lower, 'Other current ARV regimen missing' AS label, COUNT(*) AS records FROM meta_subject_patienthistory AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id LEFT JOIN meta_lists_arvregimens AS arvregimen ON crf.current_arv_regimen_id = arvregimen.id WHERE crf.other_current_arv_regimen IS NULL AND arvregimen.name = 'OTHER' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified UNION SELECT v.subject_identifier, crf.id AS original_id, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified, 'meta_subject.glucose' AS label_lower, 'FBG/OGTT: missing OGTT' AS label, COUNT(*) AS records FROM meta_subject_glucose AS crf LEFT JOIN meta_subject_subjectvisit AS v ON v.id = crf.subject_visit_id WHERE (NOT crf.fbg_value IS NULL AND crf.ogtt_value IS NULL) AND ogtt_performed = 'Yes' GROUP BY v.subject_identifier, crf.subject_visit_id, crf.report_datetime, crf.site_id, v.visit_code, v.visit_code_sequence, v.schedule_name, crf.modified) as A ORDER BY subject_identifier, site_id",
|
49
|
+
"onstudy_missing_values_view",
|
50
|
+
engine="django.db.backends.sqlite3",
|
51
|
+
),
|
52
|
+
atomic=False,
|
53
|
+
),
|
54
|
+
]
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Generated by Django 5.1 on 2024-09-09 20:37
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
("meta_reports", "0046_auto_20240829_0250"),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.CreateModel(
|
14
|
+
name="ImpSubstitutions",
|
15
|
+
fields=[
|
16
|
+
(
|
17
|
+
"id",
|
18
|
+
models.BigAutoField(
|
19
|
+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
20
|
+
),
|
21
|
+
),
|
22
|
+
("report_model", models.CharField(max_length=50)),
|
23
|
+
("subject_identifier", models.CharField(max_length=25)),
|
24
|
+
("created", models.DateTimeField()),
|
25
|
+
("original_id", models.UUIDField(null=True)),
|
26
|
+
("sid", models.IntegerField(null=True, verbose_name="Original SID")),
|
27
|
+
(
|
28
|
+
"dispensed_sid",
|
29
|
+
models.IntegerField(null=True, verbose_name="Dispensed SID"),
|
30
|
+
),
|
31
|
+
(
|
32
|
+
"arm_match",
|
33
|
+
models.CharField(
|
34
|
+
choices=[
|
35
|
+
("Yes", "Yes"),
|
36
|
+
("No", "No"),
|
37
|
+
("not_evaluated", "Not evaluated"),
|
38
|
+
],
|
39
|
+
default="not_evaluated",
|
40
|
+
max_length=15,
|
41
|
+
),
|
42
|
+
),
|
43
|
+
("allocated_datetime", models.DateTimeField(null=True)),
|
44
|
+
("user_created", models.CharField(max_length=25)),
|
45
|
+
("user_modified", models.CharField(max_length=25)),
|
46
|
+
("modified", models.DateTimeField(null=True)),
|
47
|
+
],
|
48
|
+
options={
|
49
|
+
"verbose_name": "IMP Substitutions",
|
50
|
+
"verbose_name_plural": "IMP Substitutions",
|
51
|
+
"db_table": "imp_subjectitutions_view",
|
52
|
+
"managed": False,
|
53
|
+
"default_permissions": ("view", "export", "viewallsites"),
|
54
|
+
},
|
55
|
+
),
|
56
|
+
]
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by Django 5.1 on 2024-09-09 20:38
|
2
|
+
|
3
|
+
import django_db_views.migration_functions
|
4
|
+
import django_db_views.operations
|
5
|
+
from django.db import migrations
|
6
|
+
|
7
|
+
|
8
|
+
class Migration(migrations.Migration):
|
9
|
+
|
10
|
+
dependencies = [
|
11
|
+
("meta_reports", "0047_impsubstitutions"),
|
12
|
+
]
|
13
|
+
|
14
|
+
operations = [
|
15
|
+
django_db_views.operations.ViewRunPython(
|
16
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
17
|
+
"select *, uuid() as id, now() as `created`, 'meta_reports.imp_subjectitutions_view' as `report_model` from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier) as A ORDER BY subject_identifier, site_id",
|
18
|
+
"imp_subjectitutions_view",
|
19
|
+
engine="django.db.backends.mysql",
|
20
|
+
),
|
21
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
22
|
+
"", "imp_subjectitutions_view", engine="django.db.backends.mysql"
|
23
|
+
),
|
24
|
+
atomic=False,
|
25
|
+
),
|
26
|
+
django_db_views.operations.ViewRunPython(
|
27
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
28
|
+
"select *, get_random_uuid() as id, now() as created, 'meta_reports.imp_subjectitutions_view' as report_model from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier NULLS FIRST) as A ORDER BY subject_identifier, site_id",
|
29
|
+
"imp_subjectitutions_view",
|
30
|
+
engine="django.db.backends.postgresql",
|
31
|
+
),
|
32
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
33
|
+
"", "imp_subjectitutions_view", engine="django.db.backends.postgresql"
|
34
|
+
),
|
35
|
+
atomic=False,
|
36
|
+
),
|
37
|
+
django_db_views.operations.ViewRunPython(
|
38
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
39
|
+
"select *, uuid() as id, datetime() as created, 'meta_reports.imp_subjectitutions_view' as report_model from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier) as A ORDER BY subject_identifier, site_id",
|
40
|
+
"imp_subjectitutions_view",
|
41
|
+
engine="django.db.backends.sqlite3",
|
42
|
+
),
|
43
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
44
|
+
"", "imp_subjectitutions_view", engine="django.db.backends.sqlite3"
|
45
|
+
),
|
46
|
+
atomic=False,
|
47
|
+
),
|
48
|
+
]
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Generated by Django 5.1 on 2024-09-11 00:27
|
2
|
+
|
3
|
+
import django_db_views.migration_functions
|
4
|
+
import django_db_views.operations
|
5
|
+
from django.db import migrations
|
6
|
+
|
7
|
+
|
8
|
+
class Migration(migrations.Migration):
|
9
|
+
|
10
|
+
dependencies = [
|
11
|
+
("meta_reports", "0048_auto_20240909_2338"),
|
12
|
+
]
|
13
|
+
|
14
|
+
operations = [
|
15
|
+
django_db_views.operations.ViewRunPython(
|
16
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
17
|
+
"select *, uuid() as id, now() as `created`, 'meta_reports.imp_subjectitutions_view' as `report_model` from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, s.report_datetime, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier) as A ORDER BY subject_identifier, site_id",
|
18
|
+
"imp_subjectitutions_view",
|
19
|
+
engine="django.db.backends.mysql",
|
20
|
+
),
|
21
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
22
|
+
"select *, uuid() as id, now() as `created`, 'meta_reports.imp_subjectitutions_view' as `report_model` from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier) as A ORDER BY subject_identifier, site_id",
|
23
|
+
"imp_subjectitutions_view",
|
24
|
+
engine="django.db.backends.mysql",
|
25
|
+
),
|
26
|
+
atomic=False,
|
27
|
+
),
|
28
|
+
django_db_views.operations.ViewRunPython(
|
29
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
30
|
+
"select *, get_random_uuid() as id, now() as created, 'meta_reports.imp_subjectitutions_view' as report_model from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, s.report_datetime, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier NULLS FIRST) as A ORDER BY subject_identifier, site_id",
|
31
|
+
"imp_subjectitutions_view",
|
32
|
+
engine="django.db.backends.postgresql",
|
33
|
+
),
|
34
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
35
|
+
"select *, get_random_uuid() as id, now() as created, 'meta_reports.imp_subjectitutions_view' as report_model from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier NULLS FIRST) as A ORDER BY subject_identifier, site_id",
|
36
|
+
"imp_subjectitutions_view",
|
37
|
+
engine="django.db.backends.postgresql",
|
38
|
+
),
|
39
|
+
atomic=False,
|
40
|
+
),
|
41
|
+
django_db_views.operations.ViewRunPython(
|
42
|
+
code=django_db_views.migration_functions.ForwardViewMigration(
|
43
|
+
"select *, uuid() as id, datetime() as created, 'meta_reports.imp_subjectitutions_view' as report_model from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, s.report_datetime, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier) as A ORDER BY subject_identifier, site_id",
|
44
|
+
"imp_subjectitutions_view",
|
45
|
+
engine="django.db.backends.sqlite3",
|
46
|
+
),
|
47
|
+
reverse_code=django_db_views.migration_functions.BackwardViewMigration(
|
48
|
+
"select *, uuid() as id, datetime() as created, 'meta_reports.imp_subjectitutions_view' as report_model from (SELECT s.subject_identifier, s.sid, s.dispensed_sid, arm_match, r.allocated_datetime, s.site_id, s.user_created, s.user_modified, s.modified, s.id AS original_id FROM meta_pharmacy_substitutions AS s LEFT JOIN meta_rando_randomizationlist AS r ON r.subject_identifier = s.subject_identifier ORDER BY s.subject_identifier) as A ORDER BY subject_identifier, site_id",
|
49
|
+
"imp_subjectitutions_view",
|
50
|
+
engine="django.db.backends.sqlite3",
|
51
|
+
),
|
52
|
+
atomic=False,
|
53
|
+
),
|
54
|
+
]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Generated by Django 5.1 on 2024-10-07 22:02
|
2
|
+
|
3
|
+
import edc_utils.date
|
4
|
+
from django.db import migrations, models
|
5
|
+
|
6
|
+
|
7
|
+
class Migration(migrations.Migration):
|
8
|
+
|
9
|
+
dependencies = [
|
10
|
+
("meta_reports", "0049_auto_20240911_0327"),
|
11
|
+
]
|
12
|
+
|
13
|
+
operations = [
|
14
|
+
migrations.AlterField(
|
15
|
+
model_name="endpoints",
|
16
|
+
name="created",
|
17
|
+
field=models.DateTimeField(default=edc_utils.date.get_utcnow),
|
18
|
+
),
|
19
|
+
]
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Generated by Django 5.1 on 2024-10-09 16:04
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
("meta_reports", "0050_alter_endpoints_created"),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.RemoveField(
|
14
|
+
model_name="endpoints",
|
15
|
+
name="baseline_datetime",
|
16
|
+
),
|
17
|
+
migrations.RemoveField(
|
18
|
+
model_name="endpoints",
|
19
|
+
name="fbg_datetime",
|
20
|
+
),
|
21
|
+
migrations.RemoveField(
|
22
|
+
model_name="endpoints",
|
23
|
+
name="offstudy_datetime",
|
24
|
+
),
|
25
|
+
migrations.AddField(
|
26
|
+
model_name="endpoints",
|
27
|
+
name="baseline_date",
|
28
|
+
field=models.DateField(null=True),
|
29
|
+
),
|
30
|
+
migrations.AddField(
|
31
|
+
model_name="endpoints",
|
32
|
+
name="fbg_date",
|
33
|
+
field=models.DateField(null=True),
|
34
|
+
),
|
35
|
+
migrations.AddField(
|
36
|
+
model_name="endpoints",
|
37
|
+
name="offstudy_date",
|
38
|
+
field=models.DateField(null=True),
|
39
|
+
),
|
40
|
+
]
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by Django 5.1.2 on 2024-10-16 00:53
|
2
|
+
|
3
|
+
import django.db.models.deletion
|
4
|
+
import edc_utils.date
|
5
|
+
from django.db import migrations, models
|
6
|
+
|
7
|
+
|
8
|
+
class Migration(migrations.Migration):
|
9
|
+
|
10
|
+
dependencies = [
|
11
|
+
("meta_reports", "0051_remove_endpoints_baseline_datetime_and_more"),
|
12
|
+
("sites", "0002_alter_domain_unique"),
|
13
|
+
]
|
14
|
+
|
15
|
+
operations = [
|
16
|
+
migrations.CreateModel(
|
17
|
+
name="LastImpVisit",
|
18
|
+
fields=[
|
19
|
+
(
|
20
|
+
"id",
|
21
|
+
models.BigAutoField(
|
22
|
+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
23
|
+
),
|
24
|
+
),
|
25
|
+
("report_model", models.CharField(max_length=50)),
|
26
|
+
("subject_identifier", models.CharField(max_length=25)),
|
27
|
+
("created", models.DateTimeField(default=edc_utils.date.get_utcnow)),
|
28
|
+
("reference_date", models.DateField(null=True)),
|
29
|
+
("imp_visit_code", models.FloatField(null=True)),
|
30
|
+
("imp_visit_date", models.DateField(null=True)),
|
31
|
+
("next_visit_code", models.FloatField(null=True)),
|
32
|
+
("next_appt_date", models.DateField(null=True)),
|
33
|
+
("visit_code", models.CharField(max_length=15, null=True)),
|
34
|
+
("visit_code_sequence", models.IntegerField(null=True)),
|
35
|
+
("days_since", models.IntegerField(null=True)),
|
36
|
+
("days_until", models.IntegerField(null=True)),
|
37
|
+
(
|
38
|
+
"site",
|
39
|
+
models.ForeignKey(
|
40
|
+
on_delete=django.db.models.deletion.DO_NOTHING, to="sites.site"
|
41
|
+
),
|
42
|
+
),
|
43
|
+
],
|
44
|
+
options={
|
45
|
+
"verbose_name": "Last IMP Visit",
|
46
|
+
"verbose_name_plural": "Last IMP Visits",
|
47
|
+
"abstract": False,
|
48
|
+
"default_permissions": ("view", "export", "viewallsites"),
|
49
|
+
"indexes": [
|
50
|
+
models.Index(
|
51
|
+
fields=["subject_identifier", "site"],
|
52
|
+
name="meta_report_subject_4a9e15_idx",
|
53
|
+
)
|
54
|
+
],
|
55
|
+
},
|
56
|
+
),
|
57
|
+
]
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Generated by Django 5.1.2 on 2024-10-16 01:39
|
2
|
+
|
3
|
+
from django.db import migrations
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
("meta_reports", "0052_lastimpvisit"),
|
10
|
+
("sites", "0002_alter_domain_unique"),
|
11
|
+
]
|
12
|
+
|
13
|
+
operations = [
|
14
|
+
migrations.RenameModel(
|
15
|
+
old_name="LastImpVisit",
|
16
|
+
new_name="LastImpRefill",
|
17
|
+
),
|
18
|
+
migrations.AlterModelOptions(
|
19
|
+
name="lastimprefill",
|
20
|
+
options={
|
21
|
+
"default_permissions": ("view", "export", "viewallsites"),
|
22
|
+
"verbose_name": "Last IMP Refill",
|
23
|
+
"verbose_name_plural": "Last IMP Refills",
|
24
|
+
},
|
25
|
+
),
|
26
|
+
migrations.RenameIndex(
|
27
|
+
model_name="lastimprefill",
|
28
|
+
new_name="meta_report_subject_bc8268_idx",
|
29
|
+
old_name="meta_report_subject_4a9e15_idx",
|
30
|
+
),
|
31
|
+
]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from .dbviews import (
|
2
|
+
NOTE_STATUSES,
|
3
|
+
GlucoseSummary,
|
4
|
+
ImpSubstitutions,
|
5
|
+
MissingOgttNote,
|
6
|
+
MissingScreeningOgtt,
|
7
|
+
OnStudyMissingLabValues,
|
8
|
+
OnStudyMissingValues,
|
9
|
+
PatientHistoryMissingBaselineCd4,
|
10
|
+
UnattendedThreeInRow,
|
11
|
+
UnattendedThreeInRow2,
|
12
|
+
UnattendedTwoInRow,
|
13
|
+
)
|
14
|
+
from .endpoints import Endpoints
|
15
|
+
from .endpoints_proxy import EndpointsProxy
|
16
|
+
from .last_imp_refill import LastImpRefill
|
@@ -0,0 +1,14 @@
|
|
1
|
+
The models in this folder represent VIEWS in the DB. Since the VIEWS
|
2
|
+
are created separately, the model classes are "unmanaged". Unmanaged
|
3
|
+
models do not trigger migrations that change the schema. However,
|
4
|
+
a change to any of these model classes will trigger a migration, but
|
5
|
+
the migration does to change the schema.
|
6
|
+
|
7
|
+
Each model class has a corresponding SQL file. A migration has been
|
8
|
+
created to run the ``CREATE VIEW`` commands using the
|
9
|
+
``migrations.RunSQL`` method.
|
10
|
+
|
11
|
+
If you change the ``CREATE VIEW`` command, you have to generate a
|
12
|
+
new empty migration which calls ``migrations.RunSQL`` to re-run the
|
13
|
+
modified ``CREATE VIEW`` SQL command.
|
14
|
+
(remember to ``DROP VIEW`` first.)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
from .glucose_summary import GlucoseSummary
|
2
|
+
from .imp_substitutions import ImpSubstitutions
|
3
|
+
from .missing_screening_ogtt import NOTE_STATUSES, MissingOgttNote, MissingScreeningOgtt
|
4
|
+
from .on_study_missing_lab_values import OnStudyMissingLabValues
|
5
|
+
from .on_study_missing_values import OnStudyMissingValues
|
6
|
+
from .patient_history_missing_baseline_cd4 import PatientHistoryMissingBaselineCd4
|
7
|
+
from .unattended_three_in_row import UnattendedThreeInRow
|
8
|
+
from .unattended_three_in_row2 import UnattendedThreeInRow2
|
9
|
+
from .unattended_two_in_row import UnattendedTwoInRow
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from django.db import models
|
2
|
+
from django_db_views.db_view import DBView
|
3
|
+
from edc_qareports.model_mixins import QaReportModelMixin, qa_reports_permissions
|
4
|
+
|
5
|
+
from .view_definition import get_view_definition
|
6
|
+
|
7
|
+
|
8
|
+
class GlucoseSummary(QaReportModelMixin, DBView):
|
9
|
+
|
10
|
+
fbg_value = models.DecimalField(max_digits=8, decimal_places=2, null=True)
|
11
|
+
|
12
|
+
fbg_datetime = models.DateTimeField(null=True)
|
13
|
+
|
14
|
+
ogtt_value = models.DecimalField(max_digits=8, decimal_places=2, null=True)
|
15
|
+
|
16
|
+
ogtt_datetime = models.DateTimeField(null=True)
|
17
|
+
|
18
|
+
fasted = models.CharField(max_length=15, null=True)
|
19
|
+
|
20
|
+
visit_code = models.CharField(max_length=25)
|
21
|
+
|
22
|
+
visit_code_sequence = models.IntegerField()
|
23
|
+
|
24
|
+
appointment_id = models.UUIDField(null=True)
|
25
|
+
|
26
|
+
offstudy_datetime = models.DateTimeField(null=True)
|
27
|
+
|
28
|
+
view_definition = get_view_definition()
|
29
|
+
|
30
|
+
class Meta:
|
31
|
+
managed = False
|
32
|
+
db_table = "glucose_summary_view"
|
33
|
+
verbose_name = "Glucose Summary"
|
34
|
+
verbose_name_plural = "Glucose Summary"
|
35
|
+
default_permissions = qa_reports_permissions
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from edc_qareports.sql_generator import SqlViewGenerator
|
2
|
+
|
3
|
+
|
4
|
+
def get_view_definition() -> dict:
|
5
|
+
subquery = """
|
6
|
+
select v.subject_identifier, fbg_value, fbg_datetime, null as `ogtt_value`, null as `ogtt_datetime`,
|
7
|
+
case when fasting="fasting" then "Yes" when fasting="non_fasting" then "No" else fasting end as `fasted`,
|
8
|
+
fbg.site_id, v.visit_code, v.visit_code_sequence, v.appointment_id, eos.offstudy_datetime
|
9
|
+
from meta_subject_glucosefbg as fbg
|
10
|
+
left join meta_subject_subjectvisit as v on v.id=fbg.subject_visit_id
|
11
|
+
left join meta_prn_endofstudy as eos on v.subject_identifier=eos.subject_identifier
|
12
|
+
UNION
|
13
|
+
select v.subject_identifier, fbg_value, fbg_datetime, ogtt_value, ogtt_datetime,
|
14
|
+
case when fasting="fasting" then "Yes" when fasting="non_fasting" then "No" else fasting end as `fasted`,
|
15
|
+
fbg.site_id, v.visit_code, v.visit_code_sequence, v.appointment_id, eos.offstudy_datetime
|
16
|
+
from meta_subject_glucose as fbg
|
17
|
+
left join meta_subject_subjectvisit as v on v.id=fbg.subject_visit_id
|
18
|
+
left join meta_prn_endofstudy as eos on v.subject_identifier=eos.subject_identifier
|
19
|
+
""" # noqa
|
20
|
+
sql_view = SqlViewGenerator(
|
21
|
+
report_model="meta_reports.glucose_summary_view",
|
22
|
+
ordering=["subject_identifier", "site_id"],
|
23
|
+
)
|
24
|
+
return {
|
25
|
+
"django.db.backends.mysql": sql_view.as_mysql(subquery),
|
26
|
+
"django.db.backends.postgresql": sql_view.as_postgres(subquery),
|
27
|
+
"django.db.backends.sqlite3": sql_view.as_sqlite(subquery),
|
28
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
from .unmanaged_model import ImpSubstitutions
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from django.db import models
|
2
|
+
from django_db_views.db_view import DBView
|
3
|
+
from edc_constants.choices import YES_NO_NOT_EVALUATED
|
4
|
+
from edc_constants.constants import NOT_EVALUATED
|
5
|
+
from edc_qareports.model_mixins import QaReportModelMixin, qa_reports_permissions
|
6
|
+
|
7
|
+
from .view_definition import get_view_definition
|
8
|
+
|
9
|
+
|
10
|
+
class ImpSubstitutions(QaReportModelMixin, DBView):
|
11
|
+
|
12
|
+
original_id = models.UUIDField(null=True)
|
13
|
+
|
14
|
+
sid = models.IntegerField(verbose_name="Original SID", null=True)
|
15
|
+
|
16
|
+
dispensed_sid = models.IntegerField(verbose_name="Dispensed SID", null=True)
|
17
|
+
|
18
|
+
arm_match = models.CharField(
|
19
|
+
max_length=15,
|
20
|
+
choices=YES_NO_NOT_EVALUATED,
|
21
|
+
default=NOT_EVALUATED,
|
22
|
+
)
|
23
|
+
|
24
|
+
report_datetime = models.DateTimeField(null=True)
|
25
|
+
|
26
|
+
allocated_datetime = models.DateTimeField(null=True)
|
27
|
+
|
28
|
+
user_created = models.CharField(max_length=25)
|
29
|
+
|
30
|
+
user_modified = models.CharField(max_length=25)
|
31
|
+
|
32
|
+
modified = models.DateTimeField(null=True)
|
33
|
+
|
34
|
+
view_definition = get_view_definition()
|
35
|
+
|
36
|
+
class Meta:
|
37
|
+
managed = False
|
38
|
+
db_table = "imp_subjectitutions_view"
|
39
|
+
verbose_name = "IMP Substitutions"
|
40
|
+
verbose_name_plural = "IMP Substitutions"
|
41
|
+
default_permissions = qa_reports_permissions
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from edc_qareports.sql_generator import SqlViewGenerator
|
2
|
+
|
3
|
+
|
4
|
+
def get_view_definition() -> dict:
|
5
|
+
subquery = """
|
6
|
+
select s.subject_identifier, s.sid, s.dispensed_sid, arm_match,
|
7
|
+
s.report_datetime, r.allocated_datetime,
|
8
|
+
s.site_id, s.user_created, s.user_modified, s.modified, s.id as original_id
|
9
|
+
from meta_pharmacy_substitutions as s left join meta_rando_randomizationlist as r
|
10
|
+
on r.subject_identifier=s.subject_identifier
|
11
|
+
order by s.subject_identifier
|
12
|
+
""" # noqa
|
13
|
+
sql_view = SqlViewGenerator(
|
14
|
+
report_model="meta_reports.imp_subjectitutions_view",
|
15
|
+
ordering=["subject_identifier", "site_id"],
|
16
|
+
)
|
17
|
+
return {
|
18
|
+
"django.db.backends.mysql": sql_view.as_mysql(subquery),
|
19
|
+
"django.db.backends.postgresql": sql_view.as_postgres(subquery),
|
20
|
+
"django.db.backends.sqlite3": sql_view.as_sqlite(subquery),
|
21
|
+
}
|