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.
There are two types of medication requests:
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.
Specification
...
Link
...
...
Посилання на 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
...
Preconditions
Only authenticated and authorized users with appropriate scope can invoke Prequalify Medication Request Request (MRR)
This method simply returns the result of data validation within each submitted medical program, but not creates any entities in the system
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
Any Medical program can have separate block of branching logic configured at medical program settings by NHS administrator
Сompatibility is checked only for programs which are available in payload (array)
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
Input parameters
ATTRIBUTES - see on Apiary
Filters
No
Request structure
See on Apiary
Example:
...
title | Request example |
---|
...
Authorize
Verify the validity of access token
in case of error - 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 = '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)
Headers
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation
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.
Validate $.container_dosage field by schemata
...
$.container_dosage.code and $.container_dosage.value should be both filled
in case of error return 422 error ("required property %{property} was not present")
...
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.
There are two types of medication requests:
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.
Specification
Link | Посилання на 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 |
|
Preconditions
Only authenticated and authorized users with appropriate scope can invoke Prequalify Medication Request Request (MRR)
This method simply returns the result of data validation within each submitted medical program, but not creates any entities in the system
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
Any Medical program can have separate block of branching logic configured at medical program settings by NHS administrator
Сompatibility is checked only for programs which are available in payload (array)
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
Input parameters
ATTRIBUTES - see on Apiary
Filters
No
Request structure
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
Authorize
Verify the validity of access token
in case of error - 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 = '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)
Headers
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation
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.
Validate $.container_dosage field by schemata
$.container_dosage.code and $.container_dosage.value should be both filled
in case of error return 422 error ("required property %{property} was not present")
$.container_dosage.system should be “MEDICATION_UNIT”
in case of error return 422 error ("value is not allowed in enum")
if $.container_dosage is filled then $.container_dosage.unit should be checked with the MEDICATION_UNIT dictionary by $.container_dosage.code as a key.in case of error return 422 error ("value is not allowed in enum")
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
Check by schemata if $.priority is filled with the value of MEDICATION_REQUEST_PRIORITY dictionary
in case of error return 422 error ("value is not allowed in enum")
if $.container_dosage is filled then $.container_dosage.unit should be checked with the MEDICATION_UNIT dictionary by $.container_dosage.code as a key.
Validate prior_prescription
Check that $.prior_prescription is UUID, exists and belongs to this person:
is_active = true, and the same person.
in case of error - return 422 error (message: "value Prior prescription is not allowed in enum")
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
- Check by schemata if $.priority is filled with the value of MEDICATION_REQUEST_PRIORITY dictionary
found")
Validate medication request type
Only medication request with type (intent) order can be qualified.
Check medication request intent is order
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
...
Validate prior_prescription
Check that $.prior_prescription is UUID, exists and belongs to this person:
...
“Only employee of active divisions can create medication request!“
Validate dates:
Check ended_at >= started_at
Check ended_at >= started_at
in case of error - return 422 error “Ended date must be >= Started date!“
- Validate started_at >= created_at, but not greater than (created_at +
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.
Check medication request intent is order
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:
error “Ended date must be >= Started date!“
Validate started_at >= created_at, but not greater than (created_at + MEDICATION_REQUEST_REQUEST_EXTENDED_LIMIT_STARTED_AT_DAYS)
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).")
Validate started_at >= current_date()if invalid - return 422 error (message: "Started date must be >= current date!")
Check created_at >= (current date - MEDICATION_REQUEST_REQUEST_EXTENDED_LIMIT_STARTED_AT_DAYS)
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).")
Validate started_at >= current_date()if invalid - return 422 error (message: "Started date must be >= current date!")
Check created_at >= (current date - MEDICATION_REQUEST_REQUEST_DELAY_INPUT)DELAY_INPUT)
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
if passed - save the response by this program - status = VALID
if not passed - save response by this program - status = INVALID
Check each medical program in the array is:
is exists
in case of error - return status = INVALID and reject reason = “Medical program not found”
is_active = true
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
if passed - save the response by this program - status = VALID
if not passed - save response by this program - status = INVALID
Check each medical program in the array is:
is exists
in case of error - return status = INVALID and reject reason = “Medical program not found”
is_active = true
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 (BRANDs, which links to Innms) 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
Check compatibility of innm with medication list for the program
if data is not found:
add to response: status = INVALID
add to response: rejection_reason = "Innm not on the list of approved innms for program {program_name}"
...
title | SQL script example |
---|
...
Check if there is at list one record of Brand with requested primary container volume
if not exist - return 404 error (message: "Not found any appropriate medication with such container parameters")
...
Check if there is at list one record medication_qty <= max_request_dosage or (max_request_dosage is null)
if not exist - return 404 error (message: "Not found any appropriate medication complying with max_request_dosage limit")
Check max allowed quantity for the treatment period:
...
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
...
status = INVALID and reject reason = “Medical program is not active”
1. Check INNM complience for the programs
There is a list of medications (BRANDs, which links to Innms) 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
Check compatibility of innm with medication list for the program
if data is not found:
add to response: status = INVALID
add to response: rejection_reason = "Innm not on the list of approved innms for program {program_name}"
Expand | ||
---|---|---|
| ||
|
Check if there is at list one record of Brand with requested primary container volume
if not exist - return 404 error (message: "Not found any appropriate medication with such container parameters")
Check if there is at list one record medication_qty <= max_request_dosage or (max_request_dosage is null)
if not exist - return 404 error (message: "Not found any appropriate medication complying with max_request_dosage limit")
Check max allowed quantity for the treatment period:
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))
1.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”
Check compliance of medication quantity: remainder of the division (medication_qty/package_min_qty) is equal to 0
...