Versions Compared

Key

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

Purpose

This method allows to get detailed information of the Device dispense.

Specification

Page Properties
idAPI_Specification

...

або Swagger

Resource

/api/patients/{{patient_id}}/device_dispenses/{{device_dispense_id}}

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

Scope

device_dispense:read

Scope для доступу

Components

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

Microservices

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

Protocol type

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

Request type

GET

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

Sync/Async

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

Public/Private/Internal

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

Logic

Service returns specified Device dispense related to the legal entity from token:

  • Get Device dispense by ID from device_dispenses (MongoDB)

  • Validate data consistency:

    • Ensure that requested Device dispense relates to requested legal entity

      • Return 404 ('not_found') in case of error

  • Render a response according to specification

Input parameters

Input parameter

Values

Type

Description

Example

patient_id

String

Unique patient identifier

aff00bf6-68bf-4b49-b66d-f031d48922b3

device_dispense_id

String

Unique device dispense identifier

aff00bf6-68bf-4b49-b66d-f031d48922b3

Request structure

API paragraph not found

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

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

...

Headers

  • Content-Type:application/json

  • Authorization:Bearer mF_9.B5f-4.1JqM

  • api-key:aFBLVTZ6Z2dON1V

Request data validation

Validate Device dispense

  • Get Device dispense identifier from the URL

    • Check Device dispense exists in device_dispenses (MongoDB)

      • Return 404 ('not_found') in case of error

    • Check Device dispense belongs to legal entity

      • Return 404 ('not_found') in case of error

Service logic

Service returns specified Device dispense related to the legal entity from token:

  • Get Device dispense by ID from device_dispenses (MongoDB)

  • Validate data consistency:

    • Ensure that requested Device dispense relates to requested legal entity

      • Return 404 ('not_found') in case of error

  • Render a response according to specification

Processing

API paragraph not found

Response structure

See on Apiary

Expand
titleResponse example
Code Block
{
  "data": {
    "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
    "based_on": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "device_request"
            }
          ]
        },
        "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
      },
      "display_value": "null"
    },
    "status": "completed",
    "subject": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "patient"
            }
          ]
        },
        "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
      },
      "display_value": "null"
    },
    "performer": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "employee"
            }
          ]
        },
        "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
      },
      "display_value": "Мельник Микола Микитович"
    },
    "location": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "division"
            }
          ]
        },
        "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
      },
      "display_value": "Перше відділення"
    },
    "when_handed_over": "2018-08-02T10:45:16.000Z",
    "note": "Some notes",
    "performer_legal_entity": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "legal_entity"
            }
          ]
        },
        "value": "c5a6d991-0bf7-476f-b3cf-bec83f044b2a"
      },
      "display_value": "Комунальне підприємство Медлаб"
    },
    "program": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "medical_program"
            }
          ]
        },
        "value": "c5a6d991-0bf7-476f-b3cf-bec83f044b2a"
      },
      "display_value": "Доступні медичні вироби"
    },
    "details": [
      {
        "device": {
          "identifier": {
            "type": {
              "coding": [
                {
                  "system": "eHealth/resources",
                  "code": "device_definition"
                }
              ]
            },
            "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
          },
          "display_value": "null"
        },
        "program_device": {
          "identifier": {
            "type": {
              "coding": [
                {
                  "system": "eHealth/resources",
                  "code": "program_device"
                }
              ]
            },
            "value": "b4a6d991-0bf7-476f-b3cf-bec83f044b1b"
          },
          "display_value": "null"
        },
        "quantity": {
          "value": 10,
          "system": "device_unit",
          "code": "piece",
          "unit": "шт"
        },
        "sell_price": 18.65,
        "discount_amount": 150,
        "reimbursement_amount": 450
      }
    ],
    "payment_id": "1239804",
    "payment_amount": 50,
    "inserted_at": "2017-04-20T19:14:13Z",
    "inserted_by": "e1453f4c-1077-4e85-8c98-c13ffca0063e",
    "updated_at": "2017-04-20T19:14:13Z",
    "updated_by": "2922a240-63db-404e-b730-09222bfeb2dd"
  },
  "meta": {
    "code": 200,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  }
}
Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 404,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "error": {
    "type": "NOT_FOUND",
    "message": "Device dispense not found"
  }
}

Post-processing processes

API paragraph not found

HTTP status codes*

Page Properties
idAPI_HTTP status codes

HTTP status code

Message

What caused the error

 200

 

 

404