Bug 58 - Patient recycling order should be defined by the reception of its last instance, not by the patient creation
Summary: Patient recycling order should be defined by the reception of its last instan...
Status: RESOLVED FIXED
Alias: None
Product: Orthanc
Classification: Unclassified
Component: Orthanc Core (show other bugs)
Version: unspecified
Hardware: All All
: --- minor
Assignee: Sébastien Jodogne
URL:
Depends on:
Blocks:
 
Reported: 2020-06-29 15:12 CEST by Sébastien Jodogne
Modified: 2020-06-29 15:23 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sébastien Jodogne 2020-06-29 15:12:49 CEST
[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
```
Comment 1 Sébastien Jodogne 2020-06-29 15:23:52 CEST
[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.
Comment 2 Sébastien Jodogne 2020-06-29 15:23:54 CEST
[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