ЕСОЗ - публічна документація
RCC_DRACS birth acts synchronization for Persons (DRACS2-145)
Configuration
Value | Description | Example |
---|---|---|
DRACS_BIRTH_ACTS_PERSONS_SYNCHRONIZATION_SCHEDULE | Cron parameter, represents start time of Persons synchronization with DRACS birth acts registry process |
|
DRACS_BIRTH_ACTS_PERSONS_SYNCHRONIZATION_BATCH_SIZE | Size of Persons list that will be synchronized online with DRACS birth acts registry |
|
DRACS_BIRTH_ACTS_PERSON_VALIDATION_PERIOD_DAYS | Represents period in days when the existing person birth certificate data should be validated in DRACS birth acts registry if it still valid |
|
DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_PERIOD_DAYS | Represents period in days when the existing confidant person relatinship with birth certificate data should be validated in DRACS birth acts registry if it still valid |
|
DRACS_BIRTH_ACTS_PERSON_VALIDATION_ENABLED | Boolean parameter, represents parameter that persons must be validated in DRACS birth acts registry |
|
DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_ENABLED | Boolean parameter, represents parameter that confidant person relationships must be validated in DRACS birth acts registry |
|
Service logic
Step 1. Prepare list of Persons to be synced
Get list of active Persons (status=active, is_active=true) that must be synchronized online with DRACS birth acts registry by following criteria (using logical AND):
if DRACS_BIRTH_ACTS_PERSON_VALIDATION_ENABLED env parameter is set to
true
– get persons that must be synchronized online with DRACS birth acts registry:mpi.person_verifications.dracs_birth_synced_at <= current_date - DRACS_BIRTH_ACTS_PERSON_VALIDATION_PERIOD_DAYS OR dracs_birth_synced_at is null
exclude persons who has dracs_birth_verification_status = IN_REVIEW, NOT_VERIFIED, VERIFICATION_NOT_NEEDED
if DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_ENABLED env parameter is set to
true
– get persons whose confidant person relationship must be synchronized online with DRACS birth acts registry:mpi.confidant_person_relationships.dracs_birth_synced_at <= current_date - DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_PERIOD_DAYS OR dracs_birth_synced_at is null with confidant_person_relationship_documents.type = ‘BIRTH_CERTIFICATE’
exclude relationships who has verification_status = IN_REVIEW, NOT_VERIFIED or does not have confidant_person_relationship_documents.type ‘BIRTH_CERTIFICATE’
In case if list is empty or both parameters DRACS_BIRTH_ACTS_PERSON_VALIDATION_ENABLED and DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_ENABLED set to false
- end the process.
In case if list is not empty - sort obtained lists by:
person_verifications.dracs_birth_verification_status = VERIFICATION_NEEDED and person_verifications.dracs_birth_verification_reason = ONLINE_TRIGGERED or MANUAL (should be at the top of the list)
confidant_person_relationships.verification_status = VERIFICATION_NEEDED and confidant_person_relationships.verification_reason = ONLINE_TRIGGERED or MANUAL (should be at the top of the list)
Limit obtained list with DRACS_BIRTH_ACTS_PERSONS_SYNCHRONIZATION_BATCH_SIZE value from chart params.
Get first person from obtained list.
Step 1.1 Update Person
If DRACS_BIRTH_ACTS_PERSON_VALIDATION_ENABLED env parameter is set to true
– make data pre-estimation for a synchronization:
If a person has no birth certificate document (
BIRTH_CERTIFICATE
) at all, then update person_verifications record by person_id:dracs_birth_act_id = null
dracs_birth_verification_status = VERIFICATION_NOT_NEEDED
dracs_birth_verification_reason = INITIAL
dracs_birth_verification_comment = null
dracs_birth_synced_at = null
dracs_birth_unverified_at = null
If a person has more than one active birth certificate document, then update person_verifications record by person_id:
dracs_birth_act_id = null
dracs_birth_verification_status = NOT_VERIFIED
dracs_birth_verification_reason = INITIAL
dracs_birth_verification_comment = null
dracs_birth_synced_at = null
dracs_birth_unverified_at = now()
If persons age > no_self_auth_age global parameter and person has other active document from IDENTITY_DOCUMENT_TYPES config parameter (exclude
BIRTH_CERTIFICATE
andBIRTH_CERTIFICATE_FOREIGN
), then update person_verifications record by person_id:dracs_birth_act_id = null
dracs_birth_verification_status = VERIFICATION_NOT_NEEDED
dracs_birth_verification_reason = INITIAL
dracs_birth_verification_comment = null
dracs_birth_synced_at = null
dracs_birth_unverified_at = null
If person corresponded to any of the rules above – proceed to Step 6.
If person did not correspond to any of the rules above – proceed to Step 2.
Step 2. Get Person birth acts from DRACS
If person must be verified by DRACS birth acts registry by conditions from Step 1 and DRACS_BIRTH_ACTS_PERSON_VALIDATION_ENABLED env parameter is set to
true
- update person_verifications table in MPI db for person_id, set values:dracs_birth_verification_status = ‘IN_REVIEW’
dracs_birth_verification_reason = ‘AUTO_ONLINE’
If confidant person relationship must be verified by DRACS birth acts registry by conditions from Step 1 and DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_ENABLED env parameter is set to
true
- update confidant_person_relationships table in MPI db for person_id and relationship_id, set values:verification_status = ‘IN_REVIEW’
verification_reason = ‘AUTO’
Get persons birth acts - perform RC_DRACS Trembita methods (DRACS 2.0) | GetBirthArByChildNameAndBirthDate DRACS method with following request params:
ChildName = persons.first_name
ChildBirthDate = persons.birth_date
ChildPatronymic = persons.second_name (skip if empty)
ChildSurname = persons.last_name
Get ResultData field from GetBirthArByChildNameAndBirthDate method response and decode it from base64 to get XML file of birth acts list.
in case GetBirthArByChildNameAndBirthDate ResultCode <> 0 or connection error or timeout is occured - check that persons dracs_birth_verification_status = ‘IN_REVIEW’ or confidant person relationship verification status = ‘IN_REVIEW’
if true - rollback it in person_verifications table in MPI db for person_id to previous state
if false - skip this person, go to next person in list.
Step 4. Verify Person
Check that person_verifications.dracs_birth_verification_status equals to IN_REVIEW (because if changed to any other status, then its mean that person record has been changed while current sync with DRACS birth acts performed, or person should not be synchronized by DRACS birth acts registry) and DRACS_BIRTH_ACTS_PERSON_VALIDATION_ENABLED env parameter equals to true
:
if equals – invoke this Step.
if not equal – skip this Step, go to Step 5.
Get only active birth acts with ar_op_name = 1 or 4
and not empty certificates
with active records cert_status = 1
from the obtained birth acts list.
Step 5. Verify Confidant person relationships
Check that Person has confidant person relationships with verification_status = IN_REVIEW and verification_reason = AUTO_ONLINE with confidant_person_relationship_documents.type = BIRTH_CERTIFICATE and DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_ENABLED env parameter is set to true
.
if relationships exist and parameter is set to
true
– invoke this Step.if relationship does not exist or parameter is set to
false
– skip this Step, go to Step 6.
Get only active birth acts with ar_op_name = 1 or 4
and not empty certificates
with active records cert_status = 1
from the obtained list.
I
Related content
ЕСОЗ - публічна документація