Is there any documentation of the Postgress v6 Orthanc schema

991 views
Skip to first unread message

jamesa...@googlemail.com

unread,
May 3, 2016, 7:08:14 AM5/3/16
to Orthanc Users
Hello,
I was wondering if the database schema Orthanc uses in the postgres database is documented anywhere?

Thanks,
James

Sébastien Jodogne

unread,
May 3, 2016, 2:41:07 PM5/3/16
to Orthanc Users, jamesa...@googlemail.com
Hello,

Here is the link to the SQLite schema:

The PostgreSQL schema is essentially identical and can be found at:

There is however no textual description of these schema in English.

HTH,
Sébastien-

James Allsopp

unread,
May 4, 2016, 4:41:07 AM5/4/16
to Sébastien Jodogne, Orthanc Users
Thanks for that Sebastian. What I was trying to do is to use the database to find out where the raw uploaded Dicom images are kept, I was thinking that the uuid in the attached files table would be a filename in the directory specified by StorageDirectory in the configuration file. If you've a quick pointer in the right direction, that would be great.

Thanks,
James

Sébastien Jodogne

unread,
May 6, 2016, 3:14:58 AM5/6/16
to Orthanc Users, s.jo...@gmail.com, jamesa...@googlemail.com
That's indeed the case: The UUID of the attachment is used as the path inside "StorageDirectory".

To reduce the number of files in a single directory (which is something that can some OS do not like), a 3-level hierarchy of directories is created: The first two hexadecimal characters of the UUID give the first level path, the two next characters give the second level path.

However, pay attention to the fact that this is only true when using no database plugin for Orthanc (the PostgreSQL plugin can be configured to store the attachements inside a database). Furthermore, Orthanc can be configured to compress the attachments before writing them on the disk (cf. the "StorageCompression" option). Finally, by reading "StorageDirectory", you bypass all the locking mechanisms used by Orthanc.

As a consequence, it is HIGHLY recommended NOT to directly access "StorageDirectory" and the SQLite database. Use the REST API instead.

HTH,
Sébastien-

James Allsopp

unread,
May 6, 2016, 7:57:00 AM5/6/16
to Sébastien Jodogne, Orthanc Users
Thanks Sebastien, I'll use the REST API, as you say.

James
Reply all
Reply to author
Forward
0 new messages