endoreg-db 0.8.4.4__py3-none-any.whl → 0.8.6.1__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.

Files changed (36) hide show
  1. endoreg_db/management/commands/load_ai_model_data.py +2 -1
  2. endoreg_db/management/commands/setup_endoreg_db.py +11 -7
  3. endoreg_db/models/media/pdf/raw_pdf.py +241 -97
  4. endoreg_db/models/media/video/pipe_1.py +30 -33
  5. endoreg_db/models/media/video/video_file.py +300 -187
  6. endoreg_db/models/metadata/model_meta_logic.py +15 -1
  7. endoreg_db/models/metadata/sensitive_meta_logic.py +391 -70
  8. endoreg_db/serializers/__init__.py +26 -55
  9. endoreg_db/serializers/misc/__init__.py +1 -1
  10. endoreg_db/serializers/misc/file_overview.py +65 -35
  11. endoreg_db/serializers/misc/{vop_patient_data.py → sensitive_patient_data.py} +1 -1
  12. endoreg_db/serializers/video_examination.py +198 -0
  13. endoreg_db/services/lookup_service.py +228 -58
  14. endoreg_db/services/lookup_store.py +174 -30
  15. endoreg_db/services/pdf_import.py +585 -282
  16. endoreg_db/services/video_import.py +340 -101
  17. endoreg_db/urls/__init__.py +36 -23
  18. endoreg_db/urls/label_video_segments.py +2 -0
  19. endoreg_db/urls/media.py +3 -2
  20. endoreg_db/views/__init__.py +6 -3
  21. endoreg_db/views/media/pdf_media.py +3 -1
  22. endoreg_db/views/media/video_media.py +1 -1
  23. endoreg_db/views/media/video_segments.py +187 -259
  24. endoreg_db/views/pdf/__init__.py +5 -8
  25. endoreg_db/views/pdf/pdf_stream.py +187 -0
  26. endoreg_db/views/pdf/reimport.py +110 -94
  27. endoreg_db/views/requirement/lookup.py +171 -287
  28. endoreg_db/views/video/__init__.py +0 -2
  29. endoreg_db/views/video/video_examination_viewset.py +202 -289
  30. {endoreg_db-0.8.4.4.dist-info → endoreg_db-0.8.6.1.dist-info}/METADATA +1 -1
  31. {endoreg_db-0.8.4.4.dist-info → endoreg_db-0.8.6.1.dist-info}/RECORD +33 -34
  32. endoreg_db/views/pdf/pdf_media.py +0 -239
  33. endoreg_db/views/pdf/pdf_stream_views.py +0 -127
  34. endoreg_db/views/video/video_media.py +0 -158
  35. {endoreg_db-0.8.4.4.dist-info → endoreg_db-0.8.6.1.dist-info}/WHEEL +0 -0
  36. {endoreg_db-0.8.4.4.dist-info → endoreg_db-0.8.6.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,36 +1,39 @@
1
- from django.urls import path, include
2
1
  from django.conf import settings
3
2
  from django.conf.urls.static import static
3
+ from django.urls import include, path
4
4
  from rest_framework.routers import DefaultRouter
5
5
 
6
- # Phase 1.2: Media Management URLs ✅ IMPLEMENTED
7
- from .media import urlpatterns as media_url_patterns
8
-
9
6
  from endoreg_db.views import (
10
- VideoViewSet,
11
7
  ExaminationViewSet,
12
- VideoExaminationViewSet,
8
+ FindingClassificationViewSet,
13
9
  FindingViewSet,
14
- FindingClassificationViewSet,
10
+ PatientExaminationViewSet,
15
11
  PatientFindingViewSet,
16
- PatientExaminationViewSet
12
+ VideoExaminationViewSet,
13
+ VideoViewSet,
17
14
  )
18
15
 
19
16
  from .anonymization import url_patterns as anonymization_url_patterns
20
- from .classification import url_patterns as classification_url_patterns
21
17
  from .auth import urlpatterns as auth_url_patterns
18
+ from .classification import url_patterns as classification_url_patterns
22
19
  from .examination import urlpatterns as examination_url_patterns
23
20
  from .files import urlpatterns as files_url_patterns
21
+ from .label_video_segment_validate import (
22
+ url_patterns as label_video_segment_validate_url_patterns,
23
+ )
24
24
  from .label_video_segments import url_patterns as label_video_segments_url_patterns
25
- from .label_video_segment_validate import url_patterns as label_video_segment_validate_url_patterns
25
+
26
+ # Phase 1.2: Media Management URLs ✅ IMPLEMENTED
27
+ from .media import urlpatterns as media_url_patterns
28
+ from .patient import urlpatterns as patient_url_patterns
29
+
26
30
  # TODO Phase 1.2: Implement VideoMediaView and PDFMediaView before enabling
27
31
  # from .media import urlpatterns as media_url_patterns
28
32
  from .report import url_patterns as report_url_patterns
29
- from .upload import urlpatterns as upload_url_patterns
30
- from .video import url_patterns as video_url_patterns
31
33
  from .requirements import urlpatterns as requirements_url_patterns
32
- from .patient import urlpatterns as patient_url_patterns
33
34
  from .stats import url_patterns as stats_url_patterns
35
+ from .upload import urlpatterns as upload_url_patterns
36
+ from .video import url_patterns as video_url_patterns
34
37
 
35
38
  api_urls = []
36
39
  api_urls += classification_url_patterns
@@ -50,21 +53,31 @@ api_urls += patient_url_patterns
50
53
  api_urls += stats_url_patterns
51
54
 
52
55
  router = DefaultRouter()
53
- router.register(r'videos', VideoViewSet, basename='videos')
54
- router.register(r'examinations', ExaminationViewSet)
55
- router.register(r'video-examinations', VideoExaminationViewSet, basename='video-examinations')
56
- router.register(r'findings', FindingViewSet)
57
- router.register(r'classifications', FindingClassificationViewSet)
58
- router.register(r'patient-findings', PatientFindingViewSet)
59
- router.register(r'patient-examinations', PatientExaminationViewSet)
56
+ router.register(r"videos", VideoViewSet, basename="videos")
57
+ router.register(r"examinations", ExaminationViewSet)
58
+ router.register(
59
+ r"video-examinations", VideoExaminationViewSet, basename="video-examinations"
60
+ )
61
+ router.register(r"findings", FindingViewSet)
62
+ router.register(r"classifications", FindingClassificationViewSet)
63
+ router.register(r"patient-findings", PatientFindingViewSet)
64
+ router.register(r"patient-examinations", PatientExaminationViewSet)
65
+
66
+ # Additional custom video examination routes
67
+ # Frontend expects: GET /api/video/{id}/examinations/
68
+ video_examinations_list = VideoExaminationViewSet.as_view({"get": "by_video"})
60
69
 
61
70
  # Export raw API urlpatterns (no prefix). The project-level endoreg_db/urls.py mounts these under /api/.
62
71
  urlpatterns = [
63
- path('', include(api_urls)), # Specific routes first
64
- path('', include(router.urls)), # Generic router routes second
72
+ path(
73
+ "video/<int:video_id>/examinations/",
74
+ video_examinations_list,
75
+ name="video-examinations-by-video",
76
+ ),
77
+ path("", include(api_urls)), # Specific routes first
78
+ path("", include(router.urls)), # Generic router routes second
65
79
  ]
66
80
 
67
81
  if settings.DEBUG:
68
82
  urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
69
83
  urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
70
-
@@ -8,6 +8,8 @@ from endoreg_db.views import (
8
8
  get_lvs_by_name_and_video_id
9
9
  )
10
10
 
11
+
12
+
11
13
  url_patterns = [
12
14
  path(
13
15
  "lvs/by-label-name/<str:label_name>/by-video-id/<int:video_id>/",
endoreg_db/urls/media.py CHANGED
@@ -1,3 +1,4 @@
1
+ from PIL.PdfParser import PdfStream
1
2
  from django.urls import path
2
3
 
3
4
  from endoreg_db.views.media import (
@@ -22,6 +23,7 @@ from endoreg_db.views import (
22
23
  VideoStreamView,
23
24
  )
24
25
  from endoreg_db.views.pdf.reimport import PdfReimportView
26
+ from endoreg_db.views.pdf.pdf_stream import PdfStreamView
25
27
  from endoreg_db.views.video.reimport import VideoReimportView
26
28
  from endoreg_db.views.video.correction import (
27
29
  VideoMetadataView,
@@ -216,8 +218,7 @@ urlpatterns = [
216
218
  # PDF media endpoints
217
219
  path("media/pdfs/", PdfMediaView.as_view(), name="pdf-list"),
218
220
  path("media/pdfs/<int:pk>/", PdfMediaView.as_view(), name="pdf-detail"),
219
- path("media/pdfs/<int:pk>/stream/", PdfMediaView.as_view(), name="pdf-stream"),
220
-
221
+ path("media/pdfs/<int:pk>/stream/", PdfStreamView.as_view(), name="pdf-stream"), # Support ?type=raw|anonymized params
221
222
  # PDF Re-import API endpoint (modern media framework)
222
223
  # POST /api/media/pdfs/<int:pk>/reimport/
223
224
  # Re-imports a PDF file to regenerate metadata when OCR failed or data is incomplete
@@ -108,8 +108,9 @@ from .patient_finding_classification import (
108
108
  )
109
109
 
110
110
  from .pdf import (
111
- ClosingFileWrapper,
112
- PDFMediaView,
111
+ PdfMediaView,
112
+ PdfReimportView,
113
+ PdfStreamView,
113
114
  )
114
115
 
115
116
  from .report import (
@@ -240,7 +241,9 @@ __all__ = [
240
241
  "create_patient_finding_classification",
241
242
 
242
243
  # PDF
243
- "ClosingFileWrapper",
244
+ "PdfMediaView",
245
+ "PdfReimportView",
246
+ "PdfStreamView",
244
247
 
245
248
  # Report
246
249
  "ReportListView",
@@ -13,6 +13,7 @@ from django.http import Http404, FileResponse
13
13
  from rest_framework import status
14
14
  from rest_framework.response import Response
15
15
  from rest_framework.views import APIView
16
+ from django.views.decorators.clickjacking import xframe_options_exempt
16
17
  from django.db.models import Q
17
18
 
18
19
  from endoreg_db.models import RawPdfFile
@@ -133,7 +134,8 @@ class PdfMediaView(APIView):
133
134
  {"error": "Failed to retrieve PDF details"},
134
135
  status=status.HTTP_500_INTERNAL_SERVER_ERROR
135
136
  )
136
-
137
+
138
+ @xframe_options_exempt
137
139
  def _stream_pdf(self, pk):
138
140
  """
139
141
  Stream PDF file content for viewing/download.
@@ -30,7 +30,7 @@ class VideoMediaView(APIView):
30
30
  - GET /api/media/videos/ - List all videos with filtering
31
31
  - GET /api/media/videos/{id}/ - Get video details
32
32
  - PATCH /api/media/videos/{id}/ - Update video metadata (future)
33
- - DELETE /api/media/videos/{id}/ - Delete video (future)
33
+ - DELETE /api/media/videos/{id}/ - Delete video
34
34
 
35
35
  Query Parameters:
36
36
  - status: Filter by processing status (not_started, processing, done, failed, validated)