You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 46
Next »
Purpose
This WS is designed to return a list of detailed information for all active medications (with type innm_dosage) by search parameters.
Specification
Logic
Service returns all medications (with type innm_dosage) filtered by submitted parameters:
1. Get all medications (PRM database):
Click here to expand...
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)
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
No
Filters
See on Apiary
Request structure
API paragraph not found
Authorize
Verify the validity of access token
Verify that token is not expired
Check user scopes in order to perform this action (scope = 'drugs:read')
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
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:
Response example
{
"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
API paragraph not found