endoreg-db 0.8.8.9__py3-none-any.whl → 0.8.9.10__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 endoreg-db might be problematic. Click here for more details.
- endoreg_db/admin.py +10 -5
- endoreg_db/apps.py +4 -7
- endoreg_db/authz/auth.py +1 -0
- endoreg_db/authz/backends.py +1 -1
- endoreg_db/authz/management/commands/list_routes.py +2 -0
- endoreg_db/authz/middleware.py +8 -7
- endoreg_db/authz/permissions.py +21 -10
- endoreg_db/authz/policy.py +14 -19
- endoreg_db/authz/views_auth.py +14 -10
- endoreg_db/codemods/rename_datetime_fields.py +8 -1
- endoreg_db/exceptions.py +5 -2
- endoreg_db/forms/__init__.py +0 -1
- endoreg_db/forms/examination_form.py +4 -3
- endoreg_db/forms/patient_finding_intervention_form.py +30 -8
- endoreg_db/forms/patient_form.py +9 -13
- endoreg_db/forms/questionnaires/__init__.py +1 -1
- endoreg_db/forms/settings/__init__.py +4 -1
- endoreg_db/forms/unit.py +2 -1
- endoreg_db/helpers/count_db.py +17 -14
- endoreg_db/helpers/default_objects.py +2 -1
- endoreg_db/helpers/download_segmentation_model.py +4 -3
- endoreg_db/helpers/interact.py +0 -5
- endoreg_db/helpers/test_video_helper.py +33 -25
- endoreg_db/import_files/__init__.py +1 -1
- endoreg_db/import_files/context/__init__.py +1 -1
- endoreg_db/import_files/context/default_sensitive_meta.py +11 -9
- endoreg_db/import_files/context/ensure_center.py +4 -4
- endoreg_db/import_files/context/file_lock.py +3 -3
- endoreg_db/import_files/context/import_context.py +11 -12
- endoreg_db/import_files/context/validate_directories.py +1 -0
- endoreg_db/import_files/file_storage/create_report_file.py +57 -34
- endoreg_db/import_files/file_storage/create_video_file.py +64 -35
- endoreg_db/import_files/file_storage/sensitive_meta_storage.py +5 -2
- endoreg_db/import_files/file_storage/state_management.py +146 -83
- endoreg_db/import_files/file_storage/storage.py +5 -1
- endoreg_db/import_files/processing/report_processing/report_anonymization.py +24 -19
- endoreg_db/import_files/processing/sensitive_meta_adapter.py +3 -3
- endoreg_db/import_files/processing/video_processing/video_anonymization.py +18 -18
- endoreg_db/import_files/pseudonymization/k_anonymity.py +8 -9
- endoreg_db/import_files/pseudonymization/k_pseudonymity.py +16 -5
- endoreg_db/import_files/report_import_service.py +36 -30
- endoreg_db/import_files/video_import_service.py +27 -23
- endoreg_db/logger_conf.py +56 -40
- endoreg_db/management/__init__.py +1 -1
- endoreg_db/management/commands/__init__.py +1 -1
- endoreg_db/management/commands/check_auth.py +45 -38
- endoreg_db/management/commands/create_model_meta_from_huggingface.py +53 -2
- endoreg_db/management/commands/create_multilabel_model_meta.py +54 -19
- endoreg_db/management/commands/fix_missing_patient_data.py +105 -71
- endoreg_db/management/commands/fix_video_paths.py +75 -54
- endoreg_db/management/commands/import_report.py +1 -3
- endoreg_db/management/commands/list_routes.py +2 -0
- endoreg_db/management/commands/load_ai_model_data.py +8 -2
- endoreg_db/management/commands/load_ai_model_label_data.py +0 -1
- endoreg_db/management/commands/load_center_data.py +3 -3
- endoreg_db/management/commands/load_distribution_data.py +35 -38
- endoreg_db/management/commands/load_endoscope_data.py +0 -3
- endoreg_db/management/commands/load_examination_data.py +20 -4
- endoreg_db/management/commands/load_finding_data.py +18 -3
- endoreg_db/management/commands/load_gender_data.py +17 -24
- endoreg_db/management/commands/load_green_endoscopy_wuerzburg_data.py +95 -85
- endoreg_db/management/commands/load_information_source.py +0 -3
- endoreg_db/management/commands/load_lab_value_data.py +14 -3
- endoreg_db/management/commands/load_legacy_data.py +303 -0
- endoreg_db/management/commands/load_name_data.py +1 -2
- endoreg_db/management/commands/load_pdf_type_data.py +4 -8
- endoreg_db/management/commands/load_profession_data.py +0 -1
- endoreg_db/management/commands/load_report_reader_flag_data.py +0 -4
- endoreg_db/management/commands/load_requirement_data.py +6 -2
- endoreg_db/management/commands/load_unit_data.py +0 -4
- endoreg_db/management/commands/load_user_groups.py +5 -7
- endoreg_db/management/commands/model_input.py +169 -0
- endoreg_db/management/commands/register_ai_model.py +22 -16
- endoreg_db/management/commands/setup_endoreg_db.py +110 -32
- endoreg_db/management/commands/storage_management.py +14 -8
- endoreg_db/management/commands/summarize_db_content.py +154 -63
- endoreg_db/management/commands/train_image_multilabel_model.py +144 -0
- endoreg_db/management/commands/validate_video_files.py +82 -50
- endoreg_db/management/commands/video_validation.py +4 -6
- endoreg_db/migrations/0001_initial.py +112 -63
- endoreg_db/migrations/__init__.py +0 -0
- endoreg_db/models/__init__.py +8 -0
- endoreg_db/models/administration/ai/active_model.py +5 -5
- endoreg_db/models/administration/ai/ai_model.py +41 -18
- endoreg_db/models/administration/ai/model_type.py +1 -0
- endoreg_db/models/administration/case/case.py +22 -22
- endoreg_db/models/administration/center/__init__.py +5 -5
- endoreg_db/models/administration/center/center.py +6 -2
- endoreg_db/models/administration/center/center_resource.py +18 -4
- endoreg_db/models/administration/center/center_shift.py +3 -1
- endoreg_db/models/administration/center/center_waste.py +6 -2
- endoreg_db/models/administration/person/__init__.py +1 -1
- endoreg_db/models/administration/person/employee/__init__.py +1 -1
- endoreg_db/models/administration/person/employee/employee_type.py +3 -1
- endoreg_db/models/administration/person/examiner/__init__.py +1 -1
- endoreg_db/models/administration/person/examiner/examiner.py +10 -2
- endoreg_db/models/administration/person/names/first_name.py +6 -4
- endoreg_db/models/administration/person/names/last_name.py +4 -3
- endoreg_db/models/administration/person/patient/__init__.py +1 -1
- endoreg_db/models/administration/person/patient/patient.py +0 -1
- endoreg_db/models/administration/person/patient/patient_external_id.py +0 -1
- endoreg_db/models/administration/person/person.py +1 -1
- endoreg_db/models/administration/product/__init__.py +7 -6
- endoreg_db/models/administration/product/product.py +6 -2
- endoreg_db/models/administration/product/product_group.py +9 -7
- endoreg_db/models/administration/product/product_material.py +9 -2
- endoreg_db/models/administration/product/reference_product.py +64 -15
- endoreg_db/models/administration/qualification/qualification.py +3 -1
- endoreg_db/models/administration/shift/shift.py +3 -1
- endoreg_db/models/administration/shift/shift_type.py +12 -4
- endoreg_db/models/aidataset/__init__.py +5 -0
- endoreg_db/models/aidataset/aidataset.py +193 -0
- endoreg_db/models/label/__init__.py +1 -1
- endoreg_db/models/label/label.py +10 -2
- endoreg_db/models/label/label_set.py +3 -1
- endoreg_db/models/label/label_video_segment/_create_from_video.py +6 -2
- endoreg_db/models/label/label_video_segment/label_video_segment.py +148 -44
- endoreg_db/models/media/__init__.py +12 -5
- endoreg_db/models/media/frame/__init__.py +1 -1
- endoreg_db/models/media/frame/frame.py +34 -8
- endoreg_db/models/media/pdf/__init__.py +2 -1
- endoreg_db/models/media/pdf/raw_pdf.py +11 -4
- endoreg_db/models/media/pdf/report_file.py +6 -2
- endoreg_db/models/media/pdf/report_reader/__init__.py +3 -3
- endoreg_db/models/media/pdf/report_reader/report_reader_flag.py +15 -5
- endoreg_db/models/media/video/create_from_file.py +20 -41
- endoreg_db/models/media/video/pipe_1.py +75 -30
- endoreg_db/models/media/video/pipe_2.py +37 -12
- endoreg_db/models/media/video/video_file.py +36 -24
- endoreg_db/models/media/video/video_file_ai.py +235 -70
- endoreg_db/models/media/video/video_file_anonymize.py +240 -65
- endoreg_db/models/media/video/video_file_frames/_bulk_create_frames.py +6 -1
- endoreg_db/models/media/video/video_file_frames/_create_frame_object.py +3 -1
- endoreg_db/models/media/video/video_file_frames/_delete_frames.py +30 -9
- endoreg_db/models/media/video/video_file_frames/_extract_frames.py +95 -29
- endoreg_db/models/media/video/video_file_frames/_get_frame.py +13 -3
- endoreg_db/models/media/video/video_file_frames/_get_frame_path.py +4 -1
- endoreg_db/models/media/video/video_file_frames/_get_frame_paths.py +15 -3
- endoreg_db/models/media/video/video_file_frames/_get_frame_range.py +15 -3
- endoreg_db/models/media/video/video_file_frames/_get_frames.py +7 -2
- endoreg_db/models/media/video/video_file_frames/_initialize_frames.py +109 -23
- endoreg_db/models/media/video/video_file_frames/_manage_frame_range.py +111 -27
- endoreg_db/models/media/video/video_file_frames/_mark_frames_extracted_status.py +46 -13
- endoreg_db/models/media/video/video_file_io.py +85 -33
- endoreg_db/models/media/video/video_file_meta/__init__.py +6 -6
- endoreg_db/models/media/video/video_file_meta/get_crop_template.py +17 -4
- endoreg_db/models/media/video/video_file_meta/get_endo_roi.py +28 -7
- endoreg_db/models/media/video/video_file_meta/get_fps.py +46 -13
- endoreg_db/models/media/video/video_file_meta/initialize_video_specs.py +81 -20
- endoreg_db/models/media/video/video_file_meta/text_meta.py +61 -20
- endoreg_db/models/media/video/video_file_meta/video_meta.py +40 -12
- endoreg_db/models/media/video/video_file_segments.py +118 -27
- endoreg_db/models/media/video/video_metadata.py +25 -6
- endoreg_db/models/media/video/video_processing.py +54 -15
- endoreg_db/models/medical/__init__.py +3 -13
- endoreg_db/models/medical/contraindication/__init__.py +3 -1
- endoreg_db/models/medical/disease.py +18 -6
- endoreg_db/models/medical/event.py +6 -2
- endoreg_db/models/medical/examination/__init__.py +5 -1
- endoreg_db/models/medical/examination/examination.py +22 -6
- endoreg_db/models/medical/examination/examination_indication.py +23 -7
- endoreg_db/models/medical/examination/examination_time.py +6 -2
- endoreg_db/models/medical/finding/__init__.py +3 -1
- endoreg_db/models/medical/finding/finding.py +37 -12
- endoreg_db/models/medical/finding/finding_classification.py +27 -8
- endoreg_db/models/medical/finding/finding_intervention.py +19 -6
- endoreg_db/models/medical/finding/finding_type.py +3 -1
- endoreg_db/models/medical/hardware/__init__.py +1 -1
- endoreg_db/models/medical/hardware/endoscope.py +14 -2
- endoreg_db/models/medical/laboratory/__init__.py +1 -1
- endoreg_db/models/medical/laboratory/lab_value.py +139 -39
- endoreg_db/models/medical/medication/__init__.py +7 -3
- endoreg_db/models/medical/medication/medication.py +3 -1
- endoreg_db/models/medical/medication/medication_indication.py +3 -1
- endoreg_db/models/medical/medication/medication_indication_type.py +11 -3
- endoreg_db/models/medical/medication/medication_intake_time.py +3 -1
- endoreg_db/models/medical/medication/medication_schedule.py +3 -1
- endoreg_db/models/medical/patient/__init__.py +2 -10
- endoreg_db/models/medical/patient/medication_examples.py +3 -14
- endoreg_db/models/medical/patient/patient_disease.py +17 -5
- endoreg_db/models/medical/patient/patient_event.py +12 -4
- endoreg_db/models/medical/patient/patient_examination.py +52 -15
- endoreg_db/models/medical/patient/patient_examination_indication.py +15 -4
- endoreg_db/models/medical/patient/patient_finding.py +105 -29
- endoreg_db/models/medical/patient/patient_finding_classification.py +41 -12
- endoreg_db/models/medical/patient/patient_finding_intervention.py +11 -3
- endoreg_db/models/medical/patient/patient_lab_sample.py +6 -2
- endoreg_db/models/medical/patient/patient_lab_value.py +42 -10
- endoreg_db/models/medical/patient/patient_medication.py +25 -7
- endoreg_db/models/medical/patient/patient_medication_schedule.py +34 -10
- endoreg_db/models/metadata/model_meta.py +40 -12
- endoreg_db/models/metadata/model_meta_logic.py +51 -16
- endoreg_db/models/metadata/sensitive_meta.py +65 -28
- endoreg_db/models/metadata/sensitive_meta_logic.py +28 -26
- endoreg_db/models/metadata/video_meta.py +146 -39
- endoreg_db/models/metadata/video_prediction_logic.py +70 -21
- endoreg_db/models/metadata/video_prediction_meta.py +80 -27
- endoreg_db/models/operation_log.py +63 -0
- endoreg_db/models/other/__init__.py +10 -10
- endoreg_db/models/other/distribution/__init__.py +9 -7
- endoreg_db/models/other/distribution/base_value_distribution.py +3 -1
- endoreg_db/models/other/distribution/date_value_distribution.py +19 -5
- endoreg_db/models/other/distribution/multiple_categorical_value_distribution.py +3 -1
- endoreg_db/models/other/distribution/numeric_value_distribution.py +34 -9
- endoreg_db/models/other/emission/__init__.py +1 -1
- endoreg_db/models/other/emission/emission_factor.py +9 -3
- endoreg_db/models/other/information_source.py +15 -5
- endoreg_db/models/other/material.py +3 -1
- endoreg_db/models/other/transport_route.py +3 -1
- endoreg_db/models/other/unit.py +6 -2
- endoreg_db/models/report/report.py +0 -1
- endoreg_db/models/requirement/requirement.py +84 -27
- endoreg_db/models/requirement/requirement_error.py +5 -6
- endoreg_db/models/requirement/requirement_evaluation/__init__.py +1 -1
- endoreg_db/models/requirement/requirement_evaluation/evaluate_with_dependencies.py +8 -8
- endoreg_db/models/requirement/requirement_evaluation/get_values.py +3 -3
- endoreg_db/models/requirement/requirement_evaluation/requirement_type_parser.py +24 -8
- endoreg_db/models/requirement/requirement_operator.py +28 -8
- endoreg_db/models/requirement/requirement_set.py +34 -11
- endoreg_db/models/state/__init__.py +1 -0
- endoreg_db/models/state/audit_ledger.py +9 -2
- endoreg_db/models/{media → state}/processing_history/__init__.py +1 -3
- endoreg_db/models/state/processing_history/processing_history.py +136 -0
- endoreg_db/models/state/raw_pdf.py +0 -1
- endoreg_db/models/state/video.py +2 -3
- endoreg_db/models/utils.py +4 -2
- endoreg_db/queries/__init__.py +2 -6
- endoreg_db/queries/annotations/__init__.py +1 -3
- endoreg_db/queries/annotations/legacy.py +37 -26
- endoreg_db/root_urls.py +3 -4
- endoreg_db/schemas/examination_evaluation.py +3 -0
- endoreg_db/serializers/Frames_NICE_and_PARIS_classifications.py +249 -163
- endoreg_db/serializers/__init__.py +2 -8
- endoreg_db/serializers/administration/__init__.py +1 -2
- endoreg_db/serializers/administration/ai/__init__.py +0 -1
- endoreg_db/serializers/administration/ai/active_model.py +3 -1
- endoreg_db/serializers/administration/ai/ai_model.py +5 -3
- endoreg_db/serializers/administration/ai/model_type.py +3 -1
- endoreg_db/serializers/administration/center.py +7 -2
- endoreg_db/serializers/administration/gender.py +4 -2
- endoreg_db/serializers/anonymization.py +13 -13
- endoreg_db/serializers/evaluation/examination_evaluation.py +0 -1
- endoreg_db/serializers/examination/__init__.py +1 -1
- endoreg_db/serializers/examination/base.py +12 -13
- endoreg_db/serializers/examination/dropdown.py +6 -7
- endoreg_db/serializers/examination_serializer.py +3 -6
- endoreg_db/serializers/finding/__init__.py +1 -1
- endoreg_db/serializers/finding/finding.py +14 -7
- endoreg_db/serializers/finding_classification/__init__.py +3 -3
- endoreg_db/serializers/finding_classification/choice.py +3 -3
- endoreg_db/serializers/finding_classification/classification.py +2 -4
- endoreg_db/serializers/label_video_segment/__init__.py +5 -3
- endoreg_db/serializers/{label → label_video_segment}/image_classification_annotation.py +5 -5
- endoreg_db/serializers/label_video_segment/label/__init__.py +6 -0
- endoreg_db/serializers/{label → label_video_segment/label}/label.py +1 -1
- endoreg_db/serializers/label_video_segment/label_video_segment.py +338 -228
- endoreg_db/serializers/meta/__init__.py +1 -2
- endoreg_db/serializers/meta/sensitive_meta_detail.py +28 -13
- endoreg_db/serializers/meta/sensitive_meta_update.py +51 -46
- endoreg_db/serializers/meta/sensitive_meta_verification.py +19 -16
- endoreg_db/serializers/misc/__init__.py +2 -2
- endoreg_db/serializers/misc/file_overview.py +11 -7
- endoreg_db/serializers/misc/stats.py +10 -8
- endoreg_db/serializers/misc/translatable_field_mix_in.py +6 -6
- endoreg_db/serializers/misc/upload_job.py +32 -29
- endoreg_db/serializers/patient/__init__.py +2 -1
- endoreg_db/serializers/patient/patient.py +32 -15
- endoreg_db/serializers/patient/patient_dropdown.py +11 -3
- endoreg_db/serializers/patient_examination/__init__.py +1 -1
- endoreg_db/serializers/patient_examination/patient_examination.py +67 -40
- endoreg_db/serializers/patient_finding/__init__.py +1 -1
- endoreg_db/serializers/patient_finding/patient_finding.py +2 -1
- endoreg_db/serializers/patient_finding/patient_finding_classification.py +17 -9
- endoreg_db/serializers/patient_finding/patient_finding_detail.py +26 -17
- endoreg_db/serializers/patient_finding/patient_finding_intervention.py +7 -5
- endoreg_db/serializers/patient_finding/patient_finding_list.py +10 -11
- endoreg_db/serializers/patient_finding/patient_finding_write.py +36 -27
- endoreg_db/serializers/pdf/__init__.py +1 -3
- endoreg_db/serializers/requirements/requirement_schema.py +1 -6
- endoreg_db/serializers/sensitive_meta_serializer.py +100 -81
- endoreg_db/serializers/video/__init__.py +2 -2
- endoreg_db/serializers/video/{segmentation.py → video_file.py} +66 -47
- endoreg_db/serializers/video/video_file_brief.py +6 -2
- endoreg_db/serializers/video/video_file_detail.py +36 -23
- endoreg_db/serializers/video/video_file_list.py +4 -2
- endoreg_db/serializers/video/video_processing_history.py +54 -50
- endoreg_db/services/__init__.py +1 -1
- endoreg_db/services/anonymization.py +2 -2
- endoreg_db/services/examination_evaluation.py +40 -17
- endoreg_db/services/model_meta_from_hf.py +76 -0
- endoreg_db/services/polling_coordinator.py +101 -70
- endoreg_db/services/pseudonym_service.py +27 -22
- endoreg_db/services/report_import.py +6 -3
- endoreg_db/services/segment_sync.py +75 -59
- endoreg_db/services/video_import.py +6 -7
- endoreg_db/urls/__init__.py +2 -2
- endoreg_db/urls/ai.py +7 -25
- endoreg_db/urls/anonymization.py +61 -15
- endoreg_db/urls/auth.py +4 -4
- endoreg_db/urls/classification.py +4 -9
- endoreg_db/urls/examination.py +27 -18
- endoreg_db/urls/media.py +27 -34
- endoreg_db/urls/patient.py +11 -7
- endoreg_db/urls/requirements.py +3 -1
- endoreg_db/urls/root_urls.py +2 -3
- endoreg_db/urls/stats.py +24 -16
- endoreg_db/urls/upload.py +3 -11
- endoreg_db/utils/__init__.py +14 -15
- endoreg_db/utils/ai/__init__.py +1 -1
- endoreg_db/utils/ai/data_loader_for_model_input.py +262 -0
- endoreg_db/utils/ai/data_loader_for_model_training.py +262 -0
- endoreg_db/utils/ai/get.py +2 -1
- endoreg_db/utils/ai/inference_dataset.py +14 -15
- endoreg_db/utils/ai/model_training/config.py +117 -0
- endoreg_db/utils/ai/model_training/dataset.py +74 -0
- endoreg_db/utils/ai/model_training/losses.py +68 -0
- endoreg_db/utils/ai/model_training/metrics.py +78 -0
- endoreg_db/utils/ai/model_training/model_backbones.py +155 -0
- endoreg_db/utils/ai/model_training/model_gastronet_resnet.py +118 -0
- endoreg_db/utils/ai/model_training/trainer_gastronet_multilabel.py +771 -0
- endoreg_db/utils/ai/multilabel_classification_net.py +21 -6
- endoreg_db/utils/ai/predict.py +4 -4
- endoreg_db/utils/ai/preprocess.py +19 -11
- endoreg_db/utils/calc_duration_seconds.py +4 -4
- endoreg_db/utils/case_generator/lab_sample_factory.py +3 -4
- endoreg_db/utils/check_video_files.py +74 -47
- endoreg_db/utils/cropping.py +10 -9
- endoreg_db/utils/dataloader.py +11 -3
- endoreg_db/utils/dates.py +3 -4
- endoreg_db/utils/defaults/set_default_center.py +7 -6
- endoreg_db/utils/env.py +6 -2
- endoreg_db/utils/extract_specific_frames.py +24 -9
- endoreg_db/utils/file_operations.py +30 -18
- endoreg_db/utils/fix_video_path_direct.py +57 -41
- endoreg_db/utils/frame_anonymization_utils.py +157 -157
- endoreg_db/utils/hashs.py +3 -18
- endoreg_db/utils/links/requirement_link.py +96 -52
- endoreg_db/utils/ocr.py +30 -25
- endoreg_db/utils/operation_log.py +61 -0
- endoreg_db/utils/parse_and_generate_yaml.py +12 -13
- endoreg_db/utils/paths.py +6 -6
- endoreg_db/utils/permissions.py +40 -24
- endoreg_db/utils/pipelines/process_video_dir.py +50 -26
- endoreg_db/utils/product/sum_emissions.py +5 -3
- endoreg_db/utils/product/sum_weights.py +4 -2
- endoreg_db/utils/pydantic_models/__init__.py +3 -4
- endoreg_db/utils/requirement_operator_logic/_old/lab_value_operators.py +207 -107
- endoreg_db/utils/requirement_operator_logic/_old/model_evaluators.py +252 -65
- endoreg_db/utils/requirement_operator_logic/new_operator_logic.py +27 -10
- endoreg_db/utils/setup_config.py +21 -5
- endoreg_db/utils/storage.py +3 -1
- endoreg_db/utils/translation.py +19 -15
- endoreg_db/utils/uuid.py +1 -0
- endoreg_db/utils/validate_endo_roi.py +12 -4
- endoreg_db/utils/validate_subcategory_dict.py +26 -24
- endoreg_db/utils/validate_video_detailed.py +207 -149
- endoreg_db/utils/video/__init__.py +7 -3
- endoreg_db/utils/video/extract_frames.py +30 -18
- endoreg_db/utils/video/ffmpeg_wrapper.py +217 -52
- endoreg_db/utils/video/names.py +11 -6
- endoreg_db/utils/video/streaming_processor.py +175 -101
- endoreg_db/utils/video/video_splitter.py +30 -19
- endoreg_db/views/Frames_NICE_and_PARIS_classifications_views.py +59 -50
- endoreg_db/views/__init__.py +0 -20
- endoreg_db/views/anonymization/__init__.py +6 -2
- endoreg_db/views/anonymization/media_management.py +2 -6
- endoreg_db/views/anonymization/overview.py +34 -1
- endoreg_db/views/anonymization/validate.py +79 -18
- endoreg_db/views/auth/__init__.py +1 -1
- endoreg_db/views/auth/keycloak.py +16 -14
- endoreg_db/views/examination/__init__.py +12 -15
- endoreg_db/views/examination/examination.py +5 -5
- endoreg_db/views/examination/examination_manifest_cache.py +5 -5
- endoreg_db/views/examination/get_finding_classification_choices.py +8 -5
- endoreg_db/views/examination/get_finding_classifications.py +9 -7
- endoreg_db/views/examination/get_findings.py +8 -10
- endoreg_db/views/examination/get_instruments.py +3 -2
- endoreg_db/views/examination/get_interventions.py +1 -1
- endoreg_db/views/finding/__init__.py +2 -2
- endoreg_db/views/finding/finding.py +58 -54
- endoreg_db/views/finding/get_classifications.py +1 -1
- endoreg_db/views/finding/get_interventions.py +1 -1
- endoreg_db/views/finding_classification/__init__.py +5 -5
- endoreg_db/views/finding_classification/finding_classification.py +5 -6
- endoreg_db/views/finding_classification/get_classification_choices.py +3 -4
- endoreg_db/views/media/__init__.py +13 -13
- endoreg_db/views/media/pdf_media.py +9 -9
- endoreg_db/views/media/sensitive_metadata.py +10 -7
- endoreg_db/views/media/video_media.py +4 -4
- endoreg_db/views/meta/__init__.py +1 -1
- endoreg_db/views/meta/sensitive_meta_list.py +20 -22
- endoreg_db/views/meta/sensitive_meta_verification.py +14 -11
- endoreg_db/views/misc/__init__.py +6 -34
- endoreg_db/views/misc/center.py +2 -1
- endoreg_db/views/misc/csrf.py +2 -1
- endoreg_db/views/misc/gender.py +2 -1
- endoreg_db/views/misc/stats.py +141 -106
- endoreg_db/views/patient/__init__.py +1 -3
- endoreg_db/views/patient/patient.py +141 -99
- endoreg_db/views/patient_examination/__init__.py +5 -5
- endoreg_db/views/patient_examination/patient_examination.py +43 -42
- endoreg_db/views/patient_examination/patient_examination_create.py +10 -15
- endoreg_db/views/patient_examination/patient_examination_detail.py +12 -15
- endoreg_db/views/patient_examination/patient_examination_list.py +21 -17
- endoreg_db/views/patient_examination/video.py +114 -80
- endoreg_db/views/patient_finding/__init__.py +1 -1
- endoreg_db/views/patient_finding/patient_finding.py +17 -10
- endoreg_db/views/patient_finding/patient_finding_optimized.py +127 -95
- endoreg_db/views/patient_finding_classification/__init__.py +1 -1
- endoreg_db/views/patient_finding_classification/pfc_create.py +35 -27
- endoreg_db/views/report/reimport.py +1 -1
- endoreg_db/views/report/report_stream.py +5 -8
- endoreg_db/views/requirement/__init__.py +2 -1
- endoreg_db/views/requirement/evaluate.py +7 -9
- endoreg_db/views/requirement/lookup.py +2 -3
- endoreg_db/views/requirement/lookup_store.py +0 -1
- endoreg_db/views/requirement/requirement_utils.py +2 -4
- endoreg_db/views/stats/__init__.py +4 -4
- endoreg_db/views/stats/stats_views.py +152 -115
- endoreg_db/views/video/__init__.py +18 -27
- endoreg_db/views/{ai → video/ai}/__init__.py +2 -2
- endoreg_db/views/{ai → video/ai}/label.py +20 -16
- endoreg_db/views/video/correction.py +5 -6
- endoreg_db/views/video/reimport.py +134 -99
- endoreg_db/views/video/segments_crud.py +134 -44
- endoreg_db/views/video/video_apply_mask.py +13 -12
- endoreg_db/views/video/video_correction.py +2 -1
- endoreg_db/views/video/video_download_processed.py +15 -15
- endoreg_db/views/video/video_meta_stats.py +7 -6
- endoreg_db/views/video/video_processing_history.py +3 -2
- endoreg_db/views/video/video_remove_frames.py +13 -12
- endoreg_db/views/video/video_stream.py +110 -82
- {endoreg_db-0.8.8.9.dist-info → endoreg_db-0.8.9.10.dist-info}/METADATA +9 -3
- {endoreg_db-0.8.8.9.dist-info → endoreg_db-0.8.9.10.dist-info}/RECORD +436 -433
- endoreg_db/import_files/processing/video_processing/video_cleanup_on_error.py +0 -119
- endoreg_db/management/commands/import_fallback_video.py +0 -203
- endoreg_db/management/commands/import_video.py +0 -422
- endoreg_db/management/commands/import_video_with_classification.py +0 -367
- endoreg_db/models/media/processing_history/processing_history.py +0 -96
- endoreg_db/serializers/label/__init__.py +0 -7
- endoreg_db/serializers/label_video_segment/_lvs_create.py +0 -149
- endoreg_db/serializers/label_video_segment/_lvs_update.py +0 -138
- endoreg_db/serializers/label_video_segment/_lvs_validate.py +0 -149
- endoreg_db/serializers/label_video_segment/label_video_segment_annotation.py +0 -99
- endoreg_db/serializers/label_video_segment/label_video_segment_update.py +0 -163
- endoreg_db/services/__old/pdf_import.py +0 -1487
- endoreg_db/services/__old/video_import.py +0 -1306
- endoreg_db/tasks/upload_tasks.py +0 -216
- endoreg_db/tasks/video_ingest.py +0 -161
- endoreg_db/tasks/video_processing_tasks.py +0 -327
- endoreg_db/views/misc/translation.py +0 -182
- {endoreg_db-0.8.8.9.dist-info → endoreg_db-0.8.9.10.dist-info}/WHEEL +0 -0
- {endoreg_db-0.8.8.9.dist-info → endoreg_db-0.8.9.10.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Service for generating patient pseudonyms using SensitiveMeta logic.
|
|
3
3
|
"""
|
|
4
|
+
|
|
4
5
|
import logging
|
|
5
|
-
from typing import Tuple
|
|
6
|
+
from typing import Tuple
|
|
6
7
|
from django.db import transaction
|
|
7
8
|
|
|
8
9
|
from endoreg_db.models.administration.person.patient.patient import Patient
|
|
@@ -15,28 +16,30 @@ logger = logging.getLogger(__name__)
|
|
|
15
16
|
def generate_patient_pseudonym(patient: Patient) -> Tuple[str, bool]:
|
|
16
17
|
"""
|
|
17
18
|
Generate a pseudonym hash for an existing Patient using SensitiveMeta logic.
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
Args:
|
|
20
21
|
patient: The Patient instance to generate a pseudonym for
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
Returns:
|
|
23
24
|
Tuple of (patient_hash, persisted_flag)
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
Raises:
|
|
26
27
|
ValueError: If required fields are missing for hash calculation
|
|
27
28
|
"""
|
|
28
29
|
# Validate required fields for hash calculation
|
|
29
30
|
if not patient.dob:
|
|
30
|
-
raise ValueError(
|
|
31
|
-
|
|
31
|
+
raise ValueError(
|
|
32
|
+
"Patient date of birth (dob) is required for pseudonym generation"
|
|
33
|
+
)
|
|
34
|
+
|
|
32
35
|
if not patient.center:
|
|
33
36
|
raise ValueError("Patient center is required for pseudonym generation")
|
|
34
|
-
|
|
37
|
+
|
|
35
38
|
# Use existing patient_hash if it exists and is valid
|
|
36
39
|
if patient.patient_hash and len(patient.patient_hash.strip()) > 0:
|
|
37
40
|
logger.info(f"Patient {patient.id} already has a hash: {patient.patient_hash}")
|
|
38
41
|
return patient.patient_hash, True
|
|
39
|
-
|
|
42
|
+
|
|
40
43
|
# Create a transient SensitiveMeta instance to calculate the hash
|
|
41
44
|
# We don't save this instance, just use it for hash calculation
|
|
42
45
|
sensitive_meta = SensitiveMeta(
|
|
@@ -44,22 +47,24 @@ def generate_patient_pseudonym(patient: Patient) -> Tuple[str, bool]:
|
|
|
44
47
|
patient_last_name=patient.last_name or "",
|
|
45
48
|
patient_dob=patient.dob,
|
|
46
49
|
center=patient.center,
|
|
47
|
-
patient_gender=patient.gender # Optional, but include if available
|
|
50
|
+
patient_gender=patient.gender, # Optional, but include if available
|
|
48
51
|
)
|
|
49
|
-
|
|
52
|
+
|
|
50
53
|
try:
|
|
51
54
|
# Calculate the hash using the existing logic
|
|
52
|
-
patient_hash = logic.calculate_patient_hash(
|
|
53
|
-
|
|
55
|
+
patient_hash = logic.calculate_patient_hash(
|
|
56
|
+
sensitive_meta, salt=logic.SECRET_SALT
|
|
57
|
+
)
|
|
58
|
+
|
|
54
59
|
# Persist the hash to the Patient model
|
|
55
60
|
with transaction.atomic():
|
|
56
61
|
patient.patient_hash = patient_hash
|
|
57
|
-
patient.save(update_fields=[
|
|
58
|
-
|
|
62
|
+
patient.save(update_fields=["patient_hash"])
|
|
63
|
+
|
|
59
64
|
logger.info(f"Generated and persisted pseudonym for patient {patient.id}")
|
|
60
|
-
|
|
65
|
+
|
|
61
66
|
return patient_hash, True
|
|
62
|
-
|
|
67
|
+
|
|
63
68
|
except Exception as e:
|
|
64
69
|
logger.error(f"Error generating pseudonym for patient {patient.id}: {str(e)}")
|
|
65
70
|
raise ValueError(f"Failed to generate pseudonym: {str(e)}")
|
|
@@ -68,22 +73,22 @@ def generate_patient_pseudonym(patient: Patient) -> Tuple[str, bool]:
|
|
|
68
73
|
def validate_patient_for_pseudonym(patient: Patient) -> list[str]:
|
|
69
74
|
"""
|
|
70
75
|
Validate that a patient has all required fields for pseudonym generation.
|
|
71
|
-
|
|
76
|
+
|
|
72
77
|
Args:
|
|
73
78
|
patient: The Patient instance to validate
|
|
74
|
-
|
|
79
|
+
|
|
75
80
|
Returns:
|
|
76
81
|
List of missing required fields (empty if all fields present)
|
|
77
82
|
"""
|
|
78
83
|
missing_fields = []
|
|
79
|
-
|
|
84
|
+
|
|
80
85
|
if not patient.dob:
|
|
81
86
|
missing_fields.append("dob")
|
|
82
|
-
|
|
87
|
+
|
|
83
88
|
if not patient.center:
|
|
84
89
|
missing_fields.append("center")
|
|
85
|
-
|
|
90
|
+
|
|
86
91
|
# Note: first_name and last_name can be empty strings according to the logic,
|
|
87
92
|
# so we don't require them to be non-empty
|
|
88
|
-
|
|
93
|
+
|
|
89
94
|
return missing_fields
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
from endoreg_db.import_files.report_import_service import ReportImportService as ris
|
|
2
|
-
|
|
3
|
-
from pathlib import Path
|
|
2
|
+
|
|
4
3
|
|
|
5
4
|
class ReportImportService(ris):
|
|
6
|
-
|
|
5
|
+
__doc__ = (
|
|
6
|
+
(ris.__doc__ or "")
|
|
7
|
+
+ """
|
|
7
8
|
Wrapper for known import of concurrency safe ReportImportService,
|
|
8
9
|
here celery will be implemented in the future.
|
|
9
10
|
12.02.2025
|
|
10
11
|
"""
|
|
12
|
+
)
|
|
13
|
+
pass
|
|
@@ -15,61 +15,66 @@ from ..models import VideoFile, Label, LabelVideoSegment, InformationSource
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
def create_user_segment_from_annotation(
|
|
18
|
+
def create_user_segment_from_annotation(
|
|
19
|
+
annotation: Dict[str, Any], request_user: User
|
|
20
|
+
) -> Optional[LabelVideoSegment]:
|
|
19
21
|
"""
|
|
20
22
|
Create a user-source LabelVideoSegment from a segment annotation.
|
|
21
|
-
|
|
23
|
+
|
|
22
24
|
This function:
|
|
23
25
|
1. Locates the original LabelVideoSegment (if segmentId is present)
|
|
24
|
-
2. Clones all its DB fields
|
|
26
|
+
2. Clones all its DB fields
|
|
25
27
|
3. Overwrites with new data from annotation
|
|
26
28
|
4. Sets information_source = user
|
|
27
29
|
5. Saves via model manager
|
|
28
|
-
|
|
30
|
+
|
|
29
31
|
Args:
|
|
30
32
|
annotation: Annotation data containing segment information
|
|
31
33
|
request_user: The authenticated user making the request
|
|
32
|
-
|
|
34
|
+
|
|
33
35
|
Returns:
|
|
34
36
|
New LabelVideoSegment instance or None if creation failed/skipped
|
|
35
37
|
"""
|
|
36
38
|
# Validate this is a segment annotation
|
|
37
|
-
if annotation.get(
|
|
39
|
+
if annotation.get("type") != "segment":
|
|
38
40
|
logger.debug("Annotation is not a segment type, skipping user segment creation")
|
|
39
41
|
return None
|
|
40
|
-
|
|
42
|
+
|
|
41
43
|
# Get required data from annotation
|
|
42
|
-
video_id = annotation.get(
|
|
43
|
-
start_time = annotation.get(
|
|
44
|
-
end_time = annotation.get(
|
|
45
|
-
label_text = annotation.get(
|
|
46
|
-
metadata = annotation.get(
|
|
47
|
-
original_segment_id = metadata.get(
|
|
48
|
-
|
|
44
|
+
video_id = annotation.get("videoId")
|
|
45
|
+
start_time = annotation.get("startTime")
|
|
46
|
+
end_time = annotation.get("endTime")
|
|
47
|
+
label_text = annotation.get("text", "").strip()
|
|
48
|
+
metadata = annotation.get("metadata", {})
|
|
49
|
+
original_segment_id = metadata.get("segmentId")
|
|
50
|
+
|
|
49
51
|
if not all([video_id, start_time is not None, end_time is not None]):
|
|
50
|
-
logger.warning(
|
|
52
|
+
logger.warning(
|
|
53
|
+
"Missing required segment data in annotation, skipping user segment creation"
|
|
54
|
+
)
|
|
51
55
|
return None
|
|
52
|
-
|
|
56
|
+
|
|
53
57
|
try:
|
|
54
58
|
# Get the video file
|
|
55
59
|
video_file = VideoFile.objects.get(id=video_id)
|
|
56
|
-
|
|
60
|
+
|
|
57
61
|
# Get video FPS for frame calculation
|
|
58
62
|
fps = video_file.get_fps()
|
|
59
63
|
if not fps or fps <= 0:
|
|
60
|
-
logger.warning(
|
|
64
|
+
logger.warning(
|
|
65
|
+
f"Invalid FPS ({fps}) for video {video_id}, using default 25"
|
|
66
|
+
)
|
|
61
67
|
fps = 25.0
|
|
62
|
-
|
|
68
|
+
|
|
63
69
|
# Calculate frame numbers
|
|
64
70
|
start_frame_number = int(start_time * fps)
|
|
65
71
|
end_frame_number = int(end_time * fps)
|
|
66
|
-
|
|
72
|
+
|
|
67
73
|
# Get or create user information source
|
|
68
74
|
user_source, _ = InformationSource.objects.get_or_create(
|
|
69
|
-
name="user",
|
|
70
|
-
defaults={'description': 'User-generated annotations'}
|
|
75
|
+
name="user", defaults={"description": "User-generated annotations"}
|
|
71
76
|
)
|
|
72
|
-
|
|
77
|
+
|
|
73
78
|
# Try to find label by name from annotation text
|
|
74
79
|
label = None
|
|
75
80
|
if label_text:
|
|
@@ -77,79 +82,90 @@ def create_user_segment_from_annotation(annotation: Dict[str, Any], request_user
|
|
|
77
82
|
label = Label.objects.filter(name__iexact=label_text).first()
|
|
78
83
|
if not label:
|
|
79
84
|
# Try to extract label from tags
|
|
80
|
-
tags = annotation.get(
|
|
85
|
+
tags = annotation.get("tags", [])
|
|
81
86
|
for tag in tags:
|
|
82
87
|
label = Label.objects.filter(name__iexact=tag).first()
|
|
83
88
|
if label:
|
|
84
89
|
break
|
|
85
90
|
except Exception as e:
|
|
86
91
|
logger.warning(f"Error finding label '{label_text}': {e}")
|
|
87
|
-
|
|
92
|
+
|
|
88
93
|
# Start with default segment data
|
|
89
94
|
segment_data = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
"video_file": video_file,
|
|
96
|
+
"start_frame_number": start_frame_number,
|
|
97
|
+
"end_frame_number": end_frame_number,
|
|
98
|
+
"source": user_source,
|
|
99
|
+
"label": label,
|
|
100
|
+
"prediction_meta": None, # User segments don't have prediction meta
|
|
96
101
|
}
|
|
97
|
-
|
|
102
|
+
|
|
98
103
|
# If original segment ID is provided, try to clone from original
|
|
99
104
|
if original_segment_id:
|
|
100
105
|
try:
|
|
101
106
|
original_segment = LabelVideoSegment.objects.get(id=original_segment_id)
|
|
102
|
-
|
|
107
|
+
|
|
103
108
|
# Check if timing or label actually changed
|
|
104
109
|
original_start_time = original_segment.start_frame_number / fps
|
|
105
110
|
original_end_time = original_segment.end_frame_number / fps
|
|
106
|
-
|
|
111
|
+
|
|
107
112
|
timing_changed = (
|
|
108
|
-
abs(original_start_time - start_time)
|
|
109
|
-
|
|
113
|
+
abs(original_start_time - start_time)
|
|
114
|
+
> 0.1 # Allow small floating point differences
|
|
115
|
+
or abs(original_end_time - end_time) > 0.1
|
|
110
116
|
)
|
|
111
|
-
|
|
112
|
-
label_changed = (
|
|
113
|
-
|
|
114
|
-
(not label and original_segment.label is not None)
|
|
117
|
+
|
|
118
|
+
label_changed = (label and original_segment.label != label) or (
|
|
119
|
+
not label and original_segment.label is not None
|
|
115
120
|
)
|
|
116
|
-
|
|
121
|
+
|
|
117
122
|
# Only create new segment if something actually changed
|
|
118
123
|
if not timing_changed and not label_changed:
|
|
119
|
-
logger.debug(
|
|
124
|
+
logger.debug(
|
|
125
|
+
f"No changes detected in segment {original_segment_id}, skipping user segment creation"
|
|
126
|
+
)
|
|
120
127
|
return None
|
|
121
|
-
|
|
128
|
+
|
|
122
129
|
# Clone relevant fields from original segment
|
|
123
|
-
segment_data.update(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
segment_data.update(
|
|
131
|
+
{
|
|
132
|
+
"prediction_meta": original_segment.prediction_meta,
|
|
133
|
+
"label": label
|
|
134
|
+
or original_segment.label, # Use new label if provided, otherwise keep original
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
logger.info(
|
|
139
|
+
f"Cloning segment {original_segment_id} with user modifications"
|
|
140
|
+
)
|
|
141
|
+
|
|
130
142
|
except LabelVideoSegment.DoesNotExist:
|
|
131
|
-
logger.warning(
|
|
132
|
-
|
|
143
|
+
logger.warning(
|
|
144
|
+
f"Original segment {original_segment_id} not found, creating new user segment"
|
|
145
|
+
)
|
|
146
|
+
|
|
133
147
|
# Create the new user segment using the manager
|
|
134
148
|
with transaction.atomic():
|
|
135
149
|
new_segment = LabelVideoSegment.create_from_video(
|
|
136
150
|
source=video_file,
|
|
137
|
-
prediction_meta=segment_data.get(
|
|
138
|
-
label=segment_data[
|
|
151
|
+
prediction_meta=segment_data.get("prediction_meta"),
|
|
152
|
+
label=segment_data["label"],
|
|
139
153
|
start_frame_number=start_frame_number,
|
|
140
154
|
end_frame_number=end_frame_number,
|
|
141
155
|
)
|
|
142
|
-
|
|
156
|
+
|
|
143
157
|
# Set the user information source
|
|
144
158
|
new_segment.source = user_source
|
|
145
159
|
new_segment.save()
|
|
146
|
-
|
|
147
|
-
logger.info(
|
|
160
|
+
|
|
161
|
+
logger.info(
|
|
162
|
+
f"Created user segment {new_segment.id} for video {video_id} by user {request_user.username}"
|
|
163
|
+
)
|
|
148
164
|
return new_segment
|
|
149
|
-
|
|
165
|
+
|
|
150
166
|
except VideoFile.DoesNotExist:
|
|
151
167
|
logger.error(f"Video {video_id} not found, cannot create user segment")
|
|
152
168
|
return None
|
|
153
169
|
except Exception as e:
|
|
154
170
|
logger.error(f"Error creating user segment from annotation: {e}")
|
|
155
|
-
return None
|
|
171
|
+
return None
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
from endoreg_db.import_files.video_import_service import VideoImportService as vis
|
|
2
|
-
|
|
3
|
-
from pathlib import Path
|
|
2
|
+
|
|
4
3
|
|
|
5
4
|
class VideoImportService(vis):
|
|
6
|
-
""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
__doc__ = (vis.__doc__ or "") + (
|
|
6
|
+
"Wrapper for service import of concurrency safe VideoImportService.\n"
|
|
7
|
+
"Implemented for future Celery integration (12.02.2025).\n\n"
|
|
8
|
+
)
|
|
9
|
+
pass
|
endoreg_db/urls/__init__.py
CHANGED
|
@@ -47,8 +47,8 @@ router.register(r"patient-examinations", PatientExaminationViewSet)
|
|
|
47
47
|
# Export raw API urlpatterns (no prefix). The project-level endoreg_db/urls.py mounts these under /api/.
|
|
48
48
|
urlpatterns = [
|
|
49
49
|
path("auth/bootstrap", auth_bootstrap, name="auth-bootstrap"),
|
|
50
|
-
path(
|
|
51
|
-
path(
|
|
50
|
+
path("", include(router.urls)),
|
|
51
|
+
path("", include(api_urls)),
|
|
52
52
|
]
|
|
53
53
|
|
|
54
54
|
if settings.DEBUG:
|
endoreg_db/urls/ai.py
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
from django.urls import path
|
|
2
|
-
from endoreg_db.views.ai import
|
|
2
|
+
from endoreg_db.views.video.ai import label_list, add_label, delete_label, update_label
|
|
3
3
|
|
|
4
|
-
url_patterns=[
|
|
4
|
+
url_patterns = [
|
|
5
5
|
# Label interface
|
|
6
6
|
# GET, Returns list of labels
|
|
7
|
-
path(
|
|
8
|
-
"ai/label-list",
|
|
9
|
-
label_list,
|
|
10
|
-
name="label-list"
|
|
11
|
-
),
|
|
7
|
+
path("ai/label-list", label_list, name="label-list"),
|
|
12
8
|
# POST, updates label by deleting old one and adding new one
|
|
13
|
-
path(
|
|
14
|
-
"ai/label-update",
|
|
15
|
-
update_label,
|
|
16
|
-
name="label-update"
|
|
17
|
-
),
|
|
9
|
+
path("ai/label-update", update_label, name="label-update"),
|
|
18
10
|
# DELETE, deletes a label
|
|
19
|
-
path(
|
|
20
|
-
"ai/label-delete",
|
|
21
|
-
delete_label,
|
|
22
|
-
name="label-delete"
|
|
23
|
-
),
|
|
11
|
+
path("ai/label-delete", delete_label, name="label-delete"),
|
|
24
12
|
# POST, allows adding a new label
|
|
25
|
-
path(
|
|
26
|
-
|
|
27
|
-
add_label,
|
|
28
|
-
name="label-add"
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]
|
|
13
|
+
path("ai/label-add", add_label, name="label-add"),
|
|
14
|
+
]
|
endoreg_db/urls/anonymization.py
CHANGED
|
@@ -13,20 +13,66 @@ from endoreg_db.views.anonymization import media_management
|
|
|
13
13
|
|
|
14
14
|
url_patterns = [
|
|
15
15
|
# URL patterns for anonymization overview
|
|
16
|
-
path(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
path(
|
|
17
|
+
"anonymization/items/overview/",
|
|
18
|
+
AnonymizationOverviewView.as_view(),
|
|
19
|
+
name="anonymization_items_overview",
|
|
20
|
+
),
|
|
21
|
+
path(
|
|
22
|
+
"anonymization/<int:file_id>/current/",
|
|
23
|
+
anonymization_current,
|
|
24
|
+
name="set_current_for_validation",
|
|
25
|
+
),
|
|
26
|
+
path(
|
|
27
|
+
"anonymization/<int:file_id>/start/",
|
|
28
|
+
start_anonymization,
|
|
29
|
+
name="start_anonymization",
|
|
30
|
+
),
|
|
31
|
+
path(
|
|
32
|
+
"anonymization/<int:file_id>/status/",
|
|
33
|
+
anonymization_status,
|
|
34
|
+
name="get_anonymization_status",
|
|
35
|
+
),
|
|
36
|
+
path(
|
|
37
|
+
"anonymization/<int:file_id>/validate/",
|
|
38
|
+
AnonymizationValidateView.as_view(),
|
|
39
|
+
name="validate_anonymization",
|
|
40
|
+
),
|
|
41
|
+
# Polling Coordination API (new endpoints)
|
|
42
|
+
path(
|
|
43
|
+
"anonymization/polling-info/",
|
|
44
|
+
polling_coordinator_info,
|
|
45
|
+
name="polling_coordinator_info",
|
|
46
|
+
),
|
|
47
|
+
path(
|
|
48
|
+
"anonymization/clear-locks/",
|
|
49
|
+
clear_processing_locks,
|
|
50
|
+
name="clear_processing_locks",
|
|
51
|
+
),
|
|
52
|
+
path(
|
|
53
|
+
"anonymization/<int:file_id>/has-raw/",
|
|
54
|
+
has_raw_video_file,
|
|
55
|
+
name="has_raw_video_file",
|
|
56
|
+
),
|
|
27
57
|
# Media Management API (new endpoints)
|
|
28
|
-
path(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
58
|
+
path(
|
|
59
|
+
"media-management/status/",
|
|
60
|
+
media_management.MediaManagementView.as_view(),
|
|
61
|
+
name="media_management_status",
|
|
62
|
+
),
|
|
63
|
+
path(
|
|
64
|
+
"media-management/cleanup/",
|
|
65
|
+
media_management.MediaManagementView.as_view(),
|
|
66
|
+
name="media_management_cleanup",
|
|
67
|
+
),
|
|
68
|
+
path(
|
|
69
|
+
"media-management/force-remove/<int:file_id>/",
|
|
70
|
+
media_management.force_remove_media,
|
|
71
|
+
name="force_remove_media",
|
|
72
|
+
),
|
|
73
|
+
path(
|
|
74
|
+
"media-management/reset-status/<int:file_id>/",
|
|
75
|
+
media_management.reset_processing_status,
|
|
76
|
+
name="reset_processing_status",
|
|
77
|
+
),
|
|
32
78
|
]
|
endoreg_db/urls/auth.py
CHANGED
|
@@ -9,8 +9,8 @@ from endoreg_db.views import (
|
|
|
9
9
|
|
|
10
10
|
urlpatterns = [
|
|
11
11
|
# Authentication endpoints
|
|
12
|
-
path(
|
|
13
|
-
path(
|
|
14
|
-
path(
|
|
15
|
-
path(
|
|
12
|
+
path("endoreg_db/", public_home, name="public_home"),
|
|
13
|
+
path("login/", keycloak_login, name="keycloak_login"),
|
|
14
|
+
path("login/callback/", keycloak_callback, name="keycloak_callback"),
|
|
15
|
+
path("conf/", csrf_token_view, name="csrf_token"),
|
|
16
16
|
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
2
|
---------------------------------------------------------------------------------------
|
|
3
3
|
CLASSIFICATION API ENDPOINTS
|
|
4
4
|
|
|
@@ -9,9 +9,7 @@ Diese Endpunkte führen automatische Polyp-Klassifikationen durch:
|
|
|
9
9
|
Diese APIs sind für Backend-Verarbeitung gedacht und werden typischerweise
|
|
10
10
|
nach dem Import eines Videos automatisch aufgerufen.
|
|
11
11
|
---------------------------------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
from django.urls import path
|
|
12
|
+
"""
|
|
15
13
|
|
|
16
14
|
url_patterns = [
|
|
17
15
|
# NICE Classification API
|
|
@@ -19,21 +17,18 @@ url_patterns = [
|
|
|
19
17
|
# Body: {"video_ids": [1, 2, 3]} oder leerer Body für alle Videos
|
|
20
18
|
# Führt NICE-Klassifikation für spezifizierte Videos durch
|
|
21
19
|
# path('classifications/nice/', ForNiceClassificationView.as_view(), name='nice_classification'),
|
|
22
|
-
|
|
23
|
-
# PARIS Classification API
|
|
20
|
+
# PARIS Classification API
|
|
24
21
|
# POST /api/classifications/paris/
|
|
25
22
|
# Body: {"video_ids": [1, 2, 3]} oder leerer Body für alle Videos
|
|
26
23
|
# Führt PARIS-Klassifikation für spezifizierte Videos durch
|
|
27
24
|
# path('classifications/paris/', ForParisClassificationView.as_view(), name='paris_classification'),
|
|
28
|
-
|
|
29
25
|
# Batch Classification API (beide Typen)
|
|
30
26
|
# POST /api/classifications/batch/
|
|
31
27
|
# Body: {"video_ids": [1, 2, 3], "types": ["nice", "paris"]}
|
|
32
28
|
# Führt beide Klassifikationstypen für spezifizierte Videos durch
|
|
33
29
|
# path('classifications/batch/', BatchClassificationView.as_view(), name='batch_classification'),
|
|
34
|
-
|
|
35
30
|
# Classification Status API
|
|
36
31
|
# GET /api/classifications/status/<video_id>/
|
|
37
32
|
# Gibt den Status der Klassifikationen für ein Video zurück
|
|
38
33
|
# path('classifications/status/<int:video_id>/', ClassificationStatusView.as_view(), name='classification_status'),
|
|
39
|
-
]
|
|
34
|
+
]
|
endoreg_db/urls/examination.py
CHANGED
|
@@ -9,21 +9,21 @@ from endoreg_db.views import (
|
|
|
9
9
|
PatientExaminationListView,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
-
urlpatterns = [# URL patterns for ExaminationForm.vue API calls
|
|
12
|
+
urlpatterns = [ # URL patterns for ExaminationForm.vue API calls
|
|
13
13
|
path(
|
|
14
|
-
|
|
14
|
+
"examinations/<int:examination_id>/findings/",
|
|
15
15
|
get_findings_for_examination,
|
|
16
|
-
name=
|
|
16
|
+
name="get_findings_for_examination",
|
|
17
17
|
),
|
|
18
18
|
path(
|
|
19
|
-
|
|
19
|
+
"findings/<int:finding_id>/classifications/",
|
|
20
20
|
get_classifications_for_finding,
|
|
21
|
-
name=
|
|
21
|
+
name="get_classifications_for_finding",
|
|
22
22
|
),
|
|
23
23
|
path(
|
|
24
|
-
|
|
24
|
+
"classifications/<int:classification_id>/choices/",
|
|
25
25
|
get_classification_choices,
|
|
26
|
-
name=
|
|
26
|
+
name="get_choices_for_classification",
|
|
27
27
|
),
|
|
28
28
|
# NEW: Examination CRUD endpoints for SimpleExaminationForm
|
|
29
29
|
# POST /api/examinations/create/ - Create new examination
|
|
@@ -34,21 +34,30 @@ urlpatterns = [# URL patterns for ExaminationForm.vue API calls
|
|
|
34
34
|
# The views below handle PatientExamination instances, which represent a specific examination performed on a patient.
|
|
35
35
|
# The URL names are updated to reflect this, using the 'patient_examination_*' prefix for clarity.
|
|
36
36
|
# TODO: Clearly Distinguish between Examination and PatientExamination by using 'patient-examination' prefix for clarity
|
|
37
|
-
path(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
path(
|
|
38
|
+
"patient-examinations/create/",
|
|
39
|
+
ExaminationCreateView.as_view(),
|
|
40
|
+
name="patient_examination_create",
|
|
41
|
+
),
|
|
42
|
+
path(
|
|
43
|
+
"patient-examinations/<int:pk>/",
|
|
44
|
+
PatientExaminationDetailView.as_view(),
|
|
45
|
+
name="patient_examination_detail",
|
|
46
|
+
),
|
|
47
|
+
path(
|
|
48
|
+
"patient-examinations/list/",
|
|
49
|
+
PatientExaminationListView.as_view(),
|
|
50
|
+
name="patient_examination_list",
|
|
51
|
+
),
|
|
41
52
|
# NEW ENDPOINTS FOR RESTRUCTURED FRONTEND
|
|
42
53
|
path(
|
|
43
|
-
|
|
54
|
+
"patient-examinations/<int:exam_id>/classifications/",
|
|
44
55
|
get_classifications_for_examination,
|
|
45
|
-
name=
|
|
56
|
+
name="get_classifications_for_examination",
|
|
46
57
|
),
|
|
47
|
-
|
|
48
58
|
path(
|
|
49
|
-
|
|
59
|
+
"patient-examinations/<int:examination_id>/findings/",
|
|
50
60
|
get_findings_for_examination,
|
|
51
|
-
name=
|
|
61
|
+
name="get_patient_examination_findings",
|
|
52
62
|
),
|
|
53
|
-
|
|
54
|
-
]
|
|
63
|
+
]
|