endoreg-db 0.8.8.0__py3-none-any.whl → 0.8.9.2__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/data/__init__.py +22 -8
- endoreg_db/data/ai_model_meta/default_multilabel_classification.yaml +0 -1
- endoreg_db/data/examination/examinations/data.yaml +114 -14
- endoreg_db/data/examination/time-type/data.yaml +0 -3
- endoreg_db/data/examination_indication/endoscopy.yaml +108 -173
- endoreg_db/data/examination_indication_classification/endoscopy.yaml +0 -70
- endoreg_db/data/examination_indication_classification_choice/endoscopy.yaml +33 -37
- endoreg_db/data/finding/00_generic.yaml +35 -0
- endoreg_db/data/finding/00_generic_complication.yaml +9 -0
- endoreg_db/data/finding/01_gastroscopy_baseline.yaml +88 -0
- endoreg_db/data/finding/01_gastroscopy_observation.yaml +113 -0
- endoreg_db/data/finding/02_colonoscopy_baseline.yaml +53 -0
- endoreg_db/data/finding/02_colonoscopy_hidden.yaml +119 -0
- endoreg_db/data/finding/02_colonoscopy_observation.yaml +152 -0
- endoreg_db/data/finding_classification/00_generic.yaml +44 -0
- endoreg_db/data/finding_classification/00_generic_histology.yaml +28 -0
- endoreg_db/data/finding_classification/00_generic_lesion.yaml +52 -0
- endoreg_db/data/finding_classification/{colonoscopy_bowel_preparation.yaml → 02_colonoscopy_baseline.yaml} +35 -20
- endoreg_db/data/finding_classification/02_colonoscopy_histology.yaml +13 -0
- endoreg_db/data/finding_classification/02_colonoscopy_other.yaml +12 -0
- endoreg_db/data/finding_classification/02_colonoscopy_polyp.yaml +101 -0
- endoreg_db/data/finding_classification_choice/{yes_no_na.yaml → 00_generic.yaml} +5 -1
- endoreg_db/data/finding_classification_choice/{examination_setting_generic_types.yaml → 00_generic_baseline.yaml} +10 -2
- endoreg_db/data/finding_classification_choice/{complication_generic_types.yaml → 00_generic_complication.yaml} +1 -1
- endoreg_db/data/finding_classification_choice/{histology.yaml → 00_generic_histology.yaml} +1 -4
- endoreg_db/data/finding_classification_choice/00_generic_lesion.yaml +158 -0
- endoreg_db/data/finding_classification_choice/{bowel_preparation.yaml → 02_colonoscopy_bowel_preparation.yaml} +1 -30
- endoreg_db/data/{_examples/finding_classification_choice/colonoscopy_not_complete_reason.yaml → finding_classification_choice/02_colonoscopy_generic.yaml} +1 -1
- endoreg_db/data/finding_classification_choice/{histology_polyp.yaml → 02_colonoscopy_histology.yaml} +1 -1
- endoreg_db/data/{_examples/finding_classification_choice/colonoscopy_location.yaml → finding_classification_choice/02_colonoscopy_location.yaml} +23 -4
- endoreg_db/data/finding_classification_choice/02_colonoscopy_other.yaml +34 -0
- endoreg_db/data/finding_classification_choice/02_colonoscopy_polyp_advanced_imaging.yaml +76 -0
- endoreg_db/data/{_examples/finding_classification_choice/colon_lesion_paris.yaml → finding_classification_choice/02_colonoscopy_polyp_morphology.yaml} +26 -8
- endoreg_db/data/finding_classification_choice/02_colonoscopy_size.yaml +27 -0
- endoreg_db/data/finding_classification_type/{colonoscopy_basic.yaml → 00_generic.yaml} +18 -13
- endoreg_db/data/finding_classification_type/02_colonoscopy.yaml +9 -0
- endoreg_db/data/finding_intervention/00_generic_endoscopy.yaml +59 -0
- endoreg_db/data/finding_intervention/00_generic_endoscopy_ablation.yaml +44 -0
- endoreg_db/data/finding_intervention/00_generic_endoscopy_bleeding.yaml +55 -0
- endoreg_db/data/finding_intervention/00_generic_endoscopy_resection.yaml +85 -0
- endoreg_db/data/finding_intervention/00_generic_endoscopy_stenosis.yaml +17 -0
- endoreg_db/data/finding_intervention/00_generic_endoscopy_stent.yaml +9 -0
- endoreg_db/data/finding_intervention/01_gastroscopy.yaml +19 -0
- endoreg_db/data/finding_intervention/04_eus.yaml +39 -0
- endoreg_db/data/finding_intervention/05_ercp.yaml +3 -0
- endoreg_db/data/finding_type/data.yaml +8 -12
- endoreg_db/data/requirement/01_patient_data.yaml +93 -0
- endoreg_db/data/requirement_operator/new_operators.yaml +36 -0
- endoreg_db/data/requirement_set/01_endoscopy_generic.yaml +0 -2
- endoreg_db/data/requirement_set/90_coloreg.yaml +20 -8
- endoreg_db/exceptions.py +0 -1
- endoreg_db/forms/examination_form.py +1 -1
- endoreg_db/helpers/data_loader.py +124 -52
- endoreg_db/helpers/default_objects.py +116 -81
- endoreg_db/import_files/__init__.py +27 -0
- endoreg_db/import_files/context/__init__.py +7 -0
- endoreg_db/import_files/context/default_sensitive_meta.py +81 -0
- endoreg_db/import_files/context/ensure_center.py +17 -0
- endoreg_db/import_files/context/file_lock.py +66 -0
- endoreg_db/import_files/context/import_context.py +43 -0
- endoreg_db/import_files/context/validate_directories.py +56 -0
- endoreg_db/import_files/file_storage/__init__.py +15 -0
- endoreg_db/import_files/file_storage/create_report_file.py +76 -0
- endoreg_db/import_files/file_storage/create_video_file.py +75 -0
- endoreg_db/import_files/file_storage/sensitive_meta_storage.py +39 -0
- endoreg_db/import_files/file_storage/state_management.py +496 -0
- endoreg_db/import_files/file_storage/storage.py +36 -0
- endoreg_db/import_files/import_service.md +26 -0
- endoreg_db/import_files/processing/__init__.py +11 -0
- endoreg_db/import_files/processing/report_processing/report_anonymization.py +94 -0
- endoreg_db/import_files/processing/sensitive_meta_adapter.py +51 -0
- endoreg_db/import_files/processing/video_processing/video_anonymization.py +107 -0
- endoreg_db/import_files/pseudonymization/fake.py +52 -0
- endoreg_db/import_files/pseudonymization/k_anonymity.py +182 -0
- endoreg_db/import_files/pseudonymization/k_pseudonymity.py +128 -0
- endoreg_db/import_files/pseudonymization/pseudonymize.py +0 -0
- endoreg_db/import_files/report_import_service.py +141 -0
- endoreg_db/import_files/video_import_service.py +150 -0
- endoreg_db/management/commands/import_report.py +130 -65
- endoreg_db/management/commands/import_video_with_classification.py +1 -1
- endoreg_db/management/commands/load_ai_model_data.py +5 -5
- endoreg_db/management/commands/load_ai_model_label_data.py +9 -7
- endoreg_db/management/commands/load_base_db_data.py +5 -134
- endoreg_db/management/commands/load_contraindication_data.py +14 -16
- endoreg_db/management/commands/load_disease_classification_choices_data.py +15 -18
- endoreg_db/management/commands/load_disease_classification_data.py +15 -18
- endoreg_db/management/commands/load_disease_data.py +25 -28
- endoreg_db/management/commands/load_endoscope_data.py +20 -27
- endoreg_db/management/commands/load_event_data.py +14 -16
- endoreg_db/management/commands/load_examination_data.py +31 -44
- endoreg_db/management/commands/load_examination_indication_data.py +20 -21
- endoreg_db/management/commands/load_finding_data.py +52 -80
- endoreg_db/management/commands/load_information_source.py +21 -23
- endoreg_db/management/commands/load_lab_value_data.py +17 -26
- endoreg_db/management/commands/load_medication_data.py +13 -12
- endoreg_db/management/commands/load_organ_data.py +15 -19
- endoreg_db/management/commands/load_pdf_type_data.py +19 -18
- endoreg_db/management/commands/load_profession_data.py +14 -17
- endoreg_db/management/commands/load_qualification_data.py +20 -23
- endoreg_db/management/commands/load_report_reader_flag_data.py +17 -19
- endoreg_db/management/commands/load_requirement_data.py +14 -20
- endoreg_db/management/commands/load_risk_data.py +7 -6
- endoreg_db/management/commands/load_shift_data.py +20 -23
- endoreg_db/management/commands/load_tag_data.py +8 -11
- endoreg_db/management/commands/load_unit_data.py +17 -19
- endoreg_db/management/commands/start_filewatcher.py +46 -37
- endoreg_db/management/commands/validate_video_files.py +1 -5
- endoreg_db/migrations/0001_initial.py +1360 -1812
- endoreg_db/models/administration/person/patient/patient.py +72 -46
- endoreg_db/models/label/__init__.py +2 -2
- endoreg_db/models/label/annotation/video_segmentation_annotation.py +18 -26
- endoreg_db/models/label/label_video_segment/label_video_segment.py +23 -1
- endoreg_db/models/media/pdf/raw_pdf.py +136 -64
- endoreg_db/models/media/pdf/report_reader/report_reader_config.py +34 -10
- endoreg_db/models/media/processing_history/__init__.py +5 -0
- endoreg_db/models/media/processing_history/processing_history.py +96 -0
- endoreg_db/models/media/video/create_from_file.py +101 -31
- endoreg_db/models/media/video/video_file.py +125 -105
- endoreg_db/models/media/video/video_file_io.py +31 -26
- endoreg_db/models/medical/contraindication/README.md +1 -0
- endoreg_db/models/medical/examination/examination.py +28 -8
- endoreg_db/models/medical/examination/examination_indication.py +13 -79
- endoreg_db/models/medical/examination/examination_time.py +8 -3
- endoreg_db/models/medical/finding/finding.py +5 -12
- endoreg_db/models/medical/finding/finding_classification.py +18 -37
- endoreg_db/models/medical/finding/finding_intervention.py +7 -9
- endoreg_db/models/medical/hardware/endoscope.py +6 -0
- endoreg_db/models/medical/patient/medication_examples.py +5 -1
- endoreg_db/models/medical/patient/patient_finding.py +1 -1
- endoreg_db/models/metadata/pdf_meta.py +22 -10
- endoreg_db/models/metadata/sensitive_meta.py +3 -0
- endoreg_db/models/metadata/sensitive_meta_logic.py +200 -124
- endoreg_db/models/other/information_source.py +27 -6
- endoreg_db/models/report/__init__.py +0 -0
- endoreg_db/models/report/images.py +0 -0
- endoreg_db/models/report/report.py +6 -0
- endoreg_db/models/requirement/requirement.py +59 -399
- endoreg_db/models/requirement/requirement_operator.py +86 -98
- endoreg_db/models/state/audit_ledger.py +4 -5
- endoreg_db/models/state/raw_pdf.py +69 -30
- endoreg_db/models/state/video.py +65 -49
- endoreg_db/models/upload_job.py +33 -9
- endoreg_db/models/utils.py +27 -23
- endoreg_db/queries/__init__.py +3 -1
- endoreg_db/schemas/examination_evaluation.py +1 -1
- endoreg_db/serializers/__init__.py +2 -8
- endoreg_db/serializers/label_video_segment/label_video_segment.py +2 -29
- endoreg_db/serializers/meta/__init__.py +1 -6
- endoreg_db/serializers/misc/sensitive_patient_data.py +50 -26
- endoreg_db/serializers/patient_examination/patient_examination.py +3 -3
- endoreg_db/serializers/pdf/anony_text_validation.py +39 -23
- endoreg_db/serializers/video/video_file_list.py +65 -34
- endoreg_db/services/__old/pdf_import.py +1487 -0
- endoreg_db/services/__old/video_import.py +1306 -0
- endoreg_db/services/anonymization.py +63 -26
- endoreg_db/services/lookup_service.py +28 -28
- endoreg_db/services/lookup_store.py +2 -2
- endoreg_db/services/pdf_import.py +0 -1480
- endoreg_db/services/report_import.py +10 -0
- endoreg_db/services/video_import.py +6 -1165
- endoreg_db/tasks/upload_tasks.py +79 -70
- endoreg_db/tasks/video_ingest.py +8 -4
- endoreg_db/urls/__init__.py +0 -14
- endoreg_db/urls/ai.py +32 -0
- endoreg_db/urls/media.py +21 -24
- endoreg_db/utils/dataloader.py +87 -57
- endoreg_db/utils/paths.py +110 -46
- endoreg_db/utils/pipelines/Readme.md +1 -1
- endoreg_db/utils/requirement_operator_logic/new_operator_logic.py +97 -0
- endoreg_db/utils/video/ffmpeg_wrapper.py +217 -52
- endoreg_db/views/__init__.py +85 -173
- endoreg_db/views/ai/__init__.py +8 -0
- endoreg_db/views/ai/label.py +155 -0
- endoreg_db/views/anonymization/media_management.py +8 -7
- endoreg_db/views/anonymization/overview.py +97 -68
- endoreg_db/views/anonymization/validate.py +25 -21
- endoreg_db/views/media/__init__.py +5 -20
- endoreg_db/views/media/pdf_media.py +109 -65
- endoreg_db/views/media/sensitive_metadata.py +163 -148
- endoreg_db/views/meta/__init__.py +0 -8
- endoreg_db/views/misc/__init__.py +1 -7
- endoreg_db/views/misc/upload_views.py +94 -93
- endoreg_db/views/report/__init__.py +7 -0
- endoreg_db/views/{pdf → report}/reimport.py +45 -24
- endoreg_db/views/{pdf/pdf_stream.py → report/report_stream.py} +40 -32
- endoreg_db/views/requirement/lookup_store.py +22 -90
- endoreg_db/views/video/__init__.py +23 -22
- endoreg_db/views/video/correction.py +201 -172
- endoreg_db/views/video/reimport.py +1 -1
- endoreg_db/views/{media/video_segments.py → video/segments_crud.py} +75 -37
- endoreg_db/views/video/{video_meta.py → video_meta_stats.py} +2 -2
- endoreg_db/views/video/video_stream.py +7 -8
- {endoreg_db-0.8.8.0.dist-info → endoreg_db-0.8.9.2.dist-info}/METADATA +2 -2
- {endoreg_db-0.8.8.0.dist-info → endoreg_db-0.8.9.2.dist-info}/RECORD +217 -335
- {endoreg_db-0.8.8.0.dist-info → endoreg_db-0.8.9.2.dist-info}/WHEEL +1 -1
- endoreg_db/data/_examples/disease.yaml +0 -55
- endoreg_db/data/_examples/disease_classification.yaml +0 -13
- endoreg_db/data/_examples/disease_classification_choice.yaml +0 -62
- endoreg_db/data/_examples/event.yaml +0 -64
- endoreg_db/data/_examples/examination.yaml +0 -72
- endoreg_db/data/_examples/finding/anatomy_colon.yaml +0 -128
- endoreg_db/data/_examples/finding/colonoscopy.yaml +0 -40
- endoreg_db/data/_examples/finding/colonoscopy_bowel_prep.yaml +0 -56
- endoreg_db/data/_examples/finding/complication.yaml +0 -16
- endoreg_db/data/_examples/finding/data.yaml +0 -105
- endoreg_db/data/_examples/finding/examination_setting.yaml +0 -16
- endoreg_db/data/_examples/finding/medication_related.yaml +0 -18
- endoreg_db/data/_examples/finding/outcome.yaml +0 -12
- endoreg_db/data/_examples/finding_classification/colonoscopy_bowel_preparation.yaml +0 -68
- endoreg_db/data/_examples/finding_classification/colonoscopy_jnet.yaml +0 -22
- endoreg_db/data/_examples/finding_classification/colonoscopy_kudo.yaml +0 -25
- endoreg_db/data/_examples/finding_classification/colonoscopy_lesion_circularity.yaml +0 -20
- endoreg_db/data/_examples/finding_classification/colonoscopy_lesion_planarity.yaml +0 -24
- endoreg_db/data/_examples/finding_classification/colonoscopy_lesion_size.yaml +0 -68
- endoreg_db/data/_examples/finding_classification/colonoscopy_lesion_surface.yaml +0 -20
- endoreg_db/data/_examples/finding_classification/colonoscopy_location.yaml +0 -80
- endoreg_db/data/_examples/finding_classification/colonoscopy_lst.yaml +0 -21
- endoreg_db/data/_examples/finding_classification/colonoscopy_nice.yaml +0 -20
- endoreg_db/data/_examples/finding_classification/colonoscopy_paris.yaml +0 -26
- endoreg_db/data/_examples/finding_classification/colonoscopy_sano.yaml +0 -22
- endoreg_db/data/_examples/finding_classification/colonoscopy_summary.yaml +0 -53
- endoreg_db/data/_examples/finding_classification/complication_generic.yaml +0 -25
- endoreg_db/data/_examples/finding_classification/examination_setting_generic.yaml +0 -40
- endoreg_db/data/_examples/finding_classification/histology_colo.yaml +0 -51
- endoreg_db/data/_examples/finding_classification/intervention_required.yaml +0 -26
- endoreg_db/data/_examples/finding_classification/medication_related.yaml +0 -23
- endoreg_db/data/_examples/finding_classification/visualized.yaml +0 -33
- endoreg_db/data/_examples/finding_classification_choice/bowel_preparation.yaml +0 -78
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_circularity_default.yaml +0 -32
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_jnet.yaml +0 -15
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_kudo.yaml +0 -23
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_lst.yaml +0 -15
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_nice.yaml +0 -17
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_planarity_default.yaml +0 -49
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_sano.yaml +0 -14
- endoreg_db/data/_examples/finding_classification_choice/colon_lesion_surface_intact_default.yaml +0 -36
- endoreg_db/data/_examples/finding_classification_choice/colonoscopy_size.yaml +0 -82
- endoreg_db/data/_examples/finding_classification_choice/colonoscopy_summary_worst_finding.yaml +0 -15
- endoreg_db/data/_examples/finding_classification_choice/complication_generic_types.yaml +0 -15
- endoreg_db/data/_examples/finding_classification_choice/examination_setting_generic_types.yaml +0 -15
- endoreg_db/data/_examples/finding_classification_choice/histology.yaml +0 -24
- endoreg_db/data/_examples/finding_classification_choice/histology_polyp.yaml +0 -20
- endoreg_db/data/_examples/finding_classification_choice/outcome.yaml +0 -19
- endoreg_db/data/_examples/finding_classification_choice/yes_no_na.yaml +0 -11
- endoreg_db/data/_examples/finding_classification_type/colonoscopy_basic.yaml +0 -48
- endoreg_db/data/_examples/finding_intervention/endoscopy.yaml +0 -43
- endoreg_db/data/_examples/finding_intervention/endoscopy_colonoscopy.yaml +0 -168
- endoreg_db/data/_examples/finding_intervention/endoscopy_egd.yaml +0 -128
- endoreg_db/data/_examples/finding_intervention/endoscopy_ercp.yaml +0 -32
- endoreg_db/data/_examples/finding_intervention/endoscopy_eus_lower.yaml +0 -9
- endoreg_db/data/_examples/finding_intervention/endoscopy_eus_upper.yaml +0 -36
- endoreg_db/data/_examples/finding_intervention_type/endoscopy.yaml +0 -15
- endoreg_db/data/_examples/finding_type/data.yaml +0 -43
- endoreg_db/data/_examples/requirement/age.yaml +0 -26
- endoreg_db/data/_examples/requirement/gender.yaml +0 -25
- endoreg_db/data/_examples/requirement_set/01_endoscopy_generic.yaml +0 -48
- endoreg_db/data/_examples/requirement_set/colonoscopy_austria_screening.yaml +0 -57
- endoreg_db/data/_examples/requirement_set/endoscopy_bleeding_risk.yaml +0 -52
- endoreg_db/data/_examples/yaml_examples.xlsx +0 -0
- endoreg_db/data/finding/anatomy_colon.yaml +0 -128
- endoreg_db/data/finding/colonoscopy.yaml +0 -40
- endoreg_db/data/finding/colonoscopy_bowel_prep.yaml +0 -56
- endoreg_db/data/finding/complication.yaml +0 -16
- endoreg_db/data/finding/data.yaml +0 -105
- endoreg_db/data/finding/examination_setting.yaml +0 -16
- endoreg_db/data/finding/medication_related.yaml +0 -18
- endoreg_db/data/finding/outcome.yaml +0 -12
- endoreg_db/data/finding_classification/colonoscopy_jnet.yaml +0 -22
- endoreg_db/data/finding_classification/colonoscopy_kudo.yaml +0 -25
- endoreg_db/data/finding_classification/colonoscopy_lesion_circularity.yaml +0 -20
- endoreg_db/data/finding_classification/colonoscopy_lesion_planarity.yaml +0 -24
- endoreg_db/data/finding_classification/colonoscopy_lesion_size.yaml +0 -38
- endoreg_db/data/finding_classification/colonoscopy_lesion_surface.yaml +0 -20
- endoreg_db/data/finding_classification/colonoscopy_location.yaml +0 -49
- endoreg_db/data/finding_classification/colonoscopy_lst.yaml +0 -21
- endoreg_db/data/finding_classification/colonoscopy_nice.yaml +0 -20
- endoreg_db/data/finding_classification/colonoscopy_paris.yaml +0 -26
- endoreg_db/data/finding_classification/colonoscopy_sano.yaml +0 -22
- endoreg_db/data/finding_classification/colonoscopy_summary.yaml +0 -53
- endoreg_db/data/finding_classification/complication_generic.yaml +0 -25
- endoreg_db/data/finding_classification/examination_setting_generic.yaml +0 -40
- endoreg_db/data/finding_classification/histology_colo.yaml +0 -43
- endoreg_db/data/finding_classification/intervention_required.yaml +0 -26
- endoreg_db/data/finding_classification/medication_related.yaml +0 -23
- endoreg_db/data/finding_classification/visualized.yaml +0 -33
- endoreg_db/data/finding_classification_choice/colon_lesion_circularity_default.yaml +0 -32
- endoreg_db/data/finding_classification_choice/colon_lesion_jnet.yaml +0 -15
- endoreg_db/data/finding_classification_choice/colon_lesion_kudo.yaml +0 -23
- endoreg_db/data/finding_classification_choice/colon_lesion_lst.yaml +0 -15
- endoreg_db/data/finding_classification_choice/colon_lesion_nice.yaml +0 -17
- endoreg_db/data/finding_classification_choice/colon_lesion_paris.yaml +0 -57
- endoreg_db/data/finding_classification_choice/colon_lesion_planarity_default.yaml +0 -49
- endoreg_db/data/finding_classification_choice/colon_lesion_sano.yaml +0 -14
- endoreg_db/data/finding_classification_choice/colon_lesion_surface_intact_default.yaml +0 -36
- endoreg_db/data/finding_classification_choice/colonoscopy_location.yaml +0 -229
- endoreg_db/data/finding_classification_choice/colonoscopy_not_complete_reason.yaml +0 -19
- endoreg_db/data/finding_classification_choice/colonoscopy_size.yaml +0 -82
- endoreg_db/data/finding_classification_choice/colonoscopy_summary_worst_finding.yaml +0 -15
- endoreg_db/data/finding_classification_choice/outcome.yaml +0 -19
- endoreg_db/data/finding_intervention/endoscopy.yaml +0 -43
- endoreg_db/data/finding_intervention/endoscopy_colonoscopy.yaml +0 -168
- endoreg_db/data/finding_intervention/endoscopy_egd.yaml +0 -128
- endoreg_db/data/finding_intervention/endoscopy_ercp.yaml +0 -32
- endoreg_db/data/finding_intervention/endoscopy_eus_lower.yaml +0 -9
- endoreg_db/data/finding_intervention/endoscopy_eus_upper.yaml +0 -36
- endoreg_db/data/finding_morphology_classification_type/colonoscopy.yaml +0 -79
- endoreg_db/data/requirement/age.yaml +0 -26
- endoreg_db/data/requirement/colonoscopy_baseline_austria.yaml +0 -45
- endoreg_db/data/requirement/disease_cardiovascular.yaml +0 -79
- endoreg_db/data/requirement/disease_classification_choice_cardiovascular.yaml +0 -41
- endoreg_db/data/requirement/disease_hepatology.yaml +0 -12
- endoreg_db/data/requirement/disease_misc.yaml +0 -12
- endoreg_db/data/requirement/disease_renal.yaml +0 -96
- endoreg_db/data/requirement/endoscopy_bleeding_risk.yaml +0 -59
- endoreg_db/data/requirement/event_cardiology.yaml +0 -251
- endoreg_db/data/requirement/event_requirements.yaml +0 -145
- endoreg_db/data/requirement/finding_colon_polyp.yaml +0 -50
- endoreg_db/data/requirement/gender.yaml +0 -25
- endoreg_db/data/requirement/lab_value.yaml +0 -441
- endoreg_db/data/requirement/medication.yaml +0 -93
- endoreg_db/data/requirement_operator/age.yaml +0 -13
- endoreg_db/data/requirement_operator/lab_operators.yaml +0 -129
- endoreg_db/data/requirement_operator/model_operators.yaml +0 -96
- endoreg_db/management/commands/init_default_ai_model.py +0 -112
- endoreg_db/management/commands/reset_celery_schedule.py +0 -9
- endoreg_db/management/commands/validate_video.py +0 -204
- endoreg_db/migrations/0002_requirementset_depends_on.py +0 -18
- endoreg_db/migrations/_old/0001_initial.py +0 -1857
- endoreg_db/migrations/_old/0002_add_video_correction_models.py +0 -52
- endoreg_db/migrations/_old/0003_add_center_display_name.py +0 -30
- endoreg_db/migrations/_old/0004_employee_city_employee_post_code_employee_street_and_more.py +0 -68
- endoreg_db/migrations/_old/0004_remove_casetemplate_rules_and_more.py +0 -77
- endoreg_db/migrations/_old/0005_merge_20251111_1003.py +0 -14
- endoreg_db/migrations/_old/0006_sensitivemeta_anonymized_text_and_more.py +0 -68
- endoreg_db/migrations/_old/0007_remove_rule_attribute_dtype_remove_rule_rule_type_and_more.py +0 -89
- endoreg_db/migrations/_old/0008_remove_event_event_classification_and_more.py +0 -27
- endoreg_db/migrations/_old/0009_alter_modelmeta_options_and_more.py +0 -21
- endoreg_db/renames.yml +0 -8
- endoreg_db/serializers/_old/raw_pdf_meta_validation.py +0 -223
- endoreg_db/serializers/_old/raw_video_meta_validation.py +0 -179
- endoreg_db/serializers/_old/video.py +0 -71
- endoreg_db/serializers/meta/pdf_file_meta_extraction.py +0 -115
- endoreg_db/serializers/meta/report_meta.py +0 -53
- endoreg_db/serializers/report/__init__.py +0 -9
- endoreg_db/serializers/report/mixins.py +0 -45
- endoreg_db/serializers/report/report.py +0 -105
- endoreg_db/serializers/report/report_list.py +0 -22
- endoreg_db/serializers/report/secure_file_url.py +0 -26
- endoreg_db/services/requirements_object.py +0 -147
- endoreg_db/services/storage_aware_video_processor.py +0 -370
- endoreg_db/urls/files.py +0 -6
- endoreg_db/urls/label_video_segment_validate.py +0 -33
- endoreg_db/urls/label_video_segments.py +0 -46
- endoreg_db/views/label/__init__.py +0 -5
- endoreg_db/views/label/label.py +0 -15
- endoreg_db/views/label_video_segment/__init__.py +0 -16
- endoreg_db/views/label_video_segment/create_lvs_from_annotation.py +0 -44
- endoreg_db/views/label_video_segment/get_lvs_by_name_and_video.py +0 -50
- endoreg_db/views/label_video_segment/label_video_segment.py +0 -77
- endoreg_db/views/label_video_segment/label_video_segment_by_label.py +0 -174
- endoreg_db/views/label_video_segment/label_video_segment_detail.py +0 -73
- endoreg_db/views/label_video_segment/update_lvs_from_annotation.py +0 -46
- endoreg_db/views/label_video_segment/validate.py +0 -226
- endoreg_db/views/media/segments.py +0 -71
- endoreg_db/views/meta/available_files_list.py +0 -146
- endoreg_db/views/meta/report_meta.py +0 -53
- endoreg_db/views/meta/sensitive_meta_detail.py +0 -85
- endoreg_db/views/misc/secure_file_serving_view.py +0 -80
- endoreg_db/views/misc/secure_file_url_view.py +0 -84
- endoreg_db/views/misc/secure_url_validate.py +0 -79
- endoreg_db/views/patient_examination/DEPRECATED_video_backup.py +0 -164
- endoreg_db/views/patient_finding_location/__init__.py +0 -5
- endoreg_db/views/patient_finding_location/pfl_create.py +0 -70
- endoreg_db/views/patient_finding_morphology/__init__.py +0 -5
- endoreg_db/views/patient_finding_morphology/pfm_create.py +0 -70
- endoreg_db/views/pdf/__init__.py +0 -8
- endoreg_db/views/video/segmentation.py +0 -274
- endoreg_db/views/video/task_status.py +0 -49
- endoreg_db/views/video/timeline.py +0 -46
- endoreg_db/views/video/video_analyze.py +0 -52
- /endoreg_db/data/requirement/{colon_polyp_intervention.yaml → old/colon_polyp_intervention.yaml} +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/colonoscopy_baseline_austria.yaml +0 -0
- /endoreg_db/data/requirement/{coloreg_colon_polyp.yaml → old/coloreg_colon_polyp.yaml} +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/disease_cardiovascular.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/disease_classification_choice_cardiovascular.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/disease_hepatology.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/disease_misc.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/disease_renal.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/endoscopy_bleeding_risk.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/event_cardiology.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/event_requirements.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/finding_colon_polyp.yaml +0 -0
- /endoreg_db/{urls/sensitive_meta.py → data/requirement/old/gender.yaml} +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/lab_value.yaml +0 -0
- /endoreg_db/data/{_examples/requirement → requirement/old}/medication.yaml +0 -0
- /endoreg_db/data/{_examples/requirement_operator → requirement_operator/_old}/age.yaml +0 -0
- /endoreg_db/data/{_examples/requirement_operator → requirement_operator/_old}/lab_operators.yaml +0 -0
- /endoreg_db/data/{_examples/requirement_operator → requirement_operator/_old}/model_operators.yaml +0 -0
- /endoreg_db/{views/pdf/pdf_stream_views.py → import_files/pseudonymization/__init__.py} +0 -0
- /endoreg_db/utils/requirement_operator_logic/{lab_value_operators.py → _old/lab_value_operators.py} +0 -0
- /endoreg_db/utils/requirement_operator_logic/{model_evaluators.py → _old/model_evaluators.py} +0 -0
- {endoreg_db-0.8.8.0.dist-info → endoreg_db-0.8.9.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
# Modern Media Framework: Sensitive Metadata Management
|
|
2
2
|
import string
|
|
3
|
-
|
|
4
|
-
from rest_framework.decorators import api_view, permission_classes
|
|
5
|
-
from rest_framework.response import Response
|
|
6
|
-
from rest_framework import status
|
|
3
|
+
|
|
7
4
|
from django.db import transaction
|
|
8
5
|
from django.db.models import Q
|
|
9
6
|
from django.shortcuts import get_object_or_404
|
|
10
|
-
from
|
|
11
|
-
from
|
|
7
|
+
from numpy import number
|
|
8
|
+
from rest_framework import status
|
|
9
|
+
from rest_framework.decorators import api_view, permission_classes
|
|
10
|
+
from rest_framework.response import Response
|
|
11
|
+
|
|
12
|
+
from endoreg_db.models import RawPdfFile, SensitiveMeta, VideoFile
|
|
12
13
|
from endoreg_db.serializers.meta import (
|
|
13
14
|
SensitiveMetaDetailSerializer,
|
|
14
15
|
SensitiveMetaUpdateSerializer,
|
|
15
16
|
)
|
|
17
|
+
from endoreg_db.utils.permissions import EnvironmentAwarePermission
|
|
16
18
|
|
|
17
19
|
# === VIDEO SENSITIVE METADATA ===
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
@api_view(["GET"])
|
|
20
23
|
@permission_classes([EnvironmentAwarePermission])
|
|
21
24
|
def get_sensitive_metadata_pk(request, pk: number, mediaType: str) -> Response | None:
|
|
22
25
|
"""
|
|
23
26
|
A route to get the sensitive meta pk for a media type quickly.
|
|
24
|
-
|
|
27
|
+
|
|
25
28
|
GET api/media/sensitive-media-id/<pk>/<str:mediaType>
|
|
26
29
|
|
|
27
30
|
Args:
|
|
@@ -31,84 +34,80 @@ def get_sensitive_metadata_pk(request, pk: number, mediaType: str) -> Response |
|
|
|
31
34
|
Returns:
|
|
32
35
|
Response | None: _description_
|
|
33
36
|
"""
|
|
34
|
-
|
|
35
|
-
if mediaType ==
|
|
37
|
+
|
|
38
|
+
if mediaType == "video":
|
|
36
39
|
video = get_object_or_404(VideoFile, pk=pk)
|
|
37
40
|
if not video.sensitive_meta:
|
|
38
41
|
return Response(
|
|
39
42
|
{"error": f"No sensitive metadata found for video {pk}"},
|
|
40
|
-
status=status.HTTP_404_NOT_FOUND
|
|
43
|
+
status=status.HTTP_404_NOT_FOUND,
|
|
41
44
|
)
|
|
42
45
|
sm_id = video.sensitive_meta.pk
|
|
43
|
-
return Response({
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
if mediaType == 'pdf':
|
|
46
|
+
return Response({"sm": sm_id})
|
|
47
|
+
if mediaType == "pdf":
|
|
47
48
|
pdf = get_object_or_404(RawPdfFile, pk=pk)
|
|
48
49
|
if not pdf.sensitive_meta:
|
|
49
50
|
return Response(
|
|
50
|
-
{"error": f"No sensitive metadata found for
|
|
51
|
-
status=status.HTTP_404_NOT_FOUND
|
|
51
|
+
{"error": f"No sensitive metadata found for report {pk}"},
|
|
52
|
+
status=status.HTTP_404_NOT_FOUND,
|
|
52
53
|
)
|
|
53
54
|
sm_id = pdf.sensitive_meta.pk
|
|
54
|
-
return Response({
|
|
55
|
-
"sm": sm_id
|
|
56
|
-
})
|
|
57
|
-
|
|
55
|
+
return Response({"sm": sm_id})
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
|
|
58
|
+
@api_view(["GET", "PATCH"])
|
|
60
59
|
@permission_classes([EnvironmentAwarePermission])
|
|
61
60
|
def video_sensitive_metadata(request, pk):
|
|
62
61
|
"""
|
|
63
62
|
GET /api/media/videos/<pk>/sensitive-metadata/
|
|
64
63
|
PATCH /api/media/videos/<pk>/sensitive-metadata/
|
|
65
|
-
|
|
64
|
+
|
|
66
65
|
Get or update sensitive metadata for a video.
|
|
67
|
-
Video-scoped: Uses
|
|
66
|
+
Video-scoped: Uses sensitive meta ID to locate related sensitive metadata.
|
|
68
67
|
"""
|
|
69
68
|
sensitive_meta = get_object_or_404(SensitiveMeta, pk=pk)
|
|
70
|
-
|
|
69
|
+
|
|
71
70
|
# Get related sensitive metadata
|
|
72
71
|
if not sensitive_meta:
|
|
73
72
|
return Response(
|
|
74
73
|
{"error": f"No sensitive metadata found for video {pk}"},
|
|
75
|
-
status=status.HTTP_404_NOT_FOUND
|
|
74
|
+
status=status.HTTP_404_NOT_FOUND,
|
|
76
75
|
)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if request.method == 'GET':
|
|
76
|
+
|
|
77
|
+
if request.method == "GET":
|
|
80
78
|
serializer = SensitiveMetaDetailSerializer(sensitive_meta)
|
|
81
79
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
82
|
-
|
|
83
|
-
elif request.method ==
|
|
80
|
+
|
|
81
|
+
elif request.method == "PATCH":
|
|
84
82
|
serializer = SensitiveMetaUpdateSerializer(
|
|
85
|
-
sensitive_meta,
|
|
86
|
-
data=request.data,
|
|
87
|
-
partial=True
|
|
83
|
+
sensitive_meta, data=request.data, partial=True
|
|
88
84
|
)
|
|
89
|
-
|
|
85
|
+
|
|
90
86
|
if serializer.is_valid():
|
|
91
87
|
updated_instance = serializer.save()
|
|
92
88
|
response_serializer = SensitiveMetaDetailSerializer(updated_instance)
|
|
93
|
-
|
|
94
|
-
return Response(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
89
|
+
|
|
90
|
+
return Response(
|
|
91
|
+
{
|
|
92
|
+
"message": "Sensitive metadata updated successfully",
|
|
93
|
+
"sensitive_meta": response_serializer.data,
|
|
94
|
+
"video_id": pk,
|
|
95
|
+
},
|
|
96
|
+
status=status.HTTP_200_OK,
|
|
97
|
+
)
|
|
98
|
+
|
|
100
99
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
101
100
|
|
|
102
101
|
|
|
103
|
-
@api_view([
|
|
102
|
+
@api_view(["POST"])
|
|
104
103
|
@permission_classes([EnvironmentAwarePermission])
|
|
105
104
|
@transaction.atomic
|
|
106
105
|
def video_sensitive_metadata_verify(request, pk):
|
|
107
106
|
"""
|
|
108
107
|
POST /api/media/videos/<pk>/sensitive-metadata/verify/
|
|
109
|
-
|
|
108
|
+
|
|
110
109
|
Update verification state for video sensitive metadata.
|
|
111
|
-
|
|
110
|
+
|
|
112
111
|
Expected payload:
|
|
113
112
|
{
|
|
114
113
|
"dob_verified": true,
|
|
@@ -116,97 +115,103 @@ def video_sensitive_metadata_verify(request, pk):
|
|
|
116
115
|
}
|
|
117
116
|
"""
|
|
118
117
|
video = get_object_or_404(VideoFile, pk=pk)
|
|
119
|
-
|
|
118
|
+
|
|
120
119
|
if not video.sensitive_meta:
|
|
121
120
|
return Response(
|
|
122
121
|
{"error": f"No sensitive metadata found for video {pk}"},
|
|
123
|
-
status=status.HTTP_404_NOT_FOUND
|
|
122
|
+
status=status.HTTP_404_NOT_FOUND,
|
|
124
123
|
)
|
|
125
|
-
|
|
124
|
+
|
|
126
125
|
sensitive_meta = video.sensitive_meta
|
|
127
|
-
|
|
128
|
-
dob_verified = request.data.get(
|
|
129
|
-
names_verified = request.data.get(
|
|
130
|
-
|
|
126
|
+
|
|
127
|
+
dob_verified = request.data.get("dob_verified")
|
|
128
|
+
names_verified = request.data.get("names_verified")
|
|
129
|
+
|
|
131
130
|
if dob_verified is None and names_verified is None:
|
|
132
131
|
return Response(
|
|
133
|
-
{
|
|
134
|
-
|
|
132
|
+
{
|
|
133
|
+
"error": "At least one of dob_verified or names_verified must be provided"
|
|
134
|
+
},
|
|
135
|
+
status=status.HTTP_400_BAD_REQUEST,
|
|
135
136
|
)
|
|
136
|
-
|
|
137
|
+
|
|
137
138
|
state = sensitive_meta.get_or_create_state()
|
|
138
|
-
|
|
139
|
+
|
|
139
140
|
if dob_verified is not None:
|
|
140
141
|
state.dob_verified = dob_verified
|
|
141
142
|
if names_verified is not None:
|
|
142
143
|
state.names_verified = names_verified
|
|
143
|
-
|
|
144
|
+
|
|
144
145
|
state.save()
|
|
145
|
-
|
|
146
|
+
|
|
146
147
|
response_serializer = SensitiveMetaDetailSerializer(sensitive_meta)
|
|
147
|
-
return Response(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
return Response(
|
|
149
|
+
{
|
|
150
|
+
"message": "Verification state updated successfully",
|
|
151
|
+
"sensitive_meta": response_serializer.data,
|
|
152
|
+
"video_id": pk,
|
|
153
|
+
"state_verified": state.is_verified,
|
|
154
|
+
},
|
|
155
|
+
status=status.HTTP_200_OK,
|
|
156
|
+
)
|
|
157
|
+
|
|
153
158
|
|
|
159
|
+
# === report SENSITIVE METADATA ===
|
|
154
160
|
|
|
155
|
-
# === PDF SENSITIVE METADATA ===
|
|
156
161
|
|
|
157
|
-
@api_view([
|
|
162
|
+
@api_view(["GET", "PATCH"])
|
|
158
163
|
@permission_classes([EnvironmentAwarePermission])
|
|
159
164
|
def pdf_sensitive_metadata(request, pk):
|
|
160
165
|
"""
|
|
161
166
|
GET /api/media/pdfs/<pk>/sensitive-metadata/
|
|
162
167
|
PATCH /api/media/pdfs/<pk>/sensitive-metadata/
|
|
163
|
-
|
|
164
|
-
Get or update sensitive metadata for a
|
|
165
|
-
|
|
168
|
+
|
|
169
|
+
Get or update sensitive metadata for a report.
|
|
170
|
+
report-scoped: Uses report ID to locate related sensitive metadata.
|
|
166
171
|
"""
|
|
167
172
|
sensitive_meta = get_object_or_404(SensitiveMeta, pk=pk)
|
|
168
|
-
|
|
173
|
+
|
|
169
174
|
# Get related sensitive metadata
|
|
170
175
|
if not sensitive_meta:
|
|
171
176
|
return Response(
|
|
172
|
-
{"error": f"No sensitive metadata found for
|
|
173
|
-
status=status.HTTP_404_NOT_FOUND
|
|
177
|
+
{"error": f"No sensitive metadata found for report {pk}"},
|
|
178
|
+
status=status.HTTP_404_NOT_FOUND,
|
|
174
179
|
)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if request.method == 'GET':
|
|
180
|
+
|
|
181
|
+
if request.method == "GET":
|
|
178
182
|
serializer = SensitiveMetaDetailSerializer(sensitive_meta)
|
|
179
183
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
180
|
-
|
|
181
|
-
elif request.method ==
|
|
184
|
+
|
|
185
|
+
elif request.method == "PATCH":
|
|
182
186
|
serializer = SensitiveMetaUpdateSerializer(
|
|
183
|
-
sensitive_meta,
|
|
184
|
-
data=request.data,
|
|
185
|
-
partial=True
|
|
187
|
+
sensitive_meta, data=request.data, partial=True
|
|
186
188
|
)
|
|
187
|
-
|
|
189
|
+
|
|
188
190
|
if serializer.is_valid():
|
|
189
191
|
updated_instance = serializer.save()
|
|
190
192
|
response_serializer = SensitiveMetaDetailSerializer(updated_instance)
|
|
191
|
-
|
|
192
|
-
return Response(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
193
|
+
|
|
194
|
+
return Response(
|
|
195
|
+
{
|
|
196
|
+
"message": "Sensitive metadata updated successfully",
|
|
197
|
+
"sensitive_meta": response_serializer.data,
|
|
198
|
+
"pdf_id": pk,
|
|
199
|
+
},
|
|
200
|
+
status=status.HTTP_200_OK,
|
|
201
|
+
)
|
|
202
|
+
|
|
198
203
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
199
204
|
|
|
200
205
|
|
|
201
|
-
@api_view([
|
|
206
|
+
@api_view(["POST"])
|
|
202
207
|
@permission_classes([EnvironmentAwarePermission])
|
|
203
208
|
@transaction.atomic
|
|
204
209
|
def pdf_sensitive_metadata_verify(request, pk):
|
|
205
210
|
"""
|
|
206
211
|
POST /api/media/pdfs/<pk>/sensitive-metadata/verify/
|
|
207
|
-
|
|
208
|
-
Update verification state for
|
|
209
|
-
|
|
212
|
+
|
|
213
|
+
Update verification state for report sensitive metadata.
|
|
214
|
+
|
|
210
215
|
Expected payload:
|
|
211
216
|
{
|
|
212
217
|
"dob_verified": true,
|
|
@@ -214,53 +219,59 @@ def pdf_sensitive_metadata_verify(request, pk):
|
|
|
214
219
|
}
|
|
215
220
|
"""
|
|
216
221
|
pdf = get_object_or_404(RawPdfFile, pk=pk)
|
|
217
|
-
|
|
222
|
+
|
|
218
223
|
if not pdf.sensitive_meta:
|
|
219
224
|
return Response(
|
|
220
|
-
{"error": f"No sensitive metadata found for
|
|
221
|
-
status=status.HTTP_404_NOT_FOUND
|
|
225
|
+
{"error": f"No sensitive metadata found for report {pk}"},
|
|
226
|
+
status=status.HTTP_404_NOT_FOUND,
|
|
222
227
|
)
|
|
223
|
-
|
|
228
|
+
|
|
224
229
|
sensitive_meta = pdf.sensitive_meta
|
|
225
|
-
|
|
226
|
-
dob_verified = request.data.get(
|
|
227
|
-
names_verified = request.data.get(
|
|
228
|
-
|
|
230
|
+
|
|
231
|
+
dob_verified = request.data.get("dob_verified")
|
|
232
|
+
names_verified = request.data.get("names_verified")
|
|
233
|
+
|
|
229
234
|
if dob_verified is None and names_verified is None:
|
|
230
235
|
return Response(
|
|
231
|
-
{
|
|
232
|
-
|
|
236
|
+
{
|
|
237
|
+
"error": "At least one of dob_verified or names_verified must be provided"
|
|
238
|
+
},
|
|
239
|
+
status=status.HTTP_400_BAD_REQUEST,
|
|
233
240
|
)
|
|
234
|
-
|
|
241
|
+
|
|
235
242
|
state = sensitive_meta.get_or_create_state()
|
|
236
|
-
|
|
243
|
+
|
|
237
244
|
if dob_verified is not None:
|
|
238
245
|
state.dob_verified = dob_verified
|
|
239
246
|
if names_verified is not None:
|
|
240
247
|
state.names_verified = names_verified
|
|
241
|
-
|
|
248
|
+
|
|
242
249
|
state.save()
|
|
243
|
-
|
|
250
|
+
|
|
244
251
|
response_serializer = SensitiveMetaDetailSerializer(sensitive_meta)
|
|
245
|
-
return Response(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
252
|
+
return Response(
|
|
253
|
+
{
|
|
254
|
+
"message": "Verification state updated successfully",
|
|
255
|
+
"sensitive_meta": response_serializer.data,
|
|
256
|
+
"pdf_id": pk,
|
|
257
|
+
"state_verified": state.is_verified,
|
|
258
|
+
},
|
|
259
|
+
status=status.HTTP_200_OK,
|
|
260
|
+
)
|
|
251
261
|
|
|
252
262
|
|
|
253
263
|
# === LIST ENDPOINTS (Collection-Level) ===
|
|
254
264
|
|
|
255
|
-
|
|
265
|
+
|
|
266
|
+
@api_view(["GET"])
|
|
256
267
|
@permission_classes([EnvironmentAwarePermission])
|
|
257
268
|
def sensitive_metadata_list(request):
|
|
258
269
|
"""
|
|
259
270
|
GET /api/media/sensitive-metadata/
|
|
260
|
-
|
|
271
|
+
|
|
261
272
|
List all sensitive metadata (combined PDFs and Videos).
|
|
262
273
|
Supports filtering by content_type, status, etc.
|
|
263
|
-
|
|
274
|
+
|
|
264
275
|
Query parameters:
|
|
265
276
|
- content_type: 'pdf' | 'video' (optional)
|
|
266
277
|
- verified: Filter by verification status
|
|
@@ -268,87 +279,91 @@ def sensitive_metadata_list(request):
|
|
|
268
279
|
- search: Search in patient names
|
|
269
280
|
"""
|
|
270
281
|
from endoreg_db.serializers.meta import SensitiveMetaDetailSerializer
|
|
271
|
-
|
|
282
|
+
|
|
272
283
|
# Get all sensitive metadata
|
|
273
|
-
queryset = SensitiveMeta.objects.select_related(
|
|
274
|
-
|
|
284
|
+
queryset = SensitiveMeta.objects.select_related("state").all()
|
|
285
|
+
|
|
275
286
|
# Filter by content type
|
|
276
|
-
content_type = request.query_params.get(
|
|
277
|
-
if content_type ==
|
|
287
|
+
content_type = request.query_params.get("content_type")
|
|
288
|
+
if content_type == "pdf":
|
|
278
289
|
# Only PDFs - filter by existence of related PDFs
|
|
279
290
|
queryset = queryset.filter(raw_pdf_files__isnull=False).distinct()
|
|
280
|
-
elif content_type ==
|
|
291
|
+
elif content_type == "video":
|
|
281
292
|
# Only Videos - filter by existence of related video
|
|
282
293
|
queryset = queryset.filter(video_file__isnull=False).distinct()
|
|
283
|
-
|
|
294
|
+
|
|
284
295
|
# Filter by verification status
|
|
285
|
-
verified = request.query_params.get(
|
|
296
|
+
verified = request.query_params.get("verified")
|
|
286
297
|
if verified is not None:
|
|
287
|
-
verified_bool = verified.lower() in (
|
|
298
|
+
verified_bool = verified.lower() in ("true", "1", "yes")
|
|
288
299
|
queryset = queryset.filter(state__is_verified=verified_bool)
|
|
289
|
-
|
|
300
|
+
|
|
290
301
|
# Search in patient names
|
|
291
|
-
search = request.query_params.get(
|
|
302
|
+
search = request.query_params.get("search")
|
|
292
303
|
if search:
|
|
293
304
|
queryset = queryset.filter(
|
|
294
|
-
Q(patient_first_name__icontains=search)
|
|
295
|
-
Q(patient_last_name__icontains=search)
|
|
305
|
+
Q(patient_first_name__icontains=search)
|
|
306
|
+
| Q(patient_last_name__icontains=search)
|
|
296
307
|
)
|
|
297
|
-
|
|
308
|
+
|
|
298
309
|
# Ordering
|
|
299
|
-
ordering = request.query_params.get(
|
|
310
|
+
ordering = request.query_params.get("ordering", "-id")
|
|
300
311
|
queryset = queryset.order_by(ordering)
|
|
301
|
-
|
|
312
|
+
|
|
302
313
|
# Pagination
|
|
303
314
|
from rest_framework.pagination import PageNumberPagination
|
|
315
|
+
|
|
304
316
|
paginator = PageNumberPagination()
|
|
305
317
|
paginator.page_size = 20
|
|
306
318
|
page = paginator.paginate_queryset(queryset, request)
|
|
307
|
-
|
|
319
|
+
|
|
308
320
|
if page is not None:
|
|
309
321
|
serializer = SensitiveMetaDetailSerializer(page, many=True)
|
|
310
322
|
return paginator.get_paginated_response(serializer.data)
|
|
311
|
-
|
|
323
|
+
|
|
312
324
|
serializer = SensitiveMetaDetailSerializer(queryset, many=True)
|
|
313
325
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
314
326
|
|
|
315
327
|
|
|
316
|
-
@api_view([
|
|
328
|
+
@api_view(["GET"])
|
|
317
329
|
@permission_classes([EnvironmentAwarePermission])
|
|
318
330
|
def pdf_sensitive_metadata_list(request):
|
|
319
331
|
"""
|
|
320
332
|
GET /api/media/pdfs/sensitive-metadata/
|
|
321
|
-
|
|
333
|
+
|
|
322
334
|
List sensitive metadata for PDFs only.
|
|
323
335
|
Replaces legacy /api/pdf/sensitivemeta/list/
|
|
324
336
|
"""
|
|
325
337
|
from endoreg_db.serializers.meta import SensitiveMetaDetailSerializer
|
|
326
|
-
|
|
338
|
+
|
|
327
339
|
# Get all PDFs with sensitive metadata
|
|
328
|
-
queryset =
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
340
|
+
queryset = (
|
|
341
|
+
SensitiveMeta.objects.select_related("state")
|
|
342
|
+
.filter(raw_pdf_files__isnull=False)
|
|
343
|
+
.distinct()
|
|
344
|
+
)
|
|
345
|
+
|
|
332
346
|
# Apply filters
|
|
333
|
-
search = request.query_params.get(
|
|
347
|
+
search = request.query_params.get("search")
|
|
334
348
|
if search:
|
|
335
349
|
queryset = queryset.filter(
|
|
336
|
-
Q(patient_first_name__icontains=search)
|
|
337
|
-
Q(patient_last_name__icontains=search)
|
|
350
|
+
Q(patient_first_name__icontains=search)
|
|
351
|
+
| Q(patient_last_name__icontains=search)
|
|
338
352
|
)
|
|
339
|
-
|
|
340
|
-
ordering = request.query_params.get(
|
|
353
|
+
|
|
354
|
+
ordering = request.query_params.get("ordering", "-id")
|
|
341
355
|
queryset = queryset.order_by(ordering)
|
|
342
|
-
|
|
356
|
+
|
|
343
357
|
# Pagination
|
|
344
358
|
from rest_framework.pagination import PageNumberPagination
|
|
359
|
+
|
|
345
360
|
paginator = PageNumberPagination()
|
|
346
361
|
paginator.page_size = 20
|
|
347
362
|
page = paginator.paginate_queryset(queryset, request)
|
|
348
|
-
|
|
363
|
+
|
|
349
364
|
if page is not None:
|
|
350
365
|
serializer = SensitiveMetaDetailSerializer(page, many=True)
|
|
351
366
|
return paginator.get_paginated_response(serializer.data)
|
|
352
|
-
|
|
367
|
+
|
|
353
368
|
serializer = SensitiveMetaDetailSerializer(queryset, many=True)
|
|
354
369
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
from .available_files_list import AvailableFilesListView
|
|
2
|
-
from .sensitive_meta_detail import SensitiveMetaDetailView
|
|
3
1
|
from .sensitive_meta_list import SensitiveMetaListView
|
|
4
2
|
from .sensitive_meta_verification import SensitiveMetaVerificationView
|
|
5
|
-
from .report_meta import (
|
|
6
|
-
ReportFileMetadataView,
|
|
7
|
-
)
|
|
8
3
|
|
|
9
4
|
__all__ = [
|
|
10
|
-
"AvailableFilesListView",
|
|
11
|
-
"SensitiveMetaDetailView",
|
|
12
5
|
"SensitiveMetaListView",
|
|
13
6
|
"SensitiveMetaVerificationView",
|
|
14
|
-
"ReportFileMetadataView",
|
|
15
7
|
]
|
|
@@ -7,9 +7,7 @@ from .stats import (
|
|
|
7
7
|
SensitiveMetaStatsView,
|
|
8
8
|
GeneralStatsView,
|
|
9
9
|
)
|
|
10
|
-
|
|
11
|
-
from .secure_file_serving_view import SecureFileServingView
|
|
12
|
-
from .secure_url_validate import validate_secure_url
|
|
10
|
+
|
|
13
11
|
|
|
14
12
|
from .translation import (
|
|
15
13
|
ExaminationTranslationOptions,
|
|
@@ -40,10 +38,6 @@ __all__ = [
|
|
|
40
38
|
'SensitiveMetaStatsView',
|
|
41
39
|
"GeneralStatsView",
|
|
42
40
|
|
|
43
|
-
# Secure File / URL views
|
|
44
|
-
"SecureFileUrlView",
|
|
45
|
-
"SecureFileServingView",
|
|
46
|
-
"validate_secure_url",
|
|
47
41
|
|
|
48
42
|
# Translation options
|
|
49
43
|
'ExaminationTranslationOptions',
|