Versions Compared

Key

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

Table of Contents

Purpose

This process is designed for NHS admin to deactivate declaration manually .(for NHS admin or patient authorized via Cabinet)

Apiary

https://uaehealthapi.docs.apiary.io/#reference/internal.-ops-db/declarations/terminate-declarations-by-employee-or-person

...

  1. Verify the validity of access token
  2. Check user scopes declaration:terminate in order to perform this action
    1. In case error - generate 401 response

Validate request

One of parameter of employeeperson_id   or  personemployee_id must be set. Also can be added the description field: reason_description.

Patient via cabinet can terminate only his own active declaration.

Validate person

  1. For NHS admin
    1. Search person by $.id
      1. in case error return 404
    2. Search declaration by $.person_id
      1. in case error return 404
    3. Check declaration status = active
      1. in case error return 422. Message:"declaration status is not active"
  2. For authorized patient:
    1. extract person_id from 

Validate employee

  1. Search employee by$by $.id
    1. in case error return 404
  2. Check if employee is an active doctor (employee_type=DOCTOR and is_active=true)
    1. in case error return 422. Message: "Employee is not an active doctor"
  3. Select all active declarations by $.employee_id
    1. in case error return 422. Message: "Employee does not have active declarations"

...