Table of Contents |
---|
...
Confidant_person is an object, not an array, so user must use responses from /wiki/spaces/CSI/pages/17613226064 or /wiki/spaces/CSI/pages/17613422676 RC_(CSI-1323)_Get Person request by ID v2 or RC_(CSI-1323)_Approve person request v2
In case if document that prove legal capacity is set: deactivates all person records in IL | confidanthttps://e-health-ua.atlassian.net/wiki/spaces/EH/pages/724271171/IL#confidant_person_relationship_requests and MPI | confidant and https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/724729917/MPI#confidant_person_relationships tables.
In case if person is created and confidant is submitted: creates relationship in MPI | confidant https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/724729917/MPI#confidant_person_relationships and saves documents that prove relationship to MPI | confidant https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/724729917/MPI#confidant_person_relationship_documents .
Authorization
Verify the validity of access token
Return (401, 'Invalid access token') in case of validation fails
Verify that token is not expired
in case of error - return (401, 'Invalid access token')
Check user scopes in order to perform this action (scope = 'person_request:write')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: person_request:write') in case of invalid scope(s)
...
This WS can sign only person requests that were approved by /wiki/spaces/CSI/pages/17613422676 RC_(CSI-1323)_Approve person request v2
Check that
person_request.version
field is equal to2
in case of error - return 422 ('Person request cannot be processed by the version 2 of the service, use version 1 instead')
Check that
channel
equals to MISin case of error - return 422 ('Only person request with MIS channel can be signed.')
...
If
$.person.authentication_methods[0].type = OTP
- check that phone number is found less than phone_number_auth_limit global parameter in the system according to https://e-health-ua.atlassian.net/wiki/spaces/CSI/pages/17613193262/CR-183.+Create+Update+person+request+v2#Validate-person-authentication-methods RC_(CSI-1323)_Create/Update person request v2in case of error - return 409 ('This phone number is present more then $.global_parameters.phone_number_auth_limit times in the system')
If
$.person.authentication_methods[0].type = THIRD_PERSON
- check that third person is found less than third_person_limit global parameter in the system according to https://e-health-ua.atlassian.net/wiki/spaces/CSIEH/pages/17613193262/CR-183.+17999298851/RC_+CSI-1323+_Create+Update+person+request+v2#Validate-person-authentication-methodsin case of error - return 422 ('This fiduciary person is present more than $.global_parameters.third_person_limit times in the system')
...
Then person will be verified online with DRACS death acts registry via separate process: https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/17629643174
DRACS birth acts registry verification
If person’s data match any of the following rules:
Person is created and persons age <= no_self_auth_age and person has document with type BIRTH_CERTIFICATE (check in Request, within $.person.documents)
Person is created and persons age > no_self_auth_age and person has only document with type BIRTH_CERTIFICATE (check in Request, within $.person.documents)
Person is updated and persons age <= no_self_auth_age and person has document with type BIRTH_CERTIFICATE (check in Request, within $.person.documents) and following fields are updated:
first_name
last_name
second_name
birth_date
document.number with type = ‘BIRTH_CERTIFICATE’
Person is updated and persons age > no_self_auth_age and person has only document with type BIRTH_CERTIFICATE (check in Request, within $.person.documents) and following fields are updated:
first_name
last_name
second_name
birth_date
document.number with type = ‘BIRTH_CERTIFICATE’
thenonline verification with DRACS birth acts registry needed. Set to person verification record:
dracs_birth_act_id = null
dracs_birth_verification_status = VERIFICATION_NEEDED
dracs_birth_verification_reason = ONLINE_TRIGGERED
dracs_birth_verification_comment = null
dracs_birth_synced_at = null
dracs_birth_unverified_at = null
Check existence of verification candidates for person_id with status = ‘NEW’ and entity_type = ‘dracs_birth_act' in person_verification_candidates
table, if found - deactivate them, set:
status = ‘DEACTIVATED’
status_reason = ‘PERSON_UPDATED’
updated_at = now()
Then person will be verified online with DRACS birth acts registry via separate process: https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/18201837580
If person’s data does not match rules from above – online verification with DRACS birth acts registry is not needed. Set to person verification record:
if person is created:
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 is updated – do not update dracs_birth_verification_status and dracs_birth_verification_reason for person.
DRACS name change acts registry verification
If person is created, set values in person_verifications table:
dracs_name_change_verification_status = VERIFICATION_NOT_NEEDED
dracs_name_change_verification_reason = INITIAL
If person is updated and persons dracs_name_change_verification_status = ‘VERIFICATION_NEEDED’:
Check existence of verification candidates for person_id with status = ‘NEW’ and entity_type in (‘dracs_marriage_act', ‘dracs_divorce_act’, ‘dracs_change_name_act’) in the person_verification_candidates table:
if found:
Compare updated person data with them using following processes for each entity_type:
for dracs_marriage_act - use https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/18231492689/RC_DRACS+certificates+synchronization+for+Person+DRACS+2.0#Step-3.-Marriage-act-comparison-process
for dracs_divorce_act - use https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/18231492689/RC_DRACS+certificates+synchronization+for+Person+DRACS+2.0#Step-3.-Divorce-act-comparison-process
for dracs_change_name_act - use https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/18231492689/RC_DRACS+certificates+synchronization+for+Person+DRACS+2.0#Step-3.-Change-name-act-comparison-process
If a candidate does not already match the updated person’s data - deactivate them, set:
status = ‘DEACTIVATED’
status_reason = ‘PERSON_UPDATED’
updated_at = now()
If no more active candidates for name change left - update person DRACS change name verification status, set values:
dracs_name_change_verification_status = VERIFIED
dracs_name_change_verification_reason = AUTO_OFFLINE
dracs_name_change_verification_comment = null
Legal capacity verification
If person’s data match following rules: person has legal capacity document (from PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter) with type ‘MARRIAGE_CERTIFICATE’ or ‘DIVORCE_CERTIFICATE’ (check in Request, within $.person.documents)
thenonline verification with DRACS certificates registry is needed. Set to person verification record:
legal_capacity_verification_status = VERIFICATION_NEEDED
legal_capacity_verification_reason = ONLINE_TRIGGERED
legal_capacity_entity_id = NULL
legal_capacity_entity_type = NULL
legal_capacity_unverified_at = NULL
Then person will be verified online with DRACS certificates registry via separate process: https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/18231492689
If person’s data match following rules: person has legal capacity document (from PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter) with type other than ‘MARRIAGE_CERTIFICATE’ or ‘DIVORCE_CERTIFICATE’ (check in Request, within $.person.documents)
thenpersons legal capacity is verified by default. Set to person verification record:
legal_capacity_verification_status = VERIFICATION_NOT_NEEDED
legal_capacity_verification_reason = AUTO_DATA_ABSENT
legal_capacity_entity_id = NULL
legal_capacity_entity_type = NULL
legal_capacity_unverified_at = NULL
If person does not have legal capacity document (from PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter), legal capacity verification is not needed. Set to person verification record:
legal_capacity_verification_status = VERIFICATION_NOT_NEEDED
legal_capacity_verification_reason = AUTO_DATA_ABSENT
legal_capacity_entity_id = NULL
legal_capacity_entity_type = NULL
legal_capacity_unverified_at = NULL
Calculate cumulative verification status
Calculate persons cumulative verification status based on persons verification status in each stream: Manual NHS verification, DRFO registry verification, DRACS death acts registry verification, DRACS birth acts registry verification, DRACS name change acts registry verification according to logic described at https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/18254790685:
...
Call Create confidant person relationship, set values:
confidant_person_id = person.confidant_person.person_id
person_id = id of created person
verification_status = “VERIFICATION_NEEDED”
verification_reason based on relationship document:
if
confidant_person.relationship_documents
contains document with type BIRTH_CERTIFICATE, set verification_reason = “ONLINE_TRIGGERED”if
confidant_person.relationship_documents
does not contain document with type BIRTH_CERTIFICATE, set verification_reason = “MANUAL_CREATED_BY_DOCTOR”
confidant_person_relationship_documents = person.confidant_person.documents_relationship
In case if persons age < person_full_legal_capacity_age global parameter:
calculate relationship_expiration_date - date when person becomes person_full_legal_capacity_age years old
check if $.active_to <= relationship_expiration_date
if true - set active_to = $.active_to
if false or $.active_to = null - set active_to = relationship_expiration_date
In case if person is updated (person.id
exists in person_data for person request) and at least one of submitted person document types exist in PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter and legal_capacity_verification_status = VERIFIED or VERIFICATION_NOT_NEEDED according to Legal capacity verification - deactivate all existing confidant person relationships for person:
Deactivate all records in IL | confidant https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/724271171/IL#confidant_person_relationship_requests table where person_id =
person.id
and status = NEW, set values:status = CANCELLED
updated_at = now()
updated_by = user_id (from token)
Deactivate all records in MPI | confidant https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/724729917/MPI#confidant_person_relationships table where person_id =
person.id
and is_active = true. Set:active_to = now()
updated_at = now()
updated_by = user_id (from token)
For each relationship from previous step - deactivate person authentication methods with type = THIRD_PERSON and value =
confidant_person_relationships.confidant_person_id
, set values:ended_at = now()
updated_at = now()
updated_by = user_id (from token)
In case if person is updated (person.id
exists in person_data for person request), and person has active Confidant person relationships with relationship document with type='BIRTH_CERTIFICATE' and following person fields are updated:
first_name
last_name
second_name
birth_date
Update found active Confidant person relationships as those that need online verification with DRACS birth acts registry, set values:
verification_status = “VERIFICATION_NEEDED”
verification_reason = “ONLINE_TRIGGERED”
updated_at = now()
updated_by = user_id
Check existance of verification candidates for updated confidant_person_relationship_id with status = ‘NEW’ and entity_type = ‘dracs_birth_act' in confidant_person_relationship_verification_candidates
table, if found - deactivate them, set:
status = ‘DEACTIVATED’
status_reason = ‘PERSON_UPDATED’
updated_at = now()
In case if person is updated (person.id
exists in person_data for person request), and person exists in the system as confidant person in active confidant person relationship with relationship document with type='BIRTH_CERTIFICATE' and following person fields are updated:
first_name
last_name
second_name
birth_date
tax_id
Update found active Confidant person relationships as those that need online verification with DRACS birth acts registry, set values:
verification_status = “VERIFICATION_NEEDED”
verification_reason = “ONLINE_TRIGGERED”
updated_at = now()
updated_by = user_id
Check existance of verification candidates for updated confidant_person_relationship_id with status = ‘NEW’ and entity_type = ‘dracs_birth_act' in confidant_person_relationship_verification_candidates
table, if found - deactivate them, set:
status = ‘DEACTIVATED’
status_reason = ‘CONFIDANT_PERSON_UPDATED’
updated_at = now()