ЕСОЗ - публічна документація
(GraphQL, NHS) Update Person DRACS death verification status
Purpose
This WS allows to set person verification status for DRACS death stream using Admin panel.
Key points
This graphQl method is used in Administration panel only
Only authenticated and authorized NHS employee with appropriate scope can verify persons.
If person was marked as NOT VERIFIED by NHS employee - there will be some limitations for such record. It is not possible to create new declaration and some medical events until appropriate changes conducted and documents provided.
NHS employee is obliged to provide comment if he sets NOT_VERIFIED verification status.
Specification
Authorization
Verify the validity of access token
in case of error - 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:verify')
return 403 (“Your scope does not allow to access this resource. Missing allowances: person:verify”) in case of invalid scope(s)
Validate legal entity
Extract client_id from token.
Check client scopes in order to perform this action (scope = 'person:verify')
in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: person:verify”)
Check legal entity status (status = ACTIVE)
In case of error - return 409 ('client_id refers to legal entity that is not active')
Validate request
Field personId, required.
Check it is submitted
in case of error - return 422 ('required property <name/creation_reason> was not present')
Find person in
mpi.persons
in case of error - return 404 "Such person doesn't exist"
Check if person is active: person.status = 'active' and person.is_active = true
in case of error - return 409 "Such person isn't active"
Field verificationStatus, required
Check it is submitted
in case of error - return 422 ('required property <name/creation_reason> was not present')
Check value is allowed.
in case of error - return 422 ('value is not allowed in enum')
Check status transition is allowed.
in case of error - return 409 ('Can\'t update verification status from <old status value> to <new status value>')
Field verificationReason, required
Check it is submitted
in case of error - return 422 ('required property <name/creation_reason> was not present')
Check value is allowed.
in case of error - return 422 ('value is not allowed in enum')
Check status transition allowed.
For transition VERIFICATION_NEEDED to IN_REVIEW it is required to have verification reason = MANUAL, if there are other reasons - an error should be returned.
For transition IN_REVIEW to VERIFIED it is required to have verification reason in (MANUAL_CONFIRM, MANUAL_NOT_CONFIRM), if there are other reasons - an error should be returned.
For transition IN_REVIEW to NOT_VERIFIED it is required to have verification reason = MANUAL, if there are other reasons - an error should be returned.
in case of error - return 422 ('Can\'t update verification status from <old status value> with <old verification reason> verification reason to <new status value> with <new verification reason> verification reason')
Field dracsDeathActId, required at specific case
if verification_status = VERIFIED and verification_reason = MANUAL_CONFIRMED
in case of error - return 409 ('DRACS death act is required')
Field verificationComment , required at specific case
if verification_status = NOT_VERIFIED
in case of error - return 409 ('verification status comment is required')
Service logic
Set fields in person_verifications (Person verification data model)table (mpi database):
dracs_death_verification_status = $.verification_status
dracs_death_verification_comment = $.verification_comment
dracs_death_verification_reason = $.verification_reason
dracs_death_act_id = $.dracsDeathActId
updated_by = user_id (from token)
updated_at = current timestamp
Update persons verification candidates statuses from person_verification_candidates (Person verification data model) table (mpi database)
In case if $.verification_reason =
MANUAL_CONFIRMED
find person_verification_candidate with entity_id = $.dracsDeathActId:Set person_verification_candidate.status =
CONFIRMED
Other persons verification candidates (where status !=
DEACTIVATED
):Set person_verification_candidate.status =
NOT_CONFIRMED
Calculate cumulative verification status based on persons verification status in each stream:
Manual NHS verification, DRFO registry verification, DRACS death acts registry verification according to logic described at Person verification status model_EN:Set calculated status to persons.verification_status field
Create StatusChangeEvent in event manager with new verification status if it was changed
Create StatusChangeEvent in event manager with verification_status
ЕСОЗ - публічна документація