endoreg-db 0.4.1__py3-none-any.whl → 0.4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,6 @@ from django.core.files import File
14
14
  from endoreg_db.models import ModelMeta, ModelType, LabelSet
15
15
  import json
16
16
  from pathlib import Path
17
- from icecream import ic
18
17
 
19
18
  class Command(BaseCommand):
20
19
  """
@@ -0,0 +1,40 @@
1
+ # Generated by Django 4.2.15 on 2024-09-17 11:46
2
+
3
+ import django.core.files.storage
4
+ import django.core.validators
5
+ from django.db import migrations, models
6
+ import django.db.models.deletion
7
+ import django.utils.timezone
8
+
9
+
10
+ class Migration(migrations.Migration):
11
+
12
+ dependencies = [
13
+ ('endoreg_db', '0004_alter_rawpdffile_file'),
14
+ ]
15
+
16
+ operations = [
17
+ migrations.CreateModel(
18
+ name='UploadedFile',
19
+ fields=[
20
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21
+ ('original_file', models.FileField(upload_to='uploads/original/')),
22
+ ('upload_date', models.DateTimeField(default=django.utils.timezone.now)),
23
+ ('description', models.TextField(blank=True, null=True)),
24
+ ],
25
+ ),
26
+ migrations.AlterField(
27
+ model_name='rawpdffile',
28
+ name='file',
29
+ field=models.FileField(storage=django.core.files.storage.FileSystemStorage(location='/mnt/hdd-sensitive/Pseudo/import/pdf'), upload_to='raw_pdf/', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['pdf'])]),
30
+ ),
31
+ migrations.CreateModel(
32
+ name='AnonymizedFile',
33
+ fields=[
34
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
35
+ ('anonymized_file', models.FileField(upload_to='uploads/anonymized/')),
36
+ ('anonymization_date', models.DateTimeField(default=django.utils.timezone.now)),
37
+ ('original_file', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='anonymized_file', to='endoreg_db.uploadedfile')),
38
+ ],
39
+ ),
40
+ ]
@@ -39,11 +39,7 @@ from .patient_examination import PatientExamination
39
39
 
40
40
  from .label import Label, LabelType, LabelSet
41
41
 
42
- from .annotation import (
43
- ImageClassificationAnnotation,
44
- LegacyBinaryClassificationAnnotationTask,
45
- BinaryClassificationAnnotationTask,
46
- )
42
+ from .annotation import *
47
43
 
48
44
  from .legacy_data import (
49
45
  LegacyImage,
@@ -74,3 +70,4 @@ from .hardware import (
74
70
  )
75
71
 
76
72
  from .questionnaires import TtoQuestionnaire
73
+ from .annotation import AnonymousImageAnnotation, AnonymizedImageLabel, DroppedName
@@ -1,3 +1,3 @@
1
1
  from .image_classification import ImageClassificationAnnotation
2
2
  from .binary_classification_annotation_task import LegacyBinaryClassificationAnnotationTask, BinaryClassificationAnnotationTask
3
- from .anonymized_image_annotation import AnonymousImageAnnotation, DroppedName, AnonymizedImageLabel
3
+ from .anonymized_image_annotation import AnonymousImageAnnotation, DroppedName, AnonymizedImageLabel, AnonymizedFile, UploadedFile
@@ -39,3 +39,22 @@ class DroppedName(models.Model):
39
39
 
40
40
  def __str__(self):
41
41
  return f"{self.name} ({self.gender}) at ({self.x}, {self.y})"
42
+
43
+ from django.db import models
44
+ from django.utils import timezone
45
+
46
+ class UploadedFile(models.Model):
47
+ original_file = models.FileField(upload_to='uploads/original/')
48
+ upload_date = models.DateTimeField(default=timezone.now)
49
+ description = models.TextField(blank=True, null=True)
50
+
51
+ def __str__(self):
52
+ return self.original_file.name
53
+
54
+ class AnonymizedFile(models.Model):
55
+ original_file = models.OneToOneField(UploadedFile, on_delete=models.CASCADE, related_name='anonymized_file')
56
+ anonymized_file = models.FileField(upload_to='uploads/anonymized/')
57
+ anonymization_date = models.DateTimeField(default=timezone.now)
58
+
59
+ def __str__(self):
60
+ return f"Anonymized version of {self.original_file.original_file.name}"
@@ -1,7 +1,6 @@
1
1
  from ...models import LabelSet, ImageClassificationAnnotation
2
2
  from django.db.models import Q, F
3
3
  from django.db import models
4
- from icecream import ic
5
4
  from tqdm import tqdm
6
5
  from collections import defaultdict
7
6
 
@@ -7,7 +7,6 @@ from tempfile import TemporaryDirectory
7
7
  import re
8
8
  from datetime import datetime
9
9
  from typing import Dict, List
10
- from icecream import ic
11
10
  import numpy as np
12
11
 
13
12
  N_FRAMES_MEAN_OCR = 2
@@ -126,9 +125,10 @@ def extract_text_from_rois(image_path, processor:EndoscopyProcessor):
126
125
  extracted_texts[roi_name] = processed_text
127
126
 
128
127
  else:
129
- ic(roi_name)
130
- ic(roi)
131
- ic("No values for this ROI")
128
+ pass
129
+ # ic(roi_name)
130
+ # ic(roi)
131
+ # ic("No values for this ROI")
132
132
 
133
133
  return extracted_texts
134
134
 
@@ -146,8 +146,8 @@ def get_most_frequent_values(rois_texts: Dict[str, List[str]]) -> Dict[str, str]
146
146
  most_frequent = {}
147
147
  for key in rois_texts.keys():
148
148
  counter = Counter([text for text in rois_texts[key] if text])
149
- ic(key)
150
- ic(counter)
149
+ # ic(key)
150
+ # ic(counter)
151
151
  most_frequent[key], _ = counter.most_common(1)[0] if counter else (None, None)
152
152
  return most_frequent
153
153
 
@@ -164,7 +164,7 @@ def process_video(video_path, processor):
164
164
  """
