Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Get drfo value from digital signature.

  2. Search for existing user in mithril database, users table, with tax_id = drfo from digital signature and is_active = true

    1. If user is found - check it is not blocked (is_blocked <> true)

      1. in case blocked - return 401 ('User is blocked.').

      2. in case not blocked - save user_id and proceed to p.3.

    2. If user is not found - proceed to https://e-health-ua.atlassian.net/wiki/spaces/PCABEH/pages/1741514363017525605723/PIS.+Patient+sign-up+registration#Search-or-create-person

  3. Search for existing person in mpi database, persons table, with id = person_id from found user, status = active and is_active = true

    1. in case person not found - return 401 ('Person not found.')

    2. in case person found - check its age is greater then no_self_auth_age global parameter

      1. in case of error - return 401 ('Incorrect person age for such an action.')

      2. in case persons age is correct - save user_id and proceed to https://e-health-ua.atlassian.net/wiki/spaces/PCABEH/pages/1741514363017525605723/PIS.+Patient+sign-up+registration#Generate-authorization-token

...

  1. Search for existing active person in mpi database with data from person registration request according to existing process, described here https://e-health-ua.atlassian.net/wiki/spaces/PCABEH/pages/1741514363017525605723/PIS.+Patient+sign-up+registration#Search-or-create-person
    Calculate score of comparison between found active persons and person registration request using existing deduplication process, described here /wiki/spaces/PCAB/pages/17427464424 Deduplication process
    Compare found score with PIS_ONLINE_DEDUPLICATION_MATCH_SCORE config parameter, set to ‘0.95’:

    1. If one active person with match score > PIS_ONLINE_DEDUPLICATION_MATCH_SCORE was found - check its age is greater then no_self_auth_age global parameter

      1. in case of error - return 401 ('Incorrect person age for such an action.')

      2. in case persons age is correct - save person_id and proceed to p.2.

    2. If more than one active person with match score > PIS_ONLINE_DEDUPLICATION_MATCH_SCORE was found - return 401 ('It is impossible to uniquely identify the person.')

    3. If no active person with match score > PIS_ONLINE_DEDUPLICATION_MATCH_SCORE was found - proceed to p.3.

  2. Search for existing user in mithril database, users table, with person_id = person_id from found person and is_active = true

    1. If user is found - check it is not blocked (is_blocked <> true)

      1. in case blocked - return 401 ('User is blocked.').

      2. in case not blocked - update user, set tax_id = drfo from digital signature, set settings.trusted_source = true, save user_id and proceed to https://e-health-ua.atlassian.net/wiki/spaces/PCABEH/pages/1741514363017525605723/PIS.+Patient+sign-up+registration#Generate-authorization-token

    2. If user is not found - proceed to https://e-health-ua.atlassian.net/wiki/spaces/PCABEH/pages/1741514363017525605723/PIS.+Patient+sign-up+registration#Create-user

  3. Create new patient in mpi database, set values in following tables based on person registration request:

    1. persons table

    2. person_phones table

    3. person_addresses table

    4. person_documents table

    5. person_authentication_methods table

  4. Save signed content to media storage

  5. Submit person on verification - create record in person_verifications table for person_id, set values for each verification stream:

    1. Manual NHS verifiation

      1. IF $.person.documents contains document with type = 'PERMANENT_RESIDENCE_PERMIT' or  $.person.unzr is not empty and first 8 digits of $.person.unzr != $.person.birth_date
        or $.person.documents contains document with type from PIS_PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter
        - scan copies of persons documents must be uploaded to media storage after persons registration using Initialize Person documents upload

        1. set nhs_verification_status = NOT_VERIFIED

        2. set nhs_verification_reason = DOCUMENTS_TRIGGERED

      2. else - scan copies of persons documents are not needed, set verification status according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACSEH/pages/17249206422589430849/IL.Sign+person+request+modified+EN#Manualrequest#Manual-NHS-verification

    2. DRFO registry verification - according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACSEH/pages/17249206422589430849/IL.Sign+person+request+modified+EN#DRFOrequest#DRFO-registry-verification

    3. DRACS death acts registry verification - according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACSEH/pages/17249206422589430849/IL.Sign+person+request+modified+EN#DRACSrequest#DRACS-death-acts-registry-verification

  6. Calculate cumulative person verifiation status according to logic, described here: https://e-health-ua.atlassian.net/wiki/spaces/DRACSEH/pages/17249206422589430849/IL.Sign+person+request+modified+EN#Calculaterequest#Calculate-cumulative-verification-status

Create user

  1. Create user for active patient in mithril database, users table, set:

    1. id = autogenerate uuid

    2. settings = ‘{“trusted_source”: true}’

    3. priv_settings = ‘{"login_hstr": [], "otp_error_counter": 0}’

    4. inserted_at = now()

    5. updated_at = now()

    6. password_set_at = now()

    7. tax_id = drfo value from digital signature

    8. person_id = person_id of person that was found or created on ‘Search or create patient’ step.

  2. Create global role for created user in mithril database, global_user_roles table, set:

    1. id = autogenerate uuid

    2. user_id = user_id of user created on p.4

    3. role_id = id of role with name ‘PATIENT’

    4. inserted_at = now()

    5. updated_at = now()

...