Filtering importconverter on current date

  • Hi,


    Our clinical PACS is autoforwarding QC images to our conquest dicom server and until now I have been happy with this import converter


    Code
    ImportConverter0 = ifequal "%V0010,0010[0,11]","KONSTANSTEST"; {mkdir C:\conquestdicomserver\data\Konstanskontroller\%i\; save to C:\conquestdicomserver\data\Konstanskontroller\%i\%o.dcm;destroy;}

    Now we struggle with the fact that out clinical PACS re-send a lot of images if new images are added to an old study-date. To ignore those old images I would like to save only those with the current date as acquisiton date. As I have never written a lua script before I've gone totally lost and hope to get som newbie help.


    I've found that I could get the current date with lua like this:


    Code
    currdate = os.date('%Y'..'/%m/'..'%d')


    and also I find the parameters now and age described in the manual for filtering on forward / get / delete


    but I cannot figure out how to use this terminology. Will I need a separate lua script to filter my importconverter to current date or could I have some sort of inline script that just fetches that current date as string so that I could write something like this:


    Code
    ImportConverter0 = ifequal "%V0010,0010[0,11]","KONSTANSTEST"; { if "%V0008,0022", currdate; {mkdir C:\conquestdicomserver\data\Konstanskontroller\%i\; save to C:\conquestdicomserver\data\Konstanskontroller\%i\%o.dcm;destroy;}}


    Thankful for any help here as I have spent way too much time only getting confused with the terminology.

  • Try this, a mixture of lua and script language:

    Code
    ImportConverter0 = lua: if os.date('%Y'..'/%m/'..'%d')==Data.StudyDate then Data:Script('ifequal "%V0010,0010[0,11]","KONSTANSTEST"; { mkdir C:\conquestdicomserver\data\Konstanskontroller\%i\; save to C:\conquestdicomserver\data\Konstanskontroller\%i\%o.dcm;destroy;}') end
  • Code
    ImportConverter0 = ifequal "%V0010,0010[0,11]","KONSTANSTEST"; lua "if os.date('%Y'..'/%m/'..'%d')==Data.StudyDate then Data:Script('{ mkdir C:\conquestdicomserver\data\Konstanskontroller\%i\; save to C:\conquestdicomserver\data\Konstanskontroller\%i\%o.dcm;destroy;}') end"

    Lua: is only in a newer version

  • Thanks - now I had no error messages (at least for incoming data that do not fit the first criteria).

    Changed StudyDate to AcqDate and hope that works (found from chapter 7.3 in the manual, but I am not sure if that terminology is related to the Data. object). I want to keep new images only, but the study might be older if the study is reused - that is the issue I am trying to solve.

  • I did not succeed last time with this recent date filtering, but with newer version of Conquest installed I would like to try again.


    Code
    ImportConverter0 = ifequal "%V0010,0010[0,11]","KONSTANSTEST"; lua "if os.date('%Y'..'/%m/'..'%d')==Data.StudyDate then Data:Script('{mkdir C:\dicomserver\data\Konstanskontroller\%i\; save to C:\dicomserver\data\Konstanskontroller\%i\%o.dcm;destroy;}') end"


    It fails on syntaxerror


    *** lua syntax error [string " if os.date(''..'/MR/'..'Wed Mar 06 13:39:02 2024')==Data.Study..."]:1: escape sequence too large near ''ifequal "Konstanstest","KONSTANSTEST";...


    I also tried the same with

    Code
    ImportConverter0 = lua: if os.date('%Y'..'/%m/'..'%d')==Data.StudyDate then Data:Script('ifequal "%V0010,0010[0,11]","KONSTANSTEST"; { mkdir C:\conquestdicomserver\data\Konstanskontroller\%i\; save to C:\conquestdicomserver\data\Konstanskontroller\%i\%o.dcm;destroy;}') end


    *** lua syntax error [string "if os.date(''..'/DX/'..'Wed Mar 06 13:48:38 2024')==Data.StudyD..."]:1: escape sequence too large near ''{mkdir C:dicomserve...


    The %Y and %m and %d are not interpreted correctly, but takes the conquest specific (?) meaning of the same? (%m is modality at least). I guess the slash should be some escape from that, but do not work like that. Any suggestion how the os.date right?

Participate now!

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