ЕСОЗ - публічна документація
Online verification of Parties with DRACS death acts registry_EN
Purpose
This process gets death acts data of specific party from the DRACS registry through Trembita exchange gateway and uses it for further comparison with party.
Key points
This process process uses cron parameter to configure its start time.
This process process is used to obtain all death acts of specified party from DRACS registry.
This process process gets limited amount of parties for synchronization with DRACS death acts registry.
This process process uses Oban job processing library as jobs management tool.
Configuration
Value | Description | Example |
---|---|---|
DRACS_DEATH_ACTS_PARTIES_ONLINE_VERIFICATION_SCHEDULE | Cron parameter, represents start time of online verification of Parties with DRACS death acts registry process |
|
DRACS_DEATH_ACTS_PARTIES_ONLINE_VERIFICATION_BATCH_SIZE | Size of Parties list that will be verified online with DRACS death acts registry |
|
Service logic
Get list of Parties with at least one active employee that must be verified online with DRACS death acts registry by following params from PRM db:
party_verifications.dracs_death_online_status = ‘READY’
Sort obtained list by party_verifications.updated_at field in ascending order (first updated party verification record must be first synchronized with DRACS death acts registry).
Limit obtained list with DRACS_DEATH_ACTS_PARTIES_SYNC_BATCH_SIZE value from chart params.
if resulting list is empty - end process
Get first party from obtained list.
Update party_verifications table by party_id:
set dracs_death_online_status = ‘IN_PROCESS’
Get parties death acts - perform GetDeathArByFullNameAndBirthDate DRACS method (DRACS Trembita methods | GetDeathArByFullNameAndBirthDate) with following params:
Name = parties.first_name
OnDate = parties.birth_date
Patronymic = parties.second_name
Surname = parties.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 parties dracs_death_online_status = ‘IN_PROCESS’
if true - rollback it in party_verifications table by party_id:
set dracs_death_online_status = ‘READY’
set updated_at = now()
if false - skip this party, go to next party 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 parties dracs_death_online_status = ‘IN_PROCESS’,
if true - update party_verifications table in PRM db for party_id:
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update parties 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 parties dracs_death_online_status:
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
if false - skip this party, go to next party 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 party were found - check that parties dracs_death_online_status = ‘IN_PROCESS’,
if true - update party_verifications table in mpi db for party_id:
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update parties 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 parties dracs_death_online_status:
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
if false - skip this party, go to next party in list (return to p.5)
Send parties data and active death acts list to comparison endpoint - check that parties dracs_death_online_status = ‘IN_PROCESS’
if true - proceed with comparison process
Prepare active death acts list for comparison with party according to Offline comparison of death acts with Parties | Step 2. Data preparation and potential candidates select, p.2
Compare party with each active death act using existing logistic regression predicative method as described here: Offline comparison of death acts with Parties | Step 3. Death act comparison process
if false - skip this party, go to next party in list (return to p.5)
When found death act with high or average comparison probability (white or grey zone) - check that parties dracs_death_online_status = ‘IN_PROCESS’
if true - proceed with comparison result processing:
Create verification candidate with party_id and dracs_death_act_id in party_verification_candidates table in PRM db according to Offline comparison of death acts with Parties | Step 4.1. White or grey zone
if active verification candidate between party_id and dracs_death_act_id already exists - skip death act
Update parties verification status in party_verifications table based on current dracs death verification status of party:
in case dracs_death_verification_status = ‘NOT_VERIFIED’ - do not update parties dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update parties 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 parties 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 = ‘VERIFIED’ - update parties 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 party, go to next party in list (return to p.5)
When no death act with average or high comparison probability is found (black zone) - check that parties dracs_death_online_status = ‘IN_PROGRESS’
if true - proceed with comparison result processing:
Update parties verification status in party_verifications table based on current dracs death verification status of party:
in case dracs_death_verification_status = ‘NOT_VERIFIED’ - do not update parties dracs death verification status
in case dracs_death_verification_status = ‘VERIFICATION_NEEDED’ and dracs_death_verification_reason = ‘ONLINE_TRIGGERED’ - update parties 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 parties dracs death verification status
in case dracs_death_verification_status = ‘VERIFIED’ - do not update parties dracs death verification status
if false - skip this party, go to next party in list (return to p.5)
When all death acts were fully compared with party, update party_verifications table in PRM db for party_id
set dracs_death_online_status = ‘COMPLETED’
set updated_at = now()
set updated_by = system_user()
Select next party from obtained list and return to p.5 of process.
in case no more parties available - end process
ЕСОЗ - публічна документація