Issue58

Title Patient recycling order should be defined by the reception of its last instance, not by the patient creation
Priority feature Status resolved
Superseder Nosy List admin
Assigned To
Keywords Orthanc Core

Created on 2017-07-19.15:17:16 by admin, last changed by admin.

Messages
msg271 (view) Author: admin Date: 2017-07-19.15:17:16
[BitBucket user: Alain Mazy]
[BitBucket date: 2017-07-19.13:17:16]

There's a workaround however by implementing a lua script (http://book.orthanc-server.com/users/lua.html) which will protect and unprotect a patient each time a new study is received for this patient.  This way, everytime a new study is received, the patient will be moved to the last position in the recycling order.

```
function OnStablePatient(patientId)
	local protectedStatus = RestApiGet('patients/' .. patientId .. '/protected')
	
	if protectedStatus == '1' then
	  RestApiPut('/patients/' .. patientId .. '/protected', '0')
	  RestApiPut('/patients/' .. patientId .. '/protected', '1')
	else
	  RestApiPut('/patients/' .. patientId .. '/protected', '1')
	  RestApiPut('/patients/' .. patientId .. '/protected', '0')
	end
end
```
msg272 (view) Author: admin Date: 2019-01-15.20:59:59
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2019-01-15.19:59:59]

The decision was taken to modify the patient recycling order as follows: Whenever a new **instance** is received, its parent patient is moved to the end of the recycling order.
msg273 (view) Author: admin Date: 2019-01-15.21:09:39
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2019-01-15.20:09:39]

Fix issue #58 (Patient recycling order should be defined by their received last instance)

→ https://hg.orthanc-server.com/orthanc/changeset/c0d7aee8c3f8
History
Date User Action Args
2026-07-29 15:51:21admincreate