/
RCC_DRACS birth acts synchronization for Persons (DRACS2-145)

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

RCC_DRACS birth acts synchronization for Persons (DRACS2-145)

Configuration

Value

Description

Example

Value

Description

Example

DRACS_BIRTH_ACTS_PERSONS_SYNCHRONIZATION_SCHEDULE

Cron parameter, represents start time of Persons synchronization with DRACS birth acts registry process

*/3 * * * *

DRACS_BIRTH_ACTS_PERSONS_SYNCHRONIZATION_BATCH_SIZE

Size of Persons list that will be synchronized online with DRACS birth acts registry

100

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

180

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

30

DRACS_BIRTH_ACTS_PERSON_VALIDATION_ENABLED

Boolean parameter, represents parameter that persons must be validated in DRACS birth acts registry

true

DRACS_BIRTH_ACTS_CONFIDANT_PERSON_RELATIONSHIP_VALIDATION_ENABLED

Boolean parameter, represents parameter that confidant person relationships must be validated in DRACS birth acts registry

true

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:

  1. If a person has no birth certificate document (BIRTH_CERTIFICATE) at all, then update person_verifications record by person_id:

    1. dracs_birth_act_id = null

    2. dracs_birth_verification_status = VERIFICATION_NOT_NEEDED

    3. dracs_birth_verification_reason = INITIAL

    4. dracs_birth_verification_comment = null

    5. dracs_birth_synced_at = null

    6. dracs_birth_unverified_at = null

  2. If a person has more than one active birth certificate document, then update person_verifications record by person_id:

    1. dracs_birth_act_id = null

    2. dracs_birth_verification_status = NOT_VERIFIED

    3. dracs_birth_verification_reason = INITIAL

    4. dracs_birth_verification_comment = null

    5. dracs_birth_synced_at = null

    6. dracs_birth_unverified_at = now()

  3. If persons age > no_self_auth_age global parameter and person has other active document from IDENTITY_DOCUMENT_TYPES config parameter (exclude BIRTH_CERTIFICATE and BIRTH_CERTIFICATE_FOREIGN), then update person_verifications record by person_id:

    1. dracs_birth_act_id = null

    2. dracs_birth_verification_status = VERIFICATION_NOT_NEEDED

    3. dracs_birth_verification_reason = INITIAL

    4. dracs_birth_verification_comment = null

    5. dracs_birth_synced_at = null

    6. 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

  1. 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:

    1. dracs_birth_verification_status = ‘IN_REVIEW’

    2. dracs_birth_verification_reason = ‘AUTO_ONLINE’

  2. 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:

    1. verification_status = ‘IN_REVIEW’

    2. verification_reason = ‘AUTO’

  3. Get persons birth acts - perform RC_DRACS Trembita methods (DRACS 2.0) | GetBirthArByChildNameAndBirthDate DRACS method with following request params:

    1. ChildName = persons.first_name

    2. ChildBirthDate = persons.birth_date

    3. ChildPatronymic = persons.second_name (skip if empty)

    4. ChildSurname = persons.last_name

  4. Get ResultData field from GetBirthArByChildNameAndBirthDate method response and decode it from base64 to get XML file of birth acts list.

    1. 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’

      1. if true - rollback it in person_verifications table in MPI db for person_id to previous state

      2. 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

RC_DRACS birth acts synchronization for Persons (DRACS 2.0)
RC_DRACS birth acts synchronization for Persons (DRACS 2.0)
More like this
RC_DRACS certificates synchronization for Person (DRACS 2.0)
RC_DRACS certificates synchronization for Person (DRACS 2.0)
More like this
Online verification of Persons with DRACS death acts registry_EN
Online verification of Persons with DRACS death acts registry_EN
More like this
RC_Marriage acts synchronization with DRACS registry (DRACS 2.0)
RC_Marriage acts synchronization with DRACS registry (DRACS 2.0)
More like this

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