Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

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

...

Table of Contents

Properties of a REST API method document

Page Properties
idpage_properties_method_REST API

Document type

Метод REST API

Document title

[Document status] REST API [Назва методу] [ID методу]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

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

Date of update

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

Method API ID

API-005-008-003-0161

Microservices (namespace)

IL

Component

ePrescription

Component ID

COM-005-008

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

https://ehealthmisapi1.docs.apiary.io/#reference/public.-reimbursement/medication-request-requests/prequalify-medication-request-request

Resource

{{host}}/api/medication_request_requests/prequalify

Scope

medication_request_request:write

Protocol type

REST

Request type

POST

Sync/Async

Sync

Public/Private

Public

Purpose

This WS is designed to Pre-qualify data of Medication request Request (post) - check whether it's possible to use Medication request within the particular Medical program.

...

  • plan - The request represents an intention to ensure something occurs without providing authorization for others to act. Medication request with type plan can't be dispensed and only provide the instruction to administer the medicine. It also can't be qualified

  • order - The request represents a request/demand and authorization for action. Medication request with type order can be dispensed.

Preconditions

  1. Only authenticated and authorized users with appropriate scope can invoke Prequalify Medication Request Request (MRR)

  2. This method simply returns the result of data validation within each submitted medical program, but not creates any entities in the system

  3. Each Medical program may have its unique conditions for the medication dispense. It can be based on analysis of personal info, medications list, terms, locations and combinations of them

  4. Any Medical program can have separate block of branching logic configured at medical program settings by NHS administrator

  5. Сompatibility is checked only for programs which are available in payload (array)

  6. Successful invocation of the method returns decision for each program if it is valid or not to create Medication Request with submitted combination of parameters in the payload. If program status is invalid, the reason must be saved and returned in response.

Logic

Технічний опис бізнес-процесу виписування рецепту в ЕСОЗ (загальний процес для усіх рецептурних ЛЗ, в т.ч. і тих, які підлягають реімбурсації)

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

ATTRIBUTES - see on Apiary

Input parameter

Mandatory

Type

Description

Example

1

--

--

--

--

--

Request structure

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

Description of the REST API request structure, example

