add log when improt fails

This commit is contained in:
Ross
2026-06-03 20:26:12 +01:00
parent 213ee17328
commit 46518a45c1
2 changed files with 74 additions and 60 deletions
+1
View File
@@ -3575,6 +3575,7 @@ def uploads_import_htmx(request, case_id: int | None = None):
imported = import_dicoms_helper(request, case_id=case_id, dicoms=dicoms)
except Exception as exc:
logger.exception("Error during uploads import")
return HttpResponse(
f'<div class="alert alert-danger mb-0">Import failed: {escape(str(exc))}</div>',
status=500,
+73 -60
View File
@@ -1,67 +1,80 @@
on the case details page when mananging series clicking on a select button launches the series popup when it shouldn't.
on the condition details pages we should have an easier way to set parents and children
when building the series / stack description for the dv3d viewer we should take into account the plane and contrast if they are defined on the series model.
the casecollection form should use a widget for the prerequisites that supports autocomplete searching to allow for easy case selection. the selection options should be restricted to those cases that the user is an author of.
when importing cases we currently get the following error:
web-1 | 2026-06-03 20:20:04.612 | ERROR | atlas.views:uploads_import_htmx:3578 - Error during uploads import
web-1 | Traceback (most recent call last):
web-1 | File "/usr/src/app/atlas/views.py", line 3576, in uploads_import_htmx
web-1 | imported = import_dicoms_helper(request, case_id=case_id, dicoms=dicoms)
web-1 | File "/usr/src/app/atlas/api.py", line 280, in import_dicoms_helper
web-1 | series_image.save()
web-1 | File "/usr/src/app/generic/models.py", line 390, in save
web-1 | super().save(*args, **kwargs) # Call the "real" save() method.
web-1 | File "/opt/venv/lib/python3.14/site-packages/django/db/models/base.py", line 874, in save
web-1 | self.save_base(
web-1 | File "/opt/venv/lib/python3.14/site-packages/django/db/models/base.py", line 981, in save_base
web-1 | post_save.send(
web-1 | File "/opt/venv/lib/python3.14/site-packages/django/dispatch/dispatcher.py", line 209, in send
web-1 | response = receiver(signal=self, sender=sender, **named)
web-1 | File "/usr/src/app/atlas/models.py", line 1382, in _populate_case_study_date_on_series_image_save
web-1 | tags = instance.basic_dicom_tags or {}
web-1 | AttributeError: 'SeriesImage' object has no attribute 'basic_dicom_tags'
web-1 | Internal Server Error: /atlas/uploads/import/case/241
if a user has multiple uploads from the same patient waiting to be imported on the uploads page and more than one study in selected to import we should be able to import them and automatically create a set of cases with appropriate case series relations (by setting the model previous_case field appropriately). the workflow should be, multiple studies are selected -> enable the import into cases series button. clicking this should open a dialog that allows a user to set the fields from the CaseForm that will be duplicated across the series. a button at the bottoms should trigger the creation of the cases and import the series appropriately.
please add a unit test that demostrates the failure and then fix the bug and confirm that the unit test then passes.
please also check why when I add the
logger.exception("Error during uploads import")
error in production this does not seem to get shown anywhere. The only log just showed
ERROR 03/Jun/2026 11:52:50 django.request:249
Internal Server Error: /atlas/uploads/import
the online local settings are
DEBUG = False
INTERNAL_IPS = ["82.69.88.125", "217.155.198.96"]
#SECURE_SSL_REDIRECT = False
#SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'http')
#REMOTE_URL = "http://46.101.13.46:8123"
#
#MEDIA_ROOT = '/home/django/rad/media/'
STATIC_ROOT = '/home/ross/web/static/'
when opening the series detail page we get the following error: web-1 | [28/May/2026 22:24:52] "GET /atlas/series/936 HTTP/1.0" 500 158244
web-1 | /opt/venv/lib/python3.14/site-packages/pydicom/dataset.py:589: UserWarning: Invalid value 'DiffusionGradientDirection' used with the 'in' operator: must be an element tag as a 2-tuple or int, or an element keyword
web-1 | warn_and_log(msg)
#EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
we also get the following error when trying to view cases (in dev at least):
MemcacheError at /atlas/case/238/
if not DEBUG:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'log.txt',
'formatter': 'verbose'
},
},
'loggers': {
'django': {
'handlers':['file'],
'propagate': True,
'level':'DEBUG',
},
'atlas': {
'handlers': ['file'],
'level': 'DEBUG',
},
#"django.core.mail": {"handlers": ["console"], "level": "DEBUG", "propagate": False},
#"smtplib": {"handlers": ["console"], "level": "DEBUG", "propagate": False},
}
}
All servers seem to be down right now
Request Method: GET
Request URL: http://127.0.0.1/atlas/case/238/
Django Version: 6.0.1
Exception Type: MemcacheError
Exception Value:
All servers seem to be down right now
Exception Location: /opt/venv/lib/python3.14/site-packages/pymemcache/client/hash.py, line 182, in _get_client
Raised during: atlas.decorators.case_detail
Python Executable: /opt/venv/bin/python
Python Version: 3.14.5
Python Path:
['/usr/src/app',
'/usr/src/app',
'/usr/local/lib/python314.zip',
'/usr/local/lib/python3.14',
'/usr/local/lib/python3.14/lib-dynload',
'/opt/venv/lib/python3.14/site-packages']
Server time: Thu, 28 May 2026 22:28:21 +0100
Error during template rendering
In template /usr/src/app/atlas/templates/atlas/case_display_block.html, error at line 528
All servers seem to be down right now
518 </div>
519
520 </div>
521
522 <details id="dicom-viewer-details">
523 <summary>Viewer</summary>
524
525 <div id="main_viewer" class="dicom-viewer-root"
526 style="box-sizing: border-box; background: #222; width: 100%; height: 600px;"
527 data-auto-cache-stack="false"
528 data-named-stacks='{{case.get_case_named_stacks}}'
529 ></div>
530 </details>
531 <details class="series-panel" id="case-series-panel" open>
532 <summary class="series-panel-summary">
533 <span class="series-panel-title">Series</span>
534 <span class="series-panel-summary-actions">
535 <span class="series-panel-badge">{{ ordered_series|length }} total</span>
536 <button type="button"
537 class="btn btn-outline-primary btn-sm series-summary-btn"
538 id="series-import-uploads-btn"
we need a link to the case admin overview page in the admin menu.