/
[DRAFT] Get drugs list v2 [API-011-001-001-0382]

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

[DRAFT] Get drugs list v2 [API-011-001-001-0382]

Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.

 

https://e-health-ua.atlassian.net/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)

Properties of a REST API method document

Document type

Метод REST API

Document title

[DRAFT] Get drugs list v2 [API-011-001-001-0382]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)

Date of update

ХХ.ХХ.ХХХХ (дата зміни версії)

Method API ID

API-011-001-001-0382

Microservices (namespace)

PRM

Component

Dictionaries and Registers

Component ID

COM-010-001

Link на API-специфікацію

GENERAL MIS API · Apiary

Resource

{{host}}/api/v2/drugs

Scope

drugs:read

Protocol type

REST

Request type

GET

Sync/Async

Sync

Public/Private

Public

Purpose

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

Logic

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

  1. Get all medications (PRM database):

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)
  1. Filter list above by submitted search parameters.

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

Configuration parameters

N/A

Dictionaries

N/A

Input parameters

Input parameter

Mandatory

Type

Description

Example

Input parameter

Mandatory

Type

Description

Example

1

 

 

 

 

 

2

 

 

 

 

 

Request structure

See on API-specification

Headers

Headers

Request data validation

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)

Processing

N/A

Response structure examples

See on API-specification

{ "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 } }

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

 

200

Response

 

 

3

 

401

Invalid access token

 

 

4

 

403

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

 

 

5

Специфічні

6

 

 

 

 

 

Post-processing processes

N/A

Technical modules where the method is used

 

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