165
165
  # Create a temporary directory to store frames
166
166
  with TemporaryDirectory() as temp_dir:
167
- ic(temp_dir)
167
+ # ic(temp_dir)
168
168
  # Capture the video
169
169
  video = cv2.VideoCapture(video_path)
170
170
  success, frame_number = True, 0
@@ -182,7 +182,7 @@ def process_video(video_path, processor):
182
182
 
183
183
  # Extract text from ROIs
184
184
  extracted_texts = extract_text_from_rois(frame_path, processor)
185
- ic(extracted_texts)
185
+ # ic(extracted_texts)
186
186
 
187
187
  # Store the extracted text from each ROI
188
188
  for key, text in extracted_texts.items():
endoreg_db/utils/ocr.py CHANGED
@@ -6,7 +6,6 @@ from tempfile import TemporaryDirectory
6
6
  import re
7
7
  from datetime import datetime
8
8
  from typing import Dict, List
9
- from icecream import ic
10
9
  import numpy as np
11
10
  from endoreg_db.utils.cropping import crop_and_insert
12
11
 
@@ -123,9 +122,7 @@ def extract_text_from_rois(image_path, processor):
123
122
  extracted_texts[roi_name] = processed_text
124
123
 
125
124
  else:
126
- ic(roi_name)
127
- ic(roi)
128
- ic("No values for this ROI")
125
+ pass
129
126
 
130
127
  return extracted_texts
131
128
 
@@ -142,8 +139,6 @@ def get_most_frequent_values(rois_texts: Dict[str, List[str]]) -> Dict[str, str]
142
139
  most_frequent = {}
143
140
  for key in rois_texts.keys():
144
141
  counter = Counter([text for text in rois_texts[key] if text])
145
- ic(key)
146
- ic(counter)
147
142
  most_frequent[key], _ = counter.most_common(1)[0] if counter else (None, None)
148
143
  return most_frequent
149
144
 
