clinicedc 2.0.1__py3-none-any.whl → 2.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of clinicedc might be problematic. Click here for more details.
- {clinicedc-2.0.1.dist-info → clinicedc-2.0.3.dist-info}/METADATA +15 -22
- {clinicedc-2.0.1.dist-info → clinicedc-2.0.3.dist-info}/RECORD +854 -787
- {clinicedc-2.0.1.dist-info → clinicedc-2.0.3.dist-info}/WHEEL +1 -1
- edc_action_item/action.py +10 -30
- edc_action_item/action_with_notification.py +1 -2
- edc_action_item/admin/action_item_admin.py +2 -6
- edc_action_item/admin_site.py +1 -3
- edc_action_item/auths.py +1 -3
- edc_action_item/create_or_update_action_type.py +1 -3
- edc_action_item/data_fixers.py +6 -20
- edc_action_item/forms/action_item_form.py +1 -3
- edc_action_item/management/commands/inspect_action_items.py +3 -9
- edc_action_item/migrations/0001_initial.py +4 -5
- edc_action_item/migrations/0003_auto_20180116_1528.py +2 -1
- edc_action_item/migrations/0006_auto_20180707_1659.py +3 -4
- edc_action_item/migrations/0007_auto_20180707_1715.py +1 -3
- edc_action_item/migrations/0008_auto_20180809_0303.py +2 -1
- edc_action_item/migrations/0014_auto_20181121_1738.py +2 -6
- edc_action_item/migrations/0015_auto_20190114_0250.py +4 -3
- edc_action_item/migrations/0021_auto_20190628_2113.py +1 -3
- edc_action_item/migrations/0022_auto_20190628_2136.py +2 -6
- edc_action_item/migrations/0030_edcpermissions.py +1 -1
- edc_action_item/migrations/0033_alter_actionitem_managers.py +1 -0
- edc_action_item/migrations/0034_alter_actionitem_device_created_and_more.py +13 -37
- edc_action_item/models/action_item.py +2 -6
- edc_action_item/models/action_model_mixin.py +5 -16
- edc_action_item/models/action_type.py +1 -3
- edc_action_item/models/reference.py +1 -2
- edc_action_item/models/signals.py +3 -9
- edc_action_item/site_action_items.py +5 -15
- edc_action_item/templatetags/action_item_extras.py +1 -3
- edc_action_item/view_utils/action_item_button.py +1 -3
- edc_action_item/view_utils/action_item_popover_list_item.py +1 -2
- edc_adherence/migrations/0002_nonadherencereasons_plural_name.py +1 -3
- edc_adherence/model_admin_mixin.py +1 -3
- edc_adverse_event/action_items/ae_followup_action.py +2 -6
- edc_adverse_event/action_items/ae_initial_action.py +3 -7
- edc_adverse_event/auth_objects.py +2 -6
- edc_adverse_event/constants.py +1 -3
- edc_adverse_event/form_validator_mixins/death_report_form_validator.py +1 -3
- edc_adverse_event/form_validator_mixins/requires_death_report_form_validator_mixin.py +2 -7
- edc_adverse_event/form_validators/hospitalization.py +1 -3
- edc_adverse_event/migrations/0003_auto_20191026_2231.py +3 -9
- edc_adverse_event/migrations/0008_auto_20220825_0451.py +1 -1
- edc_adverse_event/migrations/0009_auto_20220907_0157.py +1 -1
- edc_adverse_event/migrations/0010_auto_20220913_2139.py +4 -12
- edc_adverse_event/migrations/0013_alter_aeactionclassification_device_created_and_more.py +11 -31
- edc_adverse_event/model_mixins/ae_followup/ae_followup_fields_model_mixin.py +1 -3
- edc_adverse_event/model_mixins/ae_followup/ae_followup_model_mixin.py +1 -5
- edc_adverse_event/model_mixins/ae_initial/ae_initial_ae_model_mixin.py +1 -3
- edc_adverse_event/model_mixins/ae_initial/ae_initial_fields_model_mixin.py +1 -3
- edc_adverse_event/model_mixins/ae_initial/ae_initial_susar_model_mixin.py +1 -2
- edc_adverse_event/model_mixins/ae_special_interest/aesi_model_mixin.py +1 -5
- edc_adverse_event/model_mixins/ae_susar/ae_susar_model_mixin.py +1 -5
- edc_adverse_event/model_mixins/ae_tmg/ae_tmg_fields_model_mixin.py +2 -6
- edc_adverse_event/model_mixins/ae_tmg/ae_tmg_model_mixin.py +1 -5
- edc_adverse_event/model_mixins/death_report/death_report_extra_fields_model_mixin.py +1 -2
- edc_adverse_event/model_mixins/death_report/death_report_model_mixin.py +2 -5
- edc_adverse_event/model_mixins/death_report/death_report_tmg_model_mixin.py +2 -7
- edc_adverse_event/model_mixins/death_report/simple_death_report_model_mixin.py +1 -3
- edc_adverse_event/modeladmin_mixins/ae_tmg_admin_mixin.py +1 -3
- edc_adverse_event/modeladmin_mixins/death_report_admin_mixin.py +6 -10
- edc_adverse_event/modelform_mixins/ae_tmg_modelform_mixin.py +1 -3
- edc_adverse_event/models/signals.py +3 -9
- edc_adverse_event/pdf_reports/ae_pdf_report.py +6 -18
- edc_adverse_event/pdf_reports/death_pdf_report.py +3 -9
- edc_adverse_event/templatetags/edc_adverse_event_extras.py +5 -15
- edc_adverse_event/utils.py +2 -6
- edc_adverse_event/view_mixins/ae/ae_listboard_view_mixin.py +1 -3
- edc_adverse_event/view_mixins/ae/death_report_listboard_view_mixin.py +1 -3
- edc_adverse_event/view_mixins/tmg/tmg_ae_listboard_view_mixin.py +2 -6
- edc_adverse_event/view_utils/tmg_button.py +2 -6
- edc_adverse_event/views/home_view.py +1 -3
- edc_adverse_event/views/tmg/death_listboard_view.py +1 -3
- edc_adverse_event/views/tmg/home_view.py +2 -6
- edc_adverse_event/views/tmg/summary_listboard_view.py +1 -3
- edc_appointment/admin/appointment_admin.py +1 -3
- edc_appointment/admin/list_filters.py +1 -3
- edc_appointment/admin_site.py +1 -3
- edc_appointment/analytics/dataframes/get_appointment_df.py +2 -6
- edc_appointment/appointment_reason_updater.py +2 -5
- edc_appointment/appointment_status_updater.py +1 -4
- edc_appointment/constants.py +1 -3
- edc_appointment/creators/appointment_creator.py +4 -10
- edc_appointment/creators/unscheduled_appointment_creator.py +3 -7
- edc_appointment/creators/utils.py +4 -0
- edc_appointment/form_validator_mixins/next_appointment_crf_form_validator_mixin.py +3 -10
- edc_appointment/form_validator_mixins/window_period_form_validator_mixin.py +3 -9
- edc_appointment/form_validators/appointment_form_validator.py +11 -37
- edc_appointment/form_validators/next_appointment_crf_form_validator.py +1 -3
- edc_appointment/form_validators/utils.py +1 -3
- edc_appointment/managers.py +2 -6
- edc_appointment/migrations/0002_auto_20161126_1156.py +5 -8
- edc_appointment/migrations/0003_auto_20161127_2226.py +7 -16
- edc_appointment/migrations/0006_auto_20170106_2118.py +2 -1
- edc_appointment/migrations/0008_auto_20171115_1601.py +3 -4
- edc_appointment/migrations/0014_auto_20180116_1411.py +2 -1
- edc_appointment/migrations/0024_auto_20200911_0425.py +1 -1
- edc_appointment/migrations/0034_appointmenttype_alter_appointment_appt_type_and_more.py +2 -4
- edc_appointment/migrations/0036_auto_20230124_1822.py +2 -6
- edc_appointment/migrations/0040_appointment_appt_type_other_and_more.py +1 -0
- edc_appointment/migrations/0042_alter_appointment_device_created_and_more.py +5 -13
- edc_appointment/migrations/0046_infosources.py +1 -3
- edc_appointment/migrations/0047_alter_appointment_options_and_more.py +1 -3
- edc_appointment/model_mixins/appointment_methods_model_mixin.py +1 -5
- edc_appointment/model_mixins/appointment_model_mixin.py +2 -8
- edc_appointment/model_mixins/next_appointment_crf_model_mixin.py +1 -3
- edc_appointment/modeladmin_mixins/next_appointment_crf_modeladmin_mixin.py +1 -3
- edc_appointment/modelform_mixins/next_appointment_crf_modelform_mixins.py +1 -5
- edc_appointment/models/signals.py +5 -17
- edc_appointment/utils.py +11 -33
- edc_appointment/view_mixins/appointment_view_mixin.py +2 -6
- edc_auth/admin/list_filters.py +2 -6
- edc_auth/admin/role_admin.py +1 -3
- edc_auth/admin/user_admin.py +4 -12
- edc_auth/admin/user_profile_admin.py +2 -5
- edc_auth/auth_updater/auth_updater.py +1 -3
- edc_auth/auth_updater/group_updater.py +3 -9
- edc_auth/forms.py +1 -3
- edc_auth/get_app_codenames.py +1 -3
- edc_auth/import_users.py +3 -9
- edc_auth/management/commands/export_users.py +1 -3
- edc_auth/management/commands/reset_password.py +1 -3
- edc_auth/migrations/0001_squashed_0033_alter_userprofile_is_multisite_viewer.py +4 -12
- edc_auth/migrations/0015_auto_20191026_2149.py +1 -3
- edc_auth/migrations/0016_auto_20191026_2153.py +1 -3
- edc_auth/migrations/0025_permissions.py +1 -1
- edc_auth/migrations/0029_alter_edcpermissions_device_created_and_more.py +5 -13
- edc_auth/models/__init__.py +1 -3
- edc_auth/models/signals.py +2 -6
- edc_auth/models/user_profile.py +1 -3
- edc_auth/password_setter.py +1 -3
- edc_auth/system_checks.py +1 -5
- edc_auth/urls_for_accounts.py +1 -3
- edc_auth/utils.py +3 -9
- edc_consent/actions.py +3 -9
- edc_consent/consent_definition.py +2 -6
- edc_consent/consent_definition_extension.py +4 -12
- edc_consent/field_mixins/citizen_fields_mixin.py +2 -4
- edc_consent/field_mixins/identity_fields_mixin.py +1 -2
- edc_consent/field_mixins/personal_fields_mixin.py +8 -3
- edc_consent/field_mixins/site_fields_mixin.py +1 -2
- edc_consent/form_validators/subject_consent_form_validator.py +2 -7
- edc_consent/migrations/0001_initial.py +1 -1
- edc_consent/migrations/0002_alter_edcpermissions_device_created_and_more.py +3 -7
- edc_consent/model_mixins/consent_extension_model_mixin.py +1 -3
- edc_consent/model_mixins/consent_model_mixin.py +3 -9
- edc_consent/modeladmin_mixins/consent_model_admin_mixin.py +7 -17
- edc_consent/modelform_mixins/consent_modelform_mixin/consent_modelform_validation_mixin.py +3 -8
- edc_consent/modelform_mixins/requires_consent_modelform_mixin.py +1 -3
- edc_consent/models/signals.py +2 -6
- edc_consent/site_consents.py +5 -17
- edc_consent/system_checks.py +3 -9
- edc_consent/validators.py +1 -2
- edc_consent/view_mixins/consent_view_mixins.py +3 -5
- edc_crf/crf_form_validator.py +2 -6
- edc_crf/crf_form_validator_mixins.py +2 -6
- edc_crf/migrations/0004_alter_crfstatus_device_created_and_more.py +3 -7
- edc_crf/utils.py +1 -3
- edc_dashboard/management/commands/update_search_slugs.py +1 -3
- edc_dashboard/migrations/0001_initial.py +1 -1
- edc_dashboard/migrations/0003_alter_edcpermissions_device_created_and_more.py +3 -7
- edc_dashboard/templatetags/edc_dashboard_extras.py +2 -6
- edc_dashboard/view_mixins/administration_view_mixin.py +1 -3
- edc_dashboard/view_mixins/edc_view_mixin.py +1 -3
- edc_dashboard/views/administration_view.py +1 -3
- edc_data_manager/action_items.py +1 -3
- edc_data_manager/admin/actions.py +3 -9
- edc_data_manager/admin/data_query_admin.py +4 -12
- edc_data_manager/admin/query_rule_admin.py +4 -13
- edc_data_manager/auths.py +1 -3
- edc_data_manager/forms/data_query.py +2 -6
- edc_data_manager/forms/query_rule.py +1 -3
- edc_data_manager/get_longitudinal_value.py +2 -5
- edc_data_manager/handlers/handlers.py +2 -6
- edc_data_manager/migrations/0001_initial.py +4 -3
- edc_data_manager/migrations/0003_auto_20190806_1749.py +2 -6
- edc_data_manager/migrations/0004_auto_20190806_1750.py +1 -3
- edc_data_manager/migrations/0025_edcpermissions.py +1 -1
- edc_data_manager/migrations/0027_alter_dataquery_dm_user.py +1 -1
- edc_data_manager/migrations/0028_alter_dataquery_options_alter_queryrule_options_and_more.py +2 -1
- edc_data_manager/migrations/0029_alter_dataquery_managers.py +2 -1
- edc_data_manager/migrations/0030_alter_datadictionary_device_created_and_more.py +15 -43
- edc_data_manager/models/model_mixins.py +1 -3
- edc_data_manager/populate_data_dictionary.py +1 -2
- edc_data_manager/post_migrate_signals.py +1 -3
- edc_data_manager/site_data_manager.py +1 -3
- edc_document_status/model_mixins.py +1 -3
- edc_egfr/__init__.py +1 -0
- edc_egfr/admin/__init__.py +1 -0
- edc_egfr/admin/egfr_drop_notification_admin_mixin.py +73 -0
- edc_egfr/apps.py +5 -0
- edc_egfr/calculators/__init__.py +4 -0
- edc_egfr/calculators/base_egrfr.py +56 -0
- edc_egfr/calculators/egfr_ckd_epi.py +68 -0
- edc_egfr/calculators/egfr_cockcroft_gault.py +63 -0
- edc_egfr/calculators/percent_change.py +7 -0
- edc_egfr/constants.py +1 -0
- edc_egfr/egfr.py +237 -0
- edc_egfr/form_validator_mixins/__init__.py +4 -0
- edc_egfr/form_validator_mixins/egfr_form_validator_mixins.py +55 -0
- edc_egfr/get_drop_notification_model.py +10 -0
- edc_egfr/get_egfr_for_subject.py +31 -0
- edc_egfr/model_mixins/__init__.py +2 -0
- edc_egfr/model_mixins/egfr_drop_notification_model_mixin.py +63 -0
- edc_egfr/model_mixins/egfr_model_mixin.py +120 -0
- edc_export/archive_exporter.py +2 -6
- edc_export/exportables.py +2 -6
- edc_export/files_emailer.py +1 -3
- edc_export/management/commands/import_receipts.py +1 -3
- edc_export/managers.py +3 -9
- edc_export/migrations/0001_initial.py +15 -36
- edc_export/migrations/0005_exportdata_importdata.py +1 -3
- edc_export/migrations/0006_auto_20200512_0208.py +2 -6
- edc_export/migrations/0010_auto_20210910_1636.py +2 -6
- edc_export/migrations/0013_edcpermissions.py +1 -1
- edc_export/migrations/0015_alter_datarequest_managers_and_more.py +2 -1
- edc_export/migrations/0016_alter_datarequest_device_created_and_more.py +27 -79
- edc_export/migrations/0017_alter_datarequest_options_and_more.py +2 -6
- edc_export/migrations/0020_remove_datarequesthistory_edc_export__exporte_ba8050_idx_and_more.py +2 -6
- edc_export/model_exporter/model_exporter.py +4 -15
- edc_export/model_exporter/object_history_helpers.py +1 -3
- edc_export/model_exporter/value_getter.py +5 -14
- edc_export/models/signals.py +1 -3
- edc_export/models/upload_export_receipt_file.py +1 -3
- edc_export/utils.py +1 -4
- edc_export/views/export_selected_models_view.py +6 -17
- edc_facility/default_definitions.py +1 -3
- edc_facility/facility.py +4 -14
- edc_facility/import_holidays.py +1 -3
- edc_facility/migrations/0005_healthfacility_healthfacilitytypes_and_more.py +4 -6
- edc_facility/migrations/0006_alter_healthfacility_health_facility_type.py +1 -1
- edc_facility/migrations/0008_alter_healthfacility_device_created_and_more.py +5 -13
- edc_facility/models/holiday.py +1 -3
- edc_facility/utils.py +1 -3
- edc_fieldsets/fieldsets_modeladmin_mixin.py +1 -3
- edc_form_describer/form_describer.py +3 -9
- edc_form_describer/make_forms_reference.py +1 -3
- edc_form_describer/management/commands/make_forms_reference.py +1 -3
- edc_form_runners/admin/issue_admin.py +2 -6
- edc_form_runners/form_runner.py +4 -13
- edc_form_runners/form_runner_by_scr_id.py +1 -3
- edc_form_runners/get_form_runner.py +1 -3
- edc_form_runners/get_form_runner_by_src_id.py +3 -3
- edc_form_runners/management/commands/run_form_runners.py +1 -3
- edc_form_runners/migrations/0001_initial.py +2 -4
- edc_form_runners/run_form_runners.py +1 -3
- edc_form_runners/utils.py +1 -3
- edc_form_validators/applicable_field_validator.py +6 -17
- edc_form_validators/base_form_validator.py +1 -3
- edc_form_validators/date_range_validator.py +4 -12
- edc_form_validators/date_validator.py +3 -9
- edc_form_validators/many_to_many_field_validator.py +1 -3
- edc_form_validators/other_specify_field_validator.py +3 -7
- edc_form_validators/range_field_validator.py +1 -3
- edc_form_validators/required_field_validator.py +5 -18
- edc_glucose/__init__.py +0 -0
- edc_glucose/apps.py +6 -0
- edc_glucose/constants.py +3 -0
- edc_glucose/fieldsets.py +14 -0
- edc_glucose/form_validators/__init__.py +6 -0
- edc_glucose/form_validators/fasting_form_validator.py +12 -0
- edc_glucose/form_validators/fbg_form_validator_mixin.py +32 -0
- edc_glucose/form_validators/fbg_ogtt_form_validator_mixin.py +47 -0
- edc_glucose/form_validators/glucose_form_validator.py +44 -0
- edc_glucose/form_validators/glucose_form_validator_mixin.py +53 -0
- edc_glucose/form_validators/ogtt_form_validator_mixin.py +91 -0
- edc_glucose/list_filters.py +42 -0
- edc_glucose/migrations/__init__.py +0 -0
- edc_glucose/model_mixin_factories/__init__.py +4 -0
- edc_glucose/model_mixin_factories/fasting_model_mixin_factory.py +63 -0
- edc_glucose/model_mixin_factories/fbg_model_mixin_factory.py +48 -0
- edc_glucose/model_mixin_factories/glucose_model_mixin_factory.py +49 -0
- edc_glucose/model_mixin_factories/ogtt_model_mixin_factory.py +71 -0
- edc_glucose/model_mixins/__init__.py +5 -0
- edc_glucose/model_mixins/fasting_model_mixin.py +15 -0
- edc_glucose/model_mixins/fbg_model_mixin.py +10 -0
- edc_glucose/model_mixins/glucose_model_mixin.py +17 -0
- edc_glucose/model_mixins/hba1c_model_mixin.py +42 -0
- edc_glucose/model_mixins/ogtt_model_mixin.py +10 -0
- edc_glucose/models.py +0 -0
- edc_glucose/utils.py +42 -0
- edc_identifier/admin_site.py +1 -3
- edc_identifier/identifier.py +1 -3
- edc_identifier/migrations/0001_initial.py +3 -4
- edc_identifier/migrations/0001_squashed_0018_auto_20180128_1054.py +3 -2
- edc_identifier/migrations/0005_alter_identifiermodel_managers.py +2 -1
- edc_identifier/migrations/0005_historicalidentifierhistory_historicalidentifiertracker_historicalsubjectidentifier.py +4 -5
- edc_identifier/migrations/0006_auto_20161127_2226.py +16 -43
- edc_identifier/migrations/0007_alter_identifiermodel_device_created_and_more.py +3 -7
- edc_identifier/migrations/0007_auto_20161204_2227.py +4 -7
- edc_identifier/migrations/0009_auto_20161221_2323.py +1 -0
- edc_identifier/migrations/0010_auto_20170112_0602.py +2 -1
- edc_identifier/migrations/0012_auto_20171116_1606.py +2 -1
- edc_identifier/migrations/0013_auto_20171230_1316.py +3 -9
- edc_identifier/research_identifier.py +3 -11
- edc_identifier/short_identifier.py +5 -9
- edc_identifier/utils.py +1 -3
- edc_lab/admin/modeladmin_mixins.py +2 -8
- edc_lab/aliquot_types.py +1 -3
- edc_lab/form_validators/requisition_form_validator_mixin.py +1 -3
- edc_lab/forms/box_type_form.py +4 -6
- edc_lab/lab/aliquot_type.py +2 -6
- edc_lab/lab/manifest.py +2 -6
- edc_lab/lab/primary_aliquot.py +1 -3
- edc_lab/lab/requisition_panel.py +1 -3
- edc_lab/lab/requisition_panel_group.py +2 -6
- edc_lab/lab/specimen.py +1 -3
- edc_lab/labels/aliquot_label.py +4 -6
- edc_lab/labels/manifest_label.py +1 -3
- edc_lab/migrations/0001_initial.py +12 -29
- edc_lab/migrations/0002_auto_20170305_1939.py +4 -12
- edc_lab/migrations/0007_auto_20170321_1119.py +2 -6
- edc_lab/migrations/0008_auto_20170921_0719.py +2 -1
- edc_lab/migrations/0010_auto_20171127_1541.py +3 -2
- edc_lab/migrations/0012_auto_20180114_1438.py +2 -1
- edc_lab/migrations/0013_auto_20180117_1438.py +2 -1
- edc_lab/migrations/0022_auto_20211210_1839.py +1 -0
- edc_lab/migrations/0024_alter_manifestitem_managers.py +2 -1
- edc_lab/migrations/0027_alter_aliquot_managers_alter_box_managers_and_more.py +1 -1
- edc_lab/migrations/0028_alter_aliquot_device_created_and_more.py +43 -127
- edc_lab/model_mixins/aliquot/aliquot_label_mixin.py +1 -3
- edc_lab/model_mixins/aliquot/aliquot_model_mixin.py +4 -12
- edc_lab/model_mixins/requisition/requisition_identifier_mixin.py +1 -3
- edc_lab/model_mixins/shipping/manifest_model_mixin.py +1 -3
- edc_lab/models/box_item.py +1 -3
- edc_lab/models/box_type.py +1 -3
- edc_lab/models/manifest/manifest.py +3 -9
- edc_lab/models/manifest/manifest_item.py +1 -3
- edc_lab/models/order.py +1 -3
- edc_lab/models/signals.py +1 -3
- edc_lab/patterns.py +1 -3
- edc_lab/pdf_reports/manifest_pdf_report.py +9 -27
- edc_lab/post_migrate_signals.py +1 -3
- edc_lab/site_labs.py +4 -10
- edc_lab_dashboard/migrations/0001_initial.py +1 -1
- edc_lab_dashboard/migrations/0002_alter_edcpermissions_device_created_and_more.py +3 -7
- edc_lab_dashboard/view_mixins/box_view_mixin.py +1 -3
- edc_lab_dashboard/view_mixins/manifest_view_mixin.py +4 -12
- edc_lab_dashboard/views/action_views/receive_view.py +1 -3
- edc_lab_dashboard/views/action_views/verify_box_item_view.py +1 -3
- edc_lab_dashboard/views/listboard_filters/aliquot_listboard_view_filters.py +2 -6
- edc_lab_dashboard/views/listboard_filters/manifest_listboard_filters.py +1 -3
- edc_lab_dashboard/views/listboard_views/base_box_item_listboard_view.py +1 -3
- edc_lab_dashboard/views/listboard_views/manifest_listboard_view.py +1 -3
- edc_lab_dashboard/views/listboard_views/process_listboard_view.py +2 -6
- edc_lab_dashboard/views/listboard_views/receive_listboard_view.py +2 -6
- edc_lab_dashboard/views/listboard_views/requisition_listboard_view.py +2 -6
- edc_lab_results/action_items.py +1 -3
- edc_lab_results/form_validator_mixins/blood_results_fbg_form_validator_mixin.py +2 -4
- edc_lab_results/form_validator_mixins/blood_results_form_validator_mixin.py +1 -3
- edc_lab_results/get_summary.py +3 -5
- edc_lab_results/model_mixin_factories/__init__.py +10 -0
- edc_lab_results/{model_mixin_factory → model_mixin_factories}/field_attrs.py +8 -8
- edc_lab_results/{model_mixin_factory → model_mixin_factories}/reportable_result_model_mixin_factory.py +2 -0
- edc_lab_results/{model_mixin_factory → model_mixin_factories}/result_model_mixin_factory.py +2 -0
- edc_lab_results/model_mixins/blood_result_model_mixin.py +2 -5
- edc_lab_results/model_mixins/electrolytes_model_mixins.py +1 -1
- edc_lab_results/model_mixins/fbc_model_mixins.py +1 -1
- edc_lab_results/model_mixins/fbg_model_mixin.py +6 -3
- edc_lab_results/model_mixins/glucose_model_mixin.py +2 -2
- edc_lab_results/model_mixins/hba1c_model_mixin.py +2 -28
- edc_lab_results/model_mixins/insulin_model_mixin.py +4 -11
- edc_lab_results/model_mixins/lft_model_mixins.py +1 -1
- edc_lab_results/model_mixins/lipid_model_mixins.py +1 -1
- edc_lab_results/model_mixins/proteinuria_model_mixin.py +1 -1
- edc_lab_results/model_mixins/rft_model_mixins.py +1 -1
- edc_label/apps.py +1 -2
- edc_label/migrations/0001_initial.py +1 -1
- edc_label/migrations/0003_alter_zpllabeltemplates_device_created_and_more.py +3 -7
- edc_label/printer.py +2 -6
- edc_label/printers_mixin.py +1 -3
- edc_label/urls.py +1 -3
- edc_label/view_mixins.py +1 -3
- edc_label/views/print_label_view.py +1 -3
- edc_list_data/model_mixins.py +1 -3
- edc_list_data/preload_data.py +2 -6
- edc_list_data/site_list_data.py +1 -3
- edc_listboard/migrations/0001_initial.py +1 -1
- edc_listboard/migrations/0003_alter_listboard_device_created_and_more.py +3 -7
- edc_listboard/view_mixins/listboard_filter_view_mixin.py +5 -15
- edc_listboard/view_mixins/search_listboard_view_mixin.py +2 -6
- edc_listboard/views/listboard_view.py +2 -6
- edc_listboard/views/screen/screening_listboard_view.py +1 -3
- edc_listboard/views/subject/subject_listboard_view.py +1 -3
- edc_locator/forms/subject_locator_form_validator.py +4 -12
- edc_locator/migrations/0001_initial.py +3 -2
- edc_locator/migrations/0003_auto_20180103_1351.py +2 -1
- edc_locator/migrations/0004_auto_20180106_2148.py +2 -1
- edc_locator/migrations/0007_auto_20180117_1819.py +2 -1
- edc_locator/migrations/0011_auto_20181007_0053.py +1 -1
- edc_locator/migrations/0013_auto_20181007_0054.py +2 -3
- edc_locator/migrations/0014_auto_20181009_0545.py +1 -0
- edc_locator/migrations/0032_alter_subjectlocator_managers.py +1 -1
- edc_locator/migrations/0034_alter_historicalsubjectlocator_device_created_and_more.py +5 -13
- edc_locator/modeladmin_mixins.py +1 -3
- edc_locator/view_mixins/subject_locator_view_mixins.py +1 -3
- edc_ltfu/admin.py +1 -3
- edc_ltfu/forms/ltfu_form.py +1 -3
- edc_ltfu/forms/ltfu_form_validator_mixin.py +1 -2
- edc_ltfu/modelform_mixins.py +3 -8
- edc_metadata/admin/modeladmin_mixins.py +2 -8
- edc_metadata/management/commands/validate_entry_status.py +1 -3
- edc_metadata/metadata/metadata.py +12 -41
- edc_metadata/metadata/metadata_getter.py +2 -9
- edc_metadata/metadata/requisition_metadata_getter.py +1 -3
- edc_metadata/metadata_handler.py +3 -9
- edc_metadata/metadata_helper/metadata_helper_mixin.py +1 -3
- edc_metadata/metadata_mixins/source_model_metadata_mixin.py +3 -9
- edc_metadata/metadata_refresher.py +3 -9
- edc_metadata/metadata_rules/crf/crf_rule_group.py +2 -5
- edc_metadata/metadata_rules/persistant_singleton_mixin.py +3 -3
- edc_metadata/metadata_rules/requisition/requisition_rule_group.py +1 -2
- edc_metadata/metadata_rules/rule_evaluator.py +1 -3
- edc_metadata/metadata_rules/rule_group.py +2 -6
- edc_metadata/metadata_rules/rule_group_meta_options.py +1 -3
- edc_metadata/metadata_updater.py +1 -3
- edc_metadata/metadata_wrappers/metadata_wrapper.py +1 -3
- edc_metadata/migrations/0001_initial.py +2 -1
- edc_metadata/migrations/0002_auto_20161127_2226.py +6 -13
- edc_metadata/migrations/0005_auto_20170112_0602.py +2 -1
- edc_metadata/migrations/0007_auto_20170810_1032.py +2 -1
- edc_metadata/migrations/0009_auto_20180116_1528.py +2 -1
- edc_metadata/migrations/0014_auto_20190707_0002.py +1 -1
- edc_metadata/migrations/0015_auto_20190709_0009.py +3 -5
- edc_metadata/migrations/0021_alter_crfmetadata_managers_and_more.py +1 -1
- edc_metadata/migrations/0023_alter_crfmetadata_device_created_and_more.py +5 -13
- edc_metadata/model_mixins/creates/creates_metadata_model_mixin.py +1 -3
- edc_metadata/model_mixins/updates/updates_metadata_model_mixin.py +1 -3
- edc_metadata/models/crf_metadata_model_mixin.py +2 -6
- edc_metadata/next_form_getter.py +1 -3
- edc_metadata/requisition/requisition_metadata_handler.py +3 -2
- edc_metadata/requisition/requisition_metadata_updater.py +1 -3
- edc_metadata/update_metadata_on_schedule_change.py +7 -14
- edc_model/models/fields/initials_field.py +1 -3
- edc_model/models/signals.py +1 -3
- edc_model/system_checks.py +1 -3
- edc_model/validators/duration.py +1 -3
- edc_model_admin/admin_site.py +1 -3
- edc_model_admin/changelist_buttons/model_admin_changelist_button_mixin.py +4 -12
- edc_model_admin/changelist_buttons/model_admin_changelist_model_button_mixin.py +1 -3
- edc_model_admin/dashboard/model_admin_crf_dashboard_mixin.py +1 -3
- edc_model_admin/dashboard/model_admin_dashboard_mixin.py +1 -3
- edc_model_admin/mixins/base_model_admin_redirect_mixin.py +2 -6
- edc_model_admin/mixins/inlines/limited_admin_inline_mixin.py +1 -3
- edc_model_admin/mixins/model_admin_bypass_default_form_cls_mixin.py +4 -12
- edc_model_admin/mixins/model_admin_form_auto_number_mixin.py +2 -6
- edc_model_admin/mixins/model_admin_form_instructions_mixin.py +2 -6
- edc_model_admin/mixins/model_admin_next_url_redirect_mixin.py +3 -9
- edc_model_admin/mixins/model_admin_protect_pii_mixin.py +1 -3
- edc_model_admin/mixins/model_admin_redirect_all_to_changelist_mixin.py +2 -6
- edc_model_admin/mixins/model_admin_redirect_on_delete_mixin.py +1 -3
- edc_model_admin/templatetags/edc_admin_modify.py +3 -9
- edc_model_fields/fields/initials_field.py +1 -3
- edc_model_form/mixins/inline_model_form_mixin.py +5 -9
- edc_model_to_dataframe/model_to_dataframe.py +15 -46
- edc_navbar/get_default_navbar.py +1 -3
- edc_navbar/migrations/0004_auto_20220825_0451.py +1 -1
- edc_navbar/migrations/0006_alter_edcpermissions_device_created_and_more.py +3 -7
- edc_navbar/navbar.py +1 -3
- edc_navbar/navbar_item.py +1 -3
- edc_navbar/site_navbars.py +2 -6
- edc_navbar/templatetags/edc_navbar_extras.py +1 -3
- edc_notification/admin_site.py +1 -3
- edc_notification/mailing_list_manager.py +5 -15
- edc_notification/migrations/0001_initial.py +2 -1
- edc_notification/migrations/0008_alter_notification_device_created_and_more.py +3 -7
- edc_notification/modeladmin_mixins.py +1 -3
- edc_notification/models/notification.py +1 -3
- edc_notification/models/signals.py +3 -10
- edc_notification/notification/model_notification.py +3 -9
- edc_notification/notification/notification.py +4 -12
- edc_notification/site_notifications.py +5 -14
- edc_offstudy/migrations/0001_initial.py +2 -1
- edc_offstudy/migrations/0002_auto_20180921_0434.py +4 -3
- edc_offstudy/migrations/0008_auto_20191102_0033.py +2 -1
- edc_offstudy/migrations/0015_auto_20220925_0032.py +1 -1
- edc_offstudy/migrations/0016_auto_20220929_1742.py +1 -0
- edc_offstudy/migrations/0018_alter_subjectoffstudy_managers.py +2 -1
- edc_offstudy/migrations/0019_alter_historicalsubjectoffstudy_device_created_and_more.py +5 -13
- edc_offstudy/model_mixins/offstudy_model_mixin.py +3 -3
- edc_offstudy/modelform_mixins/crf/offstudy_crf_modelform_mixin.py +2 -6
- edc_offstudy/templatetags/edc_offstudy_extras.py +2 -6
- edc_offstudy/utils.py +1 -3
- edc_pdf_reports/admin/modeladmin_mixins.py +1 -3
- edc_pdf_reports/crf_pdf_report.py +3 -9
- edc_pdf_reports/flowables/textbox.py +1 -3
- edc_pdf_reports/report.py +6 -18
- edc_pdf_reports/utils.py +1 -3
- edc_pdf_reports/views/pdf_intermediate_view.py +1 -3
- edc_pdf_reports/views/print_pdf_report_view.py +2 -6
- edc_pdutils/actions.py +4 -12
- edc_pdutils/choices.py +1 -4
- edc_pdutils/database.py +1 -3
- edc_pdutils/df_exporters/csv_crf_inline_tables_exporter.py +4 -12
- edc_pdutils/df_exporters/csv_exporter.py +7 -22
- edc_pdutils/df_handlers/crf_df_handler.py +3 -9
- edc_pdutils/df_handlers/df_handler.py +1 -3
- edc_pdutils/df_handlers/registered_subject_df_handler.py +1 -3
- edc_pdutils/management/commands/export_models.py +2 -6
- edc_pdutils/migrations/0001_initial.py +6 -9
- edc_pdutils/site.py +2 -6
- edc_pdutils/site_values_mappings.py +3 -9
- edc_pdutils/tables/aliquot.py +2 -9
- edc_pdutils/tables/consent.py +2 -6
- edc_pdutils/tables/crf.py +4 -12
- edc_pdutils/tables/requisition.py +4 -12
- edc_pdutils/tables/visit.py +1 -3
- edc_pdutils/utils/convert_dates_from_model.py +3 -9
- edc_pdutils/utils/convert_numerics_from_model.py +1 -3
- edc_pdutils/utils/convert_timedelta_from_model.py +1 -3
- edc_pdutils/utils/missing_subject_identifiers.py +1 -3
- edc_pharmacy/admin/actions/confirm_stock.py +2 -6
- edc_pharmacy/admin/actions/delete_order_items.py +1 -3
- edc_pharmacy/admin/actions/delete_receive_items.py +1 -3
- edc_pharmacy/admin/actions/print_stock_report.py +1 -3
- edc_pharmacy/admin/list_filters.py +5 -17
- edc_pharmacy/admin/model_admin_mixin.py +1 -3
- edc_pharmacy/admin/prescription/rx_admin.py +2 -6
- edc_pharmacy/admin/prescription/rx_refill_admin.py +1 -3
- edc_pharmacy/admin/reports/stock_availability_admin.py +1 -5
- edc_pharmacy/admin/stock/allocation_admin.py +5 -15
- edc_pharmacy/admin/stock/allocation_proxy_admin.py +1 -3
- edc_pharmacy/admin/stock/confirmation_admin.py +1 -3
- edc_pharmacy/admin/stock/confirmation_at_site_admin.py +4 -12
- edc_pharmacy/admin/stock/confirmation_at_site_item_admin.py +5 -17
- edc_pharmacy/admin/stock/dispense_admin.py +3 -11
- edc_pharmacy/admin/stock/dispense_item_admin.py +4 -14
- edc_pharmacy/admin/stock/order_admin.py +1 -3
- edc_pharmacy/admin/stock/order_item_admin.py +5 -15
- edc_pharmacy/admin/stock/receive_admin.py +4 -12
- edc_pharmacy/admin/stock/receive_item_admin.py +4 -12
- edc_pharmacy/admin/stock/repack_request_admin.py +2 -6
- edc_pharmacy/admin/stock/stock_adjustment_admin.py +1 -3
- edc_pharmacy/admin/stock/stock_admin.py +8 -24
- edc_pharmacy/admin/stock/stock_proxy_admin.py +1 -5
- edc_pharmacy/admin/stock/stock_request_item_admin.py +5 -15
- edc_pharmacy/admin/stock/stock_transfer_admin.py +4 -12
- edc_pharmacy/admin/stock/stock_transfer_item_admin.py +6 -18
- edc_pharmacy/admin/stock/storage_bin_admin.py +3 -11
- edc_pharmacy/admin/stock/storage_bin_item_admin.py +4 -14
- edc_pharmacy/analytics/dataframes/get_next_scheduled_visit_for_subjects_df.py +3 -9
- edc_pharmacy/analytics/dataframes/in_stock_for_subjects_df.py +2 -6
- edc_pharmacy/analytics/dataframes/stock_for_subjects.py +1 -3
- edc_pharmacy/form_validators/crf/study_medication_form_validator.py +9 -27
- edc_pharmacy/forms/stock/container_form.py +2 -6
- edc_pharmacy/forms/stock/receive_item_form.py +2 -6
- edc_pharmacy/forms/stock/repack_request_form.py +4 -11
- edc_pharmacy/forms/stock/stock_request_form.py +5 -14
- edc_pharmacy/forms/stock/stock_request_item_form.py +1 -3
- edc_pharmacy/labels/draw_bulk_stock_label_code128.py +1 -3
- edc_pharmacy/labels/draw_bulk_stock_label_code39.py +3 -9
- edc_pharmacy/labels/draw_patient_stock_label_code128.py +1 -3
- edc_pharmacy/migrations/0001_initial.py +7 -15
- edc_pharmacy/migrations/0005_alter_rx_managers.py +2 -1
- edc_pharmacy/migrations/0015_auto_20220913_2139.py +9 -22
- edc_pharmacy/migrations/0016_auto_20220929_1742.py +2 -1
- edc_pharmacy/migrations/0018_alter_rxrefill_managers.py +1 -1
- edc_pharmacy/migrations/0020_alter_box_device_created_alter_box_device_modified_and_more.py +71 -211
- edc_pharmacy/migrations/0021_alter_box_options_alter_container_options_and_more.py +1 -1
- edc_pharmacy/migrations/0023_remove_rx_edc_pharmac_modifie_986021_idx_and_more.py +1 -3
- edc_pharmacy/migrations/0024_allocation_assignment_containerunits_dispense_and_more.py +40 -104
- edc_pharmacy/migrations/0031_historicalrepackrequest_task_id_and_more.py +2 -1
- edc_pharmacy/migrations/0033_container_display_name_and_more.py +1 -3
- edc_pharmacy/migrations/0035_container_max_per_subject_and_more.py +2 -6
- edc_pharmacy/migrations/0037_remove_historicalstock_confirmed_at_site_by_and_more.py +2 -6
- edc_pharmacy/migrations/0039_remove_dispense_registered_subject_and_more.py +7 -9
- edc_pharmacy/migrations/0043_stockproxy_alter_historicallot_lot_no_and_more.py +2 -1
- edc_pharmacy/migrations/0049_remove_stocktransferconfirmation_stock_and_more.py +5 -13
- edc_pharmacy/migrations/0050_remove_stocktransferconfirmation2_location_and_more.py +2 -6
- edc_pharmacy/migrations/0051_alter_historicalstocktransferconfirmationitem_options_and_more.py +2 -1
- edc_pharmacy/migrations/0053_alter_location_managers_alter_historicalstock_lot_and_more.py +7 -11
- edc_pharmacy/migrations/0057_scanduplicates.py +3 -4
- edc_pharmacy/migrations/0058_stockrequestproxy_alter_stockproxy_options.py +2 -1
- edc_pharmacy/migrations/0060_alter_container_max_per_subject_and_more.py +8 -14
- edc_pharmacy/migrations/0061_alter_historicalstocktransferconfirmation_options_and_more.py +1 -1
- edc_pharmacy/migrations/0062_auto_20250312_1433.py +2 -6
- edc_pharmacy/migrations/0063_alter_allocation_managers_remove_allocation_site_and_more.py +2 -1
- edc_pharmacy/migrations/0065_allocationproxy.py +2 -1
- edc_pharmacy/migrations/0068_stockout.py +2 -1
- edc_pharmacy/migrations/0076_historicalstockadjustment_stockadjustment.py +5 -8
- edc_pharmacy/migrations/0077_historicalstockadjustment_adjustment_datetime_and_more.py +2 -1
- edc_pharmacy/migrations/0078_alter_historicalstock_qty_and_more.py +2 -1
- edc_pharmacy/migrations/0081_historicalconfirmation_confirmation.py +8 -10
- edc_pharmacy/migrations/0084_confirmationatsiteitem_and_more.py +2 -2
- edc_pharmacy/model_mixins/study_medication_crf_model_mixin.py +3 -9
- edc_pharmacy/models/medication/dosage_guideline.py +1 -3
- edc_pharmacy/models/medication/formulation.py +1 -3
- edc_pharmacy/models/prescription/rx.py +1 -3
- edc_pharmacy/models/prescription/rx_refill.py +2 -6
- edc_pharmacy/models/signals.py +11 -21
- edc_pharmacy/models/stock/allocation.py +3 -9
- edc_pharmacy/models/stock/confirmation.py +1 -3
- edc_pharmacy/models/stock/confirmation_at_site_item.py +1 -3
- edc_pharmacy/models/stock/container.py +1 -3
- edc_pharmacy/models/stock/dispense.py +1 -3
- edc_pharmacy/models/stock/dispense_item.py +1 -3
- edc_pharmacy/models/stock/lot.py +1 -3
- edc_pharmacy/models/stock/order_item.py +2 -6
- edc_pharmacy/models/stock/product.py +2 -6
- edc_pharmacy/models/stock/receive_item.py +4 -12
- edc_pharmacy/models/stock/repack_request.py +1 -3
- edc_pharmacy/models/stock/stock.py +3 -8
- edc_pharmacy/models/stock/stock_request_item.py +4 -4
- edc_pharmacy/models/stock/stock_transfer_item.py +1 -3
- edc_pharmacy/models/stock/supplier.py +1 -3
- edc_pharmacy/models/storage/utils.py +1 -4
- edc_pharmacy/pdf_reports/manifest_pdf_report.py +3 -9
- edc_pharmacy/pdf_reports/stock_pdf_report.py +3 -9
- edc_pharmacy/refill/adjust_previous_end_datetime.py +2 -6
- edc_pharmacy/refill/create_next_refill.py +1 -3
- edc_pharmacy/refill/create_refill.py +1 -3
- edc_pharmacy/refill/refill_creator.py +2 -6
- edc_pharmacy/sample_usb_printing/network_printers.py +1 -3
- edc_pharmacy/settings.py +3 -9
- edc_pharmacy/urls.py +1 -3
- edc_pharmacy/utils/allocate_stock.py +1 -3
- edc_pharmacy/utils/confirm_stock_at_site.py +3 -5
- edc_pharmacy/utils/dispense.py +1 -4
- edc_pharmacy/utils/get_unit_qty_out.py +1 -3
- edc_pharmacy/utils/process_repack_request.py +1 -3
- edc_pharmacy/utils/process_repack_request_queryset.py +1 -3
- edc_pharmacy/utils/stock_request/bulk_create_stock_request_items.py +2 -6
- edc_pharmacy/utils/stock_request/get_instock_and_nostock_data.py +3 -8
- edc_pharmacy/utils/transfer_stock.py +1 -3
- edc_pharmacy/utils/update_previous_refill_end_datetime.py +1 -3
- edc_pharmacy/views/add_to_storage_bin_view.py +2 -6
- edc_pharmacy/views/allocate_to_subject_view.py +7 -21
- edc_pharmacy/views/confirm_stock_from_instance_view.py +2 -6
- edc_pharmacy/views/confirm_stock_from_queryset_view.py +2 -7
- edc_pharmacy/views/confirmation_at_site_view.py +10 -31
- edc_pharmacy/views/dispense_view.py +2 -6
- edc_pharmacy/views/move_to_storage_bin_view.py +2 -6
- edc_pharmacy/views/prepare_and_review_stock_request_view.py +3 -9
- edc_pharmacy/views/print_labels_view.py +1 -3
- edc_pharmacy/views/print_stock_transfer_manifest_view.py +1 -3
- edc_pharmacy/views/transfer_stock_view.py +1 -3
- edc_prn/modelform_mixins.py +1 -3
- edc_prn/prn.py +2 -6
- edc_prn/templatetags/edc_prn_extras.py +4 -8
- edc_protocol/research_protocol_config.py +2 -5
- edc_protocol_incident/admin/protocol_deviation_violation_admin.py +1 -3
- edc_protocol_incident/auth_objects.py +1 -3
- edc_protocol_incident/auths.py +1 -3
- edc_protocol_incident/form_validators/mixins.py +3 -9
- edc_protocol_incident/form_validators/protocol_deviation_violation_form_validator.py +6 -18
- edc_protocol_incident/form_validators/protocol_incident_form_validator.py +3 -8
- edc_protocol_incident/migrations/0001_initial.py +4 -3
- edc_protocol_incident/migrations/0001_squashed_0015_auto_20220927_0401.py +7 -12
- edc_protocol_incident/migrations/0005_protocolincident_historicalprotocolincident_and_more.py +4 -3
- edc_protocol_incident/migrations/0012_auto_20220913_2139.py +3 -9
- edc_protocol_incident/migrations/0020_alter_historicalprotocoldeviationviolation_device_created_and_more.py +9 -25
- edc_protocol_incident/model_mixins/protocol_deviation_violation_model_mixin.py +3 -7
- edc_protocol_incident/model_mixins/protocol_incident_model_mixin.py +1 -3
- edc_protocol_incident/urls.py +1 -3
- edc_pylabels/actions.py +2 -6
- edc_pylabels/admin/label_configuration_admin.py +4 -4
- edc_pylabels/drawing_callable_example.py +1 -3
- edc_pylabels/migrations/0001_initial.py +1 -3
- edc_pylabels/migrations/0002_alter_label_options_label_created_and_more.py +2 -6
- edc_pylabels/migrations/0005_labelconfiguration_delete_label_and_more.py +1 -3
- edc_pylabels/models/label_configuration.py +1 -3
- edc_qareports/migrations/0001_initial.py +3 -4
- edc_qareports/migrations/0005_edcpermissions.py +2 -4
- edc_qareports/migrations/0006_qareportlog.py +2 -1
- edc_qareports/migrations/0007_qareportlog_edc_qarepor_accesse_738ffe_idx.py +1 -3
- edc_qareports/migrations/0017_auto_20240816_0256.py +1 -0
- edc_qareports/model_mixins/note_model_mixin.py +1 -3
- edc_qareports/modeladmin_mixins/list_filters.py +8 -12
- edc_qareports/modeladmin_mixins/note_modeladmin_mixin.py +1 -3
- edc_qareports/modeladmin_mixins/on_study_missing_values_modeladmin_mixin.py +2 -6
- edc_qareports/modeladmin_mixins/qa_report_modeladmin_mixin.py +1 -3
- edc_qareports/sql_generator/crf_case.py +1 -5
- edc_qareports/sql_generator/sql_view_generator.py +1 -3
- edc_qareports/utils.py +2 -6
- edc_randomization/admin.py +1 -3
- edc_randomization/auths.py +2 -6
- edc_randomization/blinding.py +1 -3
- edc_randomization/migrations/0001_initial.py +3 -4
- edc_randomization/migrations/0009_edcpermissions.py +1 -1
- edc_randomization/migrations/0011_alter_edcpermissions_device_created_and_more.py +7 -19
- edc_randomization/model_mixins.py +2 -5
- edc_randomization/randomization_list_importer.py +3 -7
- edc_randomization/randomization_list_verifier.py +2 -7
- edc_randomization/randomizer.py +2 -6
- edc_randomization/site_randomizers.py +1 -3
- edc_randomization/system_checks.py +1 -3
- edc_randomization/utils.py +2 -6
- edc_refusal/admin.py +1 -3
- edc_refusal/forms.py +1 -2
- edc_refusal/migrations/0001_initial.py +2 -1
- edc_refusal/migrations/0002_historicalsubjectrefusal.py +6 -4
- edc_refusal/migrations/0004_refusalreasons_plural_name.py +1 -3
- edc_refusal/migrations/0005_alter_subjectrefusal_options_and_more.py +2 -1
- edc_refusal/migrations/0006_alter_subjectrefusal_managers.py +2 -1
- edc_refusal/migrations/0008_alter_historicalsubjectrefusal_device_created_and_more.py +5 -13
- edc_registration/admin_site.py +1 -3
- edc_registration/migrations/0001_initial.py +3 -4
- edc_registration/migrations/0002_auto_20161127_2226.py +4 -7
- edc_registration/migrations/0004_auto_20161221_0018.py +2 -1
- edc_registration/migrations/0005_auto_20170111_1809.py +2 -1
- edc_registration/migrations/0008_auto_20170810_1032.py +2 -1
- edc_registration/migrations/0012_auto_20180116_1528.py +2 -1
- edc_registration/migrations/0015_auto_20181006_2257.py +1 -1
- edc_registration/migrations/0016_historicalregisteredsubject.py +5 -6
- edc_registration/migrations/0026_historicalregisteredsubject_familiar_name_and_more.py +1 -1
- edc_registration/migrations/0028_alter_registeredsubject_managers.py +1 -1
- edc_registration/migrations/0029_alter_historicalregisteredsubject_device_created_and_more.py +5 -13
- edc_registration/modeladmin_mixins.py +1 -3
- edc_registration/models/registered_subject.py +4 -11
- edc_registration/utils.py +1 -3
- edc_reportable/admin_site.py +1 -3
- edc_reportable/data/normal_data/africa.py +4 -14
- edc_reportable/evaluator.py +2 -6
- edc_reportable/formula.py +2 -6
- edc_reportable/management/commands/export_reportables.py +1 -3
- edc_reportable/migrations/0001_initial.py +3 -9
- edc_reportable/migrations/0003_referencerangecollection_grade1_and_more.py +3 -9
- edc_reportable/migrations/0004_alter_referencerangecollection_grade3_and_more.py +4 -7
- edc_reportable/migrations/0006_alter_gradingdata_revision_and_more.py +8 -19
- edc_reportable/models/mw.py +1 -3
- edc_reportable/models/reference_model_mixins.py +1 -3
- edc_reportable/models/reference_range_collection.py +3 -9
- edc_reportable/post_migrate_signals.py +1 -3
- edc_reportable/reference_range_evaluator.py +4 -11
- edc_reportable/utils/convert_units.py +1 -3
- edc_reportable/utils/get_grade_for_value.py +3 -1
- edc_reportable/utils/get_reference_range_collection.py +2 -2
- edc_reportable/utils/load_data.py +1 -3
- edc_reportable/utils/update_grading_data.py +2 -6
- edc_review_dashboard/migrations/0001_initial.py +1 -1
- edc_review_dashboard/migrations/0003_alter_edcpermissions_device_created_and_more.py +3 -7
- edc_review_dashboard/views/subject_review_listboard_view.py +1 -3
- edc_screening/eligibility.py +1 -3
- edc_screening/fc.py +1 -3
- edc_screening/migrations/0001_initial.py +1 -1
- edc_screening/migrations/0002_alter_edcpermissions_device_created_and_more.py +3 -7
- edc_screening/model_mixins/eligibility_model_mixin.py +1 -3
- edc_screening/model_mixins/screening_fields_model_mixin.py +2 -0
- edc_screening/modelform_mixins.py +1 -3
- edc_search/search_slug.py +2 -6
- edc_search/updater.py +2 -5
- edc_sites/admin/site_model_admin_mixin.py +4 -12
- edc_sites/management/commands/sync_sites.py +1 -3
- edc_sites/migrations/0007_edcpermissions.py +2 -4
- edc_sites/single_site/get_languages.py +1 -3
- edc_sites/site.py +4 -11
- edc_sites/system_checks.py +1 -4
- edc_sites/utils/add_or_update_django_sites.py +1 -3
- edc_subject_dashboard/migrations/0001_initial.py +1 -1
- edc_subject_dashboard/migrations/0002_alter_edcpermissions_device_created_and_more.py +3 -7
- edc_subject_dashboard/requisition_labels.py +1 -3
- edc_subject_dashboard/requisition_report.py +5 -15
- edc_subject_dashboard/requisition_verifier.py +2 -7
- edc_subject_dashboard/templatetags/edc_subject_dashboard_extras.py +2 -6
- edc_subject_dashboard/view_mixins/subject_visit_view_mixin.py +1 -2
- edc_subject_dashboard/view_utils/crf_button.py +1 -3
- edc_subject_dashboard/view_utils/subject_consent_listboard_button.py +1 -3
- edc_subject_dashboard/view_utils/timepoint_status_button.py +1 -3
- edc_subject_dashboard/views/requisition_print_actions_view.py +4 -12
- edc_subject_dashboard/views/requisition_verify_actions_view.py +1 -3
- edc_subject_dashboard/views/subject_dashboard_view.py +1 -3
- edc_timepoint/apps.py +1 -3
- edc_timepoint/timepoint.py +1 -3
- edc_timepoint/timepoint_lookup.py +1 -3
- edc_transfer/form_validators.py +4 -6
- edc_transfer/model_mixins.py +1 -3
- edc_transfer/modelform_mixins.py +1 -3
- edc_unblinding/action_items.py +1 -3
- edc_unblinding/admin_site.py +1 -3
- edc_unblinding/migrations/0001_initial.py +6 -4
- edc_unblinding/migrations/0002_auto_20210908_2318.py +1 -1
- edc_unblinding/migrations/0009_alter_unblindingrequest_managers_and_more.py +2 -1
- edc_unblinding/migrations/0010_alter_historicalunblindingrequest_device_created_and_more.py +9 -25
- edc_unblinding/models/unblinding_request.py +1 -3
- edc_unblinding/models/unblinding_review.py +1 -3
- edc_utils/age.py +1 -3
- edc_utils/date.py +1 -3
- edc_utils/paths_for_urlpatterns.py +1 -3
- edc_utils/show_urls.py +1 -3
- edc_utils/text.py +1 -2
- edc_view_utils/model_button.py +5 -13
- edc_view_utils/query_button.py +1 -3
- edc_visit_schedule/admin/subject_schedule_history_admin.py +1 -3
- edc_visit_schedule/baseline.py +1 -3
- edc_visit_schedule/migrations/0001_initial.py +3 -4
- edc_visit_schedule/migrations/0003_historicalvisitschedule_visitschedule.py +1 -3
- edc_visit_schedule/migrations/0004_auto_20190629_1800.py +1 -3
- edc_visit_schedule/migrations/0011_alter_historicalvisitschedule_device_created_and_more.py +7 -19
- edc_visit_schedule/migrations/0012_alter_subjectschedulehistory_managers_and_more.py +2 -1
- edc_visit_schedule/migrations/0015_historicalonschedule_offschedule_onschedule.py +9 -13
- edc_visit_schedule/migrations/0017_alter_onschedule_managers.py +2 -1
- edc_visit_schedule/model_mixins/crf/crf_schedule_model_mixin.py +1 -1
- edc_visit_schedule/model_mixins/off_schedule_model_mixin.py +2 -6
- edc_visit_schedule/model_mixins/on_schedule_model_mixin.py +1 -3
- edc_visit_schedule/modelform_mixins/off_schedule_modelform_mixin.py +1 -3
- edc_visit_schedule/models/subject_schedule_history.py +3 -8
- edc_visit_schedule/ordered_collection.py +1 -3
- edc_visit_schedule/schedule/schedule.py +6 -17
- edc_visit_schedule/simple_model_validator.py +3 -8
- edc_visit_schedule/site_visit_schedules.py +5 -15
- edc_visit_schedule/subject_schedule.py +4 -16
- edc_visit_schedule/system_checks.py +1 -3
- edc_visit_schedule/utils.py +8 -17
- edc_visit_schedule/view_mixins.py +4 -10
- edc_visit_schedule/visit/crf.py +1 -2
- edc_visit_schedule/visit/requisition.py +1 -3
- edc_visit_schedule/visit/visit.py +6 -16
- edc_visit_schedule/visit/window_period.py +3 -3
- edc_visit_schedule/visit_schedule/visit_schedule.py +2 -5
- edc_visit_tracking/crf_date_validator.py +1 -2
- edc_visit_tracking/form_validators/visit_form_validator.py +2 -8
- edc_visit_tracking/form_validators/visit_missed_form_validator.py +3 -9
- edc_visit_tracking/migrations/0003_auto_20220913_2139.py +2 -6
- edc_visit_tracking/migrations/0004_subjectvisit_subjectvisitmissedreasons_extra_value_and_more.py +8 -16
- edc_visit_tracking/model_mixins/base/visit_methods_model_mixin.py +2 -6
- edc_visit_tracking/model_mixins/crfs/visit_tracking_crf_model_mixin.py +1 -3
- edc_visit_tracking/model_mixins/requisitions/visit_tracking_requisition_model_mixin.py +1 -3
- edc_visit_tracking/model_mixins/subject_visit_missed_model_mixin.py +1 -3
- edc_visit_tracking/model_mixins/visit_model_mixin/visit_model_fields_mixin.py +1 -2
- edc_visit_tracking/modeladmin_mixins/crf_model_admin_mixin.py +4 -8
- edc_visit_tracking/modeladmin_mixins/visit_model_admin_mixin.py +4 -6
- edc_visit_tracking/modelform_mixins/crf/visit_tracking_crf_modelform_mixin.py +2 -6
- edc_visit_tracking/modelform_mixins/utils.py +1 -3
- edc_visit_tracking/modelform_mixins/visit_tracking_modelform_mixin.py +1 -2
- edc_visit_tracking/models/signals.py +1 -3
- edc_visit_tracking/stubs.py +1 -3
- edc_visit_tracking/utils.py +1 -2
- edc_visit_tracking/view_utils/related_visit_button.py +1 -3
- edc_visit_tracking/visit_sequence.py +1 -3
- edc_vitals/__init__.py +2 -0
- edc_vitals/apps.py +6 -0
- edc_vitals/calculators/__init__.py +1 -0
- edc_vitals/calculators/bmi.py +70 -0
- edc_vitals/form_validators/__init__.py +5 -0
- edc_vitals/form_validators/blood_pressure_form_validator_mixin.py +40 -0
- edc_vitals/form_validators/bmi_form_validator_mixin.py +19 -0
- edc_vitals/form_validators/weight_height_with_bmi_form_validator_mixin.py +13 -0
- edc_vitals/migrations/__init__.py +0 -0
- edc_vitals/model_mixins/__init__.py +5 -0
- edc_vitals/model_mixins/blood_pressure_model_mixin.py +80 -0
- edc_vitals/model_mixins/weight_height_bmi_model_mixin.py +42 -0
- edc_vitals/models/__init__.py +10 -0
- edc_vitals/models/fields/__init__.py +7 -0
- edc_vitals/models/fields/blood_pressure.py +36 -0
- edc_vitals/models/fields/heart_rate.py +22 -0
- edc_vitals/models/fields/height.py +26 -0
- edc_vitals/models/fields/respiratory_rate.py +22 -0
- edc_vitals/models/fields/temperature.py +26 -0
- edc_vitals/models/fields/waist_circumference.py +23 -0
- edc_vitals/models/fields/weight.py +26 -0
- edc_vitals/utils.py +51 -0
- edc_vitals/validators.py +5 -0
- edc_lab_results/model_mixin_factory/__init__.py +0 -2
- {clinicedc-2.0.1.dist-info → clinicedc-2.0.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from edc_constants.constants import FEMALE, MALE
|
|
4
|
+
from edc_reportable import MICROMOLES_PER_LITER, MILLIGRAMS_PER_DECILITER
|
|
5
|
+
from edc_reportable.utils import convert_units
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EgfrCalculatorError(Exception):
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BaseEgfr:
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
gender: str | None = None,
|
|
16
|
+
age_in_years: int | float | None = None,
|
|
17
|
+
creatinine_value: float | int | None = None,
|
|
18
|
+
creatinine_units: str | None = None,
|
|
19
|
+
**kwargs, # noqa
|
|
20
|
+
):
|
|
21
|
+
"""Expects creatinine (scr) in umols/L.
|
|
22
|
+
|
|
23
|
+
Converts to creatinine to mg/dL for the calculation.
|
|
24
|
+
"""
|
|
25
|
+
self.scr = {}
|
|
26
|
+
if not gender or gender not in [MALE, FEMALE]:
|
|
27
|
+
raise EgfrCalculatorError(
|
|
28
|
+
f"Invalid gender. Expected one of {MALE}, {FEMALE}. Got {gender}."
|
|
29
|
+
)
|
|
30
|
+
self.gender = gender
|
|
31
|
+
if not (18 <= (age_in_years or 0) < 120):
|
|
32
|
+
raise EgfrCalculatorError(
|
|
33
|
+
f"Invalid age. See {self.__class__.__name__}. Got {age_in_years}"
|
|
34
|
+
)
|
|
35
|
+
self.age_in_years = float(age_in_years) if age_in_years else None
|
|
36
|
+
if creatinine_value and creatinine_units:
|
|
37
|
+
self.scr.update(
|
|
38
|
+
{
|
|
39
|
+
MILLIGRAMS_PER_DECILITER: convert_units(
|
|
40
|
+
label="creatinine",
|
|
41
|
+
value=float(creatinine_value),
|
|
42
|
+
units_from=creatinine_units,
|
|
43
|
+
units_to=MILLIGRAMS_PER_DECILITER,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
self.scr.update(
|
|
48
|
+
{
|
|
49
|
+
MICROMOLES_PER_LITER: convert_units(
|
|
50
|
+
label="creatinine",
|
|
51
|
+
value=float(creatinine_value),
|
|
52
|
+
units_from=creatinine_units,
|
|
53
|
+
units_to=MICROMOLES_PER_LITER,
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from edc_constants.constants import BLACK, FEMALE
|
|
4
|
+
from edc_reportable import MILLIGRAMS_PER_DECILITER
|
|
5
|
+
|
|
6
|
+
from .base_egrfr import BaseEgfr, EgfrCalculatorError
|
|
7
|
+
|
|
8
|
+
# TODO: https://www.rcpa.edu.au/Manuals/RCPA-Manual/
|
|
9
|
+
# Pathology-Tests/C/Creatinine-clearance-Cockcroft-and-Gault
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EgfrCkdEpi(BaseEgfr):
|
|
13
|
+
"""Reference https://nephron.com/epi_equation
|
|
14
|
+
|
|
15
|
+
CKD-EPI Creatinine equation (2009)
|
|
16
|
+
|
|
17
|
+
Levey AS, Stevens LA, et al. A New Equation to Estimate Glomerular
|
|
18
|
+
Filtration Rate. Ann Intern Med. 2009; 150:604-612.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, ethnicity: str = None, **kwargs):
|
|
22
|
+
self.ethnicity = ethnicity
|
|
23
|
+
super().__init__(**kwargs)
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def value(self) -> float | None:
|
|
27
|
+
if (
|
|
28
|
+
self.gender
|
|
29
|
+
and self.age_in_years
|
|
30
|
+
and self.ethnicity
|
|
31
|
+
and self.scr.get(MILLIGRAMS_PER_DECILITER)
|
|
32
|
+
):
|
|
33
|
+
scr = self.scr.get(MILLIGRAMS_PER_DECILITER)
|
|
34
|
+
return float(
|
|
35
|
+
141.000
|
|
36
|
+
* (min(scr / self.kappa, 1.000) ** self.alpha)
|
|
37
|
+
* (max(scr / self.kappa, 1.000) ** -1.209)
|
|
38
|
+
* self.age_factor
|
|
39
|
+
* self.gender_factor
|
|
40
|
+
* self.ethnicity_factor
|
|
41
|
+
)
|
|
42
|
+
opts = dict(
|
|
43
|
+
gender=self.gender,
|
|
44
|
+
age_in_years=self.age_in_years,
|
|
45
|
+
ethnicity=self.ethnicity,
|
|
46
|
+
scr=self.scr.get(MILLIGRAMS_PER_DECILITER),
|
|
47
|
+
)
|
|
48
|
+
raise EgfrCalculatorError(f"Unable to calculate. Insufficient information. Got {opts}")
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def alpha(self) -> float:
|
|
52
|
+
return float(-0.329 if self.gender == FEMALE else -0.411)
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def kappa(self) -> float:
|
|
56
|
+
return float(0.7 if self.gender == FEMALE else 0.9)
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def ethnicity_factor(self) -> float:
|
|
60
|
+
return float(1.159 if self.ethnicity == BLACK else 1.000)
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def gender_factor(self) -> float:
|
|
64
|
+
return float(1.018 if self.gender == FEMALE else 1.000)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def age_factor(self) -> float:
|
|
68
|
+
return float(0.993**self.age_in_years)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from decimal import Decimal
|
|
4
|
+
|
|
5
|
+
from edc_constants.constants import FEMALE
|
|
6
|
+
from edc_reportable import MICROMOLES_PER_LITER
|
|
7
|
+
|
|
8
|
+
from .base_egrfr import BaseEgfr, EgfrCalculatorError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class EgfrCockcroftGault(BaseEgfr):
|
|
12
|
+
"""Reference https://www.mdcalc.com/creatinine-clearance-cockcroft-gault-equation
|
|
13
|
+
|
|
14
|
+
Cockcroft-Gault
|
|
15
|
+
|
|
16
|
+
eGFR (mL/min) = { (140 – age (years)) x weight (kg) x constant*} /
|
|
17
|
+
serum creatinine (μmol/L)
|
|
18
|
+
*constant = 1.23 for males and 1.05 for females
|
|
19
|
+
|
|
20
|
+
Cockcroft-Gault CrCl, mL/min =
|
|
21
|
+
(140 – age) × (weight, kg) × (0.85 if female) / (72 × SCr(mg/dL))
|
|
22
|
+
|
|
23
|
+
or:
|
|
24
|
+
|
|
25
|
+
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2763564/
|
|
26
|
+
|
|
27
|
+
GFR = 141 × min(Scr/κ, 1)α × max(Scr/κ, 1)-1.209 × 0.993Age
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, weight: int | float | Decimal = None, **kwargs):
|
|
31
|
+
self.weight = float(weight) if weight else None
|
|
32
|
+
super().__init__(**kwargs)
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def value(self) -> float:
|
|
36
|
+
"""Returns the eGFR value or raises.
|
|
37
|
+
|
|
38
|
+
eGFR (mL/min) = { (140 – age (years)) x weight (kg) x constant*} /
|
|
39
|
+
serum creatinine (μmol/L)
|
|
40
|
+
|
|
41
|
+
*constant = 1.23 for males and 1.05 for females
|
|
42
|
+
"""
|
|
43
|
+
if (
|
|
44
|
+
self.gender
|
|
45
|
+
and self.age_in_years
|
|
46
|
+
and self.weight
|
|
47
|
+
and self.scr.get(MICROMOLES_PER_LITER)
|
|
48
|
+
):
|
|
49
|
+
gender_factor = 1.05 if self.gender == FEMALE else 1.23
|
|
50
|
+
adjusted_age = 140.00 - self.age_in_years
|
|
51
|
+
value = (adjusted_age * self.weight * gender_factor) / float(
|
|
52
|
+
self.scr.get(MICROMOLES_PER_LITER)
|
|
53
|
+
)
|
|
54
|
+
return value
|
|
55
|
+
opts = dict(
|
|
56
|
+
gender=self.gender,
|
|
57
|
+
age_in_years=self.age_in_years,
|
|
58
|
+
weight=self.weight,
|
|
59
|
+
scr=self.scr.get(MICROMOLES_PER_LITER),
|
|
60
|
+
)
|
|
61
|
+
raise EgfrCalculatorError(
|
|
62
|
+
f"Unable to calculate egfr_value. Insufficient information. Got {opts}."
|
|
63
|
+
)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
def egfr_percent_change(egfr_value: float, baseline_egfr_value: float) -> float:
|
|
2
|
+
"""Returns the percent change from baseline"""
|
|
3
|
+
if egfr_value and baseline_egfr_value:
|
|
4
|
+
return 100 * (
|
|
5
|
+
(float(baseline_egfr_value) - float(egfr_value)) / float(baseline_egfr_value)
|
|
6
|
+
)
|
|
7
|
+
return 0.0
|
edc_egfr/constants.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
EGFR_DROP_NOTIFICATION_ACTION = "egfr_notification_action"
|
edc_egfr/egfr.py
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import date, datetime
|
|
4
|
+
from decimal import Decimal
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Optional
|
|
6
|
+
from zoneinfo import ZoneInfo
|
|
7
|
+
|
|
8
|
+
from dateutil.relativedelta import relativedelta
|
|
9
|
+
from django.core.exceptions import ObjectDoesNotExist
|
|
10
|
+
from django.db import transaction
|
|
11
|
+
|
|
12
|
+
from edc_constants.constants import NEW
|
|
13
|
+
from edc_reportable.models import ReferenceRangeCollection
|
|
14
|
+
from edc_reportable.units import EGFR_UNITS, PERCENT
|
|
15
|
+
from edc_reportable.utils import get_grade_for_value
|
|
16
|
+
from edc_utils import age, get_utcnow
|
|
17
|
+
|
|
18
|
+
from .calculators import EgfrCkdEpi, EgfrCockcroftGault, egfr_percent_change
|
|
19
|
+
from .get_drop_notification_model import get_egfr_drop_notification_model_cls
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from edc_visit_tracking.typing_stubs import RelatedVisitProtocol
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class EgfrError(Exception):
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Egfr:
|
|
30
|
+
calculators: dict = {"ckd-epi": EgfrCkdEpi, "cockcroft-gault": EgfrCockcroftGault}
|
|
31
|
+
|
|
32
|
+
def __init__(
|
|
33
|
+
self,
|
|
34
|
+
baseline_egfr_value: Decimal | float | None = None,
|
|
35
|
+
gender: str | None = None,
|
|
36
|
+
ethnicity: str | None = None,
|
|
37
|
+
age_in_years: int | None = None,
|
|
38
|
+
dob: date | None = None,
|
|
39
|
+
weight_in_kgs: Decimal | float | None = None,
|
|
40
|
+
report_datetime: datetime | None = None,
|
|
41
|
+
creatinine_value: Decimal | float | None = None,
|
|
42
|
+
creatinine_units: str | None = None,
|
|
43
|
+
formula_name: str | None = None,
|
|
44
|
+
value_threshold: Decimal | float | None = None,
|
|
45
|
+
percent_drop_threshold: Decimal | float | None = None,
|
|
46
|
+
reference_range_collection: ReferenceRangeCollection | None = None,
|
|
47
|
+
reference_range_collection_name: str | None = None,
|
|
48
|
+
calling_crf: Any | None = None,
|
|
49
|
+
related_visit: RelatedVisitProtocol | None = None,
|
|
50
|
+
assay_datetime: datetime | None = None,
|
|
51
|
+
egfr_drop_notification_model: str | None = None,
|
|
52
|
+
):
|
|
53
|
+
self._egfr_value: Decimal | None = None
|
|
54
|
+
self._egfr_grade = None
|
|
55
|
+
self._egfr_drop_value: Decimal | None = None
|
|
56
|
+
self._egfr_drop_grade = None
|
|
57
|
+
self.assay_date: date | None = None
|
|
58
|
+
self.related_visit = None
|
|
59
|
+
|
|
60
|
+
self.baseline_egfr_value = baseline_egfr_value
|
|
61
|
+
if formula_name not in self.calculators:
|
|
62
|
+
raise EgfrError(
|
|
63
|
+
f"Invalid formula_name. Expected one of {list(self.calculators.keys())}. "
|
|
64
|
+
f"Got {formula_name}."
|
|
65
|
+
)
|
|
66
|
+
else:
|
|
67
|
+
self.calculator_cls = self.calculators.get(formula_name)
|
|
68
|
+
self.age_in_years = age_in_years
|
|
69
|
+
self.dob = dob
|
|
70
|
+
self.weight_in_kgs = weight_in_kgs
|
|
71
|
+
self.egfr_drop_notification_model = egfr_drop_notification_model
|
|
72
|
+
self.egfr_drop_units = PERCENT
|
|
73
|
+
self.egfr_units = EGFR_UNITS
|
|
74
|
+
self.ethnicity = ethnicity
|
|
75
|
+
self.gender = gender
|
|
76
|
+
if not reference_range_collection:
|
|
77
|
+
try:
|
|
78
|
+
self.reference_range_collection = ReferenceRangeCollection.objects.get(
|
|
79
|
+
name=reference_range_collection_name
|
|
80
|
+
)
|
|
81
|
+
except ObjectDoesNotExist as e:
|
|
82
|
+
raise ObjectDoesNotExist(f"{e} Got {reference_range_collection_name}")
|
|
83
|
+
else:
|
|
84
|
+
self.reference_range_collection = reference_range_collection
|
|
85
|
+
self.report_datetime = report_datetime
|
|
86
|
+
self.value_threshold = value_threshold
|
|
87
|
+
self.percent_drop_threshold = percent_drop_threshold
|
|
88
|
+
|
|
89
|
+
if self.dob:
|
|
90
|
+
self.age_in_years = age(
|
|
91
|
+
born=self.dob,
|
|
92
|
+
reference_dt=self.report_datetime.astimezone(ZoneInfo("UTC")),
|
|
93
|
+
).years
|
|
94
|
+
elif not self.dob and self.age_in_years:
|
|
95
|
+
self.dob = (
|
|
96
|
+
self.report_datetime.astimezone(ZoneInfo("UTC"))
|
|
97
|
+
- relativedelta(years=self.age_in_years)
|
|
98
|
+
).date()
|
|
99
|
+
else:
|
|
100
|
+
raise EgfrError("Expected `age_in_years` or `dob`. Got None for both.")
|
|
101
|
+
|
|
102
|
+
if calling_crf:
|
|
103
|
+
self.creatinine_units = calling_crf.creatinine_units
|
|
104
|
+
self.creatinine_value = calling_crf.creatinine_value
|
|
105
|
+
self.percent_drop_threshold = calling_crf.percent_drop_threshold
|
|
106
|
+
self.related_visit = calling_crf.related_visit
|
|
107
|
+
self.report_datetime = calling_crf.report_datetime
|
|
108
|
+
self.assay_date = calling_crf.assay_datetime.astimezone(ZoneInfo("UTC")).date()
|
|
109
|
+
else:
|
|
110
|
+
self.creatinine_units = creatinine_units
|
|
111
|
+
self.creatinine_value = creatinine_value
|
|
112
|
+
self.percent_drop_threshold = percent_drop_threshold
|
|
113
|
+
self.related_visit = related_visit
|
|
114
|
+
self.report_datetime = report_datetime
|
|
115
|
+
if assay_datetime:
|
|
116
|
+
self.assay_date = assay_datetime.astimezone(ZoneInfo("UTC")).date()
|
|
117
|
+
|
|
118
|
+
if self.percent_drop_threshold is not None and self.percent_drop_threshold < 1.0:
|
|
119
|
+
raise EgfrError(
|
|
120
|
+
"Attr `percent_drop_threshold` should be a percentage. "
|
|
121
|
+
f"Got {self.percent_drop_threshold}"
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
self.on_value_threshold_reached()
|
|
125
|
+
|
|
126
|
+
self.on_percent_drop_threshold_reached()
|
|
127
|
+
|
|
128
|
+
def on_value_threshold_reached(self) -> None:
|
|
129
|
+
"""A hook to respond if egfr value is at or beyond the value
|
|
130
|
+
threshold.
|
|
131
|
+
"""
|
|
132
|
+
pass
|
|
133
|
+
|
|
134
|
+
def on_percent_drop_threshold_reached(self) -> None:
|
|
135
|
+
"""A hook to respond if egfr percent drop from baseline
|
|
136
|
+
is at or beyond the percent drop threshold.
|
|
137
|
+
"""
|
|
138
|
+
if self.egfr_drop_value and self.percent_drop_threshold is not None:
|
|
139
|
+
if self.egfr_drop_value >= self.percent_drop_threshold:
|
|
140
|
+
self.create_or_update_egfr_drop_notification()
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def egfr_value(self) -> float:
|
|
144
|
+
if self._egfr_value is None:
|
|
145
|
+
self._egfr_value = self.calculator_cls(
|
|
146
|
+
gender=self.gender,
|
|
147
|
+
ethnicity=self.ethnicity,
|
|
148
|
+
age_in_years=self.age_in_years,
|
|
149
|
+
creatinine_value=self.creatinine_value,
|
|
150
|
+
creatinine_units=self.creatinine_units,
|
|
151
|
+
weight=self.get_weight_in_kgs(),
|
|
152
|
+
).value
|
|
153
|
+
return self._egfr_value
|
|
154
|
+
|
|
155
|
+
@property
|
|
156
|
+
def egfr_grade(self) -> Optional[int]:
|
|
157
|
+
if self._egfr_grade is None:
|
|
158
|
+
grading_data, _ = get_grade_for_value(
|
|
159
|
+
self.reference_range_collection,
|
|
160
|
+
value=self.egfr_value,
|
|
161
|
+
label="egfr",
|
|
162
|
+
gender=self.gender,
|
|
163
|
+
dob=self.dob,
|
|
164
|
+
report_datetime=self.report_datetime,
|
|
165
|
+
units=self.egfr_units,
|
|
166
|
+
age_units="years",
|
|
167
|
+
)
|
|
168
|
+
if grading_data:
|
|
169
|
+
self._egfr_grade = grading_data.grade
|
|
170
|
+
return self._egfr_grade
|
|
171
|
+
|
|
172
|
+
@property
|
|
173
|
+
def egfr_drop_value(self) -> float:
|
|
174
|
+
if self._egfr_drop_value is None:
|
|
175
|
+
if self.baseline_egfr_value:
|
|
176
|
+
egfr_drop_value = egfr_percent_change(
|
|
177
|
+
float(self.egfr_value), float(self.baseline_egfr_value)
|
|
178
|
+
)
|
|
179
|
+
else:
|
|
180
|
+
egfr_drop_value = 0.0000
|
|
181
|
+
self._egfr_drop_value = 0.0000 if egfr_drop_value < 0.0000 else egfr_drop_value
|
|
182
|
+
return self._egfr_drop_value
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def egfr_drop_grade(self) -> Optional[int]:
|
|
186
|
+
if self._egfr_drop_grade is None:
|
|
187
|
+
grading_data, _ = get_grade_for_value(
|
|
188
|
+
self.reference_range_collection,
|
|
189
|
+
value=self.egfr_drop_value,
|
|
190
|
+
label="egfr_drop",
|
|
191
|
+
gender=self.gender,
|
|
192
|
+
dob=self.dob,
|
|
193
|
+
report_datetime=self.report_datetime,
|
|
194
|
+
units=self.egfr_drop_units,
|
|
195
|
+
age_units="years",
|
|
196
|
+
)
|
|
197
|
+
if grading_data:
|
|
198
|
+
self._egfr_drop_grade = grading_data.grade
|
|
199
|
+
return self._egfr_drop_grade
|
|
200
|
+
|
|
201
|
+
def get_weight_in_kgs(self) -> Optional[float]:
|
|
202
|
+
return self.weight_in_kgs
|
|
203
|
+
|
|
204
|
+
def create_or_update_egfr_drop_notification(self):
|
|
205
|
+
"""Creates or updates the `eGFR notification model`"""
|
|
206
|
+
with transaction.atomic():
|
|
207
|
+
try:
|
|
208
|
+
obj = self.egfr_drop_notification_model_cls.objects.get(
|
|
209
|
+
subject_visit__id=self.related_visit.id
|
|
210
|
+
)
|
|
211
|
+
except ObjectDoesNotExist:
|
|
212
|
+
obj = self.egfr_drop_notification_model_cls.objects.create(
|
|
213
|
+
subject_visit_id=self.related_visit.id,
|
|
214
|
+
report_datetime=self.report_datetime,
|
|
215
|
+
egfr_value=self.egfr_value,
|
|
216
|
+
creatinine_date=self.assay_date,
|
|
217
|
+
creatinine_value=self.creatinine_value,
|
|
218
|
+
creatinine_units=self.creatinine_units,
|
|
219
|
+
weight=self.get_weight_in_kgs(),
|
|
220
|
+
egfr_percent_change=self.egfr_drop_value,
|
|
221
|
+
report_status=NEW,
|
|
222
|
+
site_id=self.related_visit.site.id,
|
|
223
|
+
)
|
|
224
|
+
else:
|
|
225
|
+
obj.egfr_value = self.egfr_value
|
|
226
|
+
obj.creatinine_value = self.creatinine_value
|
|
227
|
+
obj.weight = self.get_weight_in_kgs()
|
|
228
|
+
obj.egfr_percent_change = self.egfr_drop_value
|
|
229
|
+
obj.creatinine_date = self.assay_date
|
|
230
|
+
obj.modified = get_utcnow()
|
|
231
|
+
obj.save()
|
|
232
|
+
obj.refresh_from_db()
|
|
233
|
+
return obj
|
|
234
|
+
|
|
235
|
+
@property
|
|
236
|
+
def egfr_drop_notification_model_cls(self):
|
|
237
|
+
return get_egfr_drop_notification_model_cls()
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from django import forms
|
|
2
|
+
|
|
3
|
+
from edc_form_validators import INVALID_ERROR
|
|
4
|
+
from edc_reportable import ConversionNotHandled
|
|
5
|
+
from edc_vitals.calculators import CalculatorError
|
|
6
|
+
|
|
7
|
+
from ..calculators import EgfrCalculatorError, EgfrCkdEpi, EgfrCockcroftGault
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EgfrCkdEpiFormValidatorMixin:
|
|
11
|
+
def validate_egfr(
|
|
12
|
+
self,
|
|
13
|
+
gender: str = None,
|
|
14
|
+
age_in_years: int = None,
|
|
15
|
+
weight_in_kgs: float = None,
|
|
16
|
+
ethnicity: str = None,
|
|
17
|
+
baseline_egfr_value: float | None = None,
|
|
18
|
+
):
|
|
19
|
+
opts = dict(
|
|
20
|
+
gender=gender,
|
|
21
|
+
age_in_years=age_in_years,
|
|
22
|
+
weight=weight_in_kgs,
|
|
23
|
+
ethnicity=ethnicity,
|
|
24
|
+
creatinine_value=self.cleaned_data.get("creatinine_value"),
|
|
25
|
+
creatinine_units=self.cleaned_data.get("creatinine_units"),
|
|
26
|
+
baseline_egfr_value=baseline_egfr_value,
|
|
27
|
+
)
|
|
28
|
+
try:
|
|
29
|
+
value = EgfrCkdEpi(**opts).value
|
|
30
|
+
except (EgfrCalculatorError, CalculatorError, ConversionNotHandled) as e:
|
|
31
|
+
raise forms.ValidationError(e)
|
|
32
|
+
return value
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class EgfrCockcroftGaultFormValidatorMixin:
|
|
36
|
+
def validate_egfr(
|
|
37
|
+
self,
|
|
38
|
+
gender: str = None,
|
|
39
|
+
age_in_years: int = None,
|
|
40
|
+
weight_in_kgs: float = None,
|
|
41
|
+
ethnicity: str = None,
|
|
42
|
+
):
|
|
43
|
+
opts = dict(
|
|
44
|
+
gender=gender,
|
|
45
|
+
age_in_years=age_in_years,
|
|
46
|
+
weight=weight_in_kgs,
|
|
47
|
+
ethnicity=ethnicity,
|
|
48
|
+
creatinine_value=self.cleaned_data.get("creatinine_value"),
|
|
49
|
+
creatinine_units=self.cleaned_data.get("creatinine_units"),
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
value = EgfrCockcroftGault(**opts).value
|
|
53
|
+
except (EgfrCalculatorError, CalculatorError, ConversionNotHandled) as e:
|
|
54
|
+
self.raise_validation_error({"__all__": str(e)}, INVALID_ERROR)
|
|
55
|
+
return value
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from django.apps import apps as django_apps
|
|
2
|
+
from django.conf import settings
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def get_egfr_drop_notification_model():
|
|
6
|
+
return getattr(settings, "EDC_EGFR_DROP_NOTIFICATION_MODEL")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_egfr_drop_notification_model_cls():
|
|
10
|
+
return django_apps.get_model(get_egfr_drop_notification_model())
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from datetime import date, datetime
|
|
2
|
+
|
|
3
|
+
from .egfr import Egfr
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_egfr_for_subject(
|
|
7
|
+
creatinine_value: float = None,
|
|
8
|
+
creatinine_units: str = None,
|
|
9
|
+
assay_datetime: datetime = None,
|
|
10
|
+
dob: date = None,
|
|
11
|
+
gender: str = None,
|
|
12
|
+
ethnicity: str = None,
|
|
13
|
+
report_datetime: datetime = None,
|
|
14
|
+
baseline_egfr_value: float | None = None,
|
|
15
|
+
value_threshold: float | None = None,
|
|
16
|
+
percent_drop_threshold: float | None = None,
|
|
17
|
+
):
|
|
18
|
+
return Egfr(
|
|
19
|
+
percent_drop_threshold=percent_drop_threshold or 20.0000,
|
|
20
|
+
dob=dob,
|
|
21
|
+
gender=gender,
|
|
22
|
+
ethnicity=ethnicity,
|
|
23
|
+
value_threshold=value_threshold or 45.0000,
|
|
24
|
+
report_datetime=report_datetime,
|
|
25
|
+
baseline_egfr_value=baseline_egfr_value,
|
|
26
|
+
formula_name="ckd-epi",
|
|
27
|
+
reference_range_collection_name="meta",
|
|
28
|
+
creatinine_units=creatinine_units,
|
|
29
|
+
creatinine_value=creatinine_value,
|
|
30
|
+
assay_datetime=assay_datetime,
|
|
31
|
+
)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
|
|
3
|
+
from edc_constants.constants import COMPLETE, INCOMPLETE, NEW, OPEN
|
|
4
|
+
from edc_lab.choices import SERUM_CREATININE_UNITS
|
|
5
|
+
from edc_lab_results.model_mixin_factories import reportable_result_model_mixin_factory
|
|
6
|
+
from edc_model import REPORT_STATUS
|
|
7
|
+
from edc_reportable.units import EGFR_UNITS, MICROMOLES_PER_LITER
|
|
8
|
+
from edc_vitals.models import WeightField
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class EgfrDropNotificationModelMixin(
|
|
12
|
+
reportable_result_model_mixin_factory(
|
|
13
|
+
utest_id="egfr",
|
|
14
|
+
verbose_name="eGFR",
|
|
15
|
+
decimal_places=4,
|
|
16
|
+
default_units=EGFR_UNITS,
|
|
17
|
+
max_digits=8,
|
|
18
|
+
units_choices=((EGFR_UNITS, EGFR_UNITS),),
|
|
19
|
+
exclude_attrs_for_reportable=True,
|
|
20
|
+
),
|
|
21
|
+
reportable_result_model_mixin_factory(
|
|
22
|
+
utest_id="creatinine",
|
|
23
|
+
verbose_name="Serum creatinine",
|
|
24
|
+
decimal_places=2,
|
|
25
|
+
default_units=MICROMOLES_PER_LITER,
|
|
26
|
+
max_digits=8,
|
|
27
|
+
units_choices=((SERUM_CREATININE_UNITS, SERUM_CREATININE_UNITS),),
|
|
28
|
+
exclude_attrs_for_reportable=True,
|
|
29
|
+
),
|
|
30
|
+
models.Model,
|
|
31
|
+
):
|
|
32
|
+
creatinine_date = models.DateField(verbose_name="Serum creatinine date")
|
|
33
|
+
|
|
34
|
+
weight = WeightField(null=True, blank=True)
|
|
35
|
+
|
|
36
|
+
egfr_percent_change = models.DecimalField(
|
|
37
|
+
verbose_name="Percent change from baseline",
|
|
38
|
+
max_digits=10,
|
|
39
|
+
decimal_places=2,
|
|
40
|
+
null=True,
|
|
41
|
+
blank=True,
|
|
42
|
+
help_text="Copied from RFT result eGFR section.",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
narrative = models.TextField(
|
|
46
|
+
verbose_name="Narrative",
|
|
47
|
+
null=True,
|
|
48
|
+
blank=True,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
report_status = models.CharField(max_length=15, choices=REPORT_STATUS, default=NEW)
|
|
52
|
+
|
|
53
|
+
def save(self, *args, **kwargs):
|
|
54
|
+
if self.report_status == OPEN:
|
|
55
|
+
self.crf_status = INCOMPLETE
|
|
56
|
+
else:
|
|
57
|
+
self.crf_status = COMPLETE
|
|
58
|
+
super().save(*args, **kwargs)
|
|
59
|
+
|
|
60
|
+
class Meta:
|
|
61
|
+
verbose_name = "eGFR Drop Notification"
|
|
62
|
+
verbose_name_plural = "eGFR Drop Notifications"
|
|
63
|
+
abstract = True
|