When uploading files via the API can I force a study or patient ID?

I’m working on a project where we’re collecting data from multiple labs around the state and multiple types of images. Some are angiograms, some are ivus images (I’m not a medical professional, so this is a little out of my norm).

That being said, I’d like I way to keep these separated. When I upload the files through the API, orthanc seems to be able to scrape some data out of the files to know what patient/study they below to. This is great until I get IVUS images in the same group as angiograms. Some sites have them separated, some don’t.

My ultimate goal is to separate them, and I’m wondering if I can force a fake study or patient ID with my uploads. It’s all controlled through an API, so assigning them unique IDs won’t be a problem at all.

I’m looking at the documentation, and I can’t see anything that looks like it might help.

If I can’t force a fake (controlled fake) patient/study, is there a way I can keep these images separated? Or is there something I can add to the instructions for the sites preparing these images?


No, you can’t force PatientID when uploading a file but you can modify it directly after. You can get inspiration from this lua script: https://book.orthanc-server.com/users/lua.html#important-remarks-about-auto-routing



I’m looking over this, and the only challenge I see here is how I’d assign the ID. I don’t know if there’s a way to pass an ID to the lua script since this would be triggered OnStoredInstance. I will also need to get the new study ID from the API so that my code that uses the API can have a valid link to the viewer. I think it’s something for me to keep investigating, but I might have to shelve this for the moment until we finish our current round of collections.

I appreciate the help in pointing me towards a potential solution though.