personalcancertoolkit / openmrs-module-patientportaltoolkit

Other
7 stars 9 forks source link

Preventive Care - If a recommended date is modified to a different date - the next appointment should adjust based on the interval #514

Closed bmamlin closed 1 year ago

bmamlin commented 1 year ago

After some discussion with David, we decided to use this logic:

Look in the database for the most recent date for the preventative care item of concern up to one year from today's date. If found, use the date of that item as the anchor date; otherwise, use the join date as the anchor date. Then calculate intervals using this anchor date.

PhilipAdeoye commented 1 year ago

For each procedure (preventative care item),

If a future event exists, use its target date as the anchor date. If a future one doesn't exist, pick the completed one in the past, and use its completed date as the anchor date. If neither exist, use the patient's join date as the anchor date.

To prevent duplicates, when generating the hypothetical recommended dates, check each recommended date against the PreventativeCareEvents in the database (for the same procedure). If the event is completed, check the recommended date against the event's completed date, but if it is in the future, check the recommended date against the event's target date.