Hey Everyone,
Been using Orthanc alot over the last few months and wrote a python script that updates patients “PatientID”. I am using the patients "modify’ endpoint for this. when I include ‘KeepSource’: False in my command json it takes an extensive amount of time.
I am on Orthanc 1.12.2, using MYSQL DB. 32gb of memory both the DB and image storage are running on an SSD drive.
See the part of the script below that is taking a long time…
def update_patient_metadata(patient_id, new_patient_id):
print(patient_id, new_patient_id)
# Define headers for the request (e.g., content type)
headers = {'Content-Type': 'application/json'}
modify_endpoint = f'{orthanc_url}/patients/{patient_id}/modify'
command = {
'Replace': {
'PatientID': str(new_patient_id),
}, 'Force': True,
'KeepSource': False
}
# Send POST request to modify the instance
response = requests.post(modify_endpoint, data=json.dumps(command), headers=headers)
if response.status_code == 200:
return True
else:
return False
Relevant logs:
T0430 12:41:44.805049 JOBS-WORKER-3 ServerIndex.cpp:128] Remaining ancestor "4187a2f1-6692ac6f-344ffae7-b00a174e-f94ee966" (3)
T0430 12:41:44.806049 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.806049 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.806049 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.806049 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.807071 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.819657 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
I0430 12:41:44.820654 JOBS-WORKER-3 FilesystemStorage.cpp:266] Deleting attachment "1fcb1ce7-00c6-4941-af21-b7756e433069" of type 1
T0430 12:41:44.820654 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.820654 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.821653 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.822648 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.823644 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.823644 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
I0430 12:41:44.823644 201c FilesystemStorage.cpp:182] Reading attachment "009a538d-84e5-4db5-bff2-aeea02fbc9f1" of "DICOM" content type (range from 0 to 10130)
T0430 12:41:44.823644 32e8 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
I0430 12:41:44.823644 201c FilesystemStorage.cpp:189] Read range of attachment "009a538d-84e5-4db5-bff2-aeea02fbc9f1" (9.89KB in 0ns = infGbps)
T0430 12:41:44.824642 32e8 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.825638 32e8 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.825638 32e8 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.825638 32e8 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.825638 32e8 OrthancPlugins.cpp:5882] (plugins) Calling service 4018 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancDicomWeb.dll
T0430 12:41:44.825638 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.826637 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:41:44.827634 201c OrthancPlugins.cpp:5882] (plugins) Calling service 3004 from plugin C:\Program Files\Orthanc Server\Plugins\libOrthancOHIF-Windows64.dll
I0430 12:41:44.827634 201c OrthancPlugins.cpp:3278] (plugins) Plugin making REST PUT call on URI /instances/059e3cb6-4c1df0e5-2bc8aa64-4c3d65ef-a5b49576/metadata/4202 (built-in API)
T0430 12:41:44.828665 32e8 OrthancPlugins.cpp:5882] (plugins) Calling service 4011 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancDicomWeb.dll
T0430 12:42:01.563920 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.563920 JOBS-WORKER-3 ServerIndex.cpp:161] Change related to resource 17926b25-336664d8-19258398-9ad945ad-d5cbab78 of type Instance: Deleted
T0430 12:42:01.563920 JOBS-WORKER-3 ServerIndex.cpp:128] Remaining ancestor "b39e7049-e6a57ab0-13e231a2-0c80e8a0-4f7d2d96" (3)
T0430 12:42:01.565190 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.565190 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.565190 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.565190 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.566169 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.580050 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
I0430 12:42:01.580050 JOBS-WORKER-3 FilesystemStorage.cpp:266] Deleting attachment "65ca2323-334f-4ddf-9df7-99cc98cf1fe9" of type 1
T0430 12:42:01.580050 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.581047 SAVE-JOBS OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.598999 SAVE-JOBS OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.629224 SAVE-JOBS OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.629224 SAVE-JOBS OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.629224 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:01.630237 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:04.052911 WEBDAV-UPLOAD OrthancWebDav.cpp:1246] Cleaning up the empty WebDAV upload folders
T0430 12:42:11.706680 SAVE-JOBS ServerContext.cpp:327] Serializing the content of the jobs engine
T0430 12:42:18.332146 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.332146 JOBS-WORKER-3 ServerIndex.cpp:161] Change related to resource 18daa2ec-e2a8f668-631a0b45-af9bafcb-d78dd34d of type Instance: Deleted
T0430 12:42:18.332146 JOBS-WORKER-3 ServerIndex.cpp:128] Remaining ancestor "8ed2e8d1-d7a5e14b-8eee2b9c-5324fb75-c4c32619" (3)
T0430 12:42:18.332972 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.332972 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.332972 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.333972 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.334805 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.347267 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
I0430 12:42:18.347267 JOBS-WORKER-3 FilesystemStorage.cpp:266] Deleting attachment "72b015d7-49f3-4cd3-a62e-c85d767fcbd6" of type 1
T0430 12:42:18.348256 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.348256 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.349254 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.350252 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.351248 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.352246 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.352246 201c ServerIndex.cpp:161] Change related to resource 059e3cb6-4c1df0e5-2bc8aa64-4c3d65ef-a5b49576 of type Instance: UpdatedMetadata
T0430 12:42:18.355240 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.355240 201c OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.355240 201c OrthancPlugins.cpp:5882] (plugins) Calling service 3001 from plugin C:\Program Files\Orthanc Server\Plugins\libOrthancOHIF-Windows64.dll
I0430 12:42:18.355240 201c OrthancPlugins.cpp:3221] (plugins) Plugin making REST GET call on URI /instances/153063d1-0d2713d5-641fa00a-305ddb8c-f4759aa1/metadata/4202 (built-in API)
T0430 12:42:18.355240 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll
T0430 12:42:18.356244 JOBS-WORKER-3 OrthancPlugins.cpp:5882] (plugins) Calling service 40 from plugin C:\Program Files\Orthanc Server\Plugins\OrthancMySQLIndex.dll