lx-annotate 1.2.3__tar.gz → 1.2.4__tar.gz

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.
Files changed (332) hide show
  1. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/PKG-INFO +4 -3
  2. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/api_urls.py +15 -0
  3. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/apps.py +1 -1
  4. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/checks.py +7 -1
  5. lx_annotate-1.2.4/lx_annotate/management/commands/monitoring_status.py +30 -0
  6. lx_annotate-1.2.4/lx_annotate/monitoring/__init__.py +1 -0
  7. lx_annotate-1.2.4/lx_annotate/monitoring/configuration.py +31 -0
  8. lx_annotate-1.2.4/lx_annotate/monitoring/contracts.py +98 -0
  9. lx_annotate-1.2.4/lx_annotate/monitoring/database.py +222 -0
  10. lx_annotate-1.2.4/lx_annotate/monitoring/runtime.py +179 -0
  11. lx_annotate-1.2.4/lx_annotate/monitoring/service.py +348 -0
  12. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/permissions.py +14 -0
  13. lx_annotate-1.2.4/lx_annotate/services/report_llm.py +337 -0
  14. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/settings_base.py +12 -0
  15. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/settings_dev.py +1 -0
  16. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/anonymization_overview.py +11 -0
  17. lx_annotate-1.2.4/lx_annotate/views/monitoring.py +23 -0
  18. lx_annotate-1.2.4/lx_annotate/views/report_llm.py +104 -0
  19. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/pyproject.toml +4 -3
  20. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/.vite/manifest.json +35 -2
  21. lx_annotate-1.2.4/staticfiles/AdministrationPage.css +1 -0
  22. lx_annotate-1.2.4/staticfiles/AdministrationPage.js +1 -0
  23. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AiDatasetBucketsPage.js +1 -1
  24. lx_annotate-1.2.4/staticfiles/AiDatasetSettingsPage.js +1 -0
  25. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnnotationDashboard.js +1 -1
  26. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnnotationDashboard2.js +1 -1
  27. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnonymizationCorrectionComponent.js +1 -1
  28. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnonymizationEvaluation.js +1 -1
  29. lx_annotate-1.2.4/staticfiles/AnonymizationMetrics.js +1 -0
  30. lx_annotate-1.2.4/staticfiles/AnonymizationOverview.css +1 -0
  31. lx_annotate-1.2.4/staticfiles/AnonymizationOverview.js +1 -0
  32. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnonymizationValidationComponent.js +1 -1
  33. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ApplicationSettingsPage.js +1 -1
  34. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/CaseResolutionPage.js +1 -1
  35. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/CaseSetupPage.js +1 -1
  36. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Dashboard.js +1 -1
  37. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Export.js +1 -1
  38. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/FinalizedResultPage.js +1 -1
  39. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/FindingsCapturePage.js +1 -1
  40. lx_annotate-1.2.4/staticfiles/FrameAnnotation.css +1 -0
  41. lx_annotate-1.2.4/staticfiles/FrameAnnotation.js +1 -0
  42. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/FrameSelectorPage.js +1 -1
  43. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/HubExport.js +1 -1
  44. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ModelTrainingPage.js +2 -2
  45. lx_annotate-1.2.4/staticfiles/MonitoringPage.css +1 -0
  46. lx_annotate-1.2.4/staticfiles/MonitoringPage.js +1 -0
  47. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PageOverview.js +1 -1
  48. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PatientDocumentsPage.js +1 -1
  49. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PatientMedicationPage.js +1 -1
  50. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PatientOverview.js +1 -1
  51. lx_annotate-1.2.4/staticfiles/ReportEditorPage.css +1 -0
  52. lx_annotate-1.2.4/staticfiles/ReportEditorPage.js +4 -0
  53. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ReportExportPage.css +1 -1
  54. lx_annotate-1.2.4/staticfiles/ReportExportPage.js +3 -0
  55. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ReportTemplateBuilderPage.js +1 -1
  56. lx_annotate-1.2.4/staticfiles/ReportingShell.css +1 -0
  57. lx_annotate-1.2.4/staticfiles/ReportingShell.js +1 -0
  58. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ReportingWorklistPage.js +1 -1
  59. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/StudyCohortPage.js +1 -1
  60. lx_annotate-1.2.4/staticfiles/Timeline.css +1 -0
  61. lx_annotate-1.2.4/staticfiles/Timeline.js +2 -0
  62. lx_annotate-1.2.4/staticfiles/VideoExamination.css +1 -0
  63. lx_annotate-1.2.4/staticfiles/VideoExamination.js +1 -0
  64. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/administrationApi.js +1 -1
  65. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/aiDatasetApi.js +1 -1
  66. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/applicationSettingsApi.js +1 -1
  67. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/casesApi.js +1 -1
  68. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/SETUP_GUIDE.html +1 -1
  69. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/documentation_options.js +1 -1
  70. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/api/index.html +1 -1
  71. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/genindex.html +1 -1
  72. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/ai-training-data-export.html +1 -1
  73. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/anonymization-validation-correction-workflow.html +1 -1
  74. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/asset-deployment.html +1 -1
  75. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/core-concept-contract.html +1 -1
  76. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/core-concept-readiness-verdict.html +1 -1
  77. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/core-concept-type-matrix.html +1 -1
  78. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/deployment-strategy.html +1 -1
  79. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/dtypes-findings-migration.html +1 -1
  80. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/encrypted-model-weights-inference.html +1 -1
  81. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/encrypted-storage-process.html +1 -1
  82. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/frame-annotation-availability.html +1 -1
  83. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/general-documentation.html +1 -1
  84. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/hub-export-workflow.html +1 -1
  85. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/hub-storage-load-balancing.html +1 -1
  86. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/openapi-type-generation.html +1 -1
  87. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/pypi.html +1 -1
  88. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/reporting-shell-aaa-testing.html +1 -1
  89. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/reporting-template-requirements-page.html +1 -1
  90. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/runtime-environment-contract-test.html +1 -1
  91. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/secure-backup-disaster-recovery.html +1 -1
  92. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/segment-annotation-workflow.html +1 -1
  93. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/terminology-delivery.html +1 -1
  94. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/guides/wheel-deployment.html +1 -1
  95. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/index.html +1 -1
  96. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/search.html +1 -1
  97. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/examinationStore.js +1 -1
  98. lx_annotate-1.2.4/staticfiles/frameStreams.js +1 -0
  99. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/knowledgeBaseGraphApi.js +1 -1
  100. lx_annotate-1.2.4/staticfiles/main.js +39 -0
  101. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/mediaTypeStore.js +1 -1
  102. lx_annotate-1.2.4/staticfiles/mediaUrls.js +1 -0
  103. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/patientExaminationStore.js +1 -1
  104. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/patientService.js +1 -1
  105. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/patientStore.js +1 -1
  106. lx_annotate-1.2.4/staticfiles/reportExportApi.js +1 -0
  107. lx_annotate-1.2.4/staticfiles/reportingPresentation.js +1 -0
  108. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/reportingTimelineApi.js +1 -1
  109. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/studyApi.js +1 -1
  110. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/studyCohortExportStore.js +1 -1
  111. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/terminologyStore.js +1 -1
  112. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/timeHelpers.js +1 -1
  113. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/useAuthenticatedVideoStream.js +1 -1
  114. lx_annotate-1.2.4/staticfiles/useDebug.js +1 -0
  115. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/useFindingSelectors.js +1 -1
  116. lx_annotate-1.2.4/staticfiles/useReportTemplates.js +1 -0
  117. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/useReportingKnowledgeBase.js +1 -1
  118. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/uv.lock +22 -18
  119. lx_annotate-1.2.3/staticfiles/AdministrationPage.css +0 -1
  120. lx_annotate-1.2.3/staticfiles/AdministrationPage.js +0 -1
  121. lx_annotate-1.2.3/staticfiles/AiDatasetSettingsPage.js +0 -1
  122. lx_annotate-1.2.3/staticfiles/AnonymizationMetrics.js +0 -1
  123. lx_annotate-1.2.3/staticfiles/AnonymizationOverview.css +0 -1
  124. lx_annotate-1.2.3/staticfiles/AnonymizationOverview.js +0 -1
  125. lx_annotate-1.2.3/staticfiles/FrameAnnotation.css +0 -1
  126. lx_annotate-1.2.3/staticfiles/FrameAnnotation.js +0 -1
  127. lx_annotate-1.2.3/staticfiles/ReportEditorPage.css +0 -1
  128. lx_annotate-1.2.3/staticfiles/ReportEditorPage.js +0 -4
  129. lx_annotate-1.2.3/staticfiles/ReportExportPage.js +0 -3
  130. lx_annotate-1.2.3/staticfiles/ReportingShell.css +0 -1
  131. lx_annotate-1.2.3/staticfiles/ReportingShell.js +0 -1
  132. lx_annotate-1.2.3/staticfiles/Timeline.css +0 -1
  133. lx_annotate-1.2.3/staticfiles/Timeline.js +0 -2
  134. lx_annotate-1.2.3/staticfiles/VideoExamination.css +0 -1
  135. lx_annotate-1.2.3/staticfiles/VideoExamination.js +0 -1
  136. lx_annotate-1.2.3/staticfiles/main.js +0 -39
  137. lx_annotate-1.2.3/staticfiles/mediaUrls.js +0 -1
  138. lx_annotate-1.2.3/staticfiles/reportingPresentation.js +0 -1
  139. lx_annotate-1.2.3/staticfiles/useDebug.js +0 -1
  140. lx_annotate-1.2.3/staticfiles/useReportTemplates.js +0 -1
  141. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/.gitignore +0 -0
  142. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/LICENSE +0 -0
  143. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/README.md +0 -0
  144. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/__init__.py +0 -0
  145. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/admin.py +0 -0
  146. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/asgi.py +0 -0
  147. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/celery.py +0 -0
  148. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/cli.py +0 -0
  149. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/dtypes_api_urls.py +0 -0
  150. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/file_watcher.py +0 -0
  151. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/__init__.py +0 -0
  152. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_audit.py +0 -0
  153. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_cleanup.py +0 -0
  154. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_contracts.py +0 -0
  155. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_envelope.py +0 -0
  156. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_health.py +0 -0
  157. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_jobs.py +0 -0
  158. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_payloads.py +0 -0
  159. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_reconciliation.py +0 -0
  160. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_state.py +0 -0
  161. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/hub_export_worker.py +0 -0
  162. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/node_provisioning.py +0 -0
  163. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_balance_worker.py +0 -0
  164. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_ingest.py +0 -0
  165. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_orchestration.py +0 -0
  166. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_provider.py +0 -0
  167. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_publication.py +0 -0
  168. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_reconciliation.py +0 -0
  169. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_recovery.py +0 -0
  170. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_rekey.py +0 -0
  171. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_report_provider.py +0 -0
  172. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_resolver.py +0 -0
  173. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_telemetry.py +0 -0
  174. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/storage_transfer_client.py +0 -0
  175. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/hub/transfer_transport.py +0 -0
  176. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/__init__.py +0 -0
  177. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/__init__.py +0 -0
  178. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/check_hub_export_health.py +0 -0
  179. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/check_migration_compatibility.py +0 -0
  180. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/dispatch_hub_export_recovery.py +0 -0
  181. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/export_openapi.py +0 -0
  182. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/export_route_manifest.py +0 -0
  183. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/provision_hub_nodes.py +0 -0
  184. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/reap_verified_hub_exports.py +0 -0
  185. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/recover_runtime_data.py +0 -0
  186. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/repair_legacy_migration_history.py +0 -0
  187. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/repair_managed_payloads.py +0 -0
  188. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/run_filewatcher.py +0 -0
  189. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/runtime_acceptance.py +0 -0
  190. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/start_filewatcher.py +0 -0
  191. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/management/commands/verify_encrypted_storage.py +0 -0
  192. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/middleware/__init__.py +0 -0
  193. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/middleware/lookup_tracker.py +0 -0
  194. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migration_history_safety.py +0 -0
  195. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/0001_outboundhubtransferjob.py +0 -0
  196. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/0002_outboundhubtransferjob_local_cleanup_fields.py +0 -0
  197. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/0003_outboundhubtransferjob_failure_class.py +0 -0
  198. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/0004_storagenodeactionreceipt.py +0 -0
  199. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/0005_storageoperatordispatchreceipt.py +0 -0
  200. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/0006_storageartifactpublication.py +0 -0
  201. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/0007_outbound_hub_receipt_cleanup.py +0 -0
  202. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/__init__.py +0 -0
  203. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/migrations/max_migration.txt +0 -0
  204. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/models.py +0 -0
  205. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/operational_support.py +0 -0
  206. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/runtime_commands/__init__.py +0 -0
  207. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/serializers.py +0 -0
  208. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/services/__init__.py +0 -0
  209. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/services/access_management.py +0 -0
  210. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/services/runtime_recovery.py +0 -0
  211. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/__init__.py +0 -0
  212. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/config.py +0 -0
  213. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/oidc.py +0 -0
  214. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/secret_key.py +0 -0
  215. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/settings_prod.py +0 -0
  216. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/settings/settings_test.py +0 -0
  217. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/signals.py +0 -0
  218. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/storage/__init__.py +0 -0
  219. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/storage/encrypted.py +0 -0
  220. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/storage/encryption.py +0 -0
  221. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/tasks.py +0 -0
  222. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/templates/base.html +0 -0
  223. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/urls.py +0 -0
  224. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/__init__.py +0 -0
  225. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/administration.py +0 -0
  226. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/application_settings.py +0 -0
  227. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/frame_annotation.py +0 -0
  228. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/hub_export.py +0 -0
  229. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/quarantine.py +0 -0
  230. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/study_export.py +0 -0
  231. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/views/video_state_repair.py +0 -0
  232. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/lx_annotate/wsgi.py +0 -0
  233. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/manage.py +0 -0
  234. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AboutUs.js +0 -0
  235. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AiDatasetBucketsPage.css +0 -0
  236. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AiDatasetSettingsPage.css +0 -0
  237. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnnotationDashboard.css +0 -0
  238. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnonymizationCorrectionComponent.css +0 -0
  239. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnonymizationEvaluation.css +0 -0
  240. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnonymizationMetrics.css +0 -0
  241. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/AnonymizationValidationComponent.css +0 -0
  242. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ApplicationSettingsPage.css +0 -0
  243. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/CaseSetupPage.css +0 -0
  244. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ColoReg.png +0 -0
  245. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Comfortaa-Bold.ttf +0 -0
  246. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Comfortaa-Regular.ttf +0 -0
  247. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Documentation.css +0 -0
  248. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Documentation.js +0 -0
  249. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Export.css +0 -0
  250. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/FindingsCapturePage.css +0 -0
  251. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/FrameSelectorPage.css +0 -0
  252. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/HubExport.css +0 -0
  253. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ModelTrainingPage.css +0 -0
  254. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PageOverview.css +0 -0
  255. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PatientDocumentsPage.css +0 -0
  256. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PatientMedicationPage.css +0 -0
  257. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/PatientOverview.css +0 -0
  258. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/Profile.js +0 -0
  259. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/ReportTemplateBuilderPage.css +0 -0
  260. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/StudyCohortPage.css +0 -0
  261. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/annotationPrincipal.js +0 -0
  262. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/dateHelpers.js +0 -0
  263. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/.buildinfo +0 -0
  264. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/SETUP_GUIDE.md.txt +0 -0
  265. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/api/index.md.txt +0 -0
  266. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/ai-training-data-export.md.txt +0 -0
  267. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/anonymization-validation-correction-workflow.md.txt +0 -0
  268. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/asset-deployment.md.txt +0 -0
  269. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/core-concept-contract.md.txt +0 -0
  270. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/core-concept-readiness-verdict.md.txt +0 -0
  271. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/core-concept-type-matrix.md.txt +0 -0
  272. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/deployment-strategy.md.txt +0 -0
  273. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/dtypes-findings-migration.md.txt +0 -0
  274. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/encrypted-model-weights-inference.md.txt +0 -0
  275. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/encrypted-storage-process.md.txt +0 -0
  276. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/frame-annotation-availability.md.txt +0 -0
  277. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/general-documentation.md.txt +0 -0
  278. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/hub-export-workflow.md.txt +0 -0
  279. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/hub-storage-load-balancing.md.txt +0 -0
  280. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/openapi-type-generation.md.txt +0 -0
  281. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/pypi.md.txt +0 -0
  282. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/reporting-shell-aaa-testing.md.txt +0 -0
  283. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/reporting-template-requirements-page.md.txt +0 -0
  284. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/runtime-environment-contract-test.md.txt +0 -0
  285. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/secure-backup-disaster-recovery.md.txt +0 -0
  286. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/segment-annotation-workflow.md.txt +0 -0
  287. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/terminology-delivery.md.txt +0 -0
  288. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/guides/wheel-deployment.md.txt +0 -0
  289. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_sources/index.md.txt +0 -0
  290. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/basic.css +0 -0
  291. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/check-solid.svg +0 -0
  292. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/clipboard.min.js +0 -0
  293. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/copy-button.svg +0 -0
  294. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/copybutton.css +0 -0
  295. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/copybutton.js +0 -0
  296. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/copybutton_funcs.js +0 -0
  297. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/debug.css +0 -0
  298. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/doctools.js +0 -0
  299. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/file.png +0 -0
  300. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/language_data.js +0 -0
  301. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/minus.png +0 -0
  302. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/plus.png +0 -0
  303. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/pygments.css +0 -0
  304. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/scripts/furo-extensions.js +0 -0
  305. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/scripts/furo.js +0 -0
  306. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/scripts/furo.js.LICENSE.txt +0 -0
  307. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/scripts/furo.js.map +0 -0
  308. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/searchtools.js +0 -0
  309. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/skeleton.css +0 -0
  310. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/sphinx_highlight.js +0 -0
  311. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/styles/furo-extensions.css +0 -0
  312. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/styles/furo-extensions.css.map +0 -0
  313. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/styles/furo.css +0 -0
  314. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/_static/styles/furo.css.map +0 -0
  315. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/objects.inv +0 -0
  316. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/py-modindex.html +0 -0
  317. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/docs/searchindex.js +0 -0
  318. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/img/favicon.png +0 -0
  319. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/main.css +0 -0
  320. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/nucleo-icons.eot +0 -0
  321. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/nucleo-icons.svg +0 -0
  322. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/nucleo-icons.ttf +0 -0
  323. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/nucleo-icons.woff +0 -0
  324. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/nucleo-icons.woff2 +0 -0
  325. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/pdf.js +0 -0
  326. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/pdf.worker.min.js +0 -0
  327. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/pdf.worker.min.mjs +0 -0
  328. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/reportTemplateLifecycleContext.js +0 -0
  329. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/reportingError.js +0 -0
  330. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/reportingExaminationResolution.js +0 -0
  331. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/reportingIndicationContract.js +0 -0
  332. {lx_annotate-1.2.3 → lx_annotate-1.2.4}/staticfiles/useReportTemplates.css +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lx-annotate
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: This webapp provides a frontend interface for pseudonymizing and annotating data and applying AI predictions.
5
5
  Author-email: Max Hild <hild_m@ukw.de>, "Thomas J. Lux" <lux_t1@ukw.de>
