Duplicate PatientID



Patient A with ID = INT12345

Patient B with ID = INT12345

The first registered patient will receive the studies.

Patient A receiving study of Patient B.

How to avoid this problem?


Hi Vinicius,

According to the DICOM standard, PatientID has to be unique… well, at least, in theory :slight_smile:

Orthanc, because of its lightweight philosophy, does not provide a reconciliation method out-of-the-box to split data from different patients with the same PatientID. This is explained in the FAQ:

However, you can consider 2 solutions:

  1. Write an external script that modifies studies, replacing the PatientID when a collision is detected:

  2. Query Orthanc at the study level, and not at the patient level. The embedded GUI (Orthanc Explorer) does not provide this feature, but your external scripts can already use the “/studies” URI instead of the “/patients” URI. I have nonetheless just added a Trello card to make this approach more viable:


Many thanks Sébastien!

Impressed with the simplicity and clarity of Orthanc.


Resurrecting an older thread given relatedness.

My instance of Orthanc receives studies from a large variety of locations. Today during some development work I loaded an old third party dummy study that had a duplicate PatientID.

I see that my old PACS system handles duplicates by automatically prepending a prefix (e.g., FIX1 or FIX2) when there is a conflicting PatientID with different demographics than existing.


I can manually split the study / series to correct the problem IF I know about it, with a new PatientID.

My Orthanc instance automatically receives a large number of studies without manual intervention. I parse the /changes file to create a custom database to show recent activity. Such PatientID duplicates will go unnoticed and possibly associate a study with the wrong patient at the meta data level (unsafe and confusing).

Searching the API at the studies level could overcome this problem per prior post, however that is not practical for a large instance. Makes the /changes activity somewhat useless then.

My challenge is that I will not know about conflicting / duplicate PatientIDs. Unless I check every instance for whether its DICOM tags match that of the patient associated with it in Orthanc. That is error prone and resource intensive. Would much rather have a prefix modification for a duplicate PatientID when the study is first imported.

Any guidance would be appreciated.

Any way Orthanc could be configured to automatically prefix something when a conflicting PatientID is encountered?

Thank you.



There’s no configuration in Orthanc to automatically add prefixes to duplicate PatientIDs. But you can “easily” do that in a lua script (check the OnStoredInstance samples).

For each new instance received, you would:

  • call /tools/find to check if a conflicting patient exists (with your own criteria to define a “conflicting patient”)
  • potentially generate a new PatientID for this instance
  • modify the new instance
  • upload it
  • remove the source instance