endoreg-db 0.5.2__py3-none-any.whl → 0.6.0__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 +90 -1
- endoreg_db/urls.py +173 -0
- endoreg_db/views.py +0 -3
- endoreg_db-0.6.0.dist-info/METADATA +151 -0
- endoreg_db-0.6.0.dist-info/RECORD +11 -0
- {endoreg_db-0.5.2.dist-info → endoreg_db-0.6.0.dist-info}/WHEEL +2 -1
- endoreg_db-0.6.0.dist-info/top_level.txt +1 -0
- endoreg_db/data/__init__.py +0 -72
- endoreg_db/data/active_model/data.yaml +0 -3
- endoreg_db/data/agl_service/data.yaml +0 -19
- endoreg_db/data/case_template/rule/00_patient_lab_sample_add_default_value.yaml +0 -167
- endoreg_db/data/case_template/rule/01_patient-set-age.yaml +0 -8
- endoreg_db/data/case_template/rule/01_patient-set-gender.yaml +0 -9
- endoreg_db/data/case_template/rule/11_create_patient_lab_sample.yaml +0 -23
- endoreg_db/data/case_template/rule/12_create-patient_medication-anticoagulation.yaml +0 -19
- endoreg_db/data/case_template/rule/13_create-patient_medication_schedule-anticoagulation.yaml +0 -19
- endoreg_db/data/case_template/rule/19_create_patient.yaml +0 -17
- endoreg_db/data/case_template/rule_type/base_types.yaml +0 -35
- endoreg_db/data/case_template/rule_value/.init +0 -0
- endoreg_db/data/case_template/rule_value_type/base_types.yaml +0 -59
- endoreg_db/data/case_template/template/base.yaml +0 -8
- endoreg_db/data/case_template/template_type/pre_endoscopy.yaml +0 -3
- endoreg_db/data/case_template/tmp/_rule_value +0 -13
- endoreg_db/data/case_template/tmp/rule/01_atrial_fibrillation.yaml +0 -21
- endoreg_db/data/case_template/tmp/rule/02_create_object.yaml +0 -10
- endoreg_db/data/case_template/tmp/template/atrial_fibrillation_low_risk.yaml +0 -7
- endoreg_db/data/center/data.yaml +0 -60
- endoreg_db/data/center_resource/green_endoscopy_dashboard_CenterResource.yaml +0 -144
- endoreg_db/data/center_waste/green_endoscopy_dashboard_CenterWaste.yaml +0 -48
- endoreg_db/data/disease/cardiovascular.yaml +0 -37
- endoreg_db/data/disease/hepatology.yaml +0 -5
- endoreg_db/data/disease/misc.yaml +0 -6
- endoreg_db/data/disease/renal.yaml +0 -5
- endoreg_db/data/disease_classification/chronic_kidney_disease.yaml +0 -6
- endoreg_db/data/disease_classification/coronary_vessel_disease.yaml +0 -6
- endoreg_db/data/disease_classification_choice/chronic_kidney_disease.yaml +0 -41
- endoreg_db/data/disease_classification_choice/coronary_vessel_disease.yaml +0 -20
- endoreg_db/data/distribution/date/patient.yaml +0 -7
- endoreg_db/data/distribution/multiple_categorical/.init +0 -0
- endoreg_db/data/distribution/numeric/.init +0 -0
- endoreg_db/data/distribution/single_categorical/patient.yaml +0 -7
- endoreg_db/data/emission_factor/green_endoscopy_dashboard_EmissionFactor.yaml +0 -132
- endoreg_db/data/endoscope_type/data.yaml +0 -11
- endoreg_db/data/endoscopy_processor/data.yaml +0 -47
- endoreg_db/data/event/cardiology.yaml +0 -28
- endoreg_db/data/event/neurology.yaml +0 -14
- endoreg_db/data/event/surgery.yaml +0 -13
- endoreg_db/data/event/thrombembolism.yaml +0 -20
- endoreg_db/data/examination/examinations/data.yaml +0 -66
- endoreg_db/data/examination/time/data.yaml +0 -48
- endoreg_db/data/examination/time-type/data.yaml +0 -8
- endoreg_db/data/examination/type/data.yaml +0 -5
- endoreg_db/data/gender/data.yaml +0 -18
- endoreg_db/data/information_source/data.yaml +0 -30
- endoreg_db/data/information_source/medication.yaml +0 -6
- endoreg_db/data/lab_value/cardiac_enzymes.yaml +0 -31
- endoreg_db/data/lab_value/coagulation.yaml +0 -49
- endoreg_db/data/lab_value/electrolytes.yaml +0 -190
- endoreg_db/data/lab_value/gastrointestinal_function.yaml +0 -121
- endoreg_db/data/lab_value/hematology.yaml +0 -169
- endoreg_db/data/lab_value/hormones.yaml +0 -53
- endoreg_db/data/lab_value/lipids.yaml +0 -44
- endoreg_db/data/lab_value/misc.yaml +0 -30
- endoreg_db/data/lab_value/renal_function.yaml +0 -11
- endoreg_db/data/label/label/data.yaml +0 -62
- endoreg_db/data/label/label-set/data.yaml +0 -18
- endoreg_db/data/label/label-type/data.yaml +0 -7
- endoreg_db/data/log_type/data.yaml +0 -57
- endoreg_db/data/material/material.yaml +0 -91
- endoreg_db/data/medication/anticoagulation.yaml +0 -65
- endoreg_db/data/medication/tah.yaml +0 -70
- endoreg_db/data/medication_indication/anticoagulation.yaml +0 -120
- endoreg_db/data/medication_indication_type/data.yaml +0 -11
- endoreg_db/data/medication_indication_type/thrombembolism.yaml +0 -41
- endoreg_db/data/medication_intake_time/base.yaml +0 -31
- endoreg_db/data/medication_schedule/apixaban.yaml +0 -95
- endoreg_db/data/medication_schedule/ass.yaml +0 -12
- endoreg_db/data/medication_schedule/enoxaparin.yaml +0 -26
- endoreg_db/data/model_type/data.yaml +0 -7
- endoreg_db/data/network_device/data.yaml +0 -29
- endoreg_db/data/network_device_type/data.yaml +0 -12
- endoreg_db/data/patient_lab_sample_type/generic.yaml +0 -6
- endoreg_db/data/pdf_type/data.yaml +0 -28
- endoreg_db/data/product/green_endoscopy_dashboard_Product.yaml +0 -66
- endoreg_db/data/product_group/green_endoscopy_dashboard_ProductGroup.yaml +0 -33
- endoreg_db/data/product_material/green_endoscopy_dashboard_ProductMaterial.yaml +0 -308
- endoreg_db/data/product_weight/green_endoscopy_dashboard_ProductWeight.yaml +0 -88
- endoreg_db/data/profession/data.yaml +0 -70
- endoreg_db/data/reference_product/green_endoscopy_dashboard_ReferenceProduct.yaml +0 -55
- endoreg_db/data/report_reader_flag/ukw-examination-generic.yaml +0 -26
- endoreg_db/data/report_reader_flag/ukw-histology-generic.yaml +0 -19
- endoreg_db/data/resource/green_endoscopy_dashboard_Resource.yaml +0 -15
- endoreg_db/data/tmp/chronic_kidney_disease.yaml +0 -0
- endoreg_db/data/tmp/congestive_heart_failure.yaml +0 -0
- endoreg_db/data/transport_route/green_endoscopy_dashboard_TransportRoute.yaml +0 -12
- endoreg_db/data/unit/concentration.yaml +0 -92
- endoreg_db/data/unit/data.yaml +0 -17
- endoreg_db/data/unit/length.yaml +0 -31
- endoreg_db/data/unit/misc.yaml +0 -20
- endoreg_db/data/unit/rate.yaml +0 -6
- endoreg_db/data/unit/time.yaml +0 -13
- endoreg_db/data/unit/volume.yaml +0 -35
- endoreg_db/data/unit/weight.yaml +0 -38
- endoreg_db/data/waste/data.yaml +0 -12
- endoreg_db/forms/__init__.py +0 -3
- endoreg_db/forms/questionnaires/__init__.py +0 -1
- endoreg_db/forms/questionnaires/tto_questionnaire.py +0 -23
- endoreg_db/forms/settings/__init__.py +0 -8
- endoreg_db/forms/unit.py +0 -6
- endoreg_db/management/commands/_load_model_template.py +0 -41
- endoreg_db/management/commands/delete_all.py +0 -18
- endoreg_db/management/commands/delete_legacy_images.py +0 -19
- endoreg_db/management/commands/delete_legacy_videos.py +0 -17
- endoreg_db/management/commands/extract_legacy_video_frames.py +0 -18
- endoreg_db/management/commands/fetch_legacy_image_dataset.py +0 -32
- endoreg_db/management/commands/fix_auth_permission.py +0 -20
- endoreg_db/management/commands/import_legacy_images.py +0 -94
- endoreg_db/management/commands/import_legacy_videos.py +0 -76
- endoreg_db/management/commands/load_active_model_data.py +0 -45
- endoreg_db/management/commands/load_ai_model_data.py +0 -45
- endoreg_db/management/commands/load_base_db_data.py +0 -136
- endoreg_db/management/commands/load_center_data.py +0 -43
- endoreg_db/management/commands/load_disease_classification_choices_data.py +0 -41
- endoreg_db/management/commands/load_disease_classification_data.py +0 -41
- endoreg_db/management/commands/load_disease_data.py +0 -40
- endoreg_db/management/commands/load_distribution_data.py +0 -66
- endoreg_db/management/commands/load_endoscope_type_data.py +0 -45
- endoreg_db/management/commands/load_endoscopy_processor_data.py +0 -45
- endoreg_db/management/commands/load_event_data.py +0 -41
- endoreg_db/management/commands/load_examination_data.py +0 -75
- endoreg_db/management/commands/load_g_play_data.py +0 -113
- endoreg_db/management/commands/load_gender_data.py +0 -44
- endoreg_db/management/commands/load_green_endoscopy_wuerzburg_data.py +0 -133
- endoreg_db/management/commands/load_information_source.py +0 -45
- endoreg_db/management/commands/load_lab_value_data.py +0 -50
- endoreg_db/management/commands/load_label_data.py +0 -67
- endoreg_db/management/commands/load_logging_data.py +0 -39
- endoreg_db/management/commands/load_medication_data.py +0 -41
- endoreg_db/management/commands/load_medication_indication_data.py +0 -63
- endoreg_db/management/commands/load_medication_indication_type_data.py +0 -41
- endoreg_db/management/commands/load_medication_intake_time_data.py +0 -41
- endoreg_db/management/commands/load_medication_schedule_data.py +0 -55
- endoreg_db/management/commands/load_network_data.py +0 -57
- endoreg_db/management/commands/load_pdf_type_data.py +0 -61
- endoreg_db/management/commands/load_profession_data.py +0 -44
- endoreg_db/management/commands/load_report_reader_flag.py +0 -46
- endoreg_db/management/commands/load_unit_data.py +0 -46
- endoreg_db/management/commands/load_user_groups.py +0 -28
- endoreg_db/management/commands/register_ai_model.py +0 -64
- endoreg_db/management/commands/reset_celery_schedule.py +0 -9
- endoreg_db/migrations/0001_initial.py +0 -1567
- endoreg_db/migrations/0002_anonymizedimagelabel_anonymousimageannotation_and_more.py +0 -55
- endoreg_db/migrations/0003_anonymousimageannotation_original_image_url_and_more.py +0 -39
- endoreg_db/migrations/0004_alter_rawpdffile_file.py +0 -20
- endoreg_db/migrations/0005_uploadedfile_alter_rawpdffile_file_anonymizedfile.py +0 -40
- endoreg_db/migrations/0006_alter_rawpdffile_file.py +0 -20
- endoreg_db/migrations/0007_networkdevicelogentry_datetime_and_more.py +0 -43
- endoreg_db/migrations/0008_networkdevicelogentry_aglnet_ip_and_more.py +0 -28
- endoreg_db/migrations/0009_alter_networkdevicelogentry_vpn_service_status.py +0 -18
- endoreg_db/migrations/0010_remove_networkdevicelogentry_hostname.py +0 -17
- endoreg_db/migrations/__init__.py +0 -0
- endoreg_db/models/__init__.py +0 -73
- endoreg_db/models/ai_model/__init__.py +0 -3
- endoreg_db/models/ai_model/active_model.py +0 -9
- endoreg_db/models/ai_model/model_meta.py +0 -24
- endoreg_db/models/ai_model/model_type.py +0 -26
- endoreg_db/models/ai_model/utils.py +0 -8
- endoreg_db/models/annotation/__init__.py +0 -3
- endoreg_db/models/annotation/anonymized_image_annotation.py +0 -60
- endoreg_db/models/annotation/binary_classification_annotation_task.py +0 -80
- endoreg_db/models/annotation/image_classification.py +0 -27
- endoreg_db/models/case_template/__init__.py +0 -6
- endoreg_db/models/case_template/case_template.py +0 -81
- endoreg_db/models/case_template/case_template_rule.py +0 -276
- endoreg_db/models/case_template/case_template_rule_value.py +0 -73
- endoreg_db/models/case_template/case_template_type.py +0 -28
- endoreg_db/models/center/__init__.py +0 -4
- endoreg_db/models/center/center.py +0 -25
- endoreg_db/models/center/center_product.py +0 -34
- endoreg_db/models/center/center_resource.py +0 -19
- endoreg_db/models/center/center_waste.py +0 -11
- endoreg_db/models/data_file/__init__.py +0 -6
- endoreg_db/models/data_file/base_classes/__init__.py +0 -2
- endoreg_db/models/data_file/base_classes/abstract_frame.py +0 -51
- endoreg_db/models/data_file/base_classes/abstract_video.py +0 -201
- endoreg_db/models/data_file/frame.py +0 -45
- endoreg_db/models/data_file/import_classes/__init__.py +0 -32
- endoreg_db/models/data_file/import_classes/processing_functions/__init__.py +0 -35
- endoreg_db/models/data_file/import_classes/processing_functions/pdf.py +0 -28
- endoreg_db/models/data_file/import_classes/processing_functions/video.py +0 -260
- endoreg_db/models/data_file/import_classes/raw_pdf.py +0 -188
- endoreg_db/models/data_file/import_classes/raw_video.py +0 -343
- endoreg_db/models/data_file/metadata/__init__.py +0 -3
- endoreg_db/models/data_file/metadata/pdf_meta.py +0 -70
- endoreg_db/models/data_file/metadata/sensitive_meta.py +0 -31
- endoreg_db/models/data_file/metadata/video_meta.py +0 -133
- endoreg_db/models/data_file/report_file.py +0 -89
- endoreg_db/models/data_file/video/__init__.py +0 -7
- endoreg_db/models/data_file/video/import_meta.py +0 -25
- endoreg_db/models/data_file/video/video.py +0 -25
- endoreg_db/models/data_file/video_segment.py +0 -107
- endoreg_db/models/disease.py +0 -56
- endoreg_db/models/emission/__init__.py +0 -1
- endoreg_db/models/emission/emission_factor.py +0 -20
- endoreg_db/models/event.py +0 -22
- endoreg_db/models/examination/__init__.py +0 -4
- endoreg_db/models/examination/examination.py +0 -26
- endoreg_db/models/examination/examination_time.py +0 -27
- endoreg_db/models/examination/examination_time_type.py +0 -24
- endoreg_db/models/examination/examination_type.py +0 -18
- endoreg_db/models/hardware/__init__.py +0 -2
- endoreg_db/models/hardware/endoscope.py +0 -44
- endoreg_db/models/hardware/endoscopy_processor.py +0 -143
- endoreg_db/models/information_source.py +0 -29
- endoreg_db/models/label/__init__.py +0 -1
- endoreg_db/models/label/label.py +0 -84
- endoreg_db/models/laboratory/__init__.py +0 -1
- endoreg_db/models/laboratory/lab_value.py +0 -102
- endoreg_db/models/legacy_data/__init__.py +0 -3
- endoreg_db/models/legacy_data/image.py +0 -34
- endoreg_db/models/logging/__init__.py +0 -4
- endoreg_db/models/logging/agl_service.py +0 -19
- endoreg_db/models/logging/base.py +0 -22
- endoreg_db/models/logging/log_type.py +0 -23
- endoreg_db/models/logging/network_device.py +0 -27
- endoreg_db/models/medication/__init__.py +0 -1
- endoreg_db/models/medication/medication.py +0 -148
- endoreg_db/models/network/__init__.py +0 -3
- endoreg_db/models/network/agl_service.py +0 -38
- endoreg_db/models/network/network_device.py +0 -53
- endoreg_db/models/network/network_device_type.py +0 -23
- endoreg_db/models/other/__init__.py +0 -5
- endoreg_db/models/other/distribution.py +0 -215
- endoreg_db/models/other/material.py +0 -16
- endoreg_db/models/other/resource.py +0 -18
- endoreg_db/models/other/transport_route.py +0 -21
- endoreg_db/models/other/waste.py +0 -20
- endoreg_db/models/patient_examination/__init__.py +0 -35
- endoreg_db/models/permissions/__init__.py +0 -44
- endoreg_db/models/persons/__init__.py +0 -7
- endoreg_db/models/persons/examiner/__init__.py +0 -2
- endoreg_db/models/persons/examiner/examiner.py +0 -16
- endoreg_db/models/persons/examiner/examiner_type.py +0 -2
- endoreg_db/models/persons/first_name.py +0 -18
- endoreg_db/models/persons/gender.py +0 -22
- endoreg_db/models/persons/last_name.py +0 -20
- endoreg_db/models/persons/patient/__init__.py +0 -8
- endoreg_db/models/persons/patient/case/__init__.py +0 -0
- endoreg_db/models/persons/patient/case/case.py +0 -30
- endoreg_db/models/persons/patient/patient.py +0 -216
- endoreg_db/models/persons/patient/patient_disease.py +0 -16
- endoreg_db/models/persons/patient/patient_event.py +0 -22
- endoreg_db/models/persons/patient/patient_lab_sample.py +0 -106
- endoreg_db/models/persons/patient/patient_lab_value.py +0 -176
- endoreg_db/models/persons/patient/patient_medication.py +0 -44
- endoreg_db/models/persons/patient/patient_medication_schedule.py +0 -28
- endoreg_db/models/persons/person.py +0 -31
- endoreg_db/models/persons/portal_user_information.py +0 -27
- endoreg_db/models/prediction/__init__.py +0 -2
- endoreg_db/models/prediction/image_classification.py +0 -37
- endoreg_db/models/prediction/video_prediction_meta.py +0 -244
- endoreg_db/models/product/__init__.py +0 -5
- endoreg_db/models/product/product.py +0 -97
- endoreg_db/models/product/product_group.py +0 -19
- endoreg_db/models/product/product_material.py +0 -24
- endoreg_db/models/product/product_weight.py +0 -26
- endoreg_db/models/product/reference_product.py +0 -99
- endoreg_db/models/questionnaires/__init__.py +0 -114
- endoreg_db/models/quiz/__init__.py +0 -2
- endoreg_db/models/quiz/quiz_answer.py +0 -41
- endoreg_db/models/quiz/quiz_question.py +0 -54
- endoreg_db/models/report_reader/__init__.py +0 -2
- endoreg_db/models/report_reader/report_reader_config.py +0 -53
- endoreg_db/models/report_reader/report_reader_flag.py +0 -20
- endoreg_db/models/rules/__init__.py +0 -5
- endoreg_db/models/rules/rule.py +0 -24
- endoreg_db/models/rules/rule_applicator.py +0 -224
- endoreg_db/models/rules/rule_attribute_dtype.py +0 -19
- endoreg_db/models/rules/rule_type.py +0 -22
- endoreg_db/models/rules/ruleset.py +0 -19
- endoreg_db/models/unit.py +0 -22
- endoreg_db/queries/__init__.py +0 -5
- endoreg_db/queries/annotations/__init__.py +0 -3
- endoreg_db/queries/annotations/legacy.py +0 -158
- endoreg_db/queries/get/__init__.py +0 -6
- endoreg_db/queries/get/annotation.py +0 -0
- endoreg_db/queries/get/center.py +0 -42
- endoreg_db/queries/get/model.py +0 -13
- endoreg_db/queries/get/patient.py +0 -14
- endoreg_db/queries/get/patient_examination.py +0 -20
- endoreg_db/queries/get/prediction.py +0 -0
- endoreg_db/queries/get/report_file.py +0 -33
- endoreg_db/queries/get/video.py +0 -31
- endoreg_db/queries/get/video_import_meta.py +0 -0
- endoreg_db/queries/get/video_prediction_meta.py +0 -0
- endoreg_db/queries/sanity/__init_.py +0 -0
- endoreg_db/serializers/__init__.py +0 -10
- endoreg_db/serializers/ai_model.py +0 -19
- endoreg_db/serializers/annotation.py +0 -17
- endoreg_db/serializers/center.py +0 -11
- endoreg_db/serializers/examination.py +0 -33
- endoreg_db/serializers/frame.py +0 -13
- endoreg_db/serializers/hardware.py +0 -21
- endoreg_db/serializers/label.py +0 -22
- endoreg_db/serializers/patient.py +0 -10
- endoreg_db/serializers/prediction.py +0 -15
- endoreg_db/serializers/report_file.py +0 -7
- endoreg_db/serializers/video.py +0 -27
- endoreg_db/utils/__init__.py +0 -1
- endoreg_db/utils/cropping.py +0 -29
- endoreg_db/utils/dataloader.py +0 -92
- endoreg_db/utils/file_operations.py +0 -30
- endoreg_db/utils/hashs.py +0 -34
- endoreg_db/utils/legacy_ocr.py +0 -201
- endoreg_db/utils/ocr.py +0 -190
- endoreg_db/utils/uuid.py +0 -4
- endoreg_db/utils/video_metadata.py +0 -87
- endoreg_db-0.5.2.dist-info/METADATA +0 -27
- endoreg_db-0.5.2.dist-info/RECORD +0 -319
- {endoreg_db-0.5.2.dist-info/licenses → endoreg_db-0.6.0.dist-info}/LICENSE +0 -0
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
import ffmpeg
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
# import endoreg_center_id from django settings
|
|
6
|
-
from django.conf import settings
|
|
7
|
-
|
|
8
|
-
# check if endoreg_center_id is set
|
|
9
|
-
if not hasattr(settings, 'ENDOREG_CENTER_ID'):
|
|
10
|
-
ENDOREG_CENTER_ID = 9999
|
|
11
|
-
else:
|
|
12
|
-
ENDOREG_CENTER_ID = settings.ENDOREG_CENTER_ID
|
|
13
|
-
|
|
14
|
-
# VideoMeta
|
|
15
|
-
class VideoMeta(models.Model):
|
|
16
|
-
processor = models.ForeignKey('EndoscopyProcessor', on_delete=models.CASCADE, blank=True, null=True)
|
|
17
|
-
endoscope = models.ForeignKey('Endoscope', on_delete=models.CASCADE, blank=True, null=True)
|
|
18
|
-
center = models.ForeignKey('Center', on_delete=models.CASCADE)
|
|
19
|
-
import_meta = models.OneToOneField('VideoImportMeta', on_delete=models.CASCADE, blank=True, null=True)
|
|
20
|
-
ffmpeg_meta = models.OneToOneField('FFMpegMeta', on_delete=models.CASCADE, blank=True, null=True)
|
|
21
|
-
|
|
22
|
-
def __str__(self):
|
|
23
|
-
|
|
24
|
-
processor_name = self.processor.name if self.processor is not None else "None"
|
|
25
|
-
endoscope_name = self.endoscope.name if self.endoscope is not None else "None"
|
|
26
|
-
center_name = self.center.name if self.center is not None else "None"
|
|
27
|
-
|
|
28
|
-
result_html = ""
|
|
29
|
-
|
|
30
|
-
result_html += f"Processor: {processor_name}<br>"
|
|
31
|
-
result_html += f"Endoscope: {endoscope_name}<br>"
|
|
32
|
-
result_html += f"Center: {center_name}<br>"
|
|
33
|
-
|
|
34
|
-
return result_html
|
|
35
|
-
|
|
36
|
-
# import meta should be created when video meta is created
|
|
37
|
-
def save(self, *args, **kwargs):
|
|
38
|
-
if self.import_meta is None:
|
|
39
|
-
self.import_meta = VideoImportMeta.objects.create()
|
|
40
|
-
super(VideoMeta, self).save(*args, **kwargs)
|
|
41
|
-
|
|
42
|
-
def initialize_ffmpeg_meta(self, file_path):
|
|
43
|
-
"""Initializes FFMpeg metadata for the video file if not already done."""
|
|
44
|
-
self.ffmpeg_meta = FFMpegMeta.create_from_file(Path(file_path))
|
|
45
|
-
self.save()
|
|
46
|
-
|
|
47
|
-
def update_meta(self, file_path):
|
|
48
|
-
"""Updates the video metadata from the file."""
|
|
49
|
-
self.initialize_ffmpeg_meta(file_path)
|
|
50
|
-
self.save()
|
|
51
|
-
|
|
52
|
-
def get_endo_roi(self):
|
|
53
|
-
endo_roi = self.processor.get_roi_endoscope_image()
|
|
54
|
-
return endo_roi
|
|
55
|
-
|
|
56
|
-
def get_fps(self):
|
|
57
|
-
if not self.ffmpeg_meta:
|
|
58
|
-
return None
|
|
59
|
-
|
|
60
|
-
return self.ffmpeg_meta.frame_rate
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class FFMpegMeta(models.Model):
|
|
64
|
-
# Existing fields
|
|
65
|
-
duration = models.FloatField(blank=True, null=True)
|
|
66
|
-
width = models.IntegerField(blank=True, null=True)
|
|
67
|
-
height = models.IntegerField(blank=True, null=True)
|
|
68
|
-
frame_rate = models.FloatField(blank=True, null=True)
|
|
69
|
-
|
|
70
|
-
# New fields for comprehensive information
|
|
71
|
-
video_codec = models.CharField(max_length=50, blank=True, null=True)
|
|
72
|
-
audio_codec = models.CharField(max_length=50, blank=True, null=True)
|
|
73
|
-
audio_channels = models.IntegerField(blank=True, null=True)
|
|
74
|
-
audio_sample_rate = models.IntegerField(blank=True, null=True)
|
|
75
|
-
|
|
76
|
-
# Existing __str__ method can be updated to include new fields
|
|
77
|
-
|
|
78
|
-
@classmethod
|
|
79
|
-
def create_from_file(cls, file_path: Path):
|
|
80
|
-
"""Creates an FFMpegMeta instance from a video file using ffmpeg probe."""
|
|
81
|
-
try:
|
|
82
|
-
probe = ffmpeg.probe(file_path.resolve().as_posix())
|
|
83
|
-
except: # ffmpeg.Error as e:
|
|
84
|
-
# print(e.stderr)
|
|
85
|
-
print(f"Error while probing {file_path}")
|
|
86
|
-
return None
|
|
87
|
-
|
|
88
|
-
video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
|
|
89
|
-
audio_streams = [stream for stream in probe['streams'] if stream['codec_type'] == 'audio']
|
|
90
|
-
|
|
91
|
-
# Check for the existence of a video stream
|
|
92
|
-
if video_stream is None:
|
|
93
|
-
print(f"No video stream found in {file_path}")
|
|
94
|
-
return None
|
|
95
|
-
|
|
96
|
-
# Extract and store video metadata
|
|
97
|
-
metadata = {
|
|
98
|
-
'duration': float(video_stream.get('duration', 0)),
|
|
99
|
-
'width': int(video_stream.get('width', 0)),
|
|
100
|
-
'height': int(video_stream.get('height', 0)),
|
|
101
|
-
'frame_rate': float(next(iter(video_stream.get('avg_frame_rate', '').split('/')), 0)),
|
|
102
|
-
'video_codec': video_stream.get('codec_name', ''),
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
# If there are audio streams, extract and store audio metadata from the first stream
|
|
106
|
-
if audio_streams:
|
|
107
|
-
first_audio_stream = audio_streams[0]
|
|
108
|
-
metadata.update({
|
|
109
|
-
'audio_codec': first_audio_stream.get('codec_name', ''),
|
|
110
|
-
'audio_channels': int(first_audio_stream.get('channels', 0)),
|
|
111
|
-
'audio_sample_rate': int(first_audio_stream.get('sample_rate', 0)),
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
# Create and return the FFMpegMeta instance
|
|
115
|
-
return cls.objects.create(**metadata)
|
|
116
|
-
|
|
117
|
-
class VideoImportMeta(models.Model):
|
|
118
|
-
|
|
119
|
-
video_anonymized = models.BooleanField(default=False)
|
|
120
|
-
video_patient_data_detected = models.BooleanField(default=False)
|
|
121
|
-
outside_detected = models.BooleanField(default=False)
|
|
122
|
-
patient_data_removed = models.BooleanField(default=False)
|
|
123
|
-
outside_removed = models.BooleanField(default=False)
|
|
124
|
-
|
|
125
|
-
def __str__(self):
|
|
126
|
-
result_html = ""
|
|
127
|
-
|
|
128
|
-
result_html += f"Video anonymized: {self.video_anonymized}<br>"
|
|
129
|
-
result_html += f"Video patient data detected: {self.video_patient_data_detected}<br>"
|
|
130
|
-
result_html += f"Outside detected: {self.outside_detected}<br>"
|
|
131
|
-
result_html += f"Patient data removed: {self.patient_data_removed}<br>"
|
|
132
|
-
result_html += f"Outside removed: {self.outside_removed}<br>"
|
|
133
|
-
return result_html
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
from ..center import Center
|
|
3
|
-
import hashlib
|
|
4
|
-
from datetime import date, time
|
|
5
|
-
|
|
6
|
-
class ReportFile(models.Model):
|
|
7
|
-
pdf = models.FileField(upload_to="raw_report_pdfs", blank=True, null=True)
|
|
8
|
-
pdf_hash = models.CharField(max_length=255, unique=True)
|
|
9
|
-
center = models.ForeignKey(Center, on_delete=models.CASCADE)
|
|
10
|
-
meta = models.JSONField(blank=True, null=True)
|
|
11
|
-
text = models.TextField(blank=True, null=True)
|
|
12
|
-
text_anonymized = models.TextField(blank=True, null=True)
|
|
13
|
-
patient = models.ForeignKey("Patient", on_delete=models.CASCADE, blank=True, null=True)
|
|
14
|
-
examiner = models.ForeignKey("Examiner", on_delete=models.CASCADE, blank=True, null=True)
|
|
15
|
-
date = models.DateField(blank=True, null=True)
|
|
16
|
-
time = models.TimeField(blank=True, null=True)
|
|
17
|
-
|
|
18
|
-
def get_pdf_hash(self):
|
|
19
|
-
#FIXME should use endoreg_db.utils.get_pdf_hash in future
|
|
20
|
-
pdf = self.pdf
|
|
21
|
-
pdf_hash = None
|
|
22
|
-
|
|
23
|
-
if pdf:
|
|
24
|
-
# Open the file in binary mode and read its contents
|
|
25
|
-
with pdf.open(mode='rb') as f:
|
|
26
|
-
pdf_contents = f.read()
|
|
27
|
-
# Create a hash object using SHA-256 algorithm
|
|
28
|
-
hash_object = hashlib.sha256(pdf_contents, usedforsecurity=False)
|
|
29
|
-
# Get the hexadecimal representation of the hash
|
|
30
|
-
pdf_hash = hash_object.hexdigest()
|
|
31
|
-
assert len(pdf_hash) <= 255, "Hash length exceeds 255 characters"
|
|
32
|
-
|
|
33
|
-
return pdf_hash
|
|
34
|
-
|
|
35
|
-
def initialize_metadata_in_db(self, report_meta=None):
|
|
36
|
-
if not report_meta:
|
|
37
|
-
report_meta = self.meta
|
|
38
|
-
self.set_examination_date_and_time(report_meta)
|
|
39
|
-
self.patient, created = self.get_or_create_patient(report_meta)
|
|
40
|
-
self.examiner, created = self.get_or_create_examiner(report_meta)
|
|
41
|
-
self.save()
|
|
42
|
-
|
|
43
|
-
def get_or_create_patient(self, report_meta=None):
|
|
44
|
-
from ..persons import Patient
|
|
45
|
-
if not report_meta:
|
|
46
|
-
report_meta = self.meta
|
|
47
|
-
patient_first_name = report_meta['patient_first_name']
|
|
48
|
-
patient_last_name = report_meta['patient_last_name']
|
|
49
|
-
patient_dob = report_meta['patient_dob']
|
|
50
|
-
|
|
51
|
-
patient, created = Patient.objects.get_or_create(
|
|
52
|
-
first_name=patient_first_name,
|
|
53
|
-
last_name=patient_last_name,
|
|
54
|
-
dob=patient_dob
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
return patient, created
|
|
58
|
-
|
|
59
|
-
def get_or_create_examiner(self, report_meta= None):
|
|
60
|
-
from ..persons import Examiner
|
|
61
|
-
if not report_meta:
|
|
62
|
-
report_meta = self.meta
|
|
63
|
-
examiner_first_name = report_meta['examiner_first_name']
|
|
64
|
-
examiner_last_name = report_meta['examiner_last_name']
|
|
65
|
-
examiner_center = self.center
|
|
66
|
-
|
|
67
|
-
examiner, created = Examiner.objects.get_or_create(
|
|
68
|
-
first_name=examiner_first_name,
|
|
69
|
-
last_name=examiner_last_name,
|
|
70
|
-
center=examiner_center
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
return examiner, created
|
|
74
|
-
|
|
75
|
-
def set_examination_date_and_time(self, report_meta=None):
|
|
76
|
-
if not report_meta:
|
|
77
|
-
report_meta = self.meta
|
|
78
|
-
examination_date_str = report_meta['examination_date']
|
|
79
|
-
examination_time_str = report_meta['examination_time']
|
|
80
|
-
|
|
81
|
-
if examination_date_str:
|
|
82
|
-
# TODO: get django DateField compatible date from string (e.g. "2021-01-01")
|
|
83
|
-
self.date = date.fromisoformat(examination_date_str)
|
|
84
|
-
if examination_time_str:
|
|
85
|
-
# TODO: get django TimeField compatible time from string (e.g. "12:00")
|
|
86
|
-
self.time = time.fromisoformat(examination_time_str)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# from django.db import models
|
|
2
|
-
|
|
3
|
-
# class VideoImportMeta(models.Model):
|
|
4
|
-
# processor = models.ForeignKey('EndoscopyProcessor', on_delete=models.CASCADE)
|
|
5
|
-
# endoscope = models.ForeignKey('Endoscope', on_delete=models.CASCADE, blank=True, null=True)
|
|
6
|
-
# center = models.ForeignKey('Center', on_delete=models.CASCADE)
|
|
7
|
-
# video_anonymized = models.BooleanField(default=False)
|
|
8
|
-
# video_patient_data_detected = models.BooleanField(default=False)
|
|
9
|
-
# outside_detected = models.BooleanField(default=False)
|
|
10
|
-
# patient_data_removed = models.BooleanField(default=False)
|
|
11
|
-
# outside_removed = models.BooleanField(default=False)
|
|
12
|
-
|
|
13
|
-
# def __str__(self):
|
|
14
|
-
# result_html = ""
|
|
15
|
-
|
|
16
|
-
# result_html += f"Processor: {self.processor.name}<br>"
|
|
17
|
-
# result_html += f"Endoscope: {self.endoscope.name}<br>"
|
|
18
|
-
# result_html += f"Center: {self.center.name}<br>"
|
|
19
|
-
# result_html += f"Video anonymized: {self.video_anonymized}<br>"
|
|
20
|
-
# result_html += f"Video patient data detected: {self.video_patient_data_detected}<br>"
|
|
21
|
-
# result_html += f"Outside detected: {self.outside_detected}<br>"
|
|
22
|
-
# result_html += f"Patient data removed: {self.patient_data_removed}<br>"
|
|
23
|
-
# result_html += f"Outside removed: {self.outside_removed}<br>"
|
|
24
|
-
# return result_html
|
|
25
|
-
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from ..base_classes import AbstractVideo
|
|
2
|
-
from django.db import models
|
|
3
|
-
|
|
4
|
-
from endoreg_db.models.data_file.frame import Frame
|
|
5
|
-
from endoreg_db.models.data_file.frame import LegacyFrame
|
|
6
|
-
|
|
7
|
-
BATCH_SIZE = 1000
|
|
8
|
-
|
|
9
|
-
class Video(AbstractVideo):
|
|
10
|
-
import_meta = models.OneToOneField('VideoImportMeta', on_delete=models.CASCADE, blank=True, null=True)
|
|
11
|
-
def get_video_model(self):
|
|
12
|
-
return Video
|
|
13
|
-
|
|
14
|
-
def get_frame_model(self):
|
|
15
|
-
return Frame
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class LegacyVideo(AbstractVideo):
|
|
19
|
-
file = models.FileField(upload_to="legacy_videos", blank=True, null=True)
|
|
20
|
-
|
|
21
|
-
def get_video_model(self):
|
|
22
|
-
return LegacyVideo
|
|
23
|
-
|
|
24
|
-
def get_frame_model(self):
|
|
25
|
-
return LegacyFrame
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
import numpy as np
|
|
3
|
-
from ..annotation import ImageClassificationAnnotation
|
|
4
|
-
|
|
5
|
-
def find_segments_in_prediction_array(prediction_array: np.array, min_frame_len: int):
|
|
6
|
-
"""
|
|
7
|
-
Expects a prediction array of shape (num_frames) and a minimum frame length.
|
|
8
|
-
Returns a list of tuples (start_frame_number, end_frame_number) that represent the segments.
|
|
9
|
-
"""
|
|
10
|
-
# Add False to the beginning and end to detect changes at the array boundaries
|
|
11
|
-
padded_prediction = np.pad(prediction_array, (1, 1), 'constant', constant_values=False)
|
|
12
|
-
|
|
13
|
-
# Find the start points and end points of the segments
|
|
14
|
-
diffs = np.diff(padded_prediction.astype(int))
|
|
15
|
-
segment_starts = np.where(diffs == 1)[0]
|
|
16
|
-
segment_ends = np.where(diffs == -1)[0]
|
|
17
|
-
|
|
18
|
-
# Filter segments based on min_frame_len
|
|
19
|
-
segments = [(start, end) for start, end in zip(segment_starts, segment_ends) if end - start >= min_frame_len]
|
|
20
|
-
|
|
21
|
-
return segments
|
|
22
|
-
|
|
23
|
-
class AbstractLabelVideoSegment(models.Model):
|
|
24
|
-
video = None # Placeholder for the video field, to be defined in derived classes
|
|
25
|
-
prediction_meta = None # Placeholder for the prediction_meta field, to be defined in derived classes
|
|
26
|
-
start_frame_number = models.IntegerField()
|
|
27
|
-
end_frame_number = models.IntegerField()
|
|
28
|
-
source = models.ForeignKey("InformationSource", on_delete=models.CASCADE)
|
|
29
|
-
label = models.ForeignKey("Label", on_delete=models.CASCADE)
|
|
30
|
-
|
|
31
|
-
class Meta:
|
|
32
|
-
abstract = True
|
|
33
|
-
|
|
34
|
-
def __str__(self):
|
|
35
|
-
return self.video.file.path + " Label - " + self.label.name + " - " + str(self.start_frame_number) + " - " + str(self.end_frame_number)
|
|
36
|
-
|
|
37
|
-
def get_frames(self):
|
|
38
|
-
return self.video.get_frame_range(self.start_frame_number, self.end_frame_number)
|
|
39
|
-
|
|
40
|
-
def get_annotations(self) -> ImageClassificationAnnotation.objects:
|
|
41
|
-
frames = self.get_frames()
|
|
42
|
-
annotations = ImageClassificationAnnotation.objects.filter(frame__in=frames, label=self.label)
|
|
43
|
-
|
|
44
|
-
return annotations
|
|
45
|
-
|
|
46
|
-
def get_frames_without_annotation(self):
|
|
47
|
-
"""
|
|
48
|
-
Get a frame without an annotation.
|
|
49
|
-
"""
|
|
50
|
-
assert 1 == 2, "This method should be overridden in derived classes"
|
|
51
|
-
|
|
52
|
-
def get_segment_len_in_s(self):
|
|
53
|
-
return (self.end_frame_number - self.start_frame_number) / self.video.fps
|
|
54
|
-
|
|
55
|
-
class LegacyLabelVideoSegment(AbstractLabelVideoSegment):
|
|
56
|
-
video = models.ForeignKey("LegacyVideo", on_delete=models.CASCADE)
|
|
57
|
-
prediction_meta = models.ForeignKey("LegacyVideoPredictionMeta", on_delete=models.CASCADE, related_name="video_segments")
|
|
58
|
-
|
|
59
|
-
def get_video_model(self):
|
|
60
|
-
from endoreg_db.models.data_file.video import LegacyVideo
|
|
61
|
-
return LegacyVideo
|
|
62
|
-
|
|
63
|
-
def get_annotations(self) -> ImageClassificationAnnotation.objects:
|
|
64
|
-
frames = self.get_frames()
|
|
65
|
-
annotations = ImageClassificationAnnotation.objects.filter(legacy_frame__in=frames, label=self.label)
|
|
66
|
-
|
|
67
|
-
return annotations
|
|
68
|
-
|
|
69
|
-
def get_frames_without_annotation(self, n_frames):
|
|
70
|
-
"""
|
|
71
|
-
Get a frame without an annotation.
|
|
72
|
-
"""
|
|
73
|
-
frames = self.get_frames()
|
|
74
|
-
annotations = ImageClassificationAnnotation.objects.filter(legacy_frame__in=frames, label=self.label)
|
|
75
|
-
|
|
76
|
-
annotated_frames = [annotation.legacy_frame for annotation in annotations]
|
|
77
|
-
frames_without_annotation = [frame for frame in frames if frame not in annotated_frames]
|
|
78
|
-
|
|
79
|
-
# draw n random frames
|
|
80
|
-
if len(frames_without_annotation) > n_frames:
|
|
81
|
-
frames_without_annotation = np.random.choice(frames_without_annotation, n_frames, replace=False)
|
|
82
|
-
|
|
83
|
-
return frames_without_annotation
|
|
84
|
-
|
|
85
|
-
class LabelVideoSegment(AbstractLabelVideoSegment):
|
|
86
|
-
video = models.ForeignKey("Video", on_delete=models.CASCADE)
|
|
87
|
-
prediction_meta = models.ForeignKey("VideoPredictionMeta", on_delete=models.CASCADE, related_name="video_segments")
|
|
88
|
-
|
|
89
|
-
def get_video_model(self):
|
|
90
|
-
from endoreg_db.models.data_file.video import Video
|
|
91
|
-
return Video
|
|
92
|
-
|
|
93
|
-
def get_frames_without_annotation(self, n_frames):
|
|
94
|
-
"""
|
|
95
|
-
Get a frame without an annotation.
|
|
96
|
-
"""
|
|
97
|
-
frames = self.get_frames()
|
|
98
|
-
annotations = ImageClassificationAnnotation.objects.filter(frame__in=frames, label=self.label)
|
|
99
|
-
|
|
100
|
-
annotated_frames = [annotation.frame for annotation in annotations]
|
|
101
|
-
frames_without_annotation = [frame for frame in frames if frame not in annotated_frames]
|
|
102
|
-
|
|
103
|
-
# draw n random frames
|
|
104
|
-
if len(frames_without_annotation) > n_frames:
|
|
105
|
-
frames_without_annotation = np.random.choice(frames_without_annotation, n_frames, replace=False)
|
|
106
|
-
|
|
107
|
-
return frames_without_annotation
|
endoreg_db/models/disease.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
|
|
3
|
-
class DiseaseManager(models.Manager):
|
|
4
|
-
def get_by_natural_key(self, name):
|
|
5
|
-
return self.get(name=name)
|
|
6
|
-
|
|
7
|
-
class Disease(models.Model):
|
|
8
|
-
name = models.CharField(max_length=255, unique=True)
|
|
9
|
-
name_de = models.CharField(max_length=255, blank=True, null=True)
|
|
10
|
-
name_en = models.CharField(max_length=255, blank=True, null=True)
|
|
11
|
-
|
|
12
|
-
objects = DiseaseManager()
|
|
13
|
-
|
|
14
|
-
def natural_key(self):
|
|
15
|
-
return (self.name,)
|
|
16
|
-
|
|
17
|
-
def __str__(self):
|
|
18
|
-
return self.name
|
|
19
|
-
|
|
20
|
-
class DiseaseClassificationManager(models.Manager):
|
|
21
|
-
def get_by_natural_key(self, name):
|
|
22
|
-
return self.get(name=name)
|
|
23
|
-
|
|
24
|
-
class DiseaseClassification(models.Model):
|
|
25
|
-
name = models.CharField(max_length=255, unique=True)
|
|
26
|
-
name_de = models.CharField(max_length=255, blank=True, null=True)
|
|
27
|
-
name_en = models.CharField(max_length=255, blank=True, null=True)
|
|
28
|
-
|
|
29
|
-
disease = models.ForeignKey(Disease, on_delete=models.CASCADE)
|
|
30
|
-
|
|
31
|
-
objects = DiseaseClassificationManager()
|
|
32
|
-
|
|
33
|
-
def natural_key(self):
|
|
34
|
-
return (self.name,)
|
|
35
|
-
|
|
36
|
-
def __str__(self):
|
|
37
|
-
return self.name
|
|
38
|
-
|
|
39
|
-
class DiseaseClassificationChoiceManager(models.Manager):
|
|
40
|
-
def get_by_natural_key(self, name):
|
|
41
|
-
return self.get(name=name)
|
|
42
|
-
|
|
43
|
-
class DiseaseClassificationChoice(models.Model):
|
|
44
|
-
name = models.CharField(max_length=255, unique=True)
|
|
45
|
-
name_de = models.CharField(max_length=255, blank=True, null=True)
|
|
46
|
-
name_en = models.CharField(max_length=255, blank=True, null=True)
|
|
47
|
-
|
|
48
|
-
disease_classification = models.ForeignKey(DiseaseClassification, on_delete=models.CASCADE)
|
|
49
|
-
|
|
50
|
-
objects = DiseaseClassificationChoiceManager()
|
|
51
|
-
|
|
52
|
-
def natural_key(self):
|
|
53
|
-
return (self.name,)
|
|
54
|
-
|
|
55
|
-
def __str__(self):
|
|
56
|
-
return self.name
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .emission_factor import EmissionFactor
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
|
|
3
|
-
class EmissionFactorManager(models.Manager):
|
|
4
|
-
def get_by_natural_key(self, name):
|
|
5
|
-
return self.get(name=name)
|
|
6
|
-
|
|
7
|
-
class EmissionFactor(models.Model):
|
|
8
|
-
objects = EmissionFactorManager()
|
|
9
|
-
|
|
10
|
-
name = models.CharField(max_length=255)
|
|
11
|
-
name_de = models.CharField(max_length=255, null=True)
|
|
12
|
-
name_en = models.CharField(max_length=255, null=True)
|
|
13
|
-
unit = models.ForeignKey("Unit", on_delete=models.SET_NULL, null=True)
|
|
14
|
-
value = models.FloatField()
|
|
15
|
-
|
|
16
|
-
def natural_key(self):
|
|
17
|
-
return (self.name,)
|
|
18
|
-
|
|
19
|
-
def __str__(self):
|
|
20
|
-
return self.name
|
endoreg_db/models/event.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
|
|
3
|
-
class Event(models.Model):
|
|
4
|
-
"""
|
|
5
|
-
A class representing an event.
|
|
6
|
-
|
|
7
|
-
Attributes:
|
|
8
|
-
name (str): The name of the event.
|
|
9
|
-
name_de (str): The German name of the event.
|
|
10
|
-
name_en (str): The English name of the event.
|
|
11
|
-
description (str): A description of the event.
|
|
12
|
-
"""
|
|
13
|
-
name = models.CharField(max_length=100, unique=True)
|
|
14
|
-
name_de = models.CharField(max_length=100, blank=True, null=True)
|
|
15
|
-
name_en = models.CharField(max_length=100, blank=True, null=True)
|
|
16
|
-
description = models.TextField(blank=True, null=True)
|
|
17
|
-
|
|
18
|
-
def natural_key(self):
|
|
19
|
-
return (self.name,)
|
|
20
|
-
|
|
21
|
-
def __str__(self):
|
|
22
|
-
return self.name
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
|
|
3
|
-
class ExaminationManager(models.Manager):
|
|
4
|
-
def get_by_natural_key(self, name):
|
|
5
|
-
return self.get(name=name)
|
|
6
|
-
|
|
7
|
-
class Examination(models.Model):
|
|
8
|
-
name = models.CharField(max_length=100, unique=True)
|
|
9
|
-
name_de = models.CharField(max_length=100, blank=True, null=True)
|
|
10
|
-
name_en = models.CharField(max_length=100, blank=True, null=True)
|
|
11
|
-
examination_types = models.ManyToManyField('ExaminationType', blank=True)
|
|
12
|
-
objects = ExaminationManager()
|
|
13
|
-
date = models.DateField(blank=True, null=True)
|
|
14
|
-
time = models.TimeField(blank=True, null=True)
|
|
15
|
-
|
|
16
|
-
def __str__(self):
|
|
17
|
-
return self.name
|
|
18
|
-
|
|
19
|
-
def natural_key(self):
|
|
20
|
-
return (self.name,)
|
|
21
|
-
|
|
22
|
-
class Meta:
|
|
23
|
-
verbose_name = 'Examination'
|
|
24
|
-
verbose_name_plural = 'Examinations'
|
|
25
|
-
ordering = ['name']
|
|
26
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
from rest_framework import serializers
|
|
3
|
-
|
|
4
|
-
class ExaminationTimeManager(models.Manager):
|
|
5
|
-
def get_by_natural_key(self, name):
|
|
6
|
-
return self.get(name=name)
|
|
7
|
-
|
|
8
|
-
class ExaminationTime(models.Model):
|
|
9
|
-
name = models.CharField(max_length=100, unique=True)
|
|
10
|
-
name_de = models.CharField(max_length=100, blank=True, null=True)
|
|
11
|
-
name_en = models.CharField(max_length=100, blank=True, null=True)
|
|
12
|
-
start_time = models.TimeField(blank=True, null=True)
|
|
13
|
-
time_types = models.ManyToManyField('ExaminationTimeType', blank=True)
|
|
14
|
-
end_time = models.TimeField(blank=True, null=True)
|
|
15
|
-
objects = ExaminationTimeManager()
|
|
16
|
-
|
|
17
|
-
def __str__(self):
|
|
18
|
-
return self.name
|
|
19
|
-
|
|
20
|
-
def natural_key(self):
|
|
21
|
-
return (self.name,)
|
|
22
|
-
|
|
23
|
-
class Meta:
|
|
24
|
-
verbose_name = 'Examination Time'
|
|
25
|
-
verbose_name_plural = 'Examination Times'
|
|
26
|
-
ordering = ['name']
|
|
27
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
|
|
3
|
-
class ExaminationTimeTypeManager(models.Manager):
|
|
4
|
-
def get_by_natural_key(self, name):
|
|
5
|
-
return self.get(name=name)
|
|
6
|
-
|
|
7
|
-
class ExaminationTimeType(models.Model):
|
|
8
|
-
objects = ExaminationTimeTypeManager()
|
|
9
|
-
name = models.CharField(max_length=100, unique=True)
|
|
10
|
-
name_de = models.CharField(max_length=100, blank=True, null=True)
|
|
11
|
-
name_en = models.CharField(max_length=100, blank=True, null=True)
|
|
12
|
-
examinations = models.ManyToManyField('Examination', blank=True)
|
|
13
|
-
|
|
14
|
-
def __str__(self):
|
|
15
|
-
return self.name
|
|
16
|
-
|
|
17
|
-
def natural_key(self):
|
|
18
|
-
return (self.name,)
|
|
19
|
-
|
|
20
|
-
class Meta:
|
|
21
|
-
verbose_name = 'Examination Time Type'
|
|
22
|
-
verbose_name_plural = 'Examination Time Types'
|
|
23
|
-
ordering = ['name']
|
|
24
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
|
|
3
|
-
class ExaminationTypeManager(models.Manager):
|
|
4
|
-
def get_by_natural_key(self, name):
|
|
5
|
-
return self.get(name=name)
|
|
6
|
-
|
|
7
|
-
class ExaminationType(models.Model):
|
|
8
|
-
objects = ExaminationTypeManager()
|
|
9
|
-
name = models.CharField(max_length=100, unique=True)
|
|
10
|
-
name_de = models.CharField(max_length=100, blank=True, null=True)
|
|
11
|
-
name_en = models.CharField(max_length=100, blank=True, null=True)
|
|
12
|
-
|
|
13
|
-
def __str__(self):
|
|
14
|
-
return self.name_en
|
|
15
|
-
|
|
16
|
-
def natural_key(self):
|
|
17
|
-
return (self.name,)
|
|
18
|
-
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from django.db import models
|
|
2
|
-
|
|
3
|
-
class EndoscopeManager(models.Manager):
|
|
4
|
-
def get_by_natural_key(self, name, sn):
|
|
5
|
-
return self.get(name=name, sn=sn)
|
|
6
|
-
|
|
7
|
-
class Endoscope(models.Model):
|
|
8
|
-
objects = EndoscopeManager()
|
|
9
|
-
|
|
10
|
-
name = models.CharField(max_length=255)
|
|
11
|
-
sn = models.CharField(max_length=255)
|
|
12
|
-
|
|
13
|
-
def natural_key(self):
|
|
14
|
-
return (self.name, self.sn)
|
|
15
|
-
|
|
16
|
-
def __str__(self):
|
|
17
|
-
return self.name
|
|
18
|
-
|
|
19
|
-
class Meta:
|
|
20
|
-
ordering = ['name']
|
|
21
|
-
verbose_name = 'Endoscope'
|
|
22
|
-
verbose_name_plural = 'Endoscopes'
|
|
23
|
-
|
|
24
|
-
class EndoscopeTypeManager(models.Manager):
|
|
25
|
-
def get_by_natural_key(self, name):
|
|
26
|
-
return self.get(name=name)
|
|
27
|
-
|
|
28
|
-
class EndoscopeType(models.Model):
|
|
29
|
-
objects = EndoscopeTypeManager()
|
|
30
|
-
|
|
31
|
-
name = models.CharField(max_length=255)
|
|
32
|
-
name_de = models.CharField(max_length=255, blank=True, null=True)
|
|
33
|
-
name_en = models.CharField(max_length=255, blank=True, null=True)
|
|
34
|
-
|
|
35
|
-
def natural_key(self):
|
|
36
|
-
return (self.name,)
|
|
37
|
-
|
|
38
|
-
def __str__(self):
|
|
39
|
-
return self.name
|
|
40
|
-
|
|
41
|
-
class Meta:
|
|
42
|
-
ordering = ['name']
|
|
43
|
-
verbose_name = 'Endoscope Type'
|
|
44
|
-
verbose_name_plural = 'Endoscope Types'
|