Counting number of files per patient / migration speed question

Hi,

We are migrating data from our old pacs to Orthanc. To check if the migration is successful we would like to check the number of files per patient.

We are also seeing a decrease in migration speed from around 370 patients per day to around 270 patients per day. Both source and destination servers are already rebooted a few times

Orthanc Configuration
Server 2019, 4 cores and 16 GB memory. CPU is around 10% memory is around 3.8 GB in use.
We use PostgreSQL for the indexing. The database is set on a separate disk.
The datastore is also located on a separate disk

I Checked out the scalability document but most setting were already implemented by Osimis

I changes the “MallocArenaMax” to 25 because with 5 the webserver was very slow and the “MaximumPduLength” to 131072 hoping to speed up the process.

With kind regards,

Martin

Hi Martin,

Difficult for me to explain the slowdown during the ingest. Note that, ideally, you should measure ingest speed in terms of instances/day or even GB/day which is less dependent on the type of exams you’re pushing.

I don’t remember observing any significant slowdown when doing large migrations but I must admit I’ve not monitored performance carefully.

To get the number of instances per patient, you can use the /statistics route at patient level:
http://localhost:8042/patients/{…}/statistics

HTH,

Alain.

Hi Alain

Thank you for your reply. Is there a way to get the statistics for all the patients at once?

With kind regards,

Martin

Yes, you can use /statistics https://api.orthanc-server.com/#tag/System/paths/~1statistics/get
James

Hi James,

Thanks for your reply. I didn’t ask the question correctly. Is it possible to get the statistics per patient for all the patient?
Is it possible to search for a patient based on the patientid or patientname instead of the uuid?

With kind regards,

Martin

Hi Martin,

No, you can not get the stats per patient for all patients at once.

You can use the /tools/find route to get the orthanc ID of a patient from its PatientID. Sample payload:
{
‘Level’ : ‘Patient’,
‘Query’ : { ‘PatientID’ : ‘1234’ }
}

HTH,

Alain

Hello,

As far as the “Is there a way to get the statistics for all the patients at once?” question is concerned, you can easily add this new feature to the REST API of Orthanc using a Python plugin:
https://book.orthanc-server.com/plugins/python.html

Here is the source code of such a plugin:

import json
import orthanc

def GetStudiesStatistics(output, uri, **request):
if request[‘method’] != ‘GET’:
output.SendMethodNotAllowed(‘GET’)
else:
answer = {}

studies = orthanc.RestApiGet(‘/studies’)
for study in json.loads(studies):
stats = orthanc.RestApiGet(‘/studies/%s/statistics’ % study)
answer[study] = json.loads(stats)

output.AnswerBuffer(json.dumps(answer), ‘application/json’)

orthanc.RegisterRestCallback(‘/studies-statistics’, GetStudiesStatistics)

Once this plugin is loaded into Orthanc, here is a sample call to it:

$ curl http://localhost:8042/studies-statistics | json_pp
{
“e9fffe71-062d34ce-abf54924-ff7d3ee2-5a93e917” : {
“DicomUncompressedSizeMB” : 0,
“DiskSizeMB” : 0,
“CountSeries” : 1,
“UncompressedSizeMB” : 0,
“DicomDiskSizeMB” : 0,
“DicomUncompressedSize” : “787152”,
“DicomDiskSize” : “787152”,
“DiskSize” : “787152”,
“CountInstances” : 1,
“UncompressedSize” : “787152”
},
“7414eb5c-1142622b-c6bb8a97-2d2f005b-6ab9a472” : {
“DiskSizeMB” : 0,
“DicomUncompressedSizeMB” : 0,
“UncompressedSizeMB” : 0,
“CountSeries” : 1,
“DicomDiskSize” : “787152”,
“DicomDiskSizeMB” : 0,
“DicomUncompressedSize” : “787152”,
“DiskSize” : “787152”,
“UncompressedSize” : “787152”,
“CountInstances” : 1
}
}

HTH,
Sébastien-