@@ -160,7 +155,6 @@ def process_video(video_path, processor):
160
155
  """
161
156
  # Create a temporary directory to store frames
162
157
  with TemporaryDirectory() as temp_dir:
163
- ic(temp_dir)
164
158
  # Capture the video
165
159
  video = cv2.VideoCapture(video_path)
166
160
  success, frame_number = True, 0
@@ -178,7 +172,6 @@ def process_video(video_path, processor):
178
172
 
179
173
  # Extract text from ROIs
180
174
  extracted_texts = extract_text_from_rois(frame_path, processor)
181
- ic(extracted_texts)
182
175
 
183
176
  # Store the extracted text from each ROI
184
177
  for key, text in extracted_texts.items():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: endoreg-db
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: EndoReg Db Django App
5
5
  License: GNU3
6
6
  Author: Thomas J. Lux
@@ -9,15 +9,14 @@ Classifier: License :: Other/Proprietary License
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
- Requires-Dist: agl-report-reader (>=0.3.0,<0.4.0)
13
- Requires-Dist: django (>=4.2,<4.3)
12
+ Requires-Dist: agl-report-reader (==0.3.2)
13
+ Requires-Dist: django (>=5.1,<6.0)
14
14
  Requires-Dist: django-bootstrap5 (>=23.4,<24.0)
15
15
  Requires-Dist: djangorestframework (>=3.14.0,<4.0.0)
16
16
  Requires-Dist: ffmpeg-python (>=0.2.0,<0.3.0)
17
- Requires-Dist: icecream (>=2.1.3,<3.0.0)
18
17
  Requires-Dist: opencv-python (>=4.9.0.80,<5.0.0.0)
19
18
  Requires-Dist: pandas (>=2.2.2,<3.0.0)
20
- Requires-Dist: pillow (>=10.2.0,<11.0.0)
19
+ Requires-Dist: pillow (>=10,<11)
21
20
  Requires-Dist: pytesseract (>=0.3.10,<0.4.0)
22
21
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
23
22
  Requires-Dist: scipy (>=1.14.0,<2.0.0)
@@ -142,21 +142,22 @@ endoreg_db/management/commands/load_profession_data.py,sha256=oF3OF7zRqxA-SVpMW6
142
142
  endoreg_db/management/commands/load_report_reader_flag.py,sha256=pvqRgtcjaYTgx2Ce7HYnNzsUB48yJe9lXTk-lzfJUPI,1371
143
143
  endoreg_db/management/commands/load_unit_data.py,sha256=tcux-iL-ByT2ApgmHEkLllZSEA3AGMK5l-ze2Mtty1Y,1319
144
144
  endoreg_db/management/commands/load_user_groups.py,sha256=D7SK2FvZEHoE4TIXNGCjDw5_12MH9bpGZvoS7eEv0Os,1031
145
- endoreg_db/management/commands/register_ai_model.py,sha256=e5hgEyLS-E98XWzINcZ79mgtHvZltmbmAmLYaNrcfQs,2544
145
+ endoreg_db/management/commands/register_ai_model.py,sha256=ni_YBlEuCuhMymRE1376e64x6S1CcQkNH7XaJ_DhP4A,2520
146
146
  endoreg_db/management/commands/reset_celery_schedule.py,sha256=U-m_FNRTw6LAwJoT9RUE4qrhmQXm7AyFToPcHYyJpIE,386
147
147
  endoreg_db/migrations/0001_initial.py,sha256=tIXFN6sFZ2VUIP-TaFSGcobrgARkia0SIOiKN0iokvU,95312
148
148
  endoreg_db/migrations/0002_anonymizedimagelabel_anonymousimageannotation_and_more.py,sha256=ABUOr5ZMUHkRQ0FDUhqNaVAvq5K8HOOdyVo1TJ8YMkQ,2605
149
149
  endoreg_db/migrations/0003_anonymousimageannotation_original_image_url_and_more.py,sha256=bTb9_FfQBNHYLq1tKw1qmem9xsecRv-z1-aWcl9ig4k,1319
150
150
  endoreg_db/migrations/0004_alter_rawpdffile_file.py,sha256=B1LxaapxDnzs08ScrXh1pM_KC2hHHyEHGce_0Ciaex8,712
151
+ endoreg_db/migrations/0005_uploadedfile_alter_rawpdffile_file_anonymizedfile.py,sha256=yhQhScntZgPdMpci2aWfGk3qzvSUS9asDfMFyMlIL2U,1776
151
152
  endoreg_db/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
152
- endoreg_db/models/__init__.py,sha256=wc1ZyDUNb-sKMZ4P7x_PAb0WtzDhYAq8y19AV8rC7dQ,1552
153
+ endoreg_db/models/__init__.py,sha256=EH4g6EvT8AbEtcVcTj8AUtjGP3sQtQw7M34I_g_IGP4,1512
153
154
  endoreg_db/models/ai_model/__init__.py,sha256=rh5npLRGml5iiRocx359gsaA82pGJTW7wdVAfnbZP6w,106
154
155
  endoreg_db/models/ai_model/active_model.py,sha256=r7SE3yg54kbjfOkk0Ei0rgs_Wo3ikx88rcEELqvRzGc,343
155
156
  endoreg_db/models/ai_model/model_meta.py,sha256=YyYW8dScpAceHePnbrnRpgVBYDByi9x7u5Ydh03OJuo,869
156
157
  endoreg_db/models/ai_model/model_type.py,sha256=mg1bEuzAjIte25N4TzD0yDhmUQYayJpyrRn2hB6b6eg,638
157
158
  endoreg_db/models/ai_model/utils.py,sha256=Vh6_3lbDuFhSVCaaZKKm0CjoGA5Man6gWYe46HUXmbA,270
158
- endoreg_db/models/annotation/__init__.py,sha256=9RM6_ZbKToUPzxgNOlFErSlFE3tdLQDY_Qw_z4Oh708,292
159
- endoreg_db/models/annotation/anonymized_image_annotation.py,sha256=i3DtDOE7OKNJLwK0u5LXDuNNopD6Nql_bCjTwJHXEUM,1961
159
+ endoreg_db/models/annotation/__init__.py,sha256=TnRp_hJ4YomxKN6N1yBzGHStY9SnY_HLPCjJKLdZmu8,323
160
+ endoreg_db/models/annotation/anonymized_image_annotation.py,sha256=1mZadIzYsEZN_zz_SMehGgiIvMbhHpiFMO2tfmbOL54,2716
160
161
  endoreg_db/models/annotation/binary_classification_annotation_task.py,sha256=CpvyDxLSJcoJyajtUsDGBt881SNSFcG8lvuQ01knMNM,3292
161
162
  endoreg_db/models/annotation/image_classification.py,sha256=Og1tRo1QKBMztwfdbFryUWghnGdsTqQdepn9rOcmVMc,1387
162
163
  endoreg_db/models/case_template/__init__.py,sha256=vtq-7Gvpv01l9CuQvBFQugXCKELx9wg2z5HkysrZCNM,369
@@ -271,7 +272,7 @@ endoreg_db/models/rules/ruleset.py,sha256=XaY30qfXuXaUhaDmgfyUhPBnQ4EE1owixZ3mDW
271
272
  endoreg_db/models/unit.py,sha256=5-LrmM3vVTElsNqztVDDBE9e9xpYIfz5-AD30H630oU,836
272
273
  endoreg_db/queries/__init__.py,sha256=3yhFtU_yY2L8rK2--8WkjcyI0q94QPpTtv5w_v8rZRY,83
273
274
  endoreg_db/queries/annotations/__init__.py,sha256=76O3dAIzuSye09VNPGSNPnqPEtgXZcBAGXKdh89y0ts,95
274
- endoreg_db/queries/annotations/legacy.py,sha256=1uHubRWItrBzvw_5nwJfc4oa6shWWJcG5J68oVgiFvY,6442
275
+ endoreg_db/queries/annotations/legacy.py,sha256=KOHWLDf3CLvIT9GpQi3ps4bUi3JDJUhJXH4gvw9T47E,6418
275
276
  endoreg_db/queries/get/__init__.py,sha256=id0oVNTEjzzUpkvTp0E4tClFN91EeKOyEuSAYsIlIQo,147
276
277
  endoreg_db/queries/get/annotation.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
277
278
  endoreg_db/queries/get/center.py,sha256=SeVxpzZUErk_jjv0RaurDar2i_28FWQ6RarxFHblnGw,1155
@@ -302,12 +303,12 @@ endoreg_db/utils/cropping.py,sha256=wMLo5sCFdZAEVBe3RbCH26eQjRe8q3th4K3ZKDd9fww,
302
303
  endoreg_db/utils/dataloader.py,sha256=rps-zZ-5QsEetYunxChbZvxZSQHOH9LU4N6a7o8Q0fs,4035
303
304
  endoreg_db/utils/file_operations.py,sha256=3mUY6jARIm927XK0nJoDO7fRp5quoSqPr95jDJERmr0,884
304
305
  endoreg_db/utils/hashs.py,sha256=mLae54Vj7h5Q-9_MWtEB_KKE7x9qALpClgZyX5DB9Ek,1069
305
- endoreg_db/utils/legacy_ocr.py,sha256=c2EBP-9egUYyfsQ1n0QoZY2wKndWoKdEXrB-MQZ0Xn4,7633
306
- endoreg_db/utils/ocr.py,sha256=jkdT1bl-LSCjZ2PvxlX1AG2TmhdMclayxUPrdZWs7UE,7322
306
+ endoreg_db/utils/legacy_ocr.py,sha256=lzZb8om4pfEJ5i7fuamW1XaVjO1Fybne7QCdVUxz8O8,7640
307
+ endoreg_db/utils/ocr.py,sha256=LvyABxX5OZhIeXw2pI6af8_xTj7nHQQoKGh5kNsrv7o,7136
307
308
  endoreg_db/utils/uuid.py,sha256=T4HXqYtKwXFqE5kPyvlgWHyllBBF6LL6N48nl9TpwBk,53
308
309
  endoreg_db/utils/video_metadata.py,sha256=HDyXxAeNQOK3cGzQ06xosmObzEnJBARuKjwz9vmmRIM,2613
309
310
  endoreg_db/views.py,sha256=xc1IQHrsij7j33TUbo-_oewy3vs03pw_etpBWaMYJl0,63
310
- endoreg_db-0.4.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
311
- endoreg_db-0.4.1.dist-info/METADATA,sha256=00evXIbn5l5x4dOmbdcvm6UAcpyBnlZuZLYvtq-NX8c,1054
312
- endoreg_db-0.4.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
313
- endoreg_db-0.4.1.dist-info/RECORD,,
311
+ endoreg_db-0.4.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
312
+ endoreg_db-0.4.3.dist-info/METADATA,sha256=hRkpATMqgQmowCk4y7KQlxzihdFvJXtOsqdsVvmLhUM,998
313
+ endoreg_db-0.4.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
314
+ endoreg_db-0.4.3.dist-info/RECORD,,