ЕСОЗ - публічна документація
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
This process uses cron parameter to configure its start time.
This process is used to obtain all death acts of specified person from DRACS registry.
This process gets limited amount of persons for synchronization with DRACS death acts registry.
This process uses Oban job processing library as jobs management tool.
Configuration
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 |
|
DRACS_DEATH_ACTS_PERSONS_ONLINE_VERIFICATION_BATCH_SIZE | Size of Persons list that will be verified online with DRACS death acts registry |
|
Service logic
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:
person_verifications.dracs_death_online_status = ‘READY’
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).
Limit obtained list with DRACS_DEATH_ACTS_PERSONS_ONLINE_VERIFICATION_BATCH_SIZE value from chart params.
if resulting list is empty - end process
Get first person from obtained list.
Update person_verifications table in MPI db for person_id:
set dracs_death_online_status = ‘IN_PROCESS’
Get persons death acts - perform GetDeathArByFullNameAndBirthDate DRACS method (DRACS Trembita methods | GetDeathArByFullNameAndBirthDate) with following params:
Name = persons.first_name
OnDate = persons.birth_date
Patronymic = persons.second_name
Surname = persons.last_name
Get ResultData field from GetDeathArByFullNameAndBirthDate method response and decode it from base64 to get XML file of death acts list.
in case GetDeathArByFullNameAndBirthDate ResultCode <> 0 or connection error or timeout is occured - check that persons dracs_death_online_status = ‘IN_PROCESS’
if true - rollback it in person_verifications table in MPI db for person_id:
set dracs_death_online_status = ‘READY’
set updated_at = now()
if false - skip this person, go to next person in list (return to p.5)
Parse obtained XML file and form death acts list.
in case empty death acts list is returned - check that persons dracs_death_online_status = ‘IN_PROCESS’,
if true - update person_verifications table in MPI db for person_id:
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:
set dracs_death_verification_status = ‘VERIFIED’
set dracs_death_verification_reason = ‘AUTO_ONLINE’
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
for any other dracs_death_verification_status and dracs_death_verification_reason combination - update persons dracs_death_online_status:
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
if false - skip this person, go to next person in list (return to p.5)
Save each death act from formed list to dracs_death_acts table in transaction according to fields matching (located in the table below)
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
in case not found - insert new act record to dracs_death_acts table, also add technical data:
set id = autogenerate uuid
set inserted_at = now()
set updated_at = now()
set persons_compare_status = ‘READY’
set parties_compare_status = ‘READY'
set settlement_id from uadresses service using RPC call with following logic:
in case locality is null or locality_type = ‘Район’ - get settlement_id where settlement_name = district and area_name = region
in case locality is not null - get settlement_id where settlement_name = locality and area_name = region
in case found - check that condition
op_date = OP_DATE and ar_op_name = AR_OP_NAME
is also met for found recordin case condition is met - full duplicate of death acts already exists, update dracs_death_acts table for found record:
set updated_at = now()
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 registryin case at least one field was updated
save existing record to dracs_death_acts_hstr table
dracs_death_act_id = id of current death act from dracs_death_acts table
dracs_death_act_data = full data of current death act in jsonb format (without technical fields, use fields matching from table below)
inserted_at = now()
fully update existing death act in dracs_death_acts table with new values from DRACS registry
set persons_compare_status = ‘READY’
set parties_compare_status = ‘READY'
set updated_at = now()
set settlement_id from uadresses service using RPC call with following logic:
in case locality is null or locality_type = ‘Район’ - get settlement_id where settlement_name = district and area_name = region
in case locality is not null - get settlement_id where settlement_name = locality and area_name = region
in case none of the fields were updated - update dracs_death_acts table for found death act:
op_date = OP_DATE from response
ar_op_name = AR_OP_NAME from response
updated_at = now()
Update existing verification candidates according to saved death acts list:
in case saved death act is cancelled (
ar_op_name = 2 or 3
) or fully updated from DRACS (ar_op_name = 4
and 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)in case found
deactivate verification candidates:
set status = ‘DEACTIVATED’
set status_reason = 'DEATH_ACT_UPDATED'
set updated_at = now()
update persons and parties compare status for death acts with
ar_op_name = 2 or 3
set persons_compare_status = ‘PROCESSED’
set parties_compare_status = ‘PROCESSED'
in case not found
update persons and parties compare status for death acts with
ar_op_name = 2 or 3
set persons_compare_status = ‘PROCESSED’
set parties_compare_status = ‘PROCESSED'
Get only active death acts with
ar_op_name = 1 or 4
from obtained list.in case no active death acts for person were found - check that persons dracs_death_online_status = ‘IN_PROCESS’,
if true - update person_verifications table in MPI db for person_id:
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:
set dracs_death_verification_status = ‘VERIFIED’
set dracs_death_verification_reason = ‘AUTO_ONLINE’
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
for any other dracs_death_verification_status and dracs_death_verification_reason combination - update persons dracs_death_online_status:
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
if false - skip this person, go to next person in list (return to p.5)
Send person data and active death acts list to comparison endpoint - check that persons dracs_death_online_status = ‘IN_PROCESS’
if true - proceed with comparison process
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
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
if false - skip this person, go to next person in list (return to p.5)
When found death act with high comparison probability (white zone) - check that persons dracs_death_online_status = ‘IN_PROCESS’
if true - proceed with comparison result processing:
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
Deactivate person
set persons.status = inactive, persons.updated_at = now()
terminate active declarations for person
deactivate active persons authentication methods
revert active verification candidates for person in person_verification_candidates table in MPI DB by person_id
set status = ‘NOT_CONFIRMED’
set updated_at = now()
Update person_verifications table in MPI db for person_id:
set dracs_death_act_id = id of death act from
mimir.dracs_death_acts
set dracs_death_verification_status = ‘VERIFIED’
set dracs_death_verification_reason = ‘AUTO_ONLINE’
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
if false - skip this person, go to next person in list (return to p.5)
When found death act with average comparison probability (grey zone) - check that persons dracs_death_online_status = ‘IN_PROCESS’
if true - proceed with comparison result processing:
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
if active verification candidate between person_id and dracs_death_act_id already exists - skip death act
Update persons verification status in person_verifications table in MPI db based on current dracs death verification status of person:
in case dracs_death_verification_status = ‘NOT_VERIFIED’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_NOT_CONFIRMED’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_CONFIRMED’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:
set dracs_death_verification_status = ‘NOT_VERIFIED’
set dracs_death_verification_reason = ‘AUTO_ONLINE’
set updated_at = now()
set updated_by = system_user()
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘INITIAL’ - update persons dracs death verification status:
set dracs_death_verification_status = ‘NOT_VERIFIED’
set dracs_death_verification_reason = ‘AUTO_ONLINE’
set updated_at = now()
set updated_by = system_user()
in case dracs_death_verification_status = ‘IN_REVIEW’ and dracs_death_verification_reason = ‘MANUAL’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFIED’ - update persons dracs death verification status:
set dracs_death_verification_status = ‘NOT_VERIFIED’
set dracs_death_verification_reason = ‘AUTO_ONLINE’
set updated_at = now()
set updated_by = system_user()
if false - skip this person, go to next person in list (return to p.5)
When no death act with average or high comparison probability is found (black zone) - check that persons dracs_death_online_status = ‘IN_PROGRESS’
if true - proceed with comparison result processing:
Update persons verification status in person_verifications table in MPI db based on current dracs death verification status of person:
in case dracs_death_verification_status = ‘NOT_VERIFIED’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_NOT_CONFIRMED’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘MANUAL_CONFIRMED’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update persons dracs death verification status:
set dracs_death_verification_status = ‘VERIFIED’
set dracs_death_verification_reason = ‘AUTO_ONLINE’
set updated_at = now()
set updated_by = system_user()
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘INITIAL’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘IN_REVIEW’ and dracs_death_verification_reason = ‘MANUAL’ - do not update persons dracs death verification status
in case dracs_death_verification_status = ‘VERIFIED’ - do not update persons dracs death verification status
if false - skip this person, go to next person in list (return to p.5)
When all death acts were fully compared with person, update person_verifications table in MPI db for person_id:
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
Select next person from obtained list and return to p.5 of process.
in case no more persons available - end process
ЕСОЗ - публічна документація