Expand
titleExample
Code Block
{
  "medication_request_request": {
    "person_id": "585044f5-1272-4bca-8d41-8440eefe7d26",
    "employee_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "division_id": "881d6dee-dd3d-43f3-8983-922354c0e6ce",
    "created_at": "2017-08-17",
    "started_at": "2017-08-17",
    "ended_at": "2017-09-16",
    "medication_id": "1349a693-4db1-4a3f-9ac6-8c2f9e541982",
    "medication_qty": 10.34,
    "intent": "plan",
    "category": "community",
    "based_on": [
      {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "care_plan"
              }
            ]
          },
          "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
        }
      },
      {
        "identifier": {
          "type": {
            "coding": [
              {
                "system": "eHealth/resources",
                "code": "activity"
              }
            ]
          },
          "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
        }
      }
    ],
    "context": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "encounter"
            }
          ]
        },
        "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
      }
    },
    "dosage_instruction": [
      {
        "sequence": 1,
        "text": "0.25mg PO every 6-12 hours as needed for menses from Jan 15-20, 2015.  Do not exceed more than 4mg per day",
        "additional_instruction": [
          {
            "coding": [
              {
                "system": "eHealth/SNOMED/additional_dosage_instructions",
                "code": "311504000"
              }
            ]
          }
        ],
        "patient_instruction": "0.25mg PO every 6-12 hours as needed for menses from Jan 15-20, 2015.  Do not exceed more than 4mg per day",
        "timing": {
          "event": [
            "2017-04-20T19:14:13Z"
          ],
          "repeat": {
            "bounds_duration": {
              "value": 10,
              "unit": "days",
              "system": "eHealth/ucum/units",
              "code": "d"
            },
            "count": 2,
            "count_max": 4,
            "duration": 4,
            "duration_max": 6,
            "duration_unit": "d",
            "frequency": 1,
            "frequency_max": 2,
            "period": 4,
            "period_max": 6,
            "period_unit": "d",
            "day_of_week": [
              "mon"
            ],
            "time_of_day": [
              "2017-04-20T19:14:13Z"
            ],
            "when": [
              "WAKE"
            ],
            "offset": 4
          },
          "code": {
            "coding": [
              {
                "system": "TIMING_ABBREVIATIONS",
                "code": "patient"
              }
            ]
          }
        },
        "as_needed_boolean": true,
        "site": {
          "coding": [
            {
              "system": "eHealth/SNOMED/anatomical_structure_administration_site_codes",
              "code": "344001"
            }
          ]
        },
        "route": {
          "coding": [
            {
              "system": "eHealth/SNOMED/route_codes",
              "code": "46713006"
            }
          ]
        },
        "method": {
          "coding": [
            {
              "system": "eHealth/SNOMED/administration_methods",
              "code": "419747000"
            }
          ]
        },
        "dose_and_rate": {
          "type": {
            "coding": [
              {
                "system": "eHealth/dose_and_rate",
                "code": "'ordered'"
              }
            ]
          },
          "dose_range": {
            "low": {
              "value": 0,
              "unit": "mg",
              "system": "eHealth/ucum/units",
              "code": "mg"
            },
            "high": {
              "value": 0,
              "unit": "mg",
              "system": "eHealth/ucum/units",
              "code": "mg"
            }
          },
          "rate_ratio": {
            "numerator": {
              "value": 0,
              "unit": "mg",
              "system": "eHealth/ucum/units",
              "code": "mg"
            },
            "denominator": {
              "value": 0,
              "unit": "mg",
              "system": "eHealth/ucum/units",
              "code": "mg"
            }
          }
        },
        "max_dose_per_period": {
          "numerator": {
            "value": 0,
            "unit": "mg",
            "system": "eHealth/ucum/units",
            "code": "mg"
          },
          "denominator": {
            "value": 0,
            "unit": "mg",
            "system": "eHealth/ucum/units",
            "code": "mg"
          }
        },
        "max_dose_per_administration": {
          "value": 0,
          "unit": "mg",
          "system": "eHealth/ucum/units",
          "code": "mg"
        },
        "max_dose_per_lifetime": {
          "value": 0,
          "unit": "mg",
          "system": "eHealth/ucum/units",
          "code": "mg"
        }
      }
    ],
    "priority": "routine",
    "prior_prescription": {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "medication_request"
            }
          ]
        },
        "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
      }
    },
    "container_dosage": {
      "system": "MEDICATION_UNIT",
      "code": "ML",
      "value": 4
    }
  },
  "programs": [
    {
      "id": "59781de0-2e64-4359-b716-bcc05a32c10f"
    }
  ]
}Headers

Request data validation

Authorize

  1. Verify the validity of access token

    • in case of error - return 401 (“Invalid access token”) in case of validation fails

  2. Verify that token is not expired

    • in case of error - return 401 (“Invalid access token”)

  3. Check user scopes in order to perform this action (scope = 'medication_request_request:write')

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: medication_request_request:write”) in case of invalid scope(s)

Validate container_dosage field

$.container_dosage - volume of a medication’s primary container, which is requested by a doctor or issuer of a medication request, to be dispensed to patient.

  1. Validate $.container_dosage field by schemata

    1. $.container_dosage.code and $.container_dosage.value should be both filled

      1. in case of error return 422 error ("required property %{property} was not present")

    2. $.container_dosage.system should be “MEDICATION_UNIT”

      1. in case of error return 422 error ("value is not allowed in enum")

    3. if $.container_dosage is filled then $.container_dosage.unit should be checked with the MEDICATION_UNIT dictionary by $.container_dosage.code as a key.

      1. in case of error return 422 error ("value is not allowed in enum")

  2. Check if there is at list one record of Brand with requested primary container volume
    a. if not exist - return 404 error (message: "Not found any appropriate medication with such container parameters")

Validate priority

  1. Check by schemata if $.priority is filled with the value of MEDICATION_REQUEST_PRIORITY dictionary

    1. in case of error return 422 error ("value is not allowed in enum")

Validate prior_prescription

  1. Check that $.prior_prescription is UUID, exists and belongs to this person:

    1. is_active = true, and the same person. 

      1. in case of error - return 422 (message: "Prior prescription is not found")

Validate medication request type

Only medication request with type (intent) order can be qualified.

  1. Check medication request intent is order

    1. in case intent == plan - return 409, "Plan can't be qualified"

Validate division

Validate it is exists and active, relates to current legal entity (client_id from token)

  • in case of error - return 422 error “Only employee of active divisions can create medication request!“