6
6
  Maintainer: Hamza Zahid
@@ -14,6 +14,7 @@ Classifier: Operating System :: POSIX :: Linux
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
16
16
  Requires-Python: <3.13,>=3.12.0
17
+ Requires-Dist: asgiref>=3.12.1
17
18
  Requires-Dist: celery>=5.5.3
18
19
  Requires-Dist: cryptography>=45.0.0
19
20
  Requires-Dist: daphne>=4.2.1
@@ -28,9 +29,9 @@ Requires-Dist: django-webpack-loader>=0.7.0
28
29
  Requires-Dist: django==6.0.3
29
30
  Requires-Dist: djangorestframework>=3.12.4
30
31
  Requires-Dist: drf-spectacular>=0.28.0
31
- Requires-Dist: endoreg-db==1.2.0
32
+ Requires-Dist: endoreg-db==1.2.5
32
33
  Requires-Dist: gunicorn>=23.0.0
33
- Requires-Dist: lx-dtypes==0.2.37
34
+ Requires-Dist: lx-dtypes==0.3.1
34
35
  Requires-Dist: mozilla-django-oidc>=4.0.1
35
36
  Requires-Dist: numpy>=1.21.0
36
37
  Requires-Dist: pillow>=9.0.0
@@ -14,6 +14,7 @@ from lx_annotate.views.administration import (
14
14
  )
