How to Forward most recent Prior

  • Marcel,


    Your absolutely right, it IS case sensitive. What a hard lesson to learn. :)


    So, I got the script to forward a study to 'SERVER1', but it didn't work as I had hoped. The delay was also 10 minutes.


    The query in the script found '2' results.


    1. How can I change the timeout for the delay?
    2. the code below will forward all results found. In the test I did, it forwarded the prior and the current study received. How can it be changed to work for only the most recent prior?



    thanks

  • Ah,


    as this script will be run for every matching image, after one image is recieved the new prior is the current study so it will forward both.


    To fix this you could e.g. make the end:


    if Data.StudyInstanceUID ~= s[1].StudyInstanceUID then
    script("forward patient study ".. s[1].StudyInstanceUID .. " after NN to SERVER1")
    end


    Where NN is the delay in seconds. It has to be long enough though to avoid that it fires before the current study is complete in conquest. Otherwise it would forward multiple times. The syntax of the forward command (and the lua stuff) is specified briefly in the manual.


    Marcel

  • Hi,


    if you want to forward without delay you would have to add memory of recently forwarded priors. The only supported way I can think of would be to add a database table using sql() and query it with dbquery() for each incoming image that matches the study description. Once you have asserted the study has not been forwarded before, you can use dicommove() to send the study.


    Marcel

  • Marcel,


    thanks a lot! This now works as expected. I'm using a delay of 180sec which works out fine.


    I'm trying to accomplish one more thing with this script.


    When the prior is found with the query, if it contains a 'SeriesDescription' that contains 'Cad', I would like it to NOT forward that series.


    Would the best way to go about this be to add something to the query like 'q.SeriesDescription ~= 'Cad'' or should I add another 'if' statement? Maybe there is a way to use one of the existing 'if' statements?


    eg.


    Code
    if Data.StudyInstanceUID ~= s[1].StudyInstanceUID and s[1].SeriesDescription ~= '*Cad*' then
    script("forward patient study ".. s[1].StudyInstanceUID .. " after 180 to SERVER1")
    end


    If I have the code above correct, can I use the wild card as I have it above?


    thanks for all of your help with this!

  • Hi,


    To do this you would have to modify the script to work at the series level. Now it will forward the entire study. I believe you would have to go to the sql / dicommove option to get this done. The forward statement maps to a simple c-move which does not allow NOT filtering.


    Marcel

  • Marcel,


    Just tested out this code again with a patient that had 1 current study and 2 priors.



    Conquest decided to only forward the 2nd most recent study instead of the MOST recent study. So, since the query found 3 studies (one is the current study and the other two are prior exams) it pushed prior #2 instead of prior #1.


    Maybe there is a way to add a 'sort' to the query so that it will know which one is old to new?


    thanks

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!