I have the requirement that once a study is stored (via DICOM), the PatientID has to be altered and then forwarded to an Orthanc peer.
At the moment I’m using Lua’s OnStableStudy() to trigger changing an original study’s original PatientID (which forces creating a new patient) but I’m finding myself in a perpetual loop. The RestApiPost() within the function makes the patient change, which totally works, but in doing so, the “original” patient’s studies are then cloned to the new patient. I believe it’s through this “cloning” that the OnStableStudy() is triggered again presumably through the API … and that’s where I believe the loop is being called again.
I was hoping that “origin” could be used, and I could ascertain if the origin of the study’s instances was via DicomProtocol or RestApi, but of course origin is only available via OnStoredInstance and not OnStableStudy.
So my question is:
- Is it possible at all to change a study’s PatientID without creating a new patient? I’m guessing not, but if I don’t ask…
- Is there a more appropriate method or “hidden” field that I could use within OnStableStudy() that will ascertain if a study was acquired via DICOM or the API?
- Is there a more appropriate method of changing the PatientID without using the API (and thereby not triggering the OnStableStudy() again)
- Is there a cleaner way of doing this?
What’s interesting is that when I perform the MRN replacement using manual cURL calls, it all works without issue - there’s no looping, the new patient is created with the altered PatientID and the studies follow suit - but only once…
Thoughts?!!