15
15
  from lx_annotate.views.anonymization_overview import (
16
16
  LifecycleAnonymizationOverviewView,
17
+ LifecycleUploadJobDismissView,
17
18
  LifecycleUploadJobRetryView,
18
19
  )
19
20
  from lx_annotate.views.application_settings import primary_annotation_settings_detail
@@ -25,11 +26,25 @@ from lx_annotate.views.hub_export import (
25
26
  hub_export_retry,
26
27
  hub_export_unmark,
27
28
  )
29
+ from lx_annotate.views.monitoring import monitoring_snapshot
28
30
  from lx_annotate.views.quarantine import quarantine_overview
31
+ from lx_annotate.views.report_llm import report_llm_generate, report_llm_status
29
32
  from lx_annotate.views.study_export import study_export_options, study_export_xlsx
30
33
  from lx_annotate.views.video_state_repair import VideoStateRepairView
31
34
 
32
35
  urlpatterns = [
36
+ path(
37
+ "administration/monitoring/",
38
+ monitoring_snapshot,
39
+ name="administration-monitoring",
40
+ ),
41
+ path("reporting/llm/status/", report_llm_status, name="report-llm-status"),
42
+ path("reporting/llm/generate/", report_llm_generate, name="report-llm-generate"),
43
+ path(
44
+ "anonymization/upload-jobs/<uuid:job_id>/dismiss/",
45
+ LifecycleUploadJobDismissView.as_view(),
46
+ name="anonymization_upload_job_dismiss",
47
+ ),
33
48
  path(
34
49
  "anonymization/items/overview/",
35
50
  LifecycleAnonymizationOverviewView.as_view(),
@@ -56,7 +56,7 @@ class LxAnnotateConfig(AppConfig):
56
56
  from . import (
57
57
  checks,
58
58
  signals, # noqa: F401
59
- )
59
+ ) # type: ignore
60
60
 
61
61
  command = sys.argv[1] if len(sys.argv) > 1 else ""
62
62
  if not self._should_skip_runtime_checks(command):
@@ -531,12 +531,18 @@ def _knowledge_base_registry_messages() -> list[CheckMessage]:
531
531
  return []
532
532
 
533
533
 
534
- def lx_annotate_environment_checks(app_configs, **kwargs): # type: ignore[unused-argument]
534
+ def runtime_configuration_messages() -> list[CheckMessage]:
535
+ """Collect configuration checks shared by startup and runtime monitoring."""
535
536
  messages: list[CheckMessage] = []
536
537
  messages.extend(_native_capability_messages())
537
538
  messages.extend(_environment_readiness_messages())
538
539
  messages.extend(_protected_media_url_messages())
539
540
  messages.extend(_protected_media_root_messages())
541
+ return messages
542
+
543
+
544
+ def lx_annotate_environment_checks(app_configs, **kwargs): # type: ignore[unused-argument]
545
+ messages = runtime_configuration_messages()
540
546
  messages.extend(_host_models_module_messages())
541
547
  messages.extend(_knowledge_base_registry_messages())
542
548
 
@@ -0,0 +1,30 @@
1
+ from django.core.management.base import BaseCommand, CommandError, CommandParser
2
+
3
+ from lx_annotate.monitoring.service import build_monitoring_snapshot
4
+
5
+
6
+ class Command(BaseCommand):
7
+ help = "Read-only runtime monitoring (exit 0 healthy, 1 warning, 2 error)."
8
+ requires_system_checks = [] # type: ignore[assignment]
9
+
10
+ def add_arguments(self, parser: CommandParser) -> None:
11
+ parser.add_argument("--format", choices=["json", "text"], default="json")
12
+
13
+ def handle(self, *args: object, **options: object) -> None:
14
+ del args
15
+ snapshot = build_monitoring_snapshot()
16
+ if options["format"] == "json":
17
+ self.stdout.write(snapshot.model_dump_json())
18
+ else:
19
+ self.stdout.write(
20
+ f"{snapshot.status.upper()} version={snapshot.version or 'unknown'} observed_at={snapshot.observed_at.isoformat()}"
21
+ )
22
+ for check in snapshot.checks:
23
+ self.stdout.write(
24
+ f"{check.status.upper()} {check.key}: {check.summary}"
25
+ )
26
+ if snapshot.status != "ok":
27
+ raise CommandError(
28
+ "Runtime monitoring reported an unhealthy state.",
29
+ returncode=2 if snapshot.status == "error" else 1,
30
+ )
@@ -0,0 +1 @@
1
+ """Read-only administrator diagnostics; API and command share one snapshot."""
@@ -0,0 +1,31 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ from django.conf import settings
6
+
7
+ from .contracts import MonitoringConfiguration, StorageLocation
8
+
9
+ MAX_CONFIGURATION_BYTES = 65536
10
+
11
+
12
+ def load_configuration() -> tuple[MonitoringConfiguration, bool]:
13
+ """Only deployment-owned configuration; request parameters never enter here."""
14
+ configured = str(
15
+ getattr(settings, "LX_ANNOTATE_MONITORING_CONFIG_FILE", "")
16
+ ).strip()
17
+ if configured:
18
+ with Path(configured).open("rb") as stream:
19
+ content = stream.read(MAX_CONFIGURATION_BYTES + 1)
20
+ if len(content) > MAX_CONFIGURATION_BYTES:
21
+ raise ValueError("Monitoring configuration exceeds its size limit")
22
+ return MonitoringConfiguration.model_validate_json(content), True
23
+ return MonitoringConfiguration(
24
+ storage=[
25
+ StorageLocation(key="protected_data", path=Path(settings.APP_DATA_DIR)),
26
+ StorageLocation(key="media", path=Path(settings.PROTECTED_MEDIA_ROOT)),
27
+ StorageLocation(
28
+ key="terminology", path=Path(settings.LX_DTYPES_TERMINOLOGY_IMPORT_ROOT)
29
+ ),
30
+ ]
31
+ ), False
@@ -0,0 +1,98 @@
1
+ from __future__ import annotations
2
+
3
+ from datetime import datetime
4
+ from pathlib import Path
5
+ from typing import Annotated, Literal, Self
6
+
7
+ from pydantic import BaseModel, ConfigDict, Field, JsonValue, model_validator
8
+
9
+ CheckStatus = Literal["ok", "warning", "error", "unknown"]
10
+ SnapshotStatus = Literal["ok", "warning", "error"]
11
+ SafeKey = Annotated[str, Field(pattern=r"^[a-z][a-z0-9_.-]{0,63}$")]
12
+
13
+
14
+ class MonitoringCheck(BaseModel):
15
+ model_config = ConfigDict(extra="forbid", frozen=True)
16
+ key: str = Field(pattern=r"^[a-z][a-z0-9_.-]{0,95}$")
17
+ status: CheckStatus
18
+ summary: str
19
+ detail: str | None = None
20
+ observed_at: datetime
21
+ metadata: dict[str, JsonValue] = Field(default_factory=dict)
22
+
23
+
24
+ def aggregate_status(checks: list[MonitoringCheck]) -> SnapshotStatus:
25
+ if any(check.status == "error" for check in checks):
26
+ return "error"
27
+ if not checks or any(check.status in {"warning", "unknown"} for check in checks):
28
+ return "warning"
29
+ return "ok"
30
+
31
+
32
+ class MonitoringSnapshot(BaseModel):
33
+ model_config = ConfigDict(extra="forbid", frozen=True)
34
+ schema_version: Literal[1] = 1
35
+ status: SnapshotStatus
36
+ observed_at: datetime
37
+ version: str | None
38
+ checks: list[MonitoringCheck]
39
+
40
+ @model_validator(mode="after")
41
+ def consistent_status(self) -> Self:
42
+ if self.status != aggregate_status(self.checks):
43
+ raise ValueError("Snapshot status must match its checks")
44
+ if len({check.key for check in self.checks}) != len(self.checks):
45
+ raise ValueError("Check keys must be unique")
46
+ return self
47
+
48
+
49
+ class StorageLocation(BaseModel):
50
+ model_config = ConfigDict(extra="forbid", frozen=True)
51
+ key: SafeKey
52
+ path: Path
53
+ required: bool = True
54
+ writable: bool = True
55
+
56
+ @model_validator(mode="after")
57
+ def absolute_path(self) -> Self:
58
+ if not self.path.is_absolute():
59
+ raise ValueError("Storage locations must be absolute")
60
+ return self
61
+
62
+
63
+ class ServiceExpectation(BaseModel):
64
+ model_config = ConfigDict(extra="forbid", frozen=True)
65
+ key: SafeKey
66
+ unit: str = Field(
67
+ pattern=r"^[A-Za-z0-9][A-Za-z0-9_.@:-]*\.(service|timer|socket|path)$",
68
+ max_length=160,
69
+ )
70
+ required: bool = True
71
+ expected_active: bool = True
72
+
73
+
74
+ class MonitoringConfiguration(BaseModel):
75
+ model_config = ConfigDict(extra="forbid", frozen=True)
76
+ schema_version: Literal[1] = 1
77
+ deployment_revision: str | None = Field(
78
+ default=None, pattern=r"^[0-9a-fA-F]{7,64}$"
79
+ )
80
+ services: list[ServiceExpectation] = Field(default_factory=list, max_length=40)
81
+ storage: list[StorageLocation] = Field(default_factory=list, max_length=24)
82
+ disk_warning_free_percent: float = Field(default=10, gt=0, lt=100)
83
+ disk_error_free_percent: float = Field(default=5, ge=0, lt=100)
84
+ pending_warning_seconds: int = Field(default=3600, ge=60, le=604800)
85
+ recent_failure_window_seconds: int = Field(default=86400, ge=60, le=604800)
86
+ systemctl_path: Path | None = None
87
+ systemctl_timeout_seconds: int = Field(default=3, ge=1, le=5)
88
+
89
+ @model_validator(mode="after")
90
+ def validate_invariants(self) -> Self:
91
+ if self.disk_error_free_percent >= self.disk_warning_free_percent:
92
+ raise ValueError("Disk error threshold must be below warning threshold")
93
+ for values in (self.services, self.storage):
94
+ if len({value.key for value in values}) != len(values):
95
+ raise ValueError("Monitoring aliases must be unique")
96
+ if self.systemctl_path is not None and not self.systemctl_path.is_absolute():
97
+ raise ValueError("systemctl executable must be absolute")
98
+ return self
@@ -0,0 +1,222 @@
1
+ from __future__ import annotations
2
+
3
+ from contextlib import contextmanager
4
+ from dataclasses import dataclass
5
+ from datetime import datetime, timedelta
6
+ from typing import Iterator
7
+
8
+ from django.apps import apps
9
+ from django.db import DatabaseError, connections
10
+ from django.db.backends.base.base import BaseDatabaseWrapper
11
+ from django.db.migrations.exceptions import InconsistentMigrationHistory
12
+ from django.db.migrations.executor import MigrationExecutor
13
+ from django.utils import timezone
14
+ from django.utils.dateparse import parse_datetime
15
+
16
+ from lx_annotate.migration_history_safety import (
17
+ MigrationHistorySafetyError,
18
+ check_migration_compatibility,
19
+ )
20
+
21
+ from .contracts import MonitoringCheck, MonitoringConfiguration
22
+
23
+
24
+ @contextmanager
25
+ def diagnostic_connection() -> Iterator[BaseDatabaseWrapper]:
26
+ original = connections["default"]
27
+ if original.vendor == "sqlite":
28
+ # A copied in-memory SQLite connection is a different database.
29
+ yield original
30
+ return
31
+ connection = original.copy()
32
+ if connection.vendor == "postgresql":
33
+ options = dict(connection.settings_dict.get("OPTIONS", {}))
34
+ options["connect_timeout"] = 2
35
+ options["options"] = (
36
+ str(options.get("options", ""))
37
+ + " -c statement_timeout=2000 -c default_transaction_read_only=on"
38
+ )
39
+ connection.settings_dict["OPTIONS"] = options
40
+ try:
41
+ yield connection
42
+ finally:
43
+ connection.close()
44
+
45
+
46
+ def check_connectivity(connection: BaseDatabaseWrapper) -> None:
47
+ with connection.cursor() as cursor:
48
+ cursor.execute("SELECT 1")
49
+ if cursor.fetchone() != (1,):
50
+ raise DatabaseError("Database probe did not return expected result")
51
+
52
+
53
+ def migration_check(connection: BaseDatabaseWrapper, now: datetime) -> MonitoringCheck:
54
+ try:
55
+ plans = check_migration_compatibility(connection)
56
+ executor = MigrationExecutor(connection)
57
+ loader = executor.loader
58
+ loader.check_consistent_history(connection)
59
+ recognized = set(loader.disk_migrations)
60
+ for migration in loader.replacements.values():
61
+ recognized.update(migration.replaces)
62
+ unknown = set(loader.applied_migrations) - recognized
63
+ if unknown or any(
64
+ plan.status not in {"canonical", "empty", "current", "no_history"}
65
+ and plan.additions
66
+ for plan in plans
67
+ ):
68
+ return MonitoringCheck(
69
+ key="database.migrations",
70
+ status="error",
71
+ summary="Recorded migrations are incompatible with installed packages.",
72
+ observed_at=now,
73
+ metadata={
74
+ "reason_code": "unknown_or_legacy_history",
75
+ "unknown_count": len(unknown),
76
+ },
77
+ )
78
+ pending = executor.migration_plan(loader.graph.leaf_nodes())
79
+ return MonitoringCheck(
80
+ key="database.migrations",
81
+ status="warning" if pending else "ok",
82
+ summary="Unapplied migrations require attention."
83
+ if pending
84
+ else "Migration history is consistent and current.",
85
+ observed_at=now,
86
+ metadata={
87
+ "reason_code": "unapplied" if pending else "current",
88
+ "unapplied_count": len(pending),
89
+ },
90
+ )
91
+ except (MigrationHistorySafetyError, InconsistentMigrationHistory):
92
+ return MonitoringCheck(
93
+ key="database.migrations",
94
+ status="error",
95
+ summary="Recorded migrations are incompatible with installed packages.",
96
+ detail="Run check_migration_compatibility and review the installed release before migrating.",
97
+ observed_at=now,
98
+ metadata={"reason_code": "incompatible_history"},
99
+ )
100
+
101
+
102
+ @dataclass(frozen=True)
103
+ class JobSource:
104
+ key: str
105
+ model_name: str
106
+ pending: tuple[str, ...]
107
+ processing: tuple[str, ...]
108
+ failed: tuple[str, ...]
109
+ lease_field: str | None = None
110
+
111
+
112
+ JOB_SOURCES = (
113
+ JobSource(
114
+ "ingestion",
115
+ "UploadJob",
116
+ ("pending", "retrying"),
117
+ ("processing",),
118
+ ("error", "lost"),
119
+ "processing_lease_expires_at",
120
+ ),
121
+ JobSource(
122
+ "hls",
123
+ "VideoHlsArtifact",
124
+ ("queued",),
125
+ ("materializing", "validated"),
126
+ ("failed",),
127
+ ),
128
+ JobSource(
129
+ "video_processing",
130
+ "VideoProcessingHistory",
131
+ ("pending",),
132
+ ("running",),
133
+ ("failure",),
134
+ ),
135
+ JobSource(
136
+ "report_import",
137
+ "ReportImportAttempt",
138
+ ("idle",),
139
+ ("active",),
140
+ ("failed", "lost"),
141
+ "lease_expires_at",
142
+ ),
143
+ )
144
+
145
+
146
+ def processing_check(
147
+ connection: BaseDatabaseWrapper,
148
+ source: JobSource,
149
+ config: MonitoringConfiguration,
150
+ now: datetime,
151
+ ) -> MonitoringCheck:
152
+ """Single aggregate query per existing ledger; no jobs or patient data leave it."""
153
+ model = apps.get_model("endoreg_db", source.model_name)
154
+ quote = connection.ops.quote_name
155
+ table = quote(model._meta.db_table)
156
+ status_column = quote(model._meta.get_field("status").column)
157
+ created = quote(model._meta.get_field("created_at").column)
158
+ updated = quote(model._meta.get_field("updated_at").column)
159
+ parameters: list[str | datetime] = []
160
+
161
+ def predicate(states: tuple[str, ...]) -> str:
162
+ parameters.extend(states)
163
+ return f"{status_column} IN ({','.join(['%s'] * len(states))})"
164
+
165
+ expressions = [
166
+ f"COUNT(CASE WHEN {predicate(states)} THEN 1 END)"
167
+ for states in (source.pending, source.processing, source.failed)
168
+ ]
169
+ expressions.append(
170
+ f"COUNT(CASE WHEN {predicate(source.failed)} AND {updated} >= %s THEN 1 END)"
171
+ )
172
+ parameters.append(now - timedelta(seconds=config.recent_failure_window_seconds))
173
+ expressions.append(f"MIN(CASE WHEN {predicate(source.pending)} THEN {created} END)")
174
+ if source.lease_field:
175
+ lease = quote(model._meta.get_field(source.lease_field).column)
176
+ expressions.append(
177
+ f"COUNT(CASE WHEN {predicate(source.processing)} AND {lease} <= %s THEN 1 END)"
178
+ )
179
+ parameters.append(now)
180
+ else:
181
+ expressions.append("0")
182
+ with connection.cursor() as cursor:
183
+ cursor.execute(f"SELECT {', '.join(expressions)} FROM {table}", parameters)
184
+ row = cursor.fetchone()
185
+ if row is None:
186
+ raise DatabaseError("Missing aggregate result")
187
+ pending, processing, failed, recent, oldest, expired = row
188
+ if isinstance(oldest, str):
189
+ oldest = parse_datetime(oldest)
190
+ if isinstance(oldest, datetime) and timezone.is_naive(oldest):
191
+ oldest = timezone.make_aware(oldest)
192
+ age = (
193
+ max(0, int((now - oldest).total_seconds()))
194
+ if isinstance(oldest, datetime)
195
+ else None
196
+ )
197
+ stalled = bool(expired) or (
198
+ age is not None and age >= config.pending_warning_seconds
199
+ )
200
+ return MonitoringCheck(
201
+ key=f"processing.{source.key}",
202
+ status="warning" if failed or stalled else "ok",
203
+ summary="Processing failures or delayed work require attention."
204
+ if failed or stalled
205
+ else "No processing failures or overdue pending work observed.",
206
+ observed_at=now,
207
+ metadata={
208
+ "pending": int(pending),
209
+ "processing": int(processing),
210
+ "failed": int(failed),
211
+ "recent_failure_count": int(recent),
212
+ "recent_failure_window_seconds": config.recent_failure_window_seconds,
213
+ "oldest_pending_at": oldest.isoformat()
214
+ if isinstance(oldest, datetime)
215
+ else None,
216
+ "oldest_pending_age_seconds": age,
217
+ "pending_warning_seconds": config.pending_warning_seconds,
218
+ "expired_processing_leases": int(expired),
219
+ "pending_overdue": age is not None
220
+ and age >= config.pending_warning_seconds,
221
+ },
222
+ )
@@ -0,0 +1,179 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import subprocess
5
+ from datetime import datetime
6
+ from pathlib import Path
7
+
8
+ from .contracts import MonitoringCheck, MonitoringConfiguration, StorageLocation
9
+
10
+
11
+ def storage_check(
12
+ location: StorageLocation, config: MonitoringConfiguration, now: datetime
13
+ ) -> MonitoringCheck:
14
+ """Permissions + statvfs only: no write probes or media directory enumeration."""
15
+ exists = location.path.is_dir()
16
+ readable = exists and os.access(
17
+ location.path, os.R_OK | os.X_OK, effective_ids=True
18
+ )
19
+ writable = exists and os.access(
20
+ location.path, os.W_OK | os.X_OK, effective_ids=True
21
+ )
22
+ metadata = {
23
+ "exists": exists,
24
+ "readable": readable,
25
+ "writable": writable,
26
+ "write_required": location.writable,
27
+ "required": location.required,
28
+ "warning_free_percent": config.disk_warning_free_percent,
29
+ "error_free_percent": config.disk_error_free_percent,
30
+ "write_check": "permissions_and_mount_flags",
31
+ }
32
+ status = "ok"
33
+ summary = "Storage is accessible."
34
+ if exists:
35
+ usage = os.statvfs(location.path)
36
+ writable = writable and not bool(usage.f_flag & os.ST_RDONLY)
37
+ metadata["writable"] = writable
38
+ free = usage.f_bavail * usage.f_frsize
39
+ total = usage.f_blocks * usage.f_frsize
40
+ percent = 100 * free / total if total else 0
41
+ metadata.update(
42
+ free_bytes=free, total_bytes=total, free_percent=round(percent, 2)
43
+ )
44
+ if percent <= config.disk_error_free_percent:
45
+ status, summary = "error", "Disk free space is below the safety threshold."
46
+ elif percent <= config.disk_warning_free_percent:
47
+ status, summary = (
48
+ "warning",
49
+ "Disk free space is approaching the safety threshold.",
50
+ )
51
+ if not exists or not readable or (location.writable and not writable):
52
+ status = "error" if location.required else "warning"
53
+ summary = (
54
+ "Required storage access is unavailable."
55
+ if location.required
56
+ else "Optional storage access is unavailable."
57
+ )
58
+ return MonitoringCheck(
59
+ key=f"storage.{location.key}",
60
+ status=status,
61
+ summary=summary,
62
+ observed_at=now,
63
+ metadata=metadata,
64
+ )
65
+
66
+
67
+ def read_systemd(
68
+ executable: Path, units: list[str], timeout: int = 3
69
+ ) -> dict[str, dict[str, str]]:
70
+ result = subprocess.run(
71
+ [
72
+ str(executable),
73
+ "--no-pager",
74
+ "show",
75
+ "--property=Id,LoadState,ActiveState,SubState,Result",
76
+ "--",
77
+ *units,
78
+ ],
79
+ capture_output=True,
80
+ text=True,
81
+ timeout=timeout,
82
+ check=False,
83
+ env={"PATH": "/usr/bin:/bin", "LC_ALL": "C", "SYSTEMD_COLORS": "0"},
84
+ )
85
+ if result.returncode != 0 or len(result.stdout) > 65536:
86
+ raise RuntimeError("Service observations unavailable")
87
+ observations: dict[str, dict[str, str]] = {}
88
+ for block in result.stdout.strip().split("\n\n"):
89
+ fields = dict(line.split("=", 1) for line in block.splitlines() if "=" in line)
90
+ if fields.get("Id") in units:
91
+ observations[fields["Id"]] = fields
92
+ return observations
93
+
94
+
95
+ def service_checks(
96
+ config: MonitoringConfiguration, now: datetime
97
+ ) -> list[MonitoringCheck]:
98
+ if not config.services:
99
+ return [
100
+ MonitoringCheck(
101
+ key="services.configuration",
102
+ status="unknown",
103
+ summary="Expected services have not been declared.",
104
+ observed_at=now,
105
+ )
106
+ ]
107
+ observed = (
108
+ read_systemd(
109
+ config.systemctl_path,
110
+ [s.unit for s in config.services],
111
+ config.systemctl_timeout_seconds,
112
+ )
113
+ if config.systemctl_path
114
+ else {}
115
+ )
116
+ results: list[MonitoringCheck] = []
117
+ for service in config.services:
118
+ state = observed.get(service.unit)
119
+ if state is None:
120
+ status, summary = "unknown", "Service state could not be observed."
121
+ elif (
122
+ state.get("LoadState") == "loaded"
123
+ and state.get("ActiveState") == "inactive"
124
+ and not service.expected_active
125
+ ):
126
+ status, summary = "ok", "Service is available for on-demand activation."
127
+ elif state.get("LoadState") != "loaded" or state.get("ActiveState") not in {
128
+ "active",
129
+ "reloading",
130
+ }:
131
+ status = "error" if service.required else "warning"
132
+ summary = "Expected service is not running."
133
+ else:
134
+ status, summary = "ok", "Service is running."
135
+ # Only fixed systemd state vocabulary reaches the API; never journal text.
136
+ allowed = {
137
+ "loaded",
138
+ "not-found",
139
+ "masked",
140
+ "active",
141
+ "inactive",
142
+ "failed",
143
+ "activating",
144
+ "deactivating",
145
+ "reloading",
146
+ "running",
147
+ "exited",
148
+ "dead",
149
+ "waiting",
150
+ "listening",
151
+ "success",
152
+ "exit-code",
153
+ "signal",
154
+ "timeout",
155
+ "watchdog",
156
+ "start-limit-hit",
157
+ "resources",
158
+ "core-dump",
159
+ }
160
+ metadata = {
161
+ key: value if value in allowed else "unknown"
162
+ for key, value in (state or {}).items()
163
+ if key in {"LoadState", "ActiveState", "SubState", "Result"}
164
+ }
165
+ metadata["unit"] = service.unit
166
+ results.append(
167
+ MonitoringCheck(
168
+ key=f"services.{service.key}",
169
+ status=status,
170
+ summary=summary,
171
+ observed_at=now,
172
+ metadata={
173
+ **metadata,
174
+ "required": service.required,
175
+ "expected_active": service.expected_active,
176
+ },
177
+ )
178
+ )
179
+ return results