Versions Compared

Key

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

Purpose

This WS is designed to allow employee with appropriate scopes to get device definition details using its identifier.

Key points

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

  2. Only authenticated and authorized employee with appropriate scope can search for device definitions.

Specification

Expand
titleindex.graphql
Code Block
languagegraphql
  "Reads a single `DeviceDefinition` using its globally unique ID."
  deviceDefinition(id: ID!): DeviceDefinition
Expand
titledeviceDefinitions.graphql
Code Block
languagegraphql
"""
A component part of medication. User must have a scope **device_definition:read**
"""
type DeviceDefinition implements Node {
  "The ID of an object."
  id: ID!
  "Primary key identifier from the database."
  databaseId: UUID!
  "Device identifier in external system."
  externalId: String
  "Device names."
  deviceNames: [DeviceName]!
  "A classification or risk class of the device model. The value should be present in the `device_classification_type` dictionary."
  classificationType: String!
  "Description of the device."
  description: String
  "Name of device manufacturer"
  manufacturerName: String!
  "Country of manufacture. The value should be present in the `COUNTRY` dictionary."
  manufacturerCountry: String!
  "The catalog or model number for the device for example as defined by the manufacturer."
  modelNumber: String!
  "The part number or catalog number of the device."
  partNumber: String
  "A code that defines the specific type of packaging. The value should be present in the `device_definition_packaging_type` dictionary."
  packagingType: String!
  "The number of items contained in the package."
  packagingCount: Int!
  "Unit of measurement. The value should be present in the `DEVICE_UNIT` dictionary."
  packagingUnit: String!
  "Device notes and comments."
  note: String
  "Array of device properties."
  properties: [DeviceDefinitionProperty]
  "Reference to parent device definition."
  parentId: UUID
  "is_active status."
  isActive: Boolean!
  "Date and time when record was inserted"
  insertedAt: DateTime!
  "Date and time when record was updated"
  updatedAt: DateTime!
}

"""
A component part of DeviceDefinition.
"""
type DeviceName implements DeviceDefinition {
  "Device name type. The value should be present in the `device_name_type` dictionary."
  type: String!
  "Device name."
  name: String!
}

"""
A component part of DeviceDefinition.
"""
type DeviceDefinitionProperty implements DeviceDefinition {
  "Device property type. The value should be present in the `device_properties` dictionary."
  type: String!
  "Device property value in integer format."
  valueInteger: Int
  "Device property value in string format."
  valueString: String
  "Device property value in boolean format."
  valueBoolean: Boolean
  "Device property value in decimal format."
  valueDecimal: Float
}

Authorize

  • Verify the validity of access token

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

    • Return (403, 'Your scope does not allow to access this resource. Missing allowances: device_definition:read') in case of invalid scope(s)

Validate legal entity

  • Extract client_id from token.

  • Check legal entity status (status = ACTIVE)

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

  • Check client type (type = NHS)

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

Service logic

  1. Get device definition by id from device_definitions and device_definition_names tables in PRM database.

  2. Render a response according to specification.