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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Purpose

This job is designed for initial and further regular synchronization of Parties with the EIS MVS registry in order to check if their passport documents are invalid or not.

Configuration

Value

Description

Example

DMS_PARTY_SYNCHRONIZATION_SCHEDULE

Cron parameter, represents start time of the EIS MVS data synchronization with register of invalid passport documents

"0 1 * * *"

DMS_PARTY_VALIDATION_PERIOD_DAYS

Represents period in days when the existing saved DMS data should be validated in EIS MVS registry if it still valid.

"270"

DMS_PASSPORT_PARTIES_SYNCHRONIZATION_BATCH_SIZE

Amount of parties processed by DMS passport data synchronization job at once

"50"

Data flow

Scheduller starts according to DMS_PARTY_SYNCHRONIZATION_SCHEDULE cron parameter. It creates oban job that selects DMS_PASSPORT_PARTIES_SYNCHRONIZATION_BATCH_SIZE Parties that match to some filter parameters. For each the job receives Party’s passport data on input and returns the result of reconciliation with the EIS MVS registry to output (details in “Step description” section below):

  • if Passport is found - set verification status to NOT_VERIFIED.

  • if Passport is not found for the Party - set verification status to VERIFIED.

  • If Passport is absent - sync isn’t performed, the Party receives VERIFICATION_NOT_NEEDED status.

  • If incorrect passport data - set verification status to NOT_VERIFIED.

  • if technical error received - the verification status and reason doesn’t change. The dms data is not saved, Party is not updated;

dms passport status check for parties v7.drawio.png

Step description

Step 1. Get list of Parties

Get list of Parties that meets the following criteria (using logical AND):

  • has at least one active and approved Employee

  • prm.party_verifications.dms_passport_synced_at <= current_date - DMS_PARTY_VALIDATION_PERIOD_DAYS OR dms_passport_synced_at is null

  • exclude parties who has dms_passport_verification_status = IN_REVIEW, NOT_VERIFIED, VERIFICATION_NOT_NEEDED

Order selected records in descending way by:

  • dms_passport_verification_status = VERIFICATION_NEEDED and dms_passport_verification_reason = ONLINE_TRIGGERED (should be at the top of the list)

Update party_verifications record by party_id:

  • dms_passport_verification_status = IN_REVIEW

  • dms_passport_verification_reason = AUTO

Step 1.1 Update Party

Invoke the Step If party_verifications.dms_passport_verification_status still IN_REVIEW

Make data pre-estimation for a synchronization:

  1. If party has no passport document (NATIONAL_ID or PASSPORT) at all, then update party_verifications record by party_id:

    • dms_passport_data_id = null

    • dms_passport_data_status = null

    • dms_passport_synced_at = null

    • dms_passport_verification_status = VERIFICATION_NOT_NEEDED

      dms_passport_verification_reason = AUTO_DATA_ABSENT

    • dms_passport_unverified_at = null

  2. Check If the party matches both rules:

    • it has only one passport document: NATIONAL_ID or PASSPORT

    • passport number matches the regex for its type:

      • ^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$ for the PASSPORT

      • ^[0-9]{9}$ for the NATIONAL_ID

Else, update party_verifications record by party_id:

  • dms_passport_data_id = null

  • dms_passport_data_status = null

  • dms_passport_synced_at = null

  • dms_passport_verification_status = NOT_VERIFIED

  • dms_passport_verification_reason = AUTO_INCORRECT_DATA

  • dms_passport_unverified_at = current datetime

Step 2. Call CheckPassportDMSStatus

Call CheckPassportDMSStatus with third-party service https://e-health-ua.atlassian.net/wiki/spaces/EDDR/pages/18052513879/MVS+Trembita+methods#CheckPassportDMSStatus using the following request params:

If prm.party.documents.type = NATIONAL_ID

  • pass_type = 0101

  • pas_number= prm.party.documents.number

