I am running Orthanc on a QNAP TS-473A, The Orthanc DB was recently migrated to POSTGRESQL from the default SQL lite database, roughly two weeks afterwards it crashed. It is using the file directory for storage, POSTGRE is just used as a DB. Orthanc was crashing on startup and any attempts to load the explorer were met with 403 forbidden errors. I was able to get it back up by reinstalling Orthanc and it currently accepts new studies and explorer lists all of the previous ones but won’t open any of them.
Developer tools shows this when I try to open any of the older studies:
The storage folder is fine, all of the data blobs are still intact so I believe this is an issue with the database. I was able to walk up from a randomly chosen file and locate the study id which I then put into the explorer URL and the study page loaded after I ran this re-import command:
curl -X POST http://x.x.x.x:8042/instances
–data-binary “@/share/DATA/Storage/12/34/123431a9-cdd9-4b4d-b3c2-a0ed0f990c0e”
-H “Content-Type: application/dicom”
The study page loaded but appeared incomplete, I think because the blob I reimported was only part of the full study but any attempts I’ve made to try and locate all blobs associated with a particular study for testing have not worked.
I am currently attempting a reimport of all blobs using a python script that finds all blobs and then runs that same command but I am looking for suggestions on how to restore these older studies. I would think there has to be a way since the storage is still there and listing all studies. I believe the hierarchy/relationships between the blobs and the studies broke after the migration to POSTGRESQL. I ran some queries via PGADMIN that have been unable to locate any blobs associated with any study id I have given it.
I have verified that the headers on the individual blobs are intact as well using
/opt/bin/python3 -c "
import pydicom
ds = pydicom.dcmread
on a few individual blob files
I am hoping it is able to rebuild the relationships in the DB by a reimport but I am open to any other ideas as I have been at this a week and been unable to restore these.
I also tried this script:
But it failed with error: are these dicom files? I think because the study data is being stored in blobs instead of actual .dcm files.
I am happy to answer any questions or provide any information necessary.