Web Interface

Hello, I am attempting to develop a custom web interface that meets my needs to display the contents of Orthanc. Is it appropriate to use PHP and query the REST API directly during page loads? Or should I be creating a list of patients, studies, etc and storing metadata in an RDBMS.

The reason I ask, for example, is because I don't see a good way to find a patient by name without querying /patients and looping through the results, running more queries (1+ for each patient) to map the id returned by /patients to names. I assume the number of queries will eventually overload Orthanc. Am I correct?

Hello,

Thanks for your feedback!

Hello, I am attempting to develop a custom web interface that meets my needs to display the contents of Orthanc. Is it appropriate to use PHP and query the REST API directly during page loads? Or should I be creating a list of patients, studies, etc and storing metadata in an RDBMS.

You should indeed use the REST API directly to ensure data consistency, through e.g. the curl module for PHP [1].

The reason I ask, for example, is because I don’t see a good way to find a patient by name without querying /patients and looping through the results, running more queries (1+ for each patient) to map the id returned by /patients to names. I assume the number of queries will eventually overload Orthanc. Am I correct?

It is planned to improve the searching capabilities of Orthanc in the following releases (as described in your message), but this is not currently implemented.

However, Orthanc is inherently multi-threaded, so you can make several HTTP requests in parallel from PHP [2,3]. This is actually what is currently done in Orthanc Explorer (the embedded Web-based GUI of Orthanc): Modern Web browsers by default make several AJAX requests in parallel, and Orthanc is still responsive. The access to the embedded database is ruled by a mutex, which should prevent the overloading of Orthanc. If performance is a matter for you, you could also consider introducing a Web cache in front of Orthanc, such as Varnish Cache [4], which could regulate the requests to Orthanc.

HTH,
Sébastien-

[1] http://php.net/manual/en/book.curl.php
[2] http://stackoverflow.com/questions/12379801/simultaneous-http-requests-in-php-with-curl
[3] http://www.phpied.com/simultaneuos-http-requests-in-php-with-curl/
[4] https://www.varnish-cache.org/

Thanks for the input! Great work on Orthanc. It really works well.