Versions Compared

Key

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

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.

...

Page Properties

Link

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

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

Resource

/api/medication_request_requests/prequalify

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

Scope

medication_request_request:write

Scope для доступу

Components

ePrescription

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

Microservices

API paragraph not found

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

Protocol type

REST

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

Request type

POST

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

Sync

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

Public/Private/Internal

Public

...

ATTRIBUTES - see on Apiary

...

No

Request structure

See on Apiary

...

  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!”

...

1. Check INNM complience for the programs

There is a list of medications (BRANDs, which links to Innmslist 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 

...

2. 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")

3. Check if there is at list one record medication_qty <= max_request_dosage or (max_request_dosage is null)

a. if not exist - return 404 error (message: "Not found any appropriate medication complying with max_request_dosage limit")

4. Check compliance of medication quantity: 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“

...

  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

a. Validate that remainder of the division: (highest_max_daily_dosage × (ended_at - started_at+1)) / one of package_min_qty is equal to 0

i. if true - check medication_qty <= (highest_max_daily_dosage × (ended_at - started_at+1))

...

ii. in case of error - return 422 “The amount of medications in medication request is greater than available maximum for the max_daily_dosage and treatment period limit” 

b. Validate: (medication_qty - (highest_max_daily_dosage × (ended_at - started_at+1))

...

) < 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

...

ba. Validate: (medication_qty - (highest_max_daily_dosage × (ended_at - started_at+1))) < lowest_package_min - 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

...

  1. For info - status charts: Medication_request

  2. Get `check_innm_id`

Expand
titleSQL script example
Code Block
SELECT m0.id
FROM medications AS m0
         INNER JOIN ingredients AS i1 ON m0.id = i1.parent_id
         INNER JOIN (SELECT si2.id AS id
                     FROM medications AS sm0
                              INNER JOIN ingredients AS si1 ON si1.parent_id = sm0.id
                              INNER JOIN innms AS si2 ON si1.innm_child_id = si2.id
                     WHERE (sm0.is_active = TRUE)
                       AND (sm0.id = {$.medication_id})
                       AND (si1.is_primary = TRUE)
                       AND (si2.is_active = TRUE)) AS s2 ON i1.innm_child_id = s2.id
WHERE (m0.is_active = TRUE)

...

  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')

...

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

...

  1. If medication request has program with MEDICATION_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 parameter

      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 in medical program setting:

    1. Check that medication request period (ended_at - started_at + 1) less than or equal to MEDICATION_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“

...

  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.

...