Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel6
outlinefalse
styledefault
typelist
printablefalse

Purpose

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

Key points

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

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

  3. This process is used to verify both persons with birth certificate documents as well as confidant person relationships with birth certificate documents.

  4. This process is used for synchoronization for new or updated persons in the system, existing persons in the system that were not synchronized with DRACS birth acts registry, existing persons in the system that were synchronized with DRACS birth acts registry to check that their data is still valid in DRACS birth acts registry.

  5. This process gets limited amount of persons for synchronization with DRACS birth acts registry.

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

Configuration

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

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):

...

Get first person from obtained list.

Step 1.1 Update Person

Make data pre-estimation for a synchronization:

...

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 - 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 - ppdate 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 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 3. Prepare obtained birth acts

If GetBirthArByChildNameAndBirthDate call in Step 2 was successful and ResultCode = 0, parse obtained XML file and form birth acts list.

...

  1. in case saved birth act is cancelled (ar_op_name = 2 or 3) or fully updated from DRACS (ar_op_name = 4 and the existing act was saved to dracs_birth_acts_hstr table) - check the existence of active person verification candidates in person_verification_candidates table in MPI db (with status = ‘NEW’, entity_type = ‘dracs_birth_act’ and entity_id = dracs_birth_act_id) or confidant person relationship verification candidates in confidant_person_relationship_verification_candidates table in MPI db (with status = ‘NEW’, entity_type = ‘dracs_birth_act’ and and entity_id = dracs_birth_act_id)

    1. in case found, deactivate each verification candidate with the following logic:

      1. update the status of the verification candidate in person_verification_candidates or confidant_person_relationship_verification_candidates table:

        1. set status = ‘DEACTIVATED’

        2. set status_reason = 'BIRTH_ACT_UPDATED'

        3. set updated_at = now()

      2. check existence of other active verification candidates for person_id in person_verification_candidates table in MPI db (with status = ‘NEW’ and entity_type = ‘dracs_birth_act’) and active verification candidates for relationship_id in confidant_person_relationship_verification_candidates table in MPI db (with status = ‘NEW’ and entity_type = ‘dracs_birth_act’):

        1. in case no more active verification candidates are found for the person, update its dracs birth verification status in person_verifications table:

          1. set dracs_birth_verification_status = ‘VERIFICATION_NEEDED’

          2. set dracs_birth_verification_status = ‘ONLINE_TRIGGERED’

          3. set dracs_birth_unverified_at = null

          4. set dracs_birth_synced_at = null

          5. set updated_at = now()

        2. in case no more active verification candidates are found for the relationship, update its verification status in confidant_person_relationships table:

          1. set verification_status = ‘VERIFICATION_NEEDED’

          2. set verification_status = ‘ONLINE_TRIGGERED’

          3. set unverified_at = null

          4. set dracs_birth_synced_at = null

          5. set updated_at = now()

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):

...

After all birth acts were compared with Person data – go to Step 4.1.

Step 4.1. Verify Persons confidant person data

Invoke this step if person must be verified by DRACS birth acts registry on Step 4 and person has confidant persons in persons.confidant_person in MPI db and existing confidant persons have documents_relationship with type = BIRTH_CERTIFICATE and person age is lesser than person_full_legal_capacity_age global parameter and person has at least one active birth acts (defined on Step 4).

...

After all birth acts were compared with Confidant persons data – go to Step 5.

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.

...

After all birth acts were compared with Confidant person relationships data – go to Step 6.

Step 6. Select next Person

Select the next person from the obtained list and return to Step 2 of the process.

...