Versions Compared

Key

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

Purpose

...

This WS is designed to return Medications list by filters.

Specification

...

Page Properties

Link

API paragraph not found

Resource

/medications

Scope

medication:read

Components

Drugs and Program medications

Microservices

API paragraph not found

Protocol type

REST

Request type

GET

Sync/Async

Sync

Public/Private/Internal

Internal

Logic

...

Use this method to obtain list of Medications. If you want to reduce amount of data that is going trough your application, use filter and show only Medications is interested in current UI section.

...

Filter

Values

Type

Description

Example

id

String

Medication Identifier

7124259c-eeb1-4cbb-acac-ada2162675d1

innm_dosage_id

String

INNM Identifier

5052fcaf-58a0-461b-9e98-d60243a1773e

name

String

Medication name

Аритміл

innm_dosage_name

String

INNM name

Аміодарон

form

String

Dictionary MEDICATION_FORM

PILL

page

Number

Page number

2

page_size

Number

A limit on the number of objects to be returned, between 1 and 100. Default: 50

50

Request structure

...

API paragraph not found

Authorize

...

Request to process the request using a token in the headers

Headers

...

Наприклад:

  • Content-Type:application/json

  • Authorization:Bearer c2778f3064753ea70de870a53795f5c9

Request data validation

...

API paragraph not found

Processing

...

Logic WS

  1. Verify the validity of access token

  2. Check user scopes in order to perform this action (scope = 'medication:read')

  3. Search Medications by filters in payload

    Code Block
    SELECT * FROM medications MED
    	INNER JOIN medications INNM
    		ON MED.ingredients.id = INNM.id 
    			AND MED.ingredients.is_active_substance = TRUE
    WHERE MED.type == MEDICATION
    	AND (MED.id == $.id OR $.id IS NULL)
    	AND (INNM.id == $.innm_id OR $.innm_id IS NULL)
    	AND (MED.form == $.form OR $.form IS NULL)
    	AND (MED.name LIKE `%$.name%` OR $.name IS NULL)
    	AND (INNM.name LIKE `%$.innm_name%` OR $.innm_name IS NULL)
    

Response structure

...

See on Apiary

Example:

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 200,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": [
    {
      "id": "09b2bffb-699a-43c0-bc9a-5066d9b9b5a8",
      "name": "Амідарон",
      "manufacturer": {
        "name": "ПАТ \"Київський вітамінний завод\"",
        "country": "UA"
      },
      "code_atc": [
        "М01АЕ01",
        "C01BD01"
      ],
      "form": "PILL",
      "container": {
        "numerator_unit": "PILL",
        "numerator_value": 1,
        "denumerator_unit": "PILL",
        "denumerator_value": 1
      },
      "package_qty": 30,
      "package_min_qty": 10,
      "daily_dosage": "12",
      "certificate": "UA/4514/01/01",
      "certificate_expired_at": "2021-02-09",
      "ingredients": [
        {
          "id": "1349a693-4db1-4a3f-9ac6-8c2f9e541982",
          "name": "Амідарон",
          "dosage": {
            "numerator_unit": "MG",
            "numerator_value": 200,
            "denumerator_unit": "PILL",
            "denumerator_value": 1
          },
          "is_primary": true
        }
      ],
      "is_active": true,
      "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"
    }
  ],
  "paging": {
    "page_number": 2,
    "page_size": 50,
    "total_entries": 1000,
    "total_pages": 23
  }
}

Post-processing processes

...

API paragraph not found

HTTP status codes

...

Page Properties

HTTP status code

Message

What caused the error

 200

 

 

...