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

Create Group of Diagnoses (NHS Admin)

Purpose

This WS allows to create a Group of Diagnoses from the Admin panel.

The Group of Diagnoses will be used by Doctor to receive Approval on all Episodes of Care which consist of Diagnoses from the Group.

Key points

  1. This is a graphQl method used in the Administration panel only.

  2. Only authenticated and authorized NHS employee with an appropriate scope can create a Group of Diagnoses.

  3. The dictionary codes from eHealth/ICD10_AM/condition_codes and eHealth/ICPC2/condition_codes can be added to the Group of Diagnoses.

  4. Added diagnoses codes should be unique within one Group of Diagnoses (check uniqueness for active items).

  5. User can not create a Group of Diagnoses with an empty list of dictionary codes.

Specification

Link

graphQl method

Посилання на Apiary або Swagger

Resource

graphQl method

Посилання на ресурс, наприклад: /api/persons/create

Scope

diagnoses_group:write

Scope для доступу

Components

Medical events

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

API paragraph not found

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

API paragraph not found

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

API paragraph not found

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

API paragraph not found

Метод є синхронним чи асинхронним?

Public/Private/Internal

Internal

Потрібно зазначити тип методу за ступенем доступності

 

"Creates a single `DiagnosesGroup`." createDiagnosesGroup( input: CreateDiagnosesGroupInput! ): CreateDiagnosesGroupPayload
""" Input for `createDiagnosesGroup` mutation. User must have a scope **diagnoses_group:write** """ input CreateDiagnosesGroupInput { "The name of the `DiagnosesGroup`." name: String! "The description of the `DiagnosesGroup`." code: String! "The code of the `DiagnosesGroup`." description: String "Codes wich belong to `DiagnosesGroup`." diagnosesGroupCodes: [CodingInput] }
""" Return type for `createDiagnosesGroup` mutation. """ type CreateDiagnosesGroupPayload { "Created `DiagnosesGroup`." diagnosesGroup: DiagnosesGroup }

Logic

  1. Save Group of Diagnoses to diagnoses_groups table (PRM DB) according to Group of Diagnoses data model

  2. For each element in the diagnoses_codes array save data to diagnoses_group_codes table:

    1. set diagnoses_group_id = $.diagnoses_group_id

    2. set system = $.system

    3. set code = $.code

Authorize

  • 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 = 'diagnoses_group:write')

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

Request data validation

Validate legal entity

  • Extract client_id from token.

  • Check client scopes in order to perform this action (scope = 'diagnoses_group:write')

    • in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: diagnoses_group:write”)

  • Check client_type = NHS

    • in case of error - return 403 ('You don’t have permission to access this resource')

  • Check legal entity status (status = ACTIVE)

    • In case of error - return 409 ('client_id refers to legal entity that is not active')

Validate request

  1. Check if

name is submitted

  • in case of error - return 422 ('required property name was not present')

  1. Check if

code is submitted

  • Check if code value is in dictionary: DIAGNOSES_GROUP_CODES

    • in case of error - return 422 ('not allowed in enum')

  1. Check if the

diagnoses_codes array is submitted and contains at least one item

  • in case of error - return 422 ('required property diagnoses_codes was not present')

  1. For each item in the

diagnoses_codes array:

  • Check if system is submitted

    • in case of error - return 422 ('required property system was not present')

  • Check if system value is following dictionary name:
    eHealth/ICD10_AM/condition_codes,
    eHealth/ICPC2/condition_codes

    • in case of error - return 422 ('not allowed in enum')

  • Check if code is submitted

    • in case not submitted - return 422 ('required property code was not present')

  • Check if code value is within dictionary specified in system property

    • in case of error - return 422 ('value is not allowed in enum')

  • Check if code is unique within system in the request

    • in case of error - return 422 ('Code <code> of <system> dictionary is duplicated in the request')

HTTP status codes

HTTP status code

Message

What caused the error

HTTP status code

Message

What caused the error

 401

 Invalid access token

 

 403

  • Your scope does not allow to access this resource. Missing allowances: diagnoses_group:write

  • You don’t have permission to access this resource

 

409

  • client_id refers to legal entity that is not active

  • You don’t have permission to access this resource

 

422

  • Code <code> of <system> dictionary is duplicated in the request

  • required property name was not present

  • required property diagnoses_codes was not present

  • 'required property system was not present

  • not allowed in enum

  • required property code was not present

  • value is not allowed in enum

 

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