archive studies made yesterday

55 views
Skip to first unread message

Adrian Schiopu

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

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 ArchiveStudiesInTimeRange.py 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

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


python ArchiveStudiesInTimeRange.py http://localhost:8042/ 20200328 20200328 /volume2/backup/2020

Adrian Schiopu

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

python ArchiveStudiesInTimeRange.py 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

unread,
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 ArchiveStudiesInTimeRange.py http://192.168.10.52:8042/ 20200621 20200621 /mnt/arhiva19
Downloading 20200621-160851.000-26021-POPESCU ION-1111111111111.zip
Downloading 20200621-172233.000-26023-POPESCU ION-1111111111111.zip
root@pacs2:

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  ArchiveStudiesInTimeRange.py file?
I try to modify it... but always error...

Adrian Schiopu

unread,
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.2.5.1.37.2427348604.1592723330.786676",
      "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 "ArchiveStudiesInTimeRange.py"

Adrian Schiopu

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

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

Finaly I get it work!

Sébastien Jodogne

unread,
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
Forward
0 new messages