Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Automatically deactivate prepersons to prevent fraud if they doesn’t have appropriate set of medical events.

Job logic

  1. Job starts once in 24 hours by default (according configured parameter PREPERSON_DEACTIVATION_SCHEDULE).

  2. After starting it gets value from global parameter config DAYS_FOR_PREPERSON_DEACTIVATIONVERIFICATION.

  3. Select all entries from mpi.prepersons with status=active and deactivation_date is not null verified is false:

    1. if preperson has Observation.codes = height and weight and gender sex and Observation.status = valid:

      • set deactivation_date verified = nulltrue

      • set updated_at = current_datetime()

      • set updated_by = system_user()

    2. else if preperson has no required set of medical events:

      1. if deactivationinseted_date at < current_date() - DAYS_FOR_PREPERSON_DEACTIVATIONVERIFICATION

        • set status = inactive

        • set is_active = falseset updated_at = current_datetime()

        • set updated_by = system_user()

      2. else if deactivationinserted_date at >= current_date() - DAYS_FOR_PREPERSON_DEACTIVATIONVERIFICATION, then skip the preperson.