ЕСОЗ - публічна документація

Online verification of Persons with DRACS death acts registry_EN

Purpose

This process gets death acts data of specific person from the DRACS registry through Trembita exchange gateway and uses it for further comparison with person.

Key points

  1. This process uses cron parameter to configure its start time.

  2. This process is used to obtain all death acts of specified person from DRACS registry.

  3. This process gets limited amount of persons for synchronization with DRACS death acts registry.

  4. This process uses Oban job processing library as jobs management tool.

Configuration

Value

Description

Example

Value

Description

Example

DRACS_DEATH_ACTS_PERSONS_ONLINE_VERIFICATION_SCHEDULE

Cron parameter, represents start time of online verification of Persons with DRACS death acts registry process

*/3 * * * *

DRACS_DEATH_ACTS_PERSONS_ONLINE_VERIFICATION_BATCH_SIZE

Size of Persons list that will be verified online with DRACS death acts registry

100

Service logic

  1. Get list of active persons (status=active, is_active=true) that must be verified online with DRACS death acts registry by following params from MPI db:

    1. person_verifications.dracs_death_online_status = ‘READY’

  2. Sort obtained list by person_verifications.updated_at field in ascending order (first updated person verification record must be first synchronized with DRACS death acts registry).

  3. Limit obtained list with DRACS_DEATH_ACTS_PERSONS_ONLINE_VERIFICATION_BATCH_SIZE value from chart params.

    1. if resulting list is empty - end process

  4. Get first person from obtained list.

  5. Update person_verifications table in MPI db for person_id:

    1. set dracs_death_online_status = ‘IN_PROCESS’

  6. Get persons death acts - perform GetDeathArByFullNameAndBirthDate DRACS method (DRACS Trembita methods | GetDeathArByFullNameAndBirthDate) with following params:

    1. Name = persons.first_name

    2. OnDate = persons.birth_date

    3. Patronymic = persons.second_name

    4. Surname = persons.last_name

  7. Get ResultData field from GetDeathArByFullNameAndBirthDate method response and decode it from base64 to get XML file of death acts list.

    1. in case GetDeathArByFullNameAndBirthDate ResultCode <> 0 or connection error or timeout is occured - check that persons dracs_death_online_status = ‘IN_PROCESS’

      1. if true - rollback it in person_verifications table in MPI db for person_id:

        1. set dracs_death_online_status = ‘READY’

        2. set updated_at = now()

      2. if false - skip this person, go to next person in list (return to p.5)

  8. Parse obtained XML file and form death acts list.

    1. in case empty death acts list is returned - check that persons dracs_death_online_status = ‘IN_PROCESS’,

      1. if true - update person_verifications table in MPI db for person_id:

        1. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:

          1. set dracs_death_verification_status = ‘VERIFIED’

          2. set dracs_death_verification_reason = ‘AUTO_ONLINE’

          3. set dracs_death_online_status = ‘COMPLETED’

          4. set updated_at = now()

          5. set updated_by = system_user()

        2. for any other dracs_death_verification_status and dracs_death_verification_reason combination - update persons dracs_death_online_status:

          1. set dracs_death_online_status = ‘COMPLETED’

          2. set updated_at = now()

          3. set updated_by = system_user()

      2. if false - skip this person, go to next person in list (return to p.5)

  9. Save each death act from formed list to dracs_death_acts table in transaction according to fields matching (located in the table below)

  10. For each death act validate duplicates - check existence of death act in dracs_death_acts table with following conditions: ar_reg_date = ArRegDate and ar_reg_number = ArRegNumber

    1. in case not found - insert new act record to dracs_death_acts table, also add technical data:

      1. set id = autogenerate uuid

      2. set inserted_at = now()

      3. set updated_at = now()

      4. set persons_compare_status = ‘READY’

      5. set parties_compare_status = ‘READY'

      6. set settlement_id from uadresses service using RPC call with following logic:

        1. in case locality is null or locality_type = ‘Район’ - get settlement_id where settlement_name = district and area_name = region

        2. in case locality is not null - get settlement_id where settlement_name = locality and area_name = region

    2. in case found - check that condition op_date = OP_DATE and ar_op_name = AR_OP_NAME is also met for found record

      1. in case condition is met - full duplicate of death acts already exists, update dracs_death_acts table for found record:

        1. set updated_at = now()

      2. in case condition is not met - death act was updated, check that fields of death act from database (according to fields matching, but exclude technical fields ar_reg_date, ar_reg_number, op_date, ar_op_name) were updated in DRACS registry

        1. in case at least one field was updated

          1. save existing record to dracs_death_acts_hstr table

            1. dracs_death_act_id = id of current death act from dracs_death_acts table

            2. dracs_death_act_data = full data of current death act in jsonb format (without technical fields, use fields matching from table below)

            3. inserted_at = now()

          2. fully update existing death act in dracs_death_acts table with new values from DRACS registry

            1. set persons_compare_status = ‘READY’

            2. set parties_compare_status = ‘READY'

            3. set updated_at = now()

            4. set settlement_id from uadresses service using RPC call with following logic:

              1. in case locality is null or locality_type = ‘Район’ - get settlement_id where settlement_name = district and area_name = region

              2. in case locality is not null - get settlement_id where settlement_name = locality and area_name = region

        2. in case none of the fields were updated - update dracs_death_acts table for found death act:

          1. op_date = OP_DATE from response

          2. ar_op_name = AR_OP_NAME from response

          3. updated_at = now()

  11. Update existing verification candidates according to saved death acts list:

    1. in case saved death act is cancelled (ar_op_name = 2 or 3) or fully updated from DRACS (ar_op_name = 4and existing act was saved to dracs_death_acts_hstr table) - check existence of active verification candidates in MPI db (with person_verification_candidates.status = ‘NEW’, person_verification_candidates.enitity_type = ‘death_act’ and person_verification_candidates.enitity_id = dracs_death_act_id) and in PRM db (with party_verification_candidates.status = ‘NEW’, party_verification_candidates.enitity_type = ‘death_act’ and party_verification_candidates.enitity_id = dracs_death_act_id)

      1. in case found

        1. deactivate verification candidates:

          1. set status = ‘DEACTIVATED’

          2. set status_reason = 'DEATH_ACT_UPDATED'

          3. set updated_at = now()

        2. update persons and parties compare status for death acts with ar_op_name = 2 or 3

          1. set persons_compare_status = ‘PROCESSED’

          2. set parties_compare_status = ‘PROCESSED'

      2. in case not found

        1. update persons and parties compare status for death acts with ar_op_name = 2 or 3

          1. set persons_compare_status = ‘PROCESSED’

          2. set parties_compare_status = ‘PROCESSED'

  12. Get only active death acts with ar_op_name = 1 or 4 from obtained list.

    1. in case no active death acts for person were found - check that persons dracs_death_online_status = ‘IN_PROCESS’,

      1. if true - update person_verifications table in MPI db for person_id:

        1. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:

          1. set dracs_death_verification_status = ‘VERIFIED’

          2. set dracs_death_verification_reason = ‘AUTO_ONLINE’

          3. set dracs_death_online_status = ‘COMPLETED’

          4. set updated_at = now()

          5. set updated_by = system_user()

        2. for any other dracs_death_verification_status and dracs_death_verification_reason combination - update persons dracs_death_online_status:

          1. set dracs_death_online_status = ‘COMPLETED’

          2. set updated_at = now()

          3. set updated_by = system_user()

      2. if false - skip this person, go to next person in list (return to p.5)

  13. Send person data and active death acts list to comparison endpoint - check that persons dracs_death_online_status = ‘IN_PROCESS’

    1. if true - proceed with comparison process

      1. Prepare active death acts list for comparison with person according to Offline comparison of death acts with Persons | Step 2. Data preparation and potential candidates select, p.2

      2. Compare person with each active death act using existing logistic regression predicative method as described here: Offline comparison of death acts with Persons | Step 3. Death act comparison process

    2. if false - skip this person, go to next person in list (return to p.5)

  14. When found death act with high comparison probability (white zone) - check that persons dracs_death_online_status = ‘IN_PROCESS’

    1. if true - proceed with comparison result processing:

      1. Create verification candidate with person_id and dracs_death_act_id in person_verification_candidates table in MPI db according to Offline comparison of death acts with Persons | Step 4.1. White zone

      2. Deactivate person

        1. set persons.status = inactive, persons.updated_at = now()

        2. terminate active declarations for person

        3. deactivate active persons authentication methods

        4. revert active verification candidates for person in person_verification_candidates table in MPI DB by person_id

          1. set status = ‘NOT_CONFIRMED’

          2. set updated_at = now()

      3. Update person_verifications table in MPI db for person_id:

        1. set dracs_death_act_id = id of death act from mimir.dracs_death_acts

        2. set dracs_death_verification_status = ‘VERIFIED’

        3. set dracs_death_verification_reason = ‘AUTO_ONLINE’

        4. set dracs_death_online_status = ‘COMPLETED’

        5. set updated_at = now()

        6. set updated_by = system_user()

    2. if false - skip this person, go to next person in list (return to p.5)

  15. When found death act with average comparison probability (grey zone) - check that persons dracs_death_online_status = ‘IN_PROCESS’

    1. if true - proceed with comparison result processing:

      1. Create verification candidate with person_id and dracs_death_act_id in person_verification_candidates table in MPI db according to Offline comparison of death acts with Persons | Step 4.2. Grey zone

        1. if active verification candidate between person_id and dracs_death_act_id already exists - skip death act

      2. Update persons verification status in person_verifications table in MPI db based on current dracs death verification status of person:

        1. in case dracs_death_verification_status = ‘NOT_VERIFIED’ - do not update persons dracs death verification status

        2. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_NOT_CONFIRMED’ - do not update persons dracs death verification status

        3. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_CONFIRMED’ - do not update persons dracs death verification status

        4. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:

          1. set dracs_death_verification_status = ‘NOT_VERIFIED’

          2. set dracs_death_verification_reason = ‘AUTO_ONLINE’

          3. set updated_at = now()

          4. set updated_by = system_user()

        5. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘INITIAL’ - update persons dracs death verification status:

          1. set dracs_death_verification_status = ‘NOT_VERIFIED’

          2. set dracs_death_verification_reason = ‘AUTO_ONLINE’

          3. set updated_at = now()

          4. set updated_by = system_user()

        6. in case dracs_death_verification_status = ‘IN_REVIEW’ and dracs_death_verification_reason = ‘MANUAL’ - do not update persons dracs death verification status

        7. in case dracs_death_verification_status = ‘VERIFIED’ - update persons dracs death verification status:

          1. set dracs_death_verification_status = ‘NOT_VERIFIED’

          2. set dracs_death_verification_reason = ‘AUTO_ONLINE’

          3. set updated_at = now()

          4. set updated_by = system_user()

    2. if false - skip this person, go to next person in list (return to p.5)

  16. When no death act with average or high comparison probability is found (black zone) - check that persons dracs_death_online_status = ‘IN_PROGRESS’

    1. if true - proceed with comparison result processing:

      1. Update persons verification status in person_verifications table in MPI db based on current dracs death verification status of person:

        1. in case dracs_death_verification_status = ‘NOT_VERIFIED’ - do not update persons dracs death verification status

        2. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_NOT_CONFIRMED’ - do not update persons dracs death verification status

        3. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_CONFIRMED’ - do not update persons dracs death verification status

        4. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:

          1. set dracs_death_verification_status = ‘VERIFIED’

          2. set dracs_death_verification_reason = ‘AUTO_ONLINE’

          3. set updated_at = now()

          4. set updated_by = system_user()

        5. in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘INITIAL’ - do not update persons dracs death verification status

        6. in case dracs_death_verification_status = ‘IN_REVIEW’ and dracs_death_verification_reason = ‘MANUAL’ - do not update persons dracs death verification status

        7. in case dracs_death_verification_status = ‘VERIFIED’ - do not update persons dracs death verification status

    2. if false - skip this person, go to next person in list (return to p.5)

  17. When all death acts were fully compared with person, update person_verifications table in MPI db for person_id:

    1. set dracs_death_online_status = ‘COMPLETED’

    2. set updated_at = now()

    3. set updated_by = system_user()

  18. Select next person from obtained list and return to p.5 of process.

    1. in case no more persons available - end process

