Tasks with Patients

I need to add these functions to our Staff

Case 1:

Patient A, ID “1”, with “n” studies
Patient B, ID “2”, with “n” studies (same Patient as “A”. For example if we import studies from other institution with another Patient ID)

I need to Merge both patiens. We have a Merge option, but only for studies (is not this case)
I thinking to do:

a) Modify all the “n” studies from Patient “B” and chage the Patient ID to “1” (and the Patient name with the name of Patient “A”).
http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify
b) Delete Patient “B”, if after a query I can check there is no a study attached to patient “B”.
I can see that option in the orthanc explorer (“Delete this patient”), but I need to find the Api rest method it uses. (There is no a /patients/{id}/delete)

Case 2:

Patient A, ID “1”, with “n” studies
One of those studies is wrong and belongs to another patient, not present in Orthanc server

a) Create a new Patient (I can do that with the Api rest functionality ?)
I can´t find something like /patients/create.
b) Modify the study from Patient “A” and chage the Patient ID to the Id of the new patient created.

Is there a better way to do these tasks ?
I’m thinking something wrong for these cases ?

Regards
Diego

Hello,

In both cases, the solution is to call “/studies/…/split” on each series of the studies/patients of interest:
http://book.orthanc-server.com/users/anonymization.html#split-merge-of-dicom-studies

Case 1:

First retrieve all the series from Patient B as follows:
$ curl http://localhost:8042/tools/find -d ‘{“Level”:“Studies”,“Query”:{“PatientID”:“B”},“Expand”:true}’

[
{
“ID” : “**6e2c0ec2-5d99c8ca-c1c21cee-**79a09605-68391d12”,

“Series” : [
**"6ca4c9f3-5e895cb3-4d82c6da-**09e060fe-9c59f228",
**"ca2cc2ef-2dd8be12-0a4506ae-**d565b7e1-a4ca9068"
],
“Type” : “Study”
}
]

As can be seen, this gives you a list of studies of interest, together with the identifiers of the series of these studies. Then, call “/split” on each study of interest as reported above, specifying the list of series and the target patient ID:

$ curl http://localhost:8042/studies/6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12/split -d ‘{“Series”:[“6ca4c9f3-5e895cb3-4d82c6da-09e060fe-9c59f228”,“ca2cc2ef-2dd8be12-0a4506ae-d565b7e1-a4ca9068”],“Replace”:{“PatientID”:“A”}}’

Case 2:

There’s no need to “create a patient”: Orthanc will do this automatically when it receives a DICOM file from some previously unknown patient.

You can actually use exactly the same solution as for case 1.

Additional remarks:

(1) You can delete a patient by typing (cf. the remark in your Case 1 - b):

$ curl -X DELETE http://localhost:8042/patients/{id}

(2) You can create a plugin to automate the tasks above: http://book.orthanc-server.com/developers/creating-plugins.html

HTH,
Sébastien-