Auto Forward (without deletion)

Hi, I've been trying to setup Orthanc to auto-forward received studies to remote modalities. I've tried the HighPerformanceAutoRoute python script, but it seems to remove the instances from Orthanc after forwarding, as well as retro-actively forward existing studies from the Orthanc database.

Ideally, I would like it to only notice newly-arriving instances, forward them, and then leave them in Orthanc.

With my limited experience with Python/REST I haven't been able to figure out how to adapt it to my needs. Any help would be appreciated!

Hi!

try this: comment lines 117, 118 and 122

# Remove all the instances from Orthanc
# for instance in instances:
# RestToolbox.DoDelete('%s/instances/%s' % (URL, instance))

# Clear the log of the exported instances (to prevent the
# SQLite database from growing indefinitely)
# RestToolbox.DoDelete('%s/exports' % URL)

As a complement to Vinicius’ answer, to avoid the retro-active routing of existing studies, you can replace line 63 of the script from:

current = 0

To:

current = int(RestToolbox.DoGet(URL + ‘/changes’, { ‘last’ : True })[‘Last’])

HTH,
Sébastien-

Thank you, Vinicius and Sebastien, the combination of those changes seems to do exactly what I wanted. Cheers!

I've got one more question I am hoping someone can help me with.

Is it possible to perform a C-ECHO through a python script? I would like to be able to check for the availability of a modality before adding items to the queue to be routed.

Hi,

Issuing a C-Echo SCU with the REST API of Orthanc is not possible at the moment.

However, this is really an interesting idea! I have just added it to our roadmap:
https://trello.com/c/b6h2LlXS

I will try and implement it in the next few days.

Stay tuned,
Sébastien-