Validate dates:

  1. Check ended_at >= started_at

    1. in case of error - return 422 error “Ended date must be >= Started date!“

  2. Validate started_at >= created_at, but not greater than (created_at + MEDICATION_REQUEST_REQUEST_EXTENDED_LIMIT_STARTED_AT_DAYS)

    1. if invalid - return 422 error  (message: "The start date should be equal to or greater than the creation date, but the difference between them should be not exceed {{MEDICATION_REQUEST_REQUEST_EXTENDED_LIMIT_STARTED_AT_DAYS}} day(s).")

  3. Validate started_at >= current_date()

    1. if invalid - return 422 error  (message: "Started date must be >= current date!")

  4. Check created_at >= (current date - MEDICATION_REQUEST_REQUEST_DELAY_INPUT)

    1. in case of error - return 422 “Create date must be >= Current date - MRR delay input!”

Validate dosage instructions

Validate each item as described at Create Medication Request Request: Validate dosage instruction

Validate compliance for programs

Some checks (below in the text) must be passed for the programs

...

  1. is exists

    1. in case of error - return status = INVALID and reject reason = “Medical program not found”

  2. is_active = true

    1. in case of error - return status = INVALID and reject reason = “Medical program is not active”

1. Check INNM complience for the programs

There is a list of medications (medications.type = BRAND OR medications.type = INNM_DOSAGE)  which can be used for the program. It must be check whether there is at least one available medication (with `medication_request_allowed` == TRUE)  for the Innm for the particular program 

...

  1. Check if there is at list one record of Brand with requested primary container volume in case when found medications is not medications.type = INNM_DOSAGE:

a. if not exist - return 404 error (message: "Not found any appropriate medication with such container parameters")

...

  1. Check max allowed quantity for the treatment period. If there in a list of medications is at list one record with medications.type = INNM_DOSAGE do p.4.2 and skip p.4.1
    4.1. in case when found medications is medications.type = BRAND:

  • Get non-null max_daily_dosage from all filtered above program medications

  • Define max value among max_daily_dosage as highest_max_daily_dosage

  • Get package_min_qty from all related brands, connected to found program medications

  • Define min value among package_min_qty as lowest_package_min_qty

...

i. in case of error - return 422 “The amount of medications in medication request is not complying with max_daily_dosage and treatment period limit”.

4.2. in case when found medications is medications.type = INNM_DOSAGE:

  • Get non-null max_daily_dosage from all filtered above program medications

  • Define max value among max_daily_dosage as highest_max_daily_dosage

a. Validate: ((highest_max_daily_dosage × (ended_at - started_at+1)) - medication_qty) >= 0

i. in case of error - return 422 “The amount of medications in medication request is not complying with max_daily_dosage and treatment period limit”

  1. Check compliance of medication quantity in case when found medications is not medications.type = INNM_DOSAGE: remainder of the division (medication_qty/package_min_qty) is equal to 0

a. in case it is not equal to zero - return 422 “The amount of medications in medication request must be divisible to package minimum quantity“

2. Check absence the same medications for the programs

It can be only 1 Medication request (ACTIVE, COMPLETED)  per one innm for the one patient at defined period of time.

...

  1. if found and medical program setting skip_mnn_in_treatment_period skip_treatment_period= false (absent):

    1. add to response: status = INVALID

    2. add to response: rejection_reason = "It can be only 1 active / completed medication request request or medication request per one innm for the same patient at the same period of time!"

  2. Fetch Medication Request by $

