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
meta_reports/tasks.py
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
from celery import shared_task
|
2
|
+
|
3
|
+
|
4
|
+
@shared_task
|
5
|
+
def update_endpoints_table(subject_identifiers: list[str] | None = None):
|
6
|
+
from meta_analytics.dataframes import GlucoseEndpointsByDate
|
7
|
+
|
8
|
+
if len(subject_identifiers) > 5:
|
9
|
+
subject_identifiers = []
|
10
|
+
cls = GlucoseEndpointsByDate(subject_identifiers=subject_identifiers)
|
11
|
+
cls.run()
|
12
|
+
return cls.to_model()
|
@@ -0,0 +1 @@
|
|
1
|
+
<a title="{{ title }}" href="{{ url }}?q={{ subject_identifier }}">{{ label|default:subject_identifier }}</a>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Endpoints report shows subjects who have reached the protocol endpoint.
|
2
|
+
<BR>
|
3
|
+
<i>This report INCLUDES subjects who are no longer on-study. See also the <a href="{% url 'meta_reports_admin:meta_reports_endpoints_changelist' %}">Endpoints (DM)</a> report.</i>
|
4
|
+
<BR>
|
5
|
+
Pay attention to the "LAST_UPDATED" column. This tells you the last time the report was updated per subject.
|
6
|
+
<BR>
|
7
|
+
<BR>
|
8
|
+
Unlike other reports, this report does not automatically update, but you can update it :
|
9
|
+
<UL>
|
10
|
+
<LI>Place a check mark next to one or more subjects and select 'Regenerate selected report data' from the Action menu.</LI>
|
11
|
+
<li>If you select more than 5 subjects, records for ALL subjects will be refreshed.</li>
|
12
|
+
</UL>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Endpoints report shows subjects who have reached the protocol endpoint and should enroll to the DM Referral Schedule.
|
2
|
+
<BR>
|
3
|
+
<i>The report EXCLUDES subjects who are no longer on-study. See also the <a href="{% url 'meta_reports_admin:meta_reports_endpointsproxy_changelist' %}">Endpoints (DM): All</a> report.</i></i>
|
4
|
+
<BR>
|
5
|
+
Pay attention to the "LAST_UPDATED" column. This tells you the last time the report was updated per subject.
|
6
|
+
<BR>
|
7
|
+
<BR>
|
8
|
+
Unlike other reports, this report does not automatically update, but you can update it :
|
9
|
+
<UL>
|
10
|
+
<LI>Place a check mark next to one or more subjects and select 'Regenerate selected report data' from the Action menu.</LI>
|
11
|
+
<li>If you select more than 5 subjects, records for ALL subjects will be refreshed.</li>
|
12
|
+
</UL>
|
meta_reports/urls.py
ADDED
meta_reports/utils.py
ADDED
File without changes
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by Django 4.2.11 on 2024-06-03 16:46
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
import edc_model.validators.date
|
5
|
+
import edc_protocol.validators
|
6
|
+
import edc_utils.date
|
7
|
+
|
8
|
+
|
9
|
+
class Migration(migrations.Migration):
|
10
|
+
|
11
|
+
dependencies = [
|
12
|
+
(
|
13
|
+
"meta_screening",
|
14
|
+
"0066_alter_historicalscreeningpartone_fasting_duration_delta_and_more",
|
15
|
+
),
|
16
|
+
]
|
17
|
+
|
18
|
+
operations = [
|
19
|
+
migrations.AlterField(
|
20
|
+
model_name="historicalscreeningpartone",
|
21
|
+
name="report_datetime",
|
22
|
+
field=models.DateTimeField(
|
23
|
+
default=edc_utils.date.get_utcnow,
|
24
|
+
help_text="Date and time of report.",
|
25
|
+
validators=[
|
26
|
+
edc_protocol.validators.datetime_not_before_study_start,
|
27
|
+
edc_model.validators.date.datetime_not_future,
|
28
|
+
],
|
29
|
+
verbose_name="Report Date and Time",
|
30
|
+
),
|
31
|
+
),
|
32
|
+
migrations.AlterField(
|
33
|
+
model_name="historicalscreeningpartthree",
|
34
|
+
name="report_datetime",
|
35
|
+
field=models.DateTimeField(
|
36
|
+
default=edc_utils.date.get_utcnow,
|
37
|
+
help_text="Date and time of report.",
|
38
|
+
validators=[
|
39
|
+
edc_protocol.validators.datetime_not_before_study_start,
|
40
|
+
edc_model.validators.date.datetime_not_future,
|
41
|
+
],
|
42
|
+
verbose_name="Report Date and Time",
|
43
|
+
),
|
44
|
+
),
|
45
|
+
migrations.AlterField(
|
46
|
+
model_name="historicalscreeningparttwo",
|
47
|
+
name="report_datetime",
|
48
|
+
field=models.DateTimeField(
|
49
|
+
default=edc_utils.date.get_utcnow,
|
50
|
+
help_text="Date and time of report.",
|
51
|
+
validators=[
|
52
|
+
edc_protocol.validators.datetime_not_before_study_start,
|
53
|
+
edc_model.validators.date.datetime_not_future,
|
54
|
+
],
|
55
|
+
verbose_name="Report Date and Time",
|
56
|
+
),
|
57
|
+
),
|
58
|
+
migrations.AlterField(
|
59
|
+
model_name="historicalsubjectscreening",
|
60
|
+
name="report_datetime",
|
61
|
+
field=models.DateTimeField(
|
62
|
+
default=edc_utils.date.get_utcnow,
|
63
|
+
help_text="Date and time of report.",
|
64
|
+
validators=[
|
65
|
+
edc_protocol.validators.datetime_not_before_study_start,
|
66
|
+
edc_model.validators.date.datetime_not_future,
|
67
|
+
],
|
68
|
+
verbose_name="Report Date and Time",
|
69
|
+
),
|
70
|
+
),
|
71
|
+
migrations.AlterField(
|
72
|
+
model_name="subjectscreening",
|
73
|
+
name="report_datetime",
|
74
|
+
field=models.DateTimeField(
|
75
|
+
default=edc_utils.date.get_utcnow,
|
76
|
+
help_text="Date and time of report.",
|
77
|
+
validators=[
|
78
|
+
edc_protocol.validators.datetime_not_before_study_start,
|
79
|
+
edc_model.validators.date.datetime_not_future,
|
80
|
+
],
|
81
|
+
verbose_name="Report Date and Time",
|
82
|
+
),
|
83
|
+
),
|
84
|
+
]
|
@@ -19,6 +19,7 @@ from edc_sites.utils import add_or_update_django_sites
|
|
19
19
|
from edc_visit_tracking.constants import SCHEDULED
|
20
20
|
from model_bakery import baker
|
21
21
|
|
22
|
+
from meta_consent.models import SubjectConsent, SubjectConsentV1Ext
|
22
23
|
from meta_edc.meta_version import PHASE_THREE
|
23
24
|
from meta_pharmacy.prepare_meta_pharmacy import prepare_meta_pharmacy
|
24
25
|
from meta_sites.sites import domain_suffix
|
@@ -143,6 +144,20 @@ class MetaTestCaseMixin(AppointmentTestCaseMixin):
|
|
143
144
|
consent_datetime=consent_datetime or subject_screening.report_datetime,
|
144
145
|
)
|
145
146
|
|
147
|
+
@staticmethod
|
148
|
+
def get_subject_consent_extended(
|
149
|
+
subject_consent: SubjectConsent,
|
150
|
+
consent_datetime: datetime = None,
|
151
|
+
):
|
152
|
+
return SubjectConsentV1Ext.objects.create(
|
153
|
+
subject_consent=subject_consent,
|
154
|
+
report_datetime=consent_datetime,
|
155
|
+
agrees_to_extension=YES,
|
156
|
+
user_created="erikvw",
|
157
|
+
user_modified="erikvw",
|
158
|
+
site=subject_consent.site,
|
159
|
+
)
|
160
|
+
|
146
161
|
def get_subject_visit(
|
147
162
|
self,
|
148
163
|
visit_code: str | None = None,
|
meta_sites/tests/test_sites.py
CHANGED
meta_subject/action_items.py
CHANGED
@@ -8,7 +8,7 @@ from edc_lab_results.action_items import (
|
|
8
8
|
BloodResultsFbcAction,
|
9
9
|
BloodResultsHba1cAction,
|
10
10
|
BloodResultsLftAction,
|
11
|
-
|
11
|
+
BloodResultsLipidsAction,
|
12
12
|
)
|
13
13
|
from edc_lab_results.action_items import (
|
14
14
|
BloodResultsRftAction as BaseBloodResultsRftAction,
|
@@ -175,7 +175,7 @@ class DmFollowAction(ActionWithNotification):
|
|
175
175
|
def register_actions():
|
176
176
|
for action_item_cls in [
|
177
177
|
BloodResultsFbcAction,
|
178
|
-
|
178
|
+
BloodResultsLipidsAction,
|
179
179
|
BloodResultsLftAction,
|
180
180
|
BloodResultsRftAction,
|
181
181
|
BloodResultsHba1cAction,
|
meta_subject/admin/__init__.py
CHANGED
@@ -3,13 +3,14 @@ from .birth_outcome_admin import BirthOutcomesAdmin
|
|
3
3
|
from .blood_results import (
|
4
4
|
BloodResultsFbcAdmin,
|
5
5
|
BloodResultsLftAdmin,
|
6
|
+
BloodResultsLipidsAdmin,
|
6
7
|
BloodResultsRftAdmin,
|
7
8
|
)
|
8
9
|
from .complications_admin import ComplicationsAdmin
|
9
10
|
from .complications_glycemia_admin import ComplicationsGlycemiaAdmin
|
10
11
|
from .concomitant_medication_admin import ConcomitantMedicationAdmin
|
11
12
|
from .delivery_admin import DeliveryAdmin
|
12
|
-
from .diabetes import DmFollowupAdmin
|
13
|
+
from .diabetes import DmEndpointAdmin, DmFollowupAdmin
|
13
14
|
from .egfr_drop_notification_admin import EgfrDropNotificationAdmin
|
14
15
|
from .eq5d3l_admin import Eq5d3lAdmin
|
15
16
|
from .followup_examination_admin import FollowupExaminationAdmin
|
@@ -5,6 +5,7 @@ from django.core.exceptions import ObjectDoesNotExist
|
|
5
5
|
from django.template.loader import render_to_string
|
6
6
|
from django.urls import NoReverseMatch, reverse
|
7
7
|
from django_audit_fields.admin import audit_fieldset_tuple
|
8
|
+
from edc_crf.fieldset import crf_status_fieldset
|
8
9
|
from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin
|
9
10
|
from edc_model_admin.history import SimpleHistoryAdmin
|
10
11
|
from edc_registration.models import RegisteredSubject
|
@@ -35,6 +36,7 @@ class BirthOutcomesAdmin(
|
|
35
36
|
)
|
36
37
|
},
|
37
38
|
),
|
39
|
+
crf_status_fieldset,
|
38
40
|
audit_fieldset_tuple,
|
39
41
|
)
|
40
42
|
|
@@ -2,5 +2,5 @@ from .blood_results_fbc_admin import BloodResultsFbcAdmin
|
|
2
2
|
from .blood_results_hba1c_admin import BloodResultsHba1cAdmin
|
3
3
|
from .blood_results_ins_admin import BloodResultsInsAdmin
|
4
4
|
from .blood_results_lft_admin import BloodResultsLftAdmin
|
5
|
-
from .
|
5
|
+
from .blood_results_lipids_admin import BloodResultsLipidsAdmin
|
6
6
|
from .blood_results_rft_admin import BloodResultsRftAdmin
|
meta_subject/admin/blood_results/{blood_results_lipid_admin.py → blood_results_lipids_admin.py}
RENAMED
@@ -5,19 +5,19 @@ from edc_lab_results.fieldsets import BloodResultFieldset
|
|
5
5
|
from edc_model_admin.history import SimpleHistoryAdmin
|
6
6
|
|
7
7
|
from ...admin_site import meta_subject_admin
|
8
|
-
from ...forms import
|
9
|
-
from ...models import
|
8
|
+
from ...forms import BloodResultsLipidsForm
|
9
|
+
from ...models import BloodResultsLipids
|
10
10
|
from ..modeladmin import CrfModelAdminMixin
|
11
11
|
|
12
12
|
|
13
|
-
@admin.register(
|
14
|
-
class
|
13
|
+
@admin.register(BloodResultsLipids, site=meta_subject_admin)
|
14
|
+
class BloodResultsLipidsAdmin(
|
15
15
|
BloodResultsModelAdminMixin, CrfModelAdminMixin, SimpleHistoryAdmin
|
16
16
|
):
|
17
|
-
form =
|
17
|
+
form = BloodResultsLipidsForm
|
18
18
|
fieldsets = BloodResultFieldset(
|
19
|
-
|
20
|
-
model_cls=
|
19
|
+
BloodResultsLipids.lab_panel,
|
20
|
+
model_cls=BloodResultsLipids,
|
21
21
|
extra_fieldsets=[
|
22
22
|
(-1, action_fieldset_tuple),
|
23
23
|
],
|
@@ -1,2 +1,2 @@
|
|
1
|
-
from .
|
1
|
+
from .dm_endpoint_admin import DmEndpointAdmin
|
2
2
|
from .dm_followup_admin import DmFollowupAdmin
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from django_audit_fields.admin import audit_fieldset_tuple
|
3
|
+
from edc_crf.fieldset import crf_status_fieldset
|
4
|
+
from edc_form_label.form_label_modeladmin_mixin import FormLabelModelAdminMixin
|
5
|
+
from edc_model_admin.history import SimpleHistoryAdmin
|
6
|
+
|
7
|
+
from ...admin_site import meta_subject_admin
|
8
|
+
from ...forms import DmEndpointForm
|
9
|
+
from ...models import DmEndpoint
|
10
|
+
from ..modeladmin import CrfModelAdminMixin
|
11
|
+
|
12
|
+
|
13
|
+
@admin.register(DmEndpoint, site=meta_subject_admin)
|
14
|
+
class DmEndpointAdmin(
|
15
|
+
CrfModelAdminMixin,
|
16
|
+
FormLabelModelAdminMixin,
|
17
|
+
SimpleHistoryAdmin,
|
18
|
+
):
|
19
|
+
form = DmEndpointForm
|
20
|
+
|
21
|
+
fieldsets = (
|
22
|
+
(None, {"fields": ("subject_visit", "report_datetime")}),
|
23
|
+
(
|
24
|
+
"Endpoint reached",
|
25
|
+
{
|
26
|
+
"fields": ("endpoint_reached", "comments"),
|
27
|
+
},
|
28
|
+
),
|
29
|
+
crf_status_fieldset,
|
30
|
+
audit_fieldset_tuple,
|
31
|
+
)
|
32
|
+
|
33
|
+
list_filter = ["endpoint_reached"]
|
34
|
+
|
35
|
+
radio_fields = {"endpoint_reached": admin.VERTICAL}
|
@@ -4,6 +4,8 @@ from typing import Type
|
|
4
4
|
|
5
5
|
from django.contrib import admin
|
6
6
|
from django.contrib.admin import SimpleListFilter
|
7
|
+
from django_audit_fields import audit_fieldset_tuple
|
8
|
+
from edc_crf.fieldset import crf_status_fieldset
|
7
9
|
from edc_model_admin.history import SimpleHistoryAdmin
|
8
10
|
|
9
11
|
from ..admin_site import meta_subject_admin
|
@@ -50,6 +52,8 @@ class GlucoseFbgAdmin(CrfModelAdminMixin, SimpleHistoryAdmin):
|
|
50
52
|
"fields": ("repeat_fbg_date",),
|
51
53
|
},
|
52
54
|
),
|
55
|
+
crf_status_fieldset,
|
56
|
+
audit_fieldset_tuple,
|
53
57
|
]
|
54
58
|
|
55
59
|
radio_fields = {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from django.contrib import admin
|
2
2
|
from django_audit_fields.admin import audit_fieldset_tuple
|
3
|
+
from edc_crf.fieldset import crf_status_fieldset
|
3
4
|
from edc_model_admin.history import SimpleHistoryAdmin
|
4
5
|
from edc_model_admin.mixins import TabularInlineMixin
|
5
6
|
|
@@ -43,6 +44,7 @@ class OtherArvRegimensAdmin(CrfModelAdminMixin, SimpleHistoryAdmin):
|
|
43
44
|
|
44
45
|
fieldsets = (
|
45
46
|
(None, {"fields": ("subject_visit", "report_datetime", "has_other_regimens")}),
|
47
|
+
crf_status_fieldset,
|
46
48
|
audit_fieldset_tuple,
|
47
49
|
)
|
48
50
|
|
@@ -64,6 +64,16 @@ class StudyMedicationAdmin(CrfModelAdminMixin, SimpleHistoryAdmin):
|
|
64
64
|
),
|
65
65
|
},
|
66
66
|
),
|
67
|
+
(
|
68
|
+
"Dispensed medication",
|
69
|
+
{
|
70
|
+
"description": (
|
71
|
+
"Type in the stock code on the medication "
|
72
|
+
"bottle or bottles. Separate by comma."
|
73
|
+
),
|
74
|
+
"fields": ("stock_codes",),
|
75
|
+
},
|
76
|
+
),
|
67
77
|
crf_status_fieldset,
|
68
78
|
audit_fieldset_tuple,
|
69
79
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from .birth_outcomes_form_validator import BirthOutcomesFormValidator
|
2
2
|
from .delivery_form_validator import DeliveryFormValidator
|
3
|
-
from .
|
3
|
+
from .dm_endpoint_form_validator import DmEndpointFormValidator
|
4
4
|
from .dm_followup_form_validator import DmFollowupFormValidator
|
5
5
|
from .egfr_drop_notification_form_validator import EgfrDropNotificationFormValidator
|
6
6
|
from .followup_examination_form_validator import FollowupExaminationFormValidator
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from django.core.exceptions import ObjectDoesNotExist
|
2
|
+
from django.template.loader import render_to_string
|
3
|
+
from django.urls import reverse
|
4
|
+
from django.utils.html import format_html
|
5
|
+
from edc_crf.crf_form_validator import CrfFormValidator
|
6
|
+
from edc_form_validators import INVALID_ERROR
|
7
|
+
|
8
|
+
from meta_reports.models import Endpoints
|
9
|
+
from meta_reports.tasks import update_endpoints_table
|
10
|
+
|
11
|
+
|
12
|
+
class DmEndpointFormValidator(CrfFormValidator):
|
13
|
+
def clean(self):
|
14
|
+
# recalc from endpoint report to confirm the endpoint has been reached
|
15
|
+
update_endpoints_table(subject_identifiers=[self.subject_identifier])
|
16
|
+
try:
|
17
|
+
Endpoints.objects.get(subject_identifier=self.subject_identifier)
|
18
|
+
except ObjectDoesNotExist:
|
19
|
+
url = reverse("meta_reports_admin:meta_reports_glucosesummary_changelist")
|
20
|
+
link = render_to_string(
|
21
|
+
"meta_reports/columns/subject_identifier_column.html",
|
22
|
+
{
|
23
|
+
"subject_identifier": self.subject_identifier,
|
24
|
+
"url": url,
|
25
|
+
"label": "Glucose Summary",
|
26
|
+
},
|
27
|
+
)
|
28
|
+
self.raise_validation_error(
|
29
|
+
{
|
30
|
+
"__all__": format_html(
|
31
|
+
f"Subject has not reached the protocol endpoint. See {link}"
|
32
|
+
)
|
33
|
+
},
|
34
|
+
INVALID_ERROR,
|
35
|
+
)
|
meta_subject/forms/__init__.py
CHANGED
@@ -4,13 +4,13 @@ from .blood_results import (
|
|
4
4
|
BloodResultsHba1cForm,
|
5
5
|
BloodResultsInsForm,
|
6
6
|
BloodResultsLftForm,
|
7
|
-
|
7
|
+
BloodResultsLipidsForm,
|
8
8
|
BloodResultsRftForm,
|
9
9
|
)
|
10
10
|
from .complications_glycemia_form import ComplicationsGlycemiaForm
|
11
11
|
from .concomitant_medication_form import ConcomitantMedicationForm
|
12
12
|
from .delivery_form import DeliveryForm
|
13
|
-
from .diabetes import
|
13
|
+
from .diabetes import DmEndpointForm, DmFollowupForm
|
14
14
|
from .egfr_drop_notification_form import EgfrDropNotificationForm
|
15
15
|
from .eq53d3l_form import Eq5d3lForm
|
16
16
|
from .followup_examination_form import FollowupExaminationForm
|
@@ -2,5 +2,5 @@ from .blood_results_fbc_form import BloodResultsFbcForm
|
|
2
2
|
from .blood_results_hba1c_form import BloodResultsHba1cForm
|
3
3
|
from .blood_results_ins_form import BloodResultsInsForm
|
4
4
|
from .blood_results_lft_form import BloodResultsLftForm
|
5
|
-
from .
|
5
|
+
from .blood_results_lipids_form import BloodResultsLipidsForm
|
6
6
|
from .blood_results_rft_form import BloodResultsRftForm
|
meta_subject/forms/blood_results/{blood_results_lipid_form.py → blood_results_lipids_form.py}
RENAMED
@@ -5,16 +5,16 @@ from edc_crf.modelform_mixins import CrfModelFormMixin
|
|
5
5
|
from edc_lab_panel.panels import lipids_panel
|
6
6
|
from edc_lab_results.form_validator_mixins import BloodResultsFormValidatorMixin
|
7
7
|
|
8
|
-
from ...models import
|
8
|
+
from ...models import BloodResultsLipids
|
9
9
|
|
10
10
|
|
11
|
-
class
|
11
|
+
class BloodResultsLipidsFormValidator(BloodResultsFormValidatorMixin, CrfFormValidator):
|
12
12
|
panel = lipids_panel
|
13
13
|
|
14
14
|
|
15
|
-
class
|
16
|
-
form_validator_cls =
|
15
|
+
class BloodResultsLipidsForm(ActionItemCrfFormMixin, CrfModelFormMixin, forms.ModelForm):
|
16
|
+
form_validator_cls = BloodResultsLipidsFormValidator
|
17
17
|
|
18
18
|
class Meta(ActionItemCrfFormMixin.Meta):
|
19
|
-
model =
|
19
|
+
model = BloodResultsLipids
|
20
20
|
fields = "__all__"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from django import forms
|
2
|
+
from edc_crf.modelform_mixins import CrfModelFormMixin
|
3
|
+
|
4
|
+
from ...form_validators import DmEndpointFormValidator
|
5
|
+
from ...models import DmEndpoint
|
6
|
+
|
7
|
+
|
8
|
+
class DmEndpointForm(CrfModelFormMixin, forms.ModelForm):
|
9
|
+
form_validator_cls = DmEndpointFormValidator
|
10
|
+
|
11
|
+
class Meta:
|
12
|
+
model = DmEndpoint
|
13
|
+
fields = "__all__"
|
@@ -1,9 +1,12 @@
|
|
1
|
+
import re
|
2
|
+
|
1
3
|
from django import forms
|
2
4
|
from edc_crf.modelform_mixins import CrfModelFormMixin
|
3
5
|
from edc_form_validators import INVALID_ERROR
|
4
6
|
from edc_pharmacy.form_validators import (
|
5
7
|
StudyMedicationFormValidator as BaseStudyMedicationFormValidator,
|
6
8
|
)
|
9
|
+
from edc_pharmacy.models import Stock
|
7
10
|
from edc_visit_schedule.constants import DAY1
|
8
11
|
|
9
12
|
from ..models import StudyMedication
|
@@ -13,6 +16,7 @@ class StudyMedicationFormValidator(BaseStudyMedicationFormValidator):
|
|
13
16
|
def clean(self):
|
14
17
|
super().clean()
|
15
18
|
self.validate_half_dose_at_baseline()
|
19
|
+
self.validate_stock_codes_are_dispensed()
|
16
20
|
|
17
21
|
def validate_half_dose_at_baseline(self):
|
18
22
|
"""Require 1000mg dose at baseline"""
|
@@ -32,6 +36,37 @@ class StudyMedicationFormValidator(BaseStudyMedicationFormValidator):
|
|
32
36
|
{"dosage_guideline": "Invalid. Expected 1000mg/day at baseline"}
|
33
37
|
)
|
34
38
|
|
39
|
+
def validate_stock_codes_are_dispensed(self):
|
40
|
+
if self.cleaned_data.get("stock_codes"):
|
41
|
+
pattern = re.compile("^([A-Z0-9]{6})(,[A-Z0-9]{6})*$")
|
42
|
+
if not pattern.match(self.cleaned_data.get("stock_codes")):
|
43
|
+
raise forms.ValidationError(
|
44
|
+
{
|
45
|
+
"stock_codes": (
|
46
|
+
"Invalid format. Enter one or more valid codes separated by comma"
|
47
|
+
)
|
48
|
+
}
|
49
|
+
)
|
50
|
+
for stock_code in self.cleaned_data.get("stock_codes").split(","):
|
51
|
+
try:
|
52
|
+
Stock.objects.get(
|
53
|
+
code=stock_code,
|
54
|
+
dispensed=True,
|
55
|
+
allocation__registered_subject__subject_identifier=(
|
56
|
+
self.subject_identifier
|
57
|
+
),
|
58
|
+
)
|
59
|
+
except Stock.DoesNotExist:
|
60
|
+
raise forms.ValidationError(
|
61
|
+
{
|
62
|
+
"stock_codes": (
|
63
|
+
f"Invalid. Got {stock_code}. "
|
64
|
+
"Either not allocated to this subject or not dispensed. "
|
65
|
+
"Please check the bottle or check with your pharmacist."
|
66
|
+
)
|
67
|
+
}
|
68
|
+
)
|
69
|
+
|
35
70
|
|
36
71
|
class StudyMedicationForm(CrfModelFormMixin, forms.ModelForm):
|
37
72
|
form_validator_cls = StudyMedicationFormValidator
|