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

(GraphQl) Search Device definitions_EN

Purpose

This WS is designed to allow employee with appropriate scopes to search device definitions.

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.

  3. User can filter list by search params.

Specification

"Reads and enables pagination through a set of `DeviceDefinition`." deviceDefinitions( "A condition to be used in determining which values should be returned by the collection." filter: DeviceDefitinionFilter "The method to use when ordering collection items." orderBy: DeviceDefitinionOrderBy "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 ): DeviceDefinitionConnection!
""" DeviceDefitinion filter. """ input DeviceDefitinionFilter { "Primary key identifier from the database." databaseId: UUID "Device name." deviceNames: DeviceDefinitionName "is_active status." isActive: Boolean "A classification or risk class of the device model. The value should be present in the `device_classification_type` dictionary." classificationType: String "Name of device manufacturer." manufacturerName: String "The catalog or model number for the device for example as defined by the manufacturer." modelNumber: String } """ Methods to use when ordering `DeviceDefitinion`. """ enum DeviceDefitinionOrderBy { "Sort by classification_type in ascending order." CLASSIFICATION_TYPE_ASC "Sort by classification_type in descending order." CLASSIFICATION_TYPE_DESC "Sort by inserted_at in ascending order." INSERTED_AT_ASC "Sort by inserted_at in descending order." INSERTED_AT_DESC "Sort by model_number in ascending order." MODEL_NUMBER_ASC "Sort by model_number in descending order." MODEL_NUMBER_DESC } """ A connection to a list of `DeviceDefinition` items. """ type DeviceDefinitionConnection { "Information to aid in pagination." pageInfo: PageInfo! "A list of nodes." nodes: [DeviceDefinition] "A list of edges." edges: [DeviceDefinitionEdge] } """ An edge in a connection of `DeviceDefinition`. """ type DeviceDefinitionEdge { "The item at the end of the edge." node: DeviceDefinition! "A cursor for use in pagination." cursor: String! } """ 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 all records from device_definitions and device_definition_names tables in PRM database

  2. Apply additional search params (connect by logical AND):

    1. databaseId - search by device_definitions.id (using exact match with = operator)

    2. deviceNames.type - seach by device_definition_names.type (using exact match with = operator )

    3. deviceNames.name - device_definition_names.name (using like match, case insensitive)

    4. isActive - search by device_definitions.is_active (using exact match with = operator)

    5. classificationType - search by device_definitions.classification_type (using exact match with = operator)

    6. manufacturerName - search by device_definitions.manufacturer_name (using like match, case insensitive)

    7. modelNumber - search by device_definitions.model_number (using like match, case insensitive)

  3. Apply optional ordering

    1. if no $.orderBy is passed - order records by inserted_at field in descending order.

  4. Render a response according to specification

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