/
REST API PRIVATE SPACE [AR] Private. Get Medication request by ID [API-005-008-002-0159]

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

REST API PRIVATE SPACE [AR] Private. Get Medication request by ID [API-005-008-002-0159]

Properties of a REST API method document

Document type

Метод REST API

Guideline ID

GUI-0011

Author

@Iryna Lishtaba (SoE eHealth)

Document version

1

Document status

DRAFT

Date of creation

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

Date of update

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

Method API ID

API-005-008-002-0159

Microservices (namespace)

IL

Component

ePrescription

Component ID

COM-005-008

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

https://uaehealthapi.docs.apiary.io/#reference/private.-reimbursement/private-medication-request/private.-get-medication-request-by-id

Resource

/api/admin/ medication_request/{{id}}

Scope

medication_request_admin:details

Protocol type

REST

Request type

GET

Sync/Async

Sync

Public/Private

Private

Purpose

This WS is designed to return Medication request detail for NHS_ADMIN. In the response of these endpoint person_id is return in hashed form. 
Search Medication Request is possible in 2 options: by `medication_request.id` OR `medication_request.request_number`.

According to requirements user of NHS_ADMIN can see all Medication request (without limitations)

Logic

  1. Verify the validity of access token

    1. Return 401 in case validation fails

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

    1. Return 403 in case invalid scope(s)

  3. Get `client_type` from `mithril.clients

  4. Search Medication request by $.id: 

    SELECT * FROM medication_requests MR WHERE (MR.id = $.id OR MR.request_number = $.id) AND MR.is_active = TRUE



Configuration parameters

Description of the configuration parameters that are used when processing a request in the system

Dictionaries

Provides a list of links to dictionaries that are available in Confluence

Input parameters

Input parameter

Values

Type

Description

Example

Input parameter

Values

Type

Description

Example

id

 

String

Request id.

Required

48416485-cc98-46c4-8bba-e321de9e1ecd

Request structure

See on API-specification (посилання на сторінку з API-специфікацією)

Description of the REST API request structure, example

Request data validation

Search Medication Request

  1. Search record by `$.id` in column `medication_request.id

    1. If not found -  Search record by `$.id` in column `medication_request.request_number`

      1. If not found - Return  404 in case "Not found record in DB with this ID!"

Validate FK

  1.  Read data from `ops_db.medication_requests` by `id`

  2. Validate legal_entity_id - legal_entity_id exists

    • Return 422 in case validation fails (422 EView)

  3. Validate employee_id - employee_id exists

    • Return 422 in case validation fails (422 EView)

  4. Validate division_id - division_id exists

    • Return 422 in case validation fails (422 EView)

  5. Validate medical_program_id - medical_program_id exists

    • Return 422 in case validation fails (422 EView)

  6. Validate all medication_id - medication_id exists

    • Return 422 in case validation fails (422 EView)

  7. Validate patient_id - mpi_id exists

    • Return 422 in case validation fails (422 EView)

Processing

A list of processes related to receiving, changing or transmitting data according to the logic defined in the REST API

Response structure examples

Description of the REST API response structure, example

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

 

401

validation fails

 

Помилка валідації

3

 

403

invalid scope(s)

 

Відсутній доступ

4

 

404

Not found record in DB with this ID

 

У базі даних не знайдено запис за цим ID

5

Специфічні

6

 

422

422 EView

 

Помилка валідації

Post-processing processes

  1. Return object with responce structure from WS Sign Medication Request.

Technical modules where the method is used

List of pages describing technical modules where the method is used

 

Related content

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