...

  1. if (ended_at - started_at + 1) >= MEDICATION_REQUEST_REQUEST_STANDARD_DURATION chart param then
    created_at from prequalify request should be greater then (ended at - MEDICATION_REQUEST_MAX_RENEW_DAY) of the found MR

    1. in case of error return 422 error ('It's to early to create new medication request for such innm_dosage and medical_program_id')

  2. if (ended_at - started_at + 1) < MEDICATION_REQUEST_REQUEST_STANDARD_DURATION chart param then
    created_at from prequalify request should be greater then (ended at - MEDICATION_REQUEST_MIN_RENEW_DAY) of the found MR

    1. in case of error return 422 error ('It's to early to create new medication request for such innm_dosage and medical_program_id')

3. Check that care plan is mandatory for programs

It is need to check if the medication request with a program need a care plan (with setting `care_plan_required` == TRUE) for a this program.

...

b. add to response: rejection_reason = "Medical program from activity should be equal to medical program from request"

4. Check diagnosis comply with programs

It is needed to check if medication request with a program needed a context (encounter) with a specified diagnosis. 

  1. If program has CONDITIONS_ICD10_AM_ALLOWED parameter in medical_program_settings:

    1. Check if primary diagnosis from the encounter in context has code from eHealth/ICD10_AM/condition_codes dictionary

      1. Check diagnosis code in CONDITIONS_ICD10_AM_ALLOWED

        1. in case of error - return 200 with status = INVALID and rejection_reason = “Encounter in context has no primary diagnosis allowed for the medical program“ 

  2. If program has CONDITIONS_ICPC2_ALLOWED parameter in medical_program_settings:

    1. Check if primary diagnosis from the encounter in context has code from eHealth/ICPC2/condition_codes dictionary

      1. Check diagnosis code in CONDITIONS_ICPC2_ALLOWED

        1. in case of error - return 200 with status = INVALID and rejection_reason = “Encounter in context has no primary diagnosis allowed for the medical program“

5. Check employee

It is needed to check if medication request with a program allowed to create for specified employee.

Validate employee_id as described on Create Medication request Request. Except on Prequalify method a declaration has not checked for the employee.

6. Check Care plan and Activity

It is needed to check if medication request with a program allowed to be created for specified care plan and activity.

Validare based_on as described on Create Medication request Request.

7. Check period

It is needed to check if medication request period does not exceed allowed maximum of days.

  1. If medication request has program with MEDICATION_REQUEST_MAX_PERIOD_DAY request_max_period_day in medical program setting:

    1. Check that medication request period (ended_at - started_at + 1) less than or equal to medical program setting MEDICATION_REQUEST_MAX_PERIOD_DAY request_max_period_dayparameter

      1. in case of error - return 200 with status = INVALID and rejection_reason = “Period length exceeds allowed value for the medical program“ 

  2. If medication request has program without MEDICATION_REQUEST_MAX_PERIOD_DAY request_max_period_dayin medical program setting:

    1. Check that medication request period (ended_at - started_at + 1) less than or equal to MEDICATION_REQUEST_MAX_PERIOD_DAY request_max_period_day parameter from charts

      1. in case of error - return 200 with status = INVALID and rejection_reason = “Period length exceeds default maximum value“lt maximum value“

8. Check context

  1. Validate "context" is an active (not entered-in-error) entity from corresponding dictionary, that belongs to the current patient

    1. Validate there is an entity in collection $.data.context.identifier.type.coding[0].code with id == $.data.context.identifier.value that belongs to the current patient

      1.  in case of error - return 200 with status = INVALID and rejection_reason = “Entity not found“

    2. encounter diagnosis is not empty in $.encounter.diagnosis

      1. in case of error return 422 ("Encounter without diagnosis can not be referenced")

    3. Validate context.identifier.type.coding[0].code = encounter

      1. in case of error return 422 ("value is not allowed in enum")

    4. encounter diagnosis is not empty in $.encounter.diagnosis

      1. in case of error return 422 ("Encounter without diagnosis can not be referenced")

9. Check person

It is needed to check if person has allowed verification status to get medication.

Validate person's verification status as described on Create Medication request Request

10. Check declaration for a program

It is needed to check specified params for each medical program.

Declaration should always be validated for each program. Validate skip_medication_request_employee_declaration_verify skip_request_employee_declaration_verify and skip_medication_request_legal_entity_declaration_verify skip_request_legal_entity_declaration_verify  parameters at medical program settings as described at Create Medication request Request if there are some exclusions.

11. Check provision for a programs

It is needed to check if medical program can be provided by pharmacies.

  1. If the medical program has no setting skip_contract_provision_verify or it is equal to false/null:

    1. If medical program has funding_source = LOCAL:

      1. Check there is exists any active medical program provision with msp_legal_entity_id equal to employee's legal entity

        1. in case of error - return 200 with status = INVALID and rejection_reason = "Medical program is not provided for legal entity specified in the medication request"

Processing

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

Response structure examples

Collect array for all programs in payload with status for each (VALID or INVALID) and rejection_reason.

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

Description of the REST API response structure, example

Expand
titleExample
Code Block
{
  "meta": {
    "code": 200,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": [
    {
      "program_id": "59781de0-2e64-4359-b716-bcc05a32c10f",
      "program_name": "Програма \"Доступні ліки\"",
      "status": "INVALID",
      "rejection_reason": "Innm not on the list of approved innms for program 'DOSTUPNI LIKI' !"
    }
  ]
}

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

200

Encounter in context has no primary diagnosis allowed for the medical program

У контексті обрано посилання на взаємодію без первинного діагнозу, що визначений для обраної програми відшкодування

3

200

Period length exceeds allowed value for the medical program

Вказана тривалість курсу лікування перевищує допустиму в рамках обраної програми відшкодування

4

200

Period length exceeds default maximum value

Тривалість періоду перевищує максимальне значення, що визначене системою

5

200

Entity not found

Сутність не знайдено

6

200

Medical program is not provided for legal entity specified in the medication request

Створення рецепту за обраною програмою не дозволене для вашого закладу

7

401

Invalid access token

Недійсний токен доступу

8

403

Your scope does not allow to access this resource. Missing allowances: medication_request_request:write

Для вашої ролі відсутній доступ до цього ресурсу. Необхідний доступ на редагування заявки на електронний рецепт

9

404

Not found any appropriate medication with such container parameters

Не знайдено жодного лікарського засобу з такими параметрами первинної упаковки

10

404

Not found any appropriate medication complying with max_request_dosage limit

Не знайдено жодного лікарського засобу, який би відповідав обмеженню максимального дозування {{max_request_dosage}}

11

409

Plan can't be qualified

План лікування не може бути перевіреним на відповідність програмі реімбурсації

12

Специфічні

13

422

required property %{property} was not present

Обов'язкові поля %{property} не вказані

14

422

value is not allowed in enum

Недопустиме значення

15

422

Prior prescription is not found

Первинний рецепт не знайдено

16

422

Only employee of active divisions can create medication request!

Лише працівник активного підрозділу може створити заявку на рецепт

17

422

Ended date must be >= Started date!

Дата закінчення курсу лікування має дорівнювати чи бути пізніше дати початку курсу лікування

18

422

The start date should be equal to or greater than the creation date, but the difference between them should be not exceed {{MEDICATION_REQUEST_REQUEST_EXTENDED_LIMIT_STARTED_AT_DAYS}} day(s)

Дата початку повинна бути такою ж або пізнішою за дату створення, але різниця між ними не повинна перевищувати {{MEDICATION_REQUEST_REQUEST_EXTENDED_LIMIT_STARTED_AT_DAYS}} день(днів).

19

422

Create date must be >= Current date - MRR delay input!

Дата створення повинна бути >= Поточна дата - 3 доби

20

Medical program not found

Програма реімбурсації не знайдена

21

Medical program is not active

Програма реімбурсації не активна

22

Innm not on the list of approved innms for program {program_name}

Лікарський засіб відсутній у програмі реімбурсації #{program.name}

23

422

The amount of medications in medication request is greater than available maximum for the max_daily_dosage and treatment period limit

Перевищено максимально допустиму кількість лікарського засобу, що дозволена до виписування в одному електронному рецепті

24

422

The amount of medications in medication request is not complying with max_daily_dosage and treatment period limit

Перевищено максимально допустиму кількість лікарського засобу за кількістю лікарського засобу на добу, що дозволена до виписування в одному електронному рецепті.

Максимально допустиме дозування на добу для вказаного періоду лікування становить Х [одиниці виміру].

Х [одиниці виміру] - значення, розраховані МІС відповідно до валідації Системи

25

422

The amount of medications in medication request must be divisible to package minimum quantity

Кількість лікарського засобу у заявці на рецепт повинна бути кратна мінімально неподільній кількості лікарського засобу в упаковці

26

It can be only 1 active / completed medication request request or medication request per one innm for the same patient at the same period of time!

Може бути лише 1 активний / погашений електронний рецепт або запит на створення електронного рецепту на одну МНН в один і той же час

27

422

It's to early to create new medication request for such innm_dosage and medical_program_id

Створення нового електронного рецепта для дозування МНН за обраною програмою відшкодування є передчасним

28

Medical program from activity should be equal to medical program from request

Програма відшкодування у заявці на рецепт повинна бути такою ж як і в призначенні на лікарський засіб

29

422

Encounter without diagnosis can not be referenced

Не можна посилатися на взаємодію без діагнозу

Post-processing processes

Description of actions performed on data after processing

Technical modules where the method is used

List of pages describing technical modules where the method is used

Page Properties Report
headingsID ТМ, Статус
cqllabel = "tr-mis"

...