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

RC [WP] Create Group of Diagnoses_EN

Purpose

This WS allows to create a Group of Diagnoses from 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 Administration panel only.

  2. Only authenticated and authorized NHS employee with 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 empty list of dictionary codes.

Specification

"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 }

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 = '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)

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')

2. 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')

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

4. 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')

Service logic

  1. Save Group of Diagnoses to diagnoses_groups table (PRM DB) according to RC [WP] 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

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