archive studies made yesterday

Skip to first unread message

Adrian Schiopu

Mar 29, 2020, 12:56:30 PM3/29/20
to Orthanc Users

I want to  archive the studies made one day before.
I made a executable file witch I want to run it each night after midnight.
I use a linux machine with  orthanc server.
I found the command : 
date --date='yesterday' '+%Y%m%d'

This command return the yesterday date in correct format : 20200328   ( today is 20200329)
My executable file have the follow instruction:

mount -o remount,size=25G /tmp/
cd /volume1/archive
python http://localhost:8042/ 20200328 20200329 /volume2/backup/2020
rm -rfv /volume1/OrthancTemp/*

Can somebody help me how to insert the "yesterday date" in this command line?

Adrian Schiopu

Mar 29, 2020, 1:00:03 PM3/29/20
to Orthanc Users
The correct archive command is:

python http://localhost:8042/ 20200328 20200328 /volume2/backup/2020

Adrian Schiopu

Mar 29, 2020, 2:41:53 PM3/29/20
to Orthanc Users
ok I found it!

python http://localhost:8042/ "$(date --date='yesterday' '+%Y%m%d')" "$(date --date='yesterday' '+%Y%m%d')" /volume2/backup/2020/

Maybe somebody need this sometime

Adrian Schiopu

Jun 26, 2020, 10:55:43 AM6/26/20
to Orthanc Users
After few mounts I find an error ...
I have some patients with same "patientID" - in fact is unknown at the studies moment.
Everything is ok, except patient name.... look at the output  below

root@pacs2:~# python 20200621 20200621 /mnt/arhiva19
Downloading 20200621-160851.000-26021-POPESCU
Downloading 20200621-172233.000-26023-POPESCU

The real name of this two patients is not POPESCU ION.... but everything else is correct; If I open this archive and load studies in a reader (Weasis , Radiant...) it show correct name of the patients
At the command:

Can you give me a clue how to modify file?
I try to modify it... but always error...

Adrian Schiopu

Jun 29, 2020, 11:36:42 AM6/29/20
to Orthanc Users
If I write:
I get this answer, including real name
   "ID" : "e99b56a4-3b23b007-db1d59d2-ea815c70-181599fb",
   "IsStable" : true,
   "LastUpdate" : "20200624T183537",
   "MainDicomTags" : {
      "AccessionNumber" : "26021",
      "InstitutionName" : "XXXXXX", (Real location name!)
      "ReferringPhysicianName" : "",
      "StudyDate" : "20200621",
      "StudyID" : "26021",
      "StudyInstanceUID" : "1.2.392.200036.9116.",
      "StudyTime" : "160851.000"
   "ParentPatient" : "37a4ed50-2e3e6968-bb094aeb-f7f1cf70-34068d62",
   "PatientMainDicomTags" : {
      "PatientBirthDate" : "",
      "PatientID" : "1111111111111",
      "PatientName" : "NXXXX TXXXXXX", (Here is real name!)
      "PatientSex" : ""
   "Series" : [ "364e77b0-7003c96c-139baa2a-d43e1039-1fee2591" ],
   "Type" : "Study"

I can't implement this in the file ""

Adrian Schiopu

Jun 29, 2020, 11:50:59 AM6/29/20
to Orthanc Users
I got it!!!

The line 65 in the file "" from must be:
 patient = RestToolbox.DoGet('%s/studies/%s' % (URL, studyId)) ['PatientMainDicomTags']

Finaly I get it work!

Sébastien Jodogne

Jun 29, 2020, 12:44:58 PM6/29/20
to Orthanc Users
Thanks for sharing your insight.

I have just added a comment in the Python sample, if someone else wonders about the same problem:
Reply all
Reply to author
0 new messages