archive studies made yesterday

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?

The correct archive command is:

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

duminică, 29 martie 2020, 19:56:30 UTC+3, Adrian Schiopu a scris:

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

duminică, 29 martie 2020, 20:00:03 UTC+3, Adrian Schiopu a scris:

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:
curl http://192.168.10.52:8042/studies/e99b56a4-3b23b007-db1d59d2-ea815c70-181599fb/patient- I get the wrong name

curl http://192.168.10.52:8042/studies/e99b56a4-3b23b007-db1d59d2-ea815c70-181599fb/module-patient - I get the real name

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

duminică, 29 martie 2020, 21:41:53 UTC+3, Adrian Schiopu a scris:

If I write:
curl http://192.168.10.52:8042/studies/e99b56a4-3b23b007-db1d59d2-ea815c70-181599fb
I get this answer, including real name

root@pacs2:~# curl http://192.168.10.52:8042/studies/e99b56a4-3b23b007-db1d59d2-ea815c70-181599fb
{
“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”

vineri, 26 iunie 2020, 17:55:43 UTC+3, Adrian Schiopu a scris:

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!

luni, 29 iunie 2020, 18:36:42 UTC+3, Adrian Schiopu a scris:

Thanks for sharing your insight.

I have just added a comment in the Python sample, if someone else wonders about the same problem:
https://hg.orthanc-server.com/orthanc/rev/a2060a76ed6a