...
Automatically deactivate prepersons to prevent fraud if they doesn’t have appropriate set of medical events.
Job logic
Job starts once in 24 hours by default (according configured parameter PREPERSON_DEACTIVATION_SCHEDULE).
After starting it gets value from config DAYS_FOR_PREPERSON_VERIFICATION.
Select all entries from mpi.prepersons with status=active and verified is false:
if preperson has Observation.codes =
height
andweight
andsex
and Observation.status =valid
:set verified = true
set updated_at = current_datetime()
set updated_by = system_user()
else if preperson has no required set of medical events:
if inseted_at < current_date() - DAYS_FOR_PREPERSON_VERIFICATION
set status = inactive
set updated_at = current_datetime()
set updated_by = system_user()
else if inserted_at >= current_date() - DAYS_FOR_PREPERSON_VERIFICATION, then skip the preperson.