In an environment of intense use of Orthanc and with little storage …
What would be the best practice mechanism to erase every X time, the index and the associated directories within OrthancStorage.
Assuming I’m using Orthanc-1.3.2 and the native database engine (SQLite)
Something rudimentary that I came up with is a script where I stop the Orthanc, delete everything in OrthancStorage (index and directories) and then start the service again.
But maybe it is not the safest and most efficient way
I would personally favor Alain’s solution, as it prevents the downtime of Orthanc, and as it allows to give a strict upper limit on the disk space that will be used by Orthanc at any time.
I have a question regarding this solution, how does the software determine what stays and what goes? In my use case, I was tasked with removing all patients that have not had new studies in over 3 months. For example, say a patient is the oldest one but it has received new studies recently. Which of the following statement is true when the MaximumStorageSize is reached?
Only the oldest studies are deleted.
The whole patient is deleted, including the recent studies.
Nothing is deleted from this patient and the next patient with the oldest studies is deleted instead.
I’m hoping that #3 is the current behavior but I’m fairly certain it will be #1 or 2 and would just like confirmation.
If it is as I suspect, what would be my possible solutions in implementing some sort of script that checks the patient’s latest entry and deletes anything that has over X months of age? Is LUA even an option or is the REST-API my only bet? I have very limited programming knowledge. My background is mostly in sysadmin work (PowerShell/bash scripting) so the simpler it is, the better, but I’m not afraid to learn.
I actually plan on doing something similar where after 3 months studies are purged from Orthanc, Out of curiosity how are you implementing this? I planned on using the REST API within Orthanc to delete resources.
I’ve simply gone and used the MaximumStorageSize option with enough leeway so that it would not be an issue. On this particular instance, ~150 GB of data is actually about a year of use and there was no requirement for absolutely getting rid of the data after 3 months, it was more a storage concern where it would fill up if left to its own devices so I set it to 200 GB and forgot about it. I have yet to fill it up completely after nearly a year and a half of use.
Sorry, I know it isn’t a very elegant or accurate solution and may not help you at all though if you do end up developing something on your end, please let me know!