dracs_death_acts

ArServiceAnswer

dracs_death_acts

ArServiceAnswer

surname

Surname

street

Street

state

State

sex

Sex

region

Region

reg_numb

RegNumb

patronymic

Patronymic

op_date

OP_DATE

numident

Numident

name

Name

locality_type

LocalityType

locality

Locality

is_restore

IS_RESTORE

house

House

doc_seizes.series_numb

DOC_SEIZES / DOC_SEIZE / SERIES_NUMB

doc_seizes.doc_type

DOC_SEIZES / DOC_SEIZE / DocType

doc_seizes.doc_org_name

DOC_SEIZES / DOC_SEIZE / DocOrgName

doc_seizes.doc_name

DOC_SEIZES / DOC_SEIZE / DocName

doc_seizes.doc_date

DOC_SEIZES / DOC_SEIZE / DocDate

district

District

date_death

DateDeath

date_birth

DateBirth

compose_org

ComposeOrg

compose_date

СomposeDate

birth_state

BirthState

birth_region

BirthRegion

birth_locality_type

BirthLocalityType

birth_locality

BirthLocality

birth_district

BirthDistrict

ar_reg_number

ArRegNumber

ar_reg_date

ArRegDate

ar_op_name

AR_OP_NAME

apartment

Apartment

ЕСОЗ - публічна документація