Versions Compared

Key

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

Purpose

This WS is designed to return a list of detailed information for all active medications (with type innm_dosage) by search parameters.

Specification

Page Properties

Project Name

Електронний рецепт

COVID-certificate

Project abreviation

ePrescription

SVC

Developer

API paragraph not found

Розробник методу API. Наприклад, Edenlab

Project Manager

API paragraph not found

@Єлизавета Гессен-Дармштадська

Tech Lead

API paragraph not found

@Іоанн Воїнов

Product Owner

API paragraph not found

@Нікодім Святогорцев

Вusiness analyst

API paragraph not found

@Пантелеймон Нікомедійський

Status

Status
colourGreen
titleAPPROVED
Status
colourGreen
titleAPPROVED

Version

API paragraph not found

1.0

Date of release

API paragraph not found

Link

https://uaehealthapiehealthmisapi1.docs.apiary.io/#reference/public.-reimbursement/drugs/get-drugs-list-v2

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

Resource

/api/v2/drugs

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

Scope

drugs:read

Зазначається потрібний scopeScope для доступу

Components

ePrescription, ReimbursementDrugs and Program medications

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

Microservices

API paragraph not found

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

Protocol type

REST

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

Request type

GET

Тип HTTP методу, який використовується запитомзапиту API, наприклад: GET, POST | GET…, PATCH…

Sync/Async

Sync

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

Public/Private/Internal

Public

Logic

Service returns all medications (with type innm_dosage) filtered by submitted parameters:

1. Get all medications (PRM database):

Expand
Code Block
SELECT DISTINCT 
    I.id, I.sctid, I.name, I.name_original,
    MI.id, MI.form, I_1.dosage, I_1.is_primary,
    MED.container, MED.package_qty, MED.package_min_qty
FROM innms I 												-- 1st level: Innm  
	INNER JOIN ingredients I_1								-- Ingredients for INNM_DOSAGE
		ON I_1.innm_child_id = I.id
	INNER JOIN medications MI								-- 2nd level: Medication (type = INNM_DOSAGE)
		ON MI.type == INNM_DOSAGE
			AND MI.id == I_1.parent_id	
	INNER JOIN ingredients I_2								-- Ingredients for INNM_DOSAGE
		ON I_2.medication_child_id = MI.id
			AND	I_2.is_primary == TRUE
	INNER JOIN medications MED								-- 3rd level: Medication (type = BRAND) 
		ON MED.type == BRAND 
			AND MED.id == I_2.parent_id
	LEFT JOIN program_medications PM						-- optional filter by medical_program
    	on MED.id = pm.medication_id 
			AND PM.is_active = TRUE
  	LEFT JOIN medical_programs MP
    	on PM.medical_program_id = MP.id 
			AND MP.is_active = TRUE
WHERE I.is_active == TRUE 
	AND MI.is_active == TRUE 
	AND MED.is_active == TRUE
	AND (I.id = $.innm_id OR $.innm_id IS NULL)
	AND (I.sctid = $.innm_sctid OR $.innm_sctid IS NULL)
	AND (I.name = $.innm_name OR $.innm_name IS NULL)
	AND (MI.id = $.innm_dosage_id OR $.innm_dosage_id IS NULL)
	AND (MED.code_atc = $.medication_code_atc OR $.medication_code_atc IS NULL)
	AND (MI.name = $.innm_dosage_name OR $.innm_dosage_name IS NULL)
	AND (MI.form = $.innm_dosage_form OR $.innm_dosage_form IS NULL)
  	AND (MP.id = $.medical_program_id OR $.medical_program_id IS NULL)
	AND (MI.mr_blank_type = $.mr_form_type OR $.mr_blank_type IS NULL)
	AND (MI.dosage_form_is_dosed = $.dosage_form_is_dosed OR $.dosage_form_is_dosed IS NULL)
	AND (PM.care_plan_activity_allowed = $.care_plan_activity_allowed OR $.care_plan_activity_allowed IS NULL)
	AND (PM.medication_request_allowed = $.medication_request_allowed OR $.medication_request_allowed IS NULL)

2. Filter list above by submitted search parameters.

3. Render a response according to specification with found medications entities.

Preconditions

No

Global and configurable parameters

No

Input parameters

No

Filters

See on Apiary

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

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

...

API-key:uXhEczJ56adsfh3Ri9SUkc4en

Validate request

API paragraph not found

Request data validation

API paragraph not found

Parameters that are used when processing the request

Configuration parameters

Access to the method is defined by the scope drugs:read. Permission for this scope is determined by the System administrator by configuring scopes in the context of clients and roles.

Dictionaries

API paragraph not found

Processing

API paragraph not found

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": "ae9bf68e-3c98-4027-9211-535f7dad7a87",
      "name": "Аміодарон 200мг таблетки",
      "mr_blank_type": "F-1",
      "dosage_form_is_dosed": false,
      "form": "PILL",
      "daily_dosage": 50,
      "max_daily_dosage": 200,
      "ingredients": [
        {
          "id": "1349a693-4db1-4a3f-9ac6-8c2f9e541982",
          "name": "Інсулін деглюдек",
          "name_original": "Insulin degludec",
          "sctid": "52574003",
          "dosage": {
            "numerator_unit": "MG",
            "numerator_value": 200,
            "denumerator_unit": "PILL",
            "denumerator_value": 1
          },
          "is_primary": true
        }
      ],
      "packages": [
        {
          "container_dosage": {
            "numerator_unit": "PILL",
            "numerator_value": 1,
            "denumerator_unit": "PILL",
            "denumerator_value": 1
          },
          "package_qty": 30,
          "package_min_qty": 10,
          "max_request_dosage": 0,
          "program_medications": [
            {
              "id": "e477a845-972b-47a1-8ca3-1c71e4fd00c2",
              "start_date": "2019-01-01",
              "end_date": "2019-06-30",
              "registry_number": "REG-1111"
            }
          ]
        }
      ]
    }
  ],
  "paging": {
    "page_number": 2,
    "page_size": 50,
    "total_entries": 1000,
    "total_pages": 23
  }
}

Post-processing processes

No

HTTP status codes

HTTP status code

Message

What caused the error

200

Response

 

401

Invalid access token

 

403

Your scope does not allow to access this resource. Missing allowances: drugs:read

Invalid scope

Backward compatibility

...