Versions Compared

Key

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

Purpose

This WS allows to find Groups of Diagnoses in Admin panel using search params. Groups can be found by group params and/or by item params.

Key points

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

  2. Only authenticated and authorized NHS employee with appropriate scope can search Groups of Diagnoses.

Specification

Page Properties

Link

graphQl query method

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

Resource

graphQl query method

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

Scope

diagnoses_group:read

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

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

Expand
titleSpecification diagnosesGroups
Code Block
languagegraphql
"Reads a single `DiagnosesGroup` using its globally unique ID."
  diagnosesGroup(id: ID!): DiagnosesGroup
Code Block
languagegraphql
"Reads and enables pagination through a set of `DiagnosesGroup`."
  diagnosesGroups(
    "A condition to be used in determining which values should be returned by the collection."
    filter: DiagnosesGroupFilter
    "The method to use when ordering collection items."
    orderBy: DiagnosesGroupOrderBy
    "Read all values in the set after (below) this cursor."
    after: String
    "Read all values in the set before (above) this cursor."
    before: String
    "Only read the first _n_ values of the set."
    first: Int
    "Only read the last _n_ values of the set."
    last: Int
  ): DiagnosesGroupConnection!
Code Block
languagegraphql
"""
Fields to filter diagnoses groups in the system.
"""
input DiagnosesGroupFilter {
  "Checks for equality with the object’s `databaseId` field."
  databaseId: UUID
  "Checks for matching with the object’s `name` field."
  name: String
  "Checks for equality with the object’s `isActive` field."
  isActive: Boolean
  "Diagnoses group code filter"
  diagnosesGroupCode: DiagnosesGroupCodeFilter
}

"""
Methods to use when ordering `DiagnosesGroup`.
"""
enum DiagnosesGroupOrderBy {
  "Orders by the object’s `insertedAt` field in the ascending order."
  INSERTED_AT_ASC
  "Orders by the object’s `insertedAt` field in the descending order."
  INSERTED_AT_DESC
  "Orders by the object’s `name` field in the ascending order."
  NAME_ASC
  "Orders by the object’s `name` field in the descending order."
  NAME_DESC
}

"""
A connection to a list of `DiagnosesGroup` items.
"""
type DiagnosesGroupConnection {
  "Information to aid in pagination."
  pageInfo: PageInfo!
  "A list of nodes."
  nodes: [DiagnosesGroup]
  "A list of edges."
  edges: [DiagnosesGroupEdge]
}

"""
An edge in a connection of `DiagnosesGroup`.
"""
type DiagnosesGroupEdge {
  "The item at the end of the edge."
  node: DiagnosesGroup!
  "A cursor for use in pagination."
  cursor: String!
}

"""
DiagnosesGroup contains diagnoses codes.
In order to obtain details user must have a scope **diagnoses_group:read**
"""
type DiagnosesGroup implements Node {
  "The ID of an object."
  id: ID!
  "Primary key identifier from the database."
  databaseId: UUID!
  "The name of the `DiagnosesGroup`."
  name: String!
  "The code of the `DiagnosesGroup`."
  code: String!
  "The description of the `DiagnosesGroup`."
  description: String
  "The reason the `DiagnosesGroup` was deactivated."
  deactivationReason: String
  "Whether the `DiagnosesGroup` is active or not?"
  isActive: Boolean!
  "Date and time when record was inserted."
  insertedAt: DateTime!
  "Date and time when record was updated."
  updatedAt: DateTime!

  "Diagnosis codes wich belong to DiagnosesGroup."
  diagnosesGroupCodes(
    "A condition to be used in determining which values should be returned by the collection."
    filter: DiagnosesGroupCodeFilter
    "The method to use when ordering collection items."
    orderBy: DiagnosesGroupCodeOrderBy
    "Read all values in the set after (below) this cursor."
    after: String
    "Read all values in the set before (above) this cursor."
    before: String
    "Only read the first _n_ values of the set."
    first: Int
    "Only read the last _n_ values of the set."
    last: Int
  ): DiagnosesGroupCodeConnection!
}
Code Block
languagegraphql
"""
Fields to filter diagnoses group codes in the system.
"""
input DiagnosesGroupCodeFilter {
  "Primary key identifier from the database."
  databaseId: UUID
  "Code from dictionary values."
  code: String
  "Dictionary name."
  system: String
}

"""
Methods to use when ordering `DiagnosesGroupCode`.
"""
enum DiagnosesGroupCodeOrderBy {
  "Sort by inserted_at in ascending order."
  INSERTED_AT_ASC
  "Sort by inserted_at in descending order."
  INSERTED_AT_DESC
}

"""
A connection to a list of `DiagnosesGroupCode` items.
"""
type DiagnosesGroupCodeConnection {
  "Information to aid in pagination."
  pageInfo: PageInfo!
  "A list of nodes."
  nodes: [DiagnosesGroupCode]
  "A list of edges."
  edges: [DiagnosesGroupCodeEdge]
}

"""
An edge in a connection of `DiagnosesGroupCode`.
"""
type DiagnosesGroupCodeEdge {
  "The item at the end of the edge."
  node: DiagnosesGroupCode!
  "A cursor for use in pagination."
  cursor: String!
}

"""
DiagnosesGroupCode connects diagnoses codes.
In order to obtain details user must have a scope **diagnoses_group:read**
"""
type DiagnosesGroupCode implements Node {
  "The ID of an object."
  id: ID!
  "Primary key identifier from the database."
  databaseId: UUID!
  "DiagnosesGroup."
  diagnosesGroup: DiagnosesGroup!
  "Dictionary name."
  system: String!
  "Code from values of the dictionary pointed at `system` property"
  code: String!
}

...

Logic

Render diagnoses_groups array with nested array of diagnoses_group_codes that match the search params

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

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: diagnoses_group:read”) 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:read')

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

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

Search params

Search with a few params performs according to the logical AND rule.

...

name. Search by diagnoses_groups.name

...

is_active. Search by diagnoses_groups.is_active

...

item_code. Search by diagnoses_groups.code

...

item_name. Search by code description for dictionaries
(diagnoses_group_codes dc
join dictionaries d
on dc.system = d.name and dc.code = d.values.code)

...

item_type (string). Limits the search to the following items:

  • <system> - search within specified dictionary. Where <system> is eHealth/ICD10_AM/condition_codes or eHealth/ICPC2/condition_codes

Service logic

...

HTTP status codes*

Page Properties

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:read

  • You don’t have permission to access this resource

 

409

client_id refers to legal entity that is not active