`patients/:id/instances` quirk

Hi,

Our tests just noticed a quirk with the latest docker image.

If you request the instances for a patient id (/patients/:id/instances) that doesn’t exist, instead of returning a 404, (unknown patient) it returns an empty array ([]).

Steps to replicate:

  1. docker run --rm -e ORTHANC__AUTHENTICATION_ENABLED=false -p 8042:8042 orthancteam/orthanc:25.1.0
  2. curl localhost:8042/patients - returns []
  3. curl localhost:8042/patients/NOT_A_PATIENT_ID/instances returns []
  4. curl localhost:8042/patients/NOT_A_PATIENT_ID returns 404 not found.

Up until a recent version, patients/:id/instances would throw a 404 if the :id was not a valid patient id.

Is this the intended response?

Cheers,

James

Hi James,

Nicely spotted !
Indeed, in the past, Orthanc was first “finding” the patient and then was listing the instances belonging to that patient hence returning a 404 since it could not find the patient.

Now, with the “ExtendedFind”, Orthanc lists all instances whose grandgrandparent is {patient_id} which leads to an empty array …

Given Orthanc data model, we can safely say that if no such instances are found, it means the patient does not exist and we should indeed return a 404.

I have just fixed it.

Best regards,

Alain.

2 Likes