If prm.party.documents.type = PASSPORT

  • pass_type = 0101

  • pas_number = prm.party.documents.number (number as last six symbols)

  • pas_serial = prm.party.documents.number (serial as first two symbols)

Step 3. Create or update dms_passport_data

If Step 2 was successful and PasStatus = 1 returned. Get a record from mimir.dms_passport_data table by pass_type, pas_serial, pas_number :

  • if not found - create a record.

 Set data to NEW record
  • id - generate uuid

  • pass_type - PassType from CheckPassportDMSStatus request

  • pas_serial - PasSerial from CheckPassportDMSStatus request

  • pas_number - PasNumber from CheckPassportDMSStatus request

  • pas_status - PasStatus from CheckPassportDMSStatus response

  • inserted_at - current date and time

  • updated_at - current date and time (set even record is not changed, but synchronized)

  • if found - updated the record.

 Set data to EXISTING record
  • pas_status - PasStatus from CheckPassportDMSStatus response

  • updated_at - current date and time (set even record is not changed, but synchronized)

Step 4. Update Party

Invoke the Step If party_verifications.dms_passport_verification_status still IN_REVIEW (because if changed to VERIFICATION_NEEDED+ONLINE_TRIGGERED, then it means that party record has been changed while current sync with EIS MVS performed)

After dms_passport_data record was stored in Step 3 - update party record in PRM db:

Update party_verifications record by party_id:

  • dms_passport_data_id = mimir.dms_passport_data.id

  • dms_passport_data_status = 1

  • dms_passport_synced_at = date and time when synchronization has been performed (current datetime)

  • dms_passport_verification_status = NOT_VERIFIED

  • dms_passport_verification_reason = AUTO_NOT_VALID

  • dms_passport_unverified_at = current datetime

Step 4.1. Update another Parties

Invoke the Step If party_verifications.dms_passport_verification_status is not IN_REVIEW

If dms_passport_data has been changed at Step 3, then find another Parties with the same document_type (PASSPORT or NATIONAL_ID) and document number. If such was fount, set for them also:

  • dms_passport_data_id = mimir.dms_passport_data.id

  • dms_passport_data_status = 1

  • dms_passport_synced_at = date and time when synchronization has been performed (current datetime)

  • dms_passport_verification_status = NOT_VERIFIED

  • dms_passport_verification_reason = AUTO_NOT_VALID

  • dms_passport_unverified_at = current datetime

Step 4.2. Update Persons

Invoke the Step if person_verifications.dms_passport_verification_status is not IN_REVIEW

If dms_passport_data has been changed at Step 3, then find Persons with the same document_type (PASSPORT or NATIONAL_ID) and document number. If such was fount, set for them also:

  • dms_passport_data_id = mimir.dms_passport_data.id

  • dms_passport_data_status = 1

  • dms_passport_synced_at = date and time when synchronization has been performed (current datetime)

  • dms_passport_verification_status = NOT_VERIFIED

  • dms_passport_verification_reason = AUTO_NOT_VALID

  • dms_passport_unverified_at = current datetime

Step 5. Update Party

Invoke the Step If party_verifications.dms_passport_verification_status still IN_REVIEW

If passport wasn’t fount (PasStatus = 0) in the register at Step 2, then update party_verification for the party_id:

  • dms_passport_data_id = null

  • dms_passport_data_status = 0

  • dms_passport_synced_at = date and time when synchronization has been performed (current datetime)

  • dms_passport_verification_status = VERIFIED

  • dms_passport_verification_reason = AUTO_VALID

  • dms_passport_unverified_at = null

Step 6. Technical error returned

If technical error: PasStatus = -2, -1, timeout, etc. returned in Step 2 - the Party is considered unprocessed.

If party_verifications.dms_passport_verification_status still IN_REVIEW:

  • rollback to previous dms_passport_verification_status and dms_passport_verification_reason (that were before IN_REVIEW, set in Step 2)

  • No labels