Limit changes REST API to certain changeType

Hi,

As a feature request I would like to suggest extending the /changes REST API with an optional parameter that limits the results to a specific “ChangeType”, like e.g. "/changes?type=‘StableStudy’.

The reasoning behind this is that with a busy server and large amounts of data being moved from multiple sources the /changes list can become flooded with hundreds of “NewInstance” changes coming in per minute. If one has a script that monitors for “slower” events such as stable studies, new patients, etc. these can be quite hard to monitor. I have actually already observed that my script that is watching for “StablePatient” via the REST API missed this event a couple of times when too many instances came in at the same time. Making it possible to filter the changes request would make this a lot more efficient and stable because even on a very busy server the NewInstances could be filtered out.

best wishes
Martin

Hi Martin,

Ok, I’ve added it to our TODO in Orthanc. However, note that I’m quite surprised that your script is missing some of the events. With proper usage of ‘since’ and ‘limit’, this should not happen (https://api.orthanc-server.com/#tag/Tracking-changes/paths/~1changes/get).

HTH,

Alain.

Hi Alain,

thank you!

I know that it should not happen and I’m already looking into what might be the reason, I’m working with limit and last but while looking into my logs and the /changes REST API I just noticed that /changes is extremely busy on my server. That’s when I just thought that it might be a good idea to be able to filter this. This could also be a great way for example the get the list of recently added Patients or Studies.

best wishes
Martin

Hello,

You should be able to easily implement this feature by yourself using the Python plugin:
https://book.orthanc-server.com/plugins/python.html

Your Python plugin would call “/changes” using “orthanc.RestApiGet()”, then filter the results as you wish, before giving them back to the caller:
https://book.orthanc-server.com/plugins/python.html#extending-the-rest-api

Sébastien-