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

(GraphQL, NHS) Update Person DRACS death verification status

Purpose

This WS allows to set person verification status for DRACS death stream using Admin panel.

ManualVerification_DRACS_v01_2022-12-01 (1).png

 

Key points

  1. This graphQl method is used in Administration panel only

  2. Only authenticated and authorized NHS employee with appropriate scope can verify persons.

  3. 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.

  4. NHS employee is obliged to provide comment if he sets NOT_VERIFIED verification status.

Specification

"Updates DRACS death verification status for a single `Person` by NHS using its globally unique ID." updatePersonDracsDeathVerificationStatus( input: UpdatePersonDracsDeathVerificationStatusInput! ): UpdatePersonDracsDeathVerificationStatusPayload
""" Input for `updatePersonDracsDeathVerificationStatus` mutation. """ input UpdatePersonDracsDeathVerificationStatusInput { "Person unique identifier." personId: ID! "DRACS death act unique identifier." dracsDeathActId: UUID "Person verification status" dracsDeathVerificationStatus: PersonVerificationStatus! "Person DRACS verification reason" dracsDeathVerificationReason: PersonNhsDracsVerificationReason! "Description about person verification status" verificationComment: String } """ Return type for `updatePersonDracsDeathVerificationStatus` mutation. In order to verify person user must have a scope `person:verify`. """ type UpdatePersonDracsDeathVerificationStatusPayload { "Payload for person." person: Person }

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

  1. Set fields in person_verifications (Person verification data model)table (mpi database):

    1. dracs_death_verification_status = $.verification_status

    2. dracs_death_verification_comment = $.verification_comment

    3. dracs_death_verification_reason = $.verification_reason

    4. dracs_death_act_id = $.dracsDeathActId

    5. updated_by = user_id (from token)

    6. updated_at = current timestamp

  2. Update persons verification candidates statuses from person_verification_candidates (Person verification data model) table (mpi database)

    1. In case if $.verification_reason = MANUAL_CONFIRMED find person_verification_candidate with entity_id = $.dracsDeathActId:

      1. Set person_verification_candidate.status = CONFIRMED

    2. Other persons verification candidates (where status != DEACTIVATED):

      1. Set person_verification_candidate.status = NOT_CONFIRMED

  3. 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

  4. Create StatusChangeEvent in event manager with verification_status

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