clinicedc 2.0.41__py3-none-any.whl → 2.0.42__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.41.dist-info → clinicedc-2.0.42.dist-info}/METADATA +3 -1
- {clinicedc-2.0.41.dist-info → clinicedc-2.0.42.dist-info}/RECORD +337 -344
- edc_action_item/action.py +1 -1
- edc_action_item/action_item_notification.py +1 -1
- edc_action_item/choices.py +1 -1
- edc_action_item/data_fixers.py +1 -2
- edc_action_item/delete_action_item.py +1 -2
- edc_action_item/forms/action_item_form.py +1 -1
- edc_action_item/models/action_item.py +1 -1
- edc_action_item/models/action_type.py +1 -1
- edc_action_item/models/signals.py +1 -1
- edc_action_item/templatetags/action_item_extras.py +1 -1
- edc_action_item/utils.py +1 -2
- edc_action_item/view_mixins/action_item_view_mixin.py +1 -1
- edc_adherence/choices.py +1 -1
- edc_adherence/form_validator_mixin.py +1 -2
- edc_adherence/list_data.py +1 -1
- edc_adherence/model_mixins.py +1 -1
- edc_adverse_event/action_items/ae_followup_action.py +9 -9
- edc_adverse_event/action_items/ae_initial_action.py +12 -16
- edc_adverse_event/action_items/ae_susar_action.py +2 -1
- edc_adverse_event/action_items/ae_tmg_action.py +6 -4
- edc_adverse_event/action_items/death_report_action.py +7 -7
- edc_adverse_event/action_items/death_report_tmg_action.py +2 -1
- edc_adverse_event/action_items/death_report_tmg_second_action.py +2 -1
- edc_adverse_event/action_items/hospitalization_action.py +2 -1
- edc_adverse_event/auths.py +3 -1
- edc_adverse_event/choices.py +13 -6
- edc_adverse_event/constants.py +1 -23
- edc_adverse_event/form_validator_mixins/death_report_form_validator.py +1 -1
- edc_adverse_event/form_validator_mixins/requires_death_report_form_validator_mixin.py +1 -2
- edc_adverse_event/form_validators/ae_followup.py +2 -3
- edc_adverse_event/form_validators/ae_initial.py +2 -1
- edc_adverse_event/form_validators/ae_tmg.py +2 -1
- edc_adverse_event/form_validators/death_report_tmg.py +1 -1
- edc_adverse_event/form_validators/hospitalization.py +2 -1
- edc_adverse_event/list_data.py +1 -1
- edc_adverse_event/model_mixins/ae_followup/ae_followup_fields_model_mixin.py +1 -1
- edc_adverse_event/model_mixins/ae_followup/ae_followup_methods_model_mixin.py +1 -2
- edc_adverse_event/model_mixins/ae_initial/ae_initial_fields_model_mixin.py +1 -1
- edc_adverse_event/model_mixins/ae_initial/ae_initial_susar_model_mixin.py +2 -2
- edc_adverse_event/model_mixins/ae_susar/ae_susar_methods_model_mixin.py +1 -2
- edc_adverse_event/model_mixins/ae_tmg/ae_tmg_fields_model_mixin.py +1 -1
- edc_adverse_event/model_mixins/hospitaization/hospitalization_model_mixin.py +1 -1
- edc_adverse_event/modeladmin_mixins/ae_initial_admin_mixin.py +1 -1
- edc_adverse_event/modeladmin_mixins/ae_tmg_admin_mixin.py +1 -1
- edc_adverse_event/modeladmin_mixins/death_report_admin_mixin.py +1 -1
- edc_adverse_event/modeladmin_mixins/death_report_tmg_admin_mixin.py +1 -1
- edc_adverse_event/modelform_mixins/ae_followup_modelform_mixin.py +1 -2
- edc_adverse_event/modelform_mixins/ae_initial_modelform_mixin.py +1 -2
- edc_adverse_event/models/signals.py +2 -2
- edc_adverse_event/pdf_reports/ae_pdf_report.py +3 -2
- edc_adverse_event/pdf_reports/death_pdf_report.py +3 -2
- edc_adverse_event/templatetags/edc_adverse_event_extras.py +2 -3
- edc_adverse_event/urls.py +1 -0
- edc_adverse_event/utils.py +11 -14
- edc_adverse_event/view_mixins/ae/ae_listboard_view_mixin.py +3 -3
- edc_adverse_event/view_mixins/ae/death_report_listboard_view_mixin.py +1 -1
- edc_adverse_event/view_mixins/tmg/tmg_ae_listboard_view_mixin.py +2 -1
- edc_adverse_event/views/home_view.py +1 -0
- edc_adverse_event/views/tmg/home_view.py +1 -1
- edc_adverse_event/views/tmg/status_listboards.py +1 -1
- edc_analytics/custom_tables/age.py +1 -2
- edc_analytics/custom_tables/art.py +1 -2
- edc_analytics/custom_tables/bmi.py +1 -3
- edc_analytics/custom_tables/bp.py +1 -3
- edc_analytics/custom_tables/fasting.py +1 -2
- edc_analytics/custom_tables/fbg.py +1 -2
- edc_analytics/custom_tables/fbg_ogtt.py +1 -2
- edc_analytics/custom_tables/hba1c.py +1 -2
- edc_analytics/custom_tables/ogtt.py +1 -2
- edc_analytics/custom_tables/waist.py +1 -2
- edc_analytics/row/row_statistics_with_gender.py +1 -2
- edc_analytics/table.py +1 -2
- edc_appointment/admin/actions.py +1 -1
- edc_appointment/admin/appointment_admin.py +1 -1
- edc_appointment/appointment_reason_updater.py +1 -1
- edc_appointment/choices.py +1 -2
- edc_appointment/form_validator_mixins/next_appointment_crf_form_validator_mixin.py +1 -1
- edc_appointment/list_data.py +2 -3
- edc_appointment/model_mixins/missed_appointment_model_mixin.py +1 -1
- edc_appointment/model_mixins/next_appointment_crf_model_mixin.py +1 -2
- edc_appointment/modeladmin_mixins/next_appointment_crf_modeladmin_mixin.py +1 -1
- edc_appointment/models/signals.py +1 -1
- edc_appointment/utils.py +4 -2
- edc_auth/constants.py +3 -0
- edc_consent/choices.py +1 -1
- edc_consent/consent_definition.py +1 -1
- edc_consent/consent_definition_extension.py +1 -1
- edc_consent/field_mixins/citizen_fields_mixin.py +3 -3
- edc_consent/model_mixins/consent_model_mixin.py +1 -1
- edc_consent/modelform_mixins/consent_modelform_mixin/consent_modelform_validation_mixin.py +1 -1
- edc_consent/modelform_mixins/consent_modelform_mixin/review_fields_modelform_mixin.py +1 -2
- edc_consent/validators.py +5 -10
- edc_constants/__init__.py +0 -3
- edc_constants/choices.py +2 -3
- edc_constants/context_processor.py +2 -3
- edc_constants/utils.py +2 -3
- edc_crf/model_mixins/crf_status_model_mixin.py +1 -1
- edc_crf/model_mixins/singleton_crf_model_mixin.py +0 -1
- edc_crf/update_crf_status_command.py +1 -2
- edc_crf/update_crf_status_for_instance.py +1 -2
- edc_dashboard/url_config.py +1 -2
- edc_dashboard/views/administration_view.py +1 -0
- edc_data_manager/action_items.py +7 -7
- edc_data_manager/admin/actions.py +1 -1
- edc_data_manager/admin/data_query_admin.py +10 -10
- edc_data_manager/choices.py +1 -1
- edc_data_manager/forms/data_query.py +1 -1
- edc_data_manager/handlers/handlers.py +1 -1
- edc_data_manager/models/data_query.py +1 -1
- edc_data_manager/models/model_mixins.py +1 -2
- edc_data_manager/models/query_rule.py +1 -1
- edc_data_manager/view_mixins/data_manager_view_mixin.py +1 -1
- edc_document_status/model_mixins.py +1 -1
- edc_document_status/models/signals.py +1 -2
- edc_dx/diagnoses.py +2 -3
- edc_dx/form_validators/diagnosis_form_validator_mixin.py +1 -2
- edc_dx_review/choices.py +1 -1
- edc_dx_review/form_validator_mixins/clinical_review_followup_form_validator_mixin.py +2 -1
- edc_dx_review/list_data.py +1 -1
- edc_dx_review/medical_date.py +1 -1
- edc_dx_review/model_mixins/clinical_review_baseline_model_mixin.py +1 -1
- edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_chol_model_mixin.py +1 -1
- edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_dm_model_mixin.py +1 -1
- edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_hiv_model_mixin.py +1 -1
- edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_htn_model_mixin.py +1 -1
- edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_model_mixin.py +1 -1
- edc_dx_review/model_mixins/factory/baseline_review_model_mixin_factory.py +1 -1
- edc_dx_review/model_mixins/factory/calculate_date.py +1 -1
- edc_dx_review/model_mixins/factory/dx_initial_review_model_mixin_factory.py +1 -1
- edc_dx_review/model_mixins/factory/followup_review_model_mixin_factory.py +1 -1
- edc_dx_review/model_mixins/factory/rx_initial_review_model_mixin_factory.py +1 -1
- edc_dx_review/model_mixins/followup_review/followup_review_model_mixin.py +1 -1
- edc_dx_review/model_mixins/followup_review/hiv_followup_review_model_mixin.py +1 -1
- edc_dx_review/model_mixins/initial_review/chol_initial_review_model_mixin.py +1 -1
- edc_dx_review/model_mixins/initial_review/hiv_initial_model_mixins.py +2 -3
- edc_dx_review/model_mixins/initial_review/ncd_initial_review_model_mixin.py +1 -1
- edc_dx_review/utils.py +1 -1
- edc_egfr/__init__.py +0 -1
- edc_egfr/egfr.py +23 -15
- edc_egfr/form_validator_mixins/egfr_form_validator_mixins.py +30 -25
- edc_egfr/model_mixins/egfr_drop_notification_model_mixin.py +8 -2
- edc_egfr/model_mixins/egfr_model_mixin.py +2 -2
- edc_export/management/commands/import_receipts.py +1 -2
- edc_export/model_exporter/object_history_helpers.py +1 -2
- edc_export/models/object_history.py +1 -1
- edc_export/models/upload_export_receipt_file.py +1 -1
- edc_facility/list_data.py +1 -1
- edc_fieldsets/fieldsets_modeladmin_mixin.py +1 -2
- edc_form_validators/applicable_field_validator.py +1 -1
- edc_form_validators/date_validator.py +1 -1
- edc_form_validators/many_to_many_field_validator.py +1 -2
- edc_form_validators/other_specify_field_validator.py +1 -2
- edc_form_validators/required_field_validator.py +1 -2
- edc_glucose/form_validators/fasting_form_validator.py +1 -1
- edc_glucose/form_validators/glucose_form_validator.py +3 -3
- edc_glucose/form_validators/glucose_form_validator_mixin.py +1 -2
- edc_glucose/form_validators/ogtt_form_validator_mixin.py +1 -2
- edc_glucose/model_mixin_factories/fasting_model_mixin_factory.py +1 -1
- edc_glucose/model_mixin_factories/fbg_model_mixin_factory.py +1 -2
- edc_glucose/model_mixin_factories/glucose_model_mixin_factory.py +1 -1
- edc_glucose/model_mixin_factories/ogtt_model_mixin_factory.py +1 -2
- edc_glucose/model_mixins/hba1c_model_mixin.py +1 -3
- edc_glucose/utils.py +2 -2
- edc_identifier/model_mixins.py +1 -2
- edc_identifier/models.py +1 -1
- edc_identifier/simple_identifier.py +1 -2
- edc_lab/admin/modeladmin_mixins.py +1 -1
- edc_lab/choices.py +7 -10
- edc_lab/constants.py +0 -2
- edc_lab/form_validators/crf_requisition_form_validator_mixin.py +1 -0
- edc_lab/form_validators/requisition_form_validator_mixin.py +1 -1
- edc_lab/lab/specimen.py +1 -2
- edc_lab/model_mixins/requisition/requisition_identifier_mixin.py +1 -1
- edc_lab/model_mixins/requisition/requisition_model_mixin.py +1 -1
- edc_lab/model_mixins/shipping/manifest_model_mixin.py +1 -1
- edc_lab/model_mixins/shipping/verify_model_mixin.py +1 -2
- edc_lab/models/box.py +1 -1
- edc_lab_dashboard/middleware.py +1 -0
- edc_lab_dashboard/urls.py +1 -0
- edc_lab_dashboard/view_mixins/form_action_view_mixin.py +1 -0
- edc_lab_dashboard/view_mixins/process_requisition_view_mixin.py +1 -1
- edc_lab_dashboard/views/action_views/manage_box_item_view.py +1 -0
- edc_lab_dashboard/views/action_views/receive_view.py +1 -1
- edc_lab_dashboard/views/listboard_views/manage_box_listboard_view.py +1 -0
- edc_lab_dashboard/views/listboard_views/pack_listboard_view.py +1 -1
- edc_lab_dashboard/views/listboard_views/process_listboard_view.py +2 -1
- edc_lab_dashboard/views/listboard_views/receive_listboard_view.py +2 -1
- edc_lab_dashboard/views/listboard_views/requisition_listboard_view.py +1 -2
- edc_lab_dashboard/views/listboard_views/verify_box_listboard_view.py +1 -0
- edc_lab_results/action_items.py +1 -1
- edc_lab_results/form_validator_mixins/blood_results_fbg_form_validator_mixin.py +1 -1
- edc_lab_results/form_validator_mixins/blood_results_form_validator_mixin.py +2 -1
- edc_lab_results/model_mixin_factories/field_attrs.py +1 -1
- edc_lab_results/model_mixins/electrolytes_model_mixins.py +2 -2
- edc_lab_results/model_mixins/fbc_model_mixins.py +9 -8
- edc_lab_results/model_mixins/fbg_model_mixin.py +2 -7
- edc_lab_results/model_mixins/glucose_model_mixin.py +2 -7
- edc_lab_results/model_mixins/insulin_model_mixin.py +2 -1
- edc_lab_results/model_mixins/lft_model_mixins.py +7 -6
- edc_lab_results/model_mixins/lipid_model_mixins.py +1 -2
- edc_lab_results/model_mixins/proteinuria_model_mixin.py +1 -2
- edc_lab_results/model_mixins/rft_model_mixins.py +5 -3
- edc_listboard/views/screen/screening_listboard_view.py +1 -1
- edc_locator/action_items.py +2 -1
- edc_locator/forms/subject_locator_form_validator.py +1 -1
- edc_locator/modeladmin_mixins.py +1 -1
- edc_ltfu/action_items.py +2 -1
- edc_ltfu/choices.py +1 -1
- edc_ltfu/constants.py +0 -2
- edc_ltfu/forms/ltfu_form_validator.py +2 -1
- edc_ltfu/forms/ltfu_form_validator_mixin.py +1 -1
- edc_ltfu/modelform_mixins.py +2 -5
- edc_metadata/admin/modeladmin_mixins.py +4 -4
- edc_model/choices.py +1 -1
- edc_model/models/fields/date_estimated.py +1 -1
- edc_model_admin/context_processors.py +1 -1
- edc_model_admin/list_filters/future_date_list_filter.py +6 -7
- edc_model_admin/list_filters/list_field_with_other_list_filter.py +1 -1
- edc_model_admin/list_filters/past_date_list_filter.py +6 -7
- edc_model_admin/mixins/model_admin_redirect_on_delete_mixin.py +1 -0
- edc_model_admin/templatetags/edc_admin_modify.py +1 -1
- edc_model_fields/fields/date_estimated.py +1 -1
- edc_model_to_dataframe/model_to_dataframe.py +1 -1
- edc_navbar/navbar_item.py +1 -0
- edc_navbar/system_checks.py +3 -0
- edc_offstudy/action_items.py +2 -1
- edc_offstudy/choices.py +2 -1
- edc_pdf_reports/crf_pdf_report.py +9 -7
- edc_pdutils/dataframes/get_subject_consent.py +1 -2
- edc_pdutils/dataframes/get_subject_visit.py +1 -11
- edc_pdutils/helper.py +1 -2
- edc_pdutils/mappings.py +1 -1
- edc_pdutils/tables/crf.py +1 -2
- edc_pdutils/tables/requisition.py +1 -2
- edc_pdutils/utils/__init__.py +1 -0
- edc_pdutils/utils/convert_visit_code_to_float.py +8 -0
- edc_pdutils/utils/decrypt.py +5 -4
- edc_pdutils/utils/missing_subject_identifiers.py +5 -4
- edc_pharmacy/action_items.py +2 -1
- edc_pharmacy/admin/list_filters.py +1 -1
- edc_pharmacy/admin/stock/allocation_admin.py +1 -1
- edc_pharmacy/admin/stock/order_item_admin.py +1 -1
- edc_pharmacy/admin/stock/stock_request_admin.py +1 -1
- edc_pharmacy/admin/stock/stock_transfer_admin.py +1 -1
- edc_pharmacy/admin/stock/stock_transfer_item_admin.py +1 -1
- edc_pharmacy/choices.py +1 -2
- edc_pharmacy/form_validators/crf/study_medication_form_validator.py +1 -1
- edc_pharmacy/list_data.py +1 -1
- edc_pharmacy/model_mixins/study_medication_crf_model_mixin.py +1 -1
- edc_pharmacy/model_mixins/study_medication_refill_model_mixin.py +1 -1
- edc_pharmacy/models/model_mixins.py +1 -2
- edc_pharmacy/models/prescription/rx.py +1 -1
- edc_pharmacy/models/signals.py +1 -1
- edc_pharmacy/models/stock/order.py +1 -1
- edc_pharmacy/models/stock/order_item.py +1 -2
- edc_pharmacy/models/stock/stock_request.py +1 -1
- edc_pharmacy/views/confirm_stock_from_queryset_view.py +2 -1
- edc_pharmacy/views/confirmation_at_site_view.py +1 -1
- edc_prn/models.py +1 -2
- edc_protocol_incident/action_items.py +2 -1
- edc_protocol_incident/choices.py +1 -1
- edc_protocol_incident/form_validators/mixins.py +2 -1
- edc_protocol_incident/form_validators/protocol_deviation_violation_form_validator.py +2 -1
- edc_protocol_incident/form_validators/protocol_incident_form_validator.py +2 -1
- edc_protocol_incident/list_data.py +1 -1
- edc_protocol_incident/model_mixins/protocol_deviation_violation_model_mixin.py +1 -1
- edc_protocol_incident/modeladmin_mixins.py +1 -1
- edc_qareports/choices.py +1 -1
- edc_qareports/migrations/0017_auto_20240816_0256.py +1 -2
- edc_qareports/modeladmin_mixins/list_filters.py +1 -2
- edc_qareports/modeladmin_mixins/qa_report_modeladmin_mixin.py +1 -1
- edc_qareports/sql_generator/requisition_subquery.py +1 -1
- edc_refusal/forms.py +2 -1
- edc_refusal/list_data.py +1 -1
- edc_registration/model_mixins/updates_or_creates_registered_subject_model_mixin.py +1 -1
- edc_registration/models/registered_subject.py +1 -1
- edc_reportable/__init__.py +0 -35
- edc_reportable/choices.py +8 -3
- edc_reportable/constants.py +0 -7
- edc_reportable/data/__init__.py +0 -1
- edc_reportable/data/grading_data/ctcae_v5.py +1 -2
- edc_reportable/data/grading_data/daids_july_2017.py +7 -6
- edc_reportable/data/normal_data/africa.py +6 -5
- edc_reportable/exceptions.py +0 -4
- edc_reportable/forms/reportables_form_validator_mixin.py +2 -1
- edc_reportable/formula.py +1 -1
- edc_reportable/post_migrate_signals.py +1 -1
- edc_reportable/reference_range_evaluator.py +8 -2
- edc_reportable/units.py +2 -23
- edc_reportable/utils/__init__.py +1 -1
- edc_reportable/utils/get_mw.py +20 -0
- edc_reportable/utils/get_normal_data_or_raise.py +1 -1
- edc_review_dashboard/auths.py +1 -1
- edc_review_dashboard/middleware.py +1 -0
- edc_review_dashboard/urls.py +1 -0
- edc_review_dashboard/views/subject_review_listboard_view.py +1 -0
- edc_screening/choices.py +1 -1
- edc_screening/gender_evaluator.py +1 -1
- edc_screening/model_mixins/screening_fields_model_mixin.py +1 -1
- edc_screening/modelform_mixins.py +1 -1
- edc_screening/screening_eligibility.py +1 -2
- edc_sites/models/site_profile.py +1 -2
- edc_sites/site.py +1 -1
- edc_subject_dashboard/requisition_labels.py +1 -1
- edc_subject_dashboard/requisition_report.py +1 -1
- edc_subject_dashboard/requisition_verifier.py +1 -1
- edc_subject_dashboard/urls.py +1 -0
- edc_subject_dashboard/view_utils/go_to_forms_button.py +1 -1
- edc_subject_dashboard/views/requisition_print_actions_view.py +1 -1
- edc_subject_dashboard/views/subject_dashboard_view.py +1 -0
- edc_transfer/action_items.py +2 -1
- edc_transfer/choices.py +1 -1
- edc_transfer/form_validators.py +1 -1
- edc_transfer/list_data.py +1 -1
- edc_unblinding/action_items.py +2 -1
- edc_unblinding/models/unblinding_request.py +1 -1
- edc_unblinding/models/unblinding_review.py +1 -1
- edc_visit_schedule/action_items.py +2 -1
- edc_visit_schedule/admin/subject_schedule_history_admin.py +1 -0
- edc_visit_tracking/action_items.py +2 -1
- edc_visit_tracking/choices.py +1 -1
- edc_visit_tracking/form_validators/visit_form_validator.py +1 -1
- edc_visit_tracking/form_validators/visit_missed_form_validator.py +2 -1
- edc_visit_tracking/managers.py +1 -2
- edc_visit_tracking/model_mixins/subject_visit_missed_model_mixin.py +1 -1
- edc_visit_tracking/model_mixins/visit_model_mixin/caretaker_fields_mixin.py +1 -1
- edc_visit_tracking/model_mixins/visit_model_mixin/visit_model_fields_mixin.py +1 -1
- edc_visit_tracking/model_mixins/visit_model_mixin/visit_model_mixin.py +1 -1
- edc_visit_tracking/modeladmin_mixins/crf_model_admin_mixin.py +2 -1
- edc_visit_tracking/modeladmin_mixins/visit_model_admin_mixin.py +1 -1
- edc_visit_tracking/models/signals.py +1 -1
- edc_visit_tracking/view_utils/related_visit_button.py +1 -1
- edc_vitals/form_validators/blood_pressure_form_validator_mixin.py +1 -2
- edc_constants/constants.py +0 -250
- edc_constants/disease_constants.py +0 -22
- edc_egfr/calculators/__init__.py +0 -4
- edc_egfr/calculators/base_egrfr.py +0 -56
- edc_egfr/calculators/egfr_ckd_epi.py +0 -68
- edc_egfr/calculators/egfr_cockcroft_gault.py +0 -62
- edc_egfr/calculators/percent_change.py +0 -7
- edc_reportable/data/molecular_weights.py +0 -11
- edc_reportable/utils/convert_units.py +0 -163
- {clinicedc-2.0.41.dist-info → clinicedc-2.0.42.dist-info}/WHEEL +0 -0
- {clinicedc-2.0.41.dist-info → clinicedc-2.0.42.dist-info}/licenses/LICENSE +0 -0
edc_visit_tracking/managers.py
CHANGED
|
@@ -2,12 +2,11 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
|
+
from clinicedc_constants import INCOMPLETE, NOT_APPLICABLE, OTHER
|
|
5
6
|
from django.contrib.sites.managers import CurrentSiteManager as DjangoCurrentSiteManager
|
|
6
7
|
from django.core.exceptions import ObjectDoesNotExist
|
|
7
8
|
from django.db import IntegrityError, models, transaction
|
|
8
9
|
|
|
9
|
-
from edc_constants.constants import INCOMPLETE, NOT_APPLICABLE, OTHER
|
|
10
|
-
|
|
11
10
|
from .constants import MISSED_VISIT
|
|
12
11
|
from .exceptions import RelatedVisitReasonError
|
|
13
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
from clinicedc_constants import NO, NOT_APPLICABLE
|
|
1
2
|
from django.core.validators import MinValueValidator
|
|
2
3
|
from django.db import models
|
|
3
4
|
from django.utils.translation import gettext_lazy as _
|
|
4
5
|
|
|
5
6
|
from edc_constants.choices import ALIVE_DEAD_UNKNOWN, YES_NO, YES_NO_NA
|
|
6
|
-
from edc_constants.constants import NO, NOT_APPLICABLE
|
|
7
7
|
from edc_model import models as edc_models
|
|
8
8
|
from edc_model.validators import date_not_future
|
|
9
9
|
from edc_protocol.validators import date_not_before_study_start
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
from clinicedc_constants import ALIVE, NOT_APPLICABLE, YES
|
|
1
2
|
from django.db import models
|
|
2
3
|
from django.utils import timezone
|
|
3
4
|
|
|
4
5
|
from edc_constants.choices import ALIVE_DEAD_UNKNOWN_NA_MISSED, YES_NO
|
|
5
|
-
from edc_constants.constants import ALIVE, NOT_APPLICABLE, YES
|
|
6
6
|
from edc_model.validators import date_not_future, datetime_not_future
|
|
7
7
|
from edc_model_fields.fields import OtherCharField
|
|
8
8
|
from edc_protocol.validators import (
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
+
from clinicedc_constants import NO, YES
|
|
3
4
|
from django.db import models
|
|
4
5
|
from django.db.models.deletion import PROTECT
|
|
5
6
|
|
|
6
7
|
from edc_appointment.appointment_status_updater import AppointmentStatusUpdater
|
|
7
8
|
from edc_appointment.constants import MISSED_APPT
|
|
8
9
|
from edc_consent.model_mixins import RequiresConsentFieldsModelMixin
|
|
9
|
-
from edc_constants.constants import NO, YES
|
|
10
10
|
from edc_document_status.model_mixins import DocumentStatusModelMixin
|
|
11
11
|
from edc_identifier.model_mixins import NonUniqueSubjectIdentifierFieldMixin
|
|
12
12
|
from edc_metadata.model_mixins import MetadataHelperModelMixin
|
|
@@ -3,8 +3,9 @@ from __future__ import annotations
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
from uuid import UUID
|
|
5
5
|
|
|
6
|
+
from clinicedc_constants import UUID_PATTERN
|
|
7
|
+
|
|
6
8
|
from edc_consent.fieldsets import REQUIRES_CONSENT_FIELDS
|
|
7
|
-
from edc_constants.constants import UUID_PATTERN
|
|
8
9
|
|
|
9
10
|
if TYPE_CHECKING:
|
|
10
11
|
from django.core.handlers.wsgi import WSGIRequest
|
|
@@ -2,12 +2,12 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
|
+
from clinicedc_constants import OTHER
|
|
5
6
|
from django.contrib import admin
|
|
6
7
|
from django.core.exceptions import ObjectDoesNotExist
|
|
7
8
|
from django_audit_fields.admin import audit_fieldset_tuple
|
|
8
9
|
|
|
9
10
|
from edc_appointment.utils import get_appointment_model_cls
|
|
10
|
-
from edc_constants.constants import OTHER
|
|
11
11
|
from edc_document_status.fieldsets import document_status_fieldset_tuple
|
|
12
12
|
from edc_document_status.modeladmin_mixins import DocumentStatusModelAdminMixin
|
|
13
13
|
from edc_visit_schedule.fieldsets import (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
from clinicedc_constants import NOT_APPLICABLE, PATIENT
|
|
1
2
|
from django.db.models.signals import post_delete, post_save
|
|
2
3
|
from django.dispatch import receiver
|
|
3
4
|
|
|
4
5
|
from edc_appointment.constants import ONTIME_APPT
|
|
5
|
-
from edc_constants.constants import NOT_APPLICABLE, PATIENT
|
|
6
6
|
from edc_metadata import REQUIRED
|
|
7
7
|
from edc_metadata.metadata import CrfMetadataGetter
|
|
8
8
|
from edc_pharmacy.constants import IN_PROGRESS_APPT
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
4
|
from typing import TYPE_CHECKING, TypeVar
|
|
5
5
|
|
|
6
|
+
from clinicedc_constants import INCOMPLETE
|
|
6
7
|
from django.utils.translation import gettext as _
|
|
7
8
|
|
|
8
9
|
from edc_appointment.constants import (
|
|
@@ -12,7 +13,6 @@ from edc_appointment.constants import (
|
|
|
12
13
|
INCOMPLETE_APPT,
|
|
13
14
|
SKIPPED_APPT,
|
|
14
15
|
)
|
|
15
|
-
from edc_constants.constants import INCOMPLETE
|
|
16
16
|
from edc_view_utils import ADD, CHANGE, VIEW, DashboardModelButton
|
|
17
17
|
|
|
18
18
|
if TYPE_CHECKING:
|
edc_constants/constants.py
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
|
|
3
|
-
UUID_PATTERN = re.compile(
|
|
4
|
-
"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}"
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
ABNORMAL = "ABNORMAL"
|
|
8
|
-
ABSENT = "absent"
|
|
9
|
-
ADDITIONAL = True
|
|
10
|
-
AFTERNOON = "afternoon"
|
|
11
|
-
AGREE = "agree"
|
|
12
|
-
ALIVE = "alive"
|
|
13
|
-
ALWAYS = "always"
|
|
14
|
-
ANONYMOUS = "anonymous"
|
|
15
|
-
ANYTIME = "anytime"
|
|
16
|
-
AWAITING_RESULTS = "awaiting_results"
|
|
17
|
-
BLACK = "black"
|
|
18
|
-
BOTH = "both"
|
|
19
|
-
BY_BIRTH = "BY_BIRTH"
|
|
20
|
-
CANCELLED = "cancelled"
|
|
21
|
-
CHOL = "chol"
|
|
22
|
-
CLINIC = "clinic"
|
|
23
|
-
CLINICAL_ENDPOINT = "clinical_endpoint"
|
|
24
|
-
CLINICAL_WITHDRAWAL = "clinical_withdrawal"
|
|
25
|
-
CLINICIAN = "clinician"
|
|
26
|
-
CLOSED = "closed"
|
|
27
|
-
COLLATERAL_HISTORY = "collateral_history"
|
|
28
|
-
COMPLETE = "COMPLETE"
|
|
29
|
-
COMMUNITY = "community"
|
|
30
|
-
CONFIRMED = "confirmed"
|
|
31
|
-
CONSENTED = "consented"
|
|
32
|
-
CONTINUOUS = "continuous"
|
|
33
|
-
CONTROL = "control"
|
|
34
|
-
CREATE = "CREATE"
|
|
35
|
-
DEAD = "dead"
|
|
36
|
-
DECEASED = "dead"
|
|
37
|
-
DECLINED = "Declined"
|
|
38
|
-
DECREASED = "decreased"
|
|
39
|
-
DEFAULTED = "defaulted"
|
|
40
|
-
DEFAULTER = "defaulter"
|
|
41
|
-
DELETE = "DELETE"
|
|
42
|
-
DELIVERY = "delivery"
|
|
43
|
-
DIABETES = "diabetes"
|
|
44
|
-
DISAGREE = "disagree"
|
|
45
|
-
DIVORCED = "divorced"
|
|
46
|
-
DM = "dm"
|
|
47
|
-
DONE = "done"
|
|
48
|
-
DONT_KNOW = "dont_know"
|
|
49
|
-
DWTA = "DWTA" # don't want to answer
|
|
50
|
-
ERROR = "ERROR"
|
|
51
|
-
ESTIMATED = "estimated"
|
|
52
|
-
EVENING = "evening"
|
|
53
|
-
FAILED_ELIGIBILITY = "failed eligibility"
|
|
54
|
-
FALSE = "false"
|
|
55
|
-
FASTING = "fasting"
|
|
56
|
-
FEEDBACK = "feedback"
|
|
57
|
-
FEMALE = "F"
|
|
58
|
-
FORMER_SMOKER = "former_smoker"
|
|
59
|
-
FREE_OF_CHARGE = "free"
|
|
60
|
-
FUTURE_DATE = "future_date"
|
|
61
|
-
GRADE0 = "0"
|
|
62
|
-
GRADE1 = "1"
|
|
63
|
-
GRADE2 = "2"
|
|
64
|
-
GRADE3 = "3"
|
|
65
|
-
GRADE4 = "4"
|
|
66
|
-
GRADE5 = "5"
|
|
67
|
-
HEADACHE = "headache"
|
|
68
|
-
HELD = "held"
|
|
69
|
-
HIDE_FORM = "NOT_REQUIRED"
|
|
70
|
-
HIGH = "high"
|
|
71
|
-
HIGH_PRIORITY = "high"
|
|
72
|
-
HIV = "HIV"
|
|
73
|
-
HOME = "home"
|
|
74
|
-
HOSPITAL = "hospital"
|
|
75
|
-
HOSPITALIZED = "hospitalized"
|
|
76
|
-
HOSPITAL_NOTES = "hospital_notes"
|
|
77
|
-
HOSPITAL_OR_CLINIC = "hospital_or_clinic"
|
|
78
|
-
HTN = "htn"
|
|
79
|
-
HYPERTENSION = "hypertension"
|
|
80
|
-
IGNORE = "ignore"
|
|
81
|
-
IN_PROGRESS = "in_progress"
|
|
82
|
-
INCOMPLETE = "INCOMPLETE"
|
|
83
|
-
IND = "IND"
|
|
84
|
-
INITIAL = "initial"
|
|
85
|
-
INPATIENT = "inpatient"
|
|
86
|
-
INSERT = "INSERT"
|
|
87
|
-
INSURANCE = "insurance"
|
|
88
|
-
INTEGRATED = "integrated"
|
|
89
|
-
INTEGRATED_CLINIC = "integrated_clinic"
|
|
90
|
-
INTERVENTION = "intervention"
|
|
91
|
-
INVESTIGATOR = "investigator"
|
|
92
|
-
INVESTIGATOR_DECISION = "investigator_decision"
|
|
93
|
-
IN_PERSON = "in_person"
|
|
94
|
-
IS_NULL = "is_null"
|
|
95
|
-
LAST_MONTH = "last_month"
|
|
96
|
-
LAST_WEEK = "last_week"
|
|
97
|
-
LIVE = "live"
|
|
98
|
-
LOW = "low"
|
|
99
|
-
LOW_PRIORITY = "low"
|
|
100
|
-
MALE = "M"
|
|
101
|
-
MALIGNANCY = "malignancy"
|
|
102
|
-
MARRIED = "married"
|
|
103
|
-
MEDIUM_PRIORITY = "medium"
|
|
104
|
-
MEASURED = "measured"
|
|
105
|
-
MICROSCOPY = "microscopy"
|
|
106
|
-
MOBILE_NUMBER = "mobile_no"
|
|
107
|
-
MODIFIED = "modified"
|
|
108
|
-
MONTHLY = "monthly"
|
|
109
|
-
MORNING = "morning"
|
|
110
|
-
MULTI_MORBIDITY = "multi"
|
|
111
|
-
NAIVE = "NAIVE"
|
|
112
|
-
NCD = "NCD"
|
|
113
|
-
NEG = "NEG"
|
|
114
|
-
NEUTRAL = "neutral"
|
|
115
|
-
NEVER = "NEVER"
|
|
116
|
-
NEW = "New"
|
|
117
|
-
NEW_FIELD = "new_field"
|
|
118
|
-
NEXT_OF_KIN = "next_of_kin"
|
|
119
|
-
NEXT_WEEK = "next_week"
|
|
120
|
-
NO = "No"
|
|
121
|
-
NONE = "none"
|
|
122
|
-
NONSMOKER = "nonsmoker"
|
|
123
|
-
NON_BLACK = "non_black"
|
|
124
|
-
NON_FASTING = "non_fasting"
|
|
125
|
-
NORMAL = "NORMAL"
|
|
126
|
-
NOT_ADDITIONAL = False
|
|
127
|
-
NOT_ANSWERED = "not_answered"
|
|
128
|
-
NOT_APPLICABLE = "N/A"
|
|
129
|
-
NOT_AVAILABLE = "not_available"
|
|
130
|
-
NOT_DONE = "not_done"
|
|
131
|
-
NOT_ESTIMATED = "not_estimated"
|
|
132
|
-
NOT_EVALUATED = "not_evaluated"
|
|
133
|
-
NOT_EXAMINED = "not_examined"
|
|
134
|
-
NOT_NULL = "not_null"
|
|
135
|
-
NOT_RECORDED = "not_recorded"
|
|
136
|
-
NOT_REQUIRED = "not_required"
|
|
137
|
-
NOT_SURE = "not_sure"
|
|
138
|
-
NOT_TESTED = "not_tested"
|
|
139
|
-
NO_EXAM = "NO_EXAM"
|
|
140
|
-
NO_UNCONFIRMED = "no_unconfirmed"
|
|
141
|
-
NULL_STRING = ""
|
|
142
|
-
OBSERVATION = "observation"
|
|
143
|
-
OK = "OK"
|
|
144
|
-
OFF_STUDY = "off study"
|
|
145
|
-
OFF_STUDY_VISIT = "off study"
|
|
146
|
-
OMANG = "OMANG"
|
|
147
|
-
ON_ART = "on_art"
|
|
148
|
-
ON_STUDY = "on study"
|
|
149
|
-
ONGOING = "ongoing"
|
|
150
|
-
OPEN = "open"
|
|
151
|
-
OPTION_RETIRED = "OPTION_RETIRED"
|
|
152
|
-
OPTIONAL = True
|
|
153
|
-
OTHER = "OTHER"
|
|
154
|
-
OTHER_PLEASE_SPECIFY_TEXT = "Other, please specify below ..."
|
|
155
|
-
OUTPATIENT_CARDS = "outpatient_cards"
|
|
156
|
-
OUTPATIENT = "outpatient"
|
|
157
|
-
OWN_CASH = "own_cash"
|
|
158
|
-
PARTIAL = "PARTIAL"
|
|
159
|
-
PARTICIPANT = "participant"
|
|
160
|
-
PAST_DATE = "past_date"
|
|
161
|
-
PATIENT = "patient"
|
|
162
|
-
PATIENT_CLUB = "club"
|
|
163
|
-
PATIENT_REPRESENTATIVE = "patient_representative"
|
|
164
|
-
PENDING = "PENDING"
|
|
165
|
-
PER_PROTOCOL = "per_protocol"
|
|
166
|
-
POS = "POS"
|
|
167
|
-
PREGNANCY = "pregnancy"
|
|
168
|
-
PRESENT = "present"
|
|
169
|
-
PRESENT_WITH_REINFORCEMENT = "present_with_reinforcement"
|
|
170
|
-
PRIMARY = "primary"
|
|
171
|
-
PRINT = "PRINT"
|
|
172
|
-
PRIVATE = "private"
|
|
173
|
-
PURPOSIVELY_SELECTED = "purposively_selected"
|
|
174
|
-
QUERY = "QUERY"
|
|
175
|
-
QUESTION_RETIRED = "QUESTION_RETIRED"
|
|
176
|
-
RANDOM_SAMPLING = "random_sampling"
|
|
177
|
-
RAPID_TEST = "rapid_test"
|
|
178
|
-
RARELY = "rarely"
|
|
179
|
-
RECEIVED = "received"
|
|
180
|
-
REDUCED = "reduced"
|
|
181
|
-
REFILL = "refill"
|
|
182
|
-
REFUSED = "REFUSED"
|
|
183
|
-
RELATIVE = "relative"
|
|
184
|
-
RESOLVED = "resolved"
|
|
185
|
-
RESTARTED = "restarted"
|
|
186
|
-
ROUTINE_VISIT = "routine_visit"
|
|
187
|
-
SAE = "sae"
|
|
188
|
-
SCREENED = "SCREENED"
|
|
189
|
-
SECONDARY = "secondary"
|
|
190
|
-
SEQUENTIAL = "sequential"
|
|
191
|
-
SEROCONVERSION = "seroconversion"
|
|
192
|
-
SHOW_FORM = "NEW"
|
|
193
|
-
SINGLE = "single"
|
|
194
|
-
SMOKER = "smoker"
|
|
195
|
-
SOMETIMES = "sometimes"
|
|
196
|
-
STEROIDS = "steroids"
|
|
197
|
-
STOPPED = "stopped"
|
|
198
|
-
STRONGLY_AGREE = "strongly_agree"
|
|
199
|
-
STRONGLY_DISAGREE = "strongly_disagree"
|
|
200
|
-
STUDY_DEFINED_TIMEPOINT = "study_defined_timepoint"
|
|
201
|
-
SUBJECT = "subject"
|
|
202
|
-
SYSTEMATIC = "systematic"
|
|
203
|
-
TBD = "tbd" # to be determined
|
|
204
|
-
TELEPHONE = "telephone"
|
|
205
|
-
TERTIARY = "tertiary"
|
|
206
|
-
TEST = "test"
|
|
207
|
-
THIS_MONTH = "this_month"
|
|
208
|
-
THIS_WEEK = "this_week"
|
|
209
|
-
TIMEPOINT = "timepoint"
|
|
210
|
-
TODAY = "today"
|
|
211
|
-
TOMORROW = "tomorrow"
|
|
212
|
-
TOXICITY = "toxicity"
|
|
213
|
-
TRUE = "true"
|
|
214
|
-
TUBERCULOSIS = "TB"
|
|
215
|
-
UNK = "UNK"
|
|
216
|
-
UNKNOWN = "unknown"
|
|
217
|
-
UNWELL_VISIT = "unwell_visit"
|
|
218
|
-
UPDATE = "UPDATE"
|
|
219
|
-
VERY_OFTEN = "very_often"
|
|
220
|
-
VIEW = "VIEW"
|
|
221
|
-
VISUAL_LOSS = "visual_loss"
|
|
222
|
-
WARN = "warn"
|
|
223
|
-
WEEKDAYS = "weekdays"
|
|
224
|
-
WEEKENDS = "weekends"
|
|
225
|
-
WEEKLY = "weekly"
|
|
226
|
-
WIDOWED = "widowed"
|
|
227
|
-
YEARLY = "yearly"
|
|
228
|
-
YES = "Yes"
|
|
229
|
-
YESTERDAY = "yesterday"
|
|
230
|
-
|
|
231
|
-
# operators
|
|
232
|
-
EQ = "="
|
|
233
|
-
GT = ">"
|
|
234
|
-
GTE = ">="
|
|
235
|
-
LT = "<"
|
|
236
|
-
LTE = "<="
|
|
237
|
-
|
|
238
|
-
# days of the week
|
|
239
|
-
MONDAY = "monday"
|
|
240
|
-
TUESDAY = "tuesday"
|
|
241
|
-
WEDNESDAY = "wednesday"
|
|
242
|
-
THURSDAY = "thursday"
|
|
243
|
-
FRIDAY = "friday"
|
|
244
|
-
SATURDAY = "saturday"
|
|
245
|
-
SUNDAY = "sunday"
|
|
246
|
-
|
|
247
|
-
VERY_DIFFICULT = "very_difficult"
|
|
248
|
-
DIFFICULT = "difficult"
|
|
249
|
-
EASY = "easy"
|
|
250
|
-
VERY_EASY = "very_easy"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
ANAEMIA = "anaemia"
|
|
2
|
-
BACTERAEMIA = "bacteraemia"
|
|
3
|
-
BACTERAEMIA_SEPSIS = "bacteraemia_sepsis"
|
|
4
|
-
BACTERIAL_PNEUMONIA = "bacterial_pneumonia"
|
|
5
|
-
CM_IRIS = "cm_iris"
|
|
6
|
-
CM_RELAPSE = "cm_relapse"
|
|
7
|
-
CM_RELAPSE_IRIS = "cm_relapse_iris"
|
|
8
|
-
CN_PALSY_LEFT_OTHER = "cn_palsy_left_other"
|
|
9
|
-
CN_PALSY_RIGHT_OTHER = "cn_palsy_right_other"
|
|
10
|
-
COVID_19 = "covid_19"
|
|
11
|
-
CRYPTOCOCCAL_MENINGITIS = "cm"
|
|
12
|
-
DIARRHOEA = "diarrhoea"
|
|
13
|
-
DIARRHOEAL_WASTING = "diarrhoeal_wasting"
|
|
14
|
-
FOCAL_NEUROLOGIC_DEFICIT_OTHER = "focal_neurologic_deficit_other"
|
|
15
|
-
NEUTROPAENIA = "neutropaenia"
|
|
16
|
-
PNEUMONIA = "pneumonia"
|
|
17
|
-
RENAL_IMPAIRMENT = "renal_impairment"
|
|
18
|
-
SEPSIS = "sepsis"
|
|
19
|
-
TB_EXTRAPULMONARY = "tb_extrapulmonary"
|
|
20
|
-
TB_PULMONARY = "tb_pulmonary"
|
|
21
|
-
THERAPEUTIC_LP = "therapeutic_lp"
|
|
22
|
-
THROMBOCYTOPENIA = "thrombocytopenia"
|
edc_egfr/calculators/__init__.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
)
|
|
@@ -1,68 +0,0 @@
|
|
|
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)
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
""" # noqa: RUF002
|
|
29
|
-
|
|
30
|
-
def __init__(self, weight: int | float | Decimal | None = 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
|
-
""" # noqa: RUF002
|
|
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
|
-
return (adjusted_age * self.weight * gender_factor) / float(
|
|
52
|
-
self.scr.get(MICROMOLES_PER_LITER)
|
|
53
|
-
)
|
|
54
|
-
opts = dict(
|
|
55
|
-
gender=self.gender,
|
|
56
|
-
age_in_years=self.age_in_years,
|
|
57
|
-
weight=self.weight,
|
|
58
|
-
scr=self.scr.get(MICROMOLES_PER_LITER),
|
|
59
|
-
)
|
|
60
|
-
raise EgfrCalculatorError(
|
|
61
|
-
f"Unable to calculate egfr_value. Insufficient information. Got {opts}."
|
|
62
|
-
)
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|