Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel3

...

  1. Verify the validity of access token

    1. in case of error - return 401 (“Invalid access token”) in case of validation fails

  2. Verify that token is not expired

    1. in case of error - return 401 (“Invalid access token”)

  3. Check user scopes in order to perform this action (scope = 'approval:create ')

    1. return 403 (“Your scope does not allow to access this resource. Missing allowances: approval:create ”) in case of invalid scope(s)

Headers

Наприклад:

Content-Type:application/json

...

  1. if episode_of_care is presented in request as the code of resource

    1. Check episode_of_care in the request exists and is in active or closed status in DB

      1. in case of error return - 422 (Episode is canceled)

    2. Check if resource from granted_to = 'employee':

      1. in case of error return - 422 ("$.resource. value is not allowed in enum")

  2. if diagnostic_report is presented in request as the code of resource

    1. Check diagnostic_report block in the request exists and is in final status in DB

      1. in case of error return - 422 (Diagnostic report in \"entered_in_error\" status can not be referenced or Diagnostic report with such id is not found)

    2. Check if resource from granted_to = 'employee':

      1. in case of error return - 422 ("$.resource. value is not allowed in enum")

  3. if care_plan is presented in request as the code of resource

    1. Check care_plan in the request exists in DB

      1. in case of error return - 422 (Care plan with such id is not found)

    2. Check there no other objects in request

      1. in case of error return - 422 (Approval for care plan can not contain other entities)

    3. Check if resource from granted_to = 'employee':

      1. in case of error return - 422 ("$.resource. value is not allowed in enum")

    4. If access_level = 'write':

      1. Check if care_plans.managing_organization = granted_to.employees.legal_entity_id:

        1. in case of error return - 422 ('User is not allowed to write care plan from another legal_entity')

  4. if encounter  is presented in request as the code of resource

    1. Check encounter in the request exists in DB

      1. in case of error return - 422 (not found)

    2. Check if resource from granted_to = 'employee':

      1. in case of error return - 422 ("$.resource. value is not allowed in enum")

  5. if procedure is presented in request as the code of resource

    1. Check procedure in the request exists in DB

      1. in case of error return - 422 (not found)

    2. Check if resource from granted_to = 'employee':

      1. in case of error return - 422 ("$.resource. value is not allowed in enum")

...

Validate person authentication_method

  1. If resource = care_plan & care_plans.terms_of_service = 'INPATIENT'&granted_to.employees.legal_entity_id = care_plans.managing_organization:

    1. skip validation of person authentication_method

    2. set approvals.urgent = null

  2. In other cases: Check patient_id:

    1. if belongs to person, then GET auth_method from MPI using {patient_id}

      1. If it's OTP:

        1. send SMS to the auth_phone via otp_verification service POST /verifications

        2. save approval to DB

        3. save authentication_method_current.type and number to DB

        4. return authentication_method_current.type = OTP

      2. If it is offline

        1. save approval to DB

        2. save authentication_method_current.type and number to DB

        3. return  authentication_method_current.type = offline

      3.  if it is null:

        1. return error 409 (Person does not have active authentication method)

    2. if belongs to preperson:

      1. save approval to DB

      2. set approval status = active

      3. set approval urgent = null 

...

block

granted_resources

access_level

access to

reason

resources

episode_of_care

read

Reading all the data of specified in approval episode

null

diagnostic_report

read

Reading all the data of specified in approval diagnostic report

null

diagnostic_report

write

Canceling diagnostic report package

care_plan

read

Reading all the data of specified in approval care plan

null

care_plan

write

Creating activities for care plan, cancelling medication requests or recalling/cancelling service requests based on care plan

encounter

write

Canceling encounter data package

null

procedure

write

Canceling procedure

null

child_resources

diagnostic_report

read

Reading all the data of specified in context for diagnostic_report

null

encounter

Reading all the data of specified in context for encounter

null

condition

Reading all the data of specified in context for condition

null

observation

Reading all the data of specified in context for observation

null

activity

Reading all the data of specified in context for activity

null

clinical_impression

Reading all the data of specified in context for clinical_impression

null

allergy_intolerance

Reading all the data of specified in context for allergy_intolerance

null

immunization

Reading all the data of specified in context for immunization

null

device

Reading all the data of specified in context for device

null

risk_assessment

Reading all the data of specified in context for risk_assessment

null

procedure

Reading all the data of specified in context for procedure

null

service_request

episode_of_care

read

Reading data from granted_resources in approval service request

service_request

diagnostic_report

read

forbidden_group

forbidden_group

read

Reading all the medical events with items (codes/services/service_groups) of specified in approval forbidden groups 

null

diagnoses_group

episode_of_care array

read

Reading all data of episodes with current_diagnoses.codes that specified in approval diagnoses group 

null

patient_id

patient_id

read

Reading all the data of specified patient

null

Validate authorize_with

The patient can pass the id of his auth_method which he wants to confirm the approval. The necessary auth method can be found by making Get person's auth methods

...

  1. All the approvals in status "new" should be deleted 12 hours after creation - env. configuration parameter

  2. All approvals with diagnoses_group has its own expires_at config parameter - env. configuration parameter

  3. All approvals with forbidden_group has its own expires_at config parameter - env. configuration parameter

  4. All approvals with care_plan has its own expires_at config parameter - env. configuration parameter

  5. All approvals with patient has its own expires_at config parameter - env. configuration parameter

  6. Approvals with child_resources will be created ON entity which is context of this child_resources

  7. For approvals on child_resource with resource and on service_request:

    1. set child resource to block reason

    2. set service_request to block reason

  8. Approvals with child_resources will be created ON entity which is context of this child_resources

  9. For approvals on child_resource with resource and on service_request:

    1. set child resource to block reason

    2. set service_request to block reason

  10. If resource from granted_to = employee:
    Check if for granted_resource and\or for reason there are forbidden groups:

    1. if there are items from forbidden group

      1. check type of authentication_method for patient

        1. If type = 'OTP' send SMS (Код <code> для доступу до даних про ВІЛ/РПП https://bit.ly/nszu1677f )

    2. if there NO forbidden group items and diagnoses_group block is presented in request

      1. if diagnoses_group type is ICD10:

        1. check type of authentication_method for patient

          1. If type = 'OTP' send SMS (Код <code>: доступ на групу діагнозів {diagnoses_group_code} http://bit.ly/nszu1677b )

      2. if diagnoses_group type is ICPC2:

        1. check type of authentication_method for patient

          1. If type = 'OTP' send SMS (Код <code> доступ на групу діагнозів {diagnoses_group_code} http://bit.ly/nszu1677e )

    3. else if there NO forbidden group items

      1. check type of authentication_method for patient

        1. If type = 'OTP' send SMS (Код авторизації дій в системі eHealth: <code>')

  11. If resource from granted_to = legal_entity:

    1. check type of authentication_method for patient

      1. If type = 'OTP' send SMS (Код <code>: згода на обробку персональних даних eZdorovya )

...

Page Properties

HTTP status code

Message

What caused the error

201

 response

 

202

 response

401

Invalid access token

403

Your scope does not allow to access this resource. Missing allowances: approval:create

404

  • not found

  • Person is not found

  • Approval for one patient can not be created in another patient’s context

409

Person does not have active authentication method

422

  • Сannot be confirmed by a method with type= NA. Use a different method

  • Should be active

  • Employee <employee_id> doesn't belong to your legal entity

  • Episode is canceled

  • Diagnostic report in "entered_in_error" status can not be referenced or Diagnostic report with such id is not found

  • Care plan with such id is not found

  • Approval for care plan can not contain other entities

  • $.access_level. value is not allowed in enum

  • Child resource context id is not equal to granted resource id

  • schema does not allow additional properties

  • $.resources.expected a maximum of 1 items but got 2

  • Resource types ["$.granted_resources[].code"] not allowed to use write access_level

  • such authentication method doesn't exist

  • such authentication method does not belong to this person

  • User is not allowed to write care plan from another legal_entity