Delete or Move old by years studies

  • Hello everyone, I have a question. Can anyone help? In our country there are requirements for the period of storage of studies. There are two cases.

    1. I would like to be able to send all the old studies to another disk. There are a lot of studies and it would not be bad to do it over the years. i.e. send all of 2018 to another MAG1 drive.

    2. The second option is to delete all studies from 2017 to 2018 or one year at a time. Both from the disk and from the database.

    Please be kind with examples. I use Linux and MYSQL.

    Thank you.

  • Hi,


    1) has an option but that works with MOVING oldest data to another MAG


    dgate -asSIZEINKB,0

    dgate -amMAG0.Archiving,MAG1


    where SIZEINKB is eg 1000000 to move 1 GB of data. Spaces are not allowed, the command must be entered exact. This command MOVES the data, does not duplicate.


    2)


    dgate --deletestudies:20170101-20173112


    Spaces are not allowed, the command must be entered exact. This command will return to the command prompt before it is done. Use it with manual control. It will DELETE DATA ON ANY MAG DEVICE!


    Use with utmost care. I would create a test server and try it out first. And make sure you have backups.


    Marcel

  • Sorry currently it is LRU sort only.


    If you are good with SQL you can use it to 'manually' select studies to move, as selection is done with the database field DeviceName:


    So change DICOMImages.DeviceName from e.g. MAG0 to MAG0.Archiving to select images from one year.


    then the command


    dgate -amMAG0.Archiving,MAG1


    will move these images


    Again trial this on a test database and be very careful.


    Marcel

  • Hi,


    to select images to archive you can use e.g.


    UPDATE DICOMImages SET DeviceName = 'MAG0.Archiving' WHERE ImageDate<'20010101' AND DeviceName='MAG0'


    In you favorite SQL console


    Then dgate can move the selected images;


    dgate -amMAG0.Archiving,MAG1


    Marcel

  • If possible it would be great to be able to store studies for a certain amount of time. In many countries, there are laws obliging to store studies for a certain period of time.


    And with limited space, this is very difficult to do, since during covid19 the number of patients has tripled.

    I don't really know how to use lua scripts

  • Well,


    conquest can delete when the disk is full (set by the MagDeviceTreshold). It will delete patients with oldest studies first.


    SQL is not lua, and dgate -am is a command line tool.


    Marcel

  • What database are you using? The use of SQL is very basic, there are many examples on the web..


    And there is also a dgate --deletestudies: command that takes a date range.


    e.g. dgate --deletestudies:19980101-19983112


    Be extremely careful with it! Another option is to downsize or compress old images.


    Marcel

  • And this actually does sql to prepare a move on the command line:


    ./dgate "--lua:sql([[ UPDATE DICOMImages SET DeviceName = 'MAG0.Archiving' WHERE ImageDate<'20010101' AND DeviceName='MAG0' ]])"


    and then moves the data:


    ./dgate -amMAG0.Archiving,MAG1


    Take care with quotes and brackets, and your data.


    Marcel

  • thanks after backup on the test server I'll try. Very relevant. It is a pity that there is no interface for all this. But I think that such examples should be added to the manual. It's wildly cool and functional. And there are no other servers like this.

Participate now!

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