Info |
---|
REST API method / Метод REST API (настанова) (remove the link block before publishing the document) |
Table of Contents |
---|
Properties of a REST API method document
Page Properties | ||
---|---|---|
| ||
Document type | Метод REST API | |
Document title | [Document status] REST API [Назва методу] [ID методу] | Guideline ID | GUI-0011
Info | ||
REST API method / Метод REST API (настанова) (remove the link block before publishing the document) |
Table of Contents |
---|
Properties of a REST API method document
Page Properties | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||
|
...
PROVIDING_CONDITIONS_ALLOWED
INNM_DOSAGE
eHealth/activity_remaining_quantity_types
Input parameters
Description of input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | patient_id |
| String | MPI identifier of the person. Required |
|
2 | care_plan_id |
| String | Unique Care Plan identifier. Required |
|
Request structure
See on API-specification (посилання на сторінку з API-специфікацією)
Description of the REST API request structure, example
Expand | ||
---|---|---|
| ||
|
Headers
...
Key
...
Value
...
Mandatory
...
Description
...
Example
...
Content-Type
...
application/json
...
M
...
Тип контенту
...
Content-Type:application/json
...
Authorization
...
Bearer {{access_token}}
...
Authorization:Bearer {{access_token}}
...
API-key
...
{{mis_client_secret}}
...
API-key:{{mis_client_secret}}
...
Expand | ||
---|---|---|
| ||
|
Headers
Key | Value | Mandatory | Description | Example | |
---|---|---|---|---|---|
1 | Content-Type | application/json | M | Тип контенту | Content-Type:application/json |
2 | Authorization | Bearer {{access_token}} | Authorization:Bearer {{access_token}} | ||
3 | API-key | {{mis_client_secret}} | API-key:{{mis_client_secret}} |
Request data validation
Authorize
Verify the validity of access token
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 = 'care_plan:write')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: care_plan:write') in case of invalid scope(s)
If BLOCK_UNVERIFIED_PARTY_USERS is true, then check party's data match following condition: verification_status != NOT_VERIFIED or (verification_status = NOT_VERIFIED and updated_at <= current_date - UNVERIFIED_PARTY_PERIOD_DAYS_ALLOWED):
in case not match - return 403 ("Access denied. Party is not verified")
Validate legal entity
Extract client_id from token
Check legal entity status is ACTIVE
In case of error - return 409 ('client_id refers to legal entity that is not active')
Check legal entity type in ME_ALLOWED_TRANSACTIONS_LE_TYPES config parameter
in case of error - return 409 ('client_id refers to legal entity with type that is not allowed to create medical events transactions')
...
Extract user_id from token.
Check user has an active and approved employee from legal entity (token) that:
has an active Approval granted by the Patient on write the Care plan resource (care plan id from URL)
Return 403 ('Access denied') in case employee has no Approval on write
Check user's employee is from the same legal entity (token) as managing_organisation from the care_plan:
Return 422 ('User is not allowed to create care plan activity for this care plan') in case employee’s legal_entity do not match managing_organisation of related care_plan
Validate Digital Sign
Validate request is signed
in case of error - return 422 (“document must be signed by 1 signer but contains 0 signatures”)
Check DS is valid and not expired
Validate that DS belongs to the author of the activity
Check that DRFO from DS and user's party.tax_id matches
in case of error - return 409 (“Signer DRFO doesn't match with requester tax_id“)
...
Check employee belongs to the user and legal entity (from token)
Employee is:
an employee who has active Approval on write the Care plan
belongs to user
in case of error - return 422 ('User is not allowed to create care plan activity for the employee')
Check employee_type is value from list of employee_types in configuration: ACTIVITY_AUTHOR_EMPLOYEE_TYPES_ALLOWED
in case of error - return 422 ('Invalid employee type')
Validate activity detail
1. Kind
...
Validate value in the field $.detail.quantity, if submitted
Check $.detail.quantity.value is not empty, is fractional, greater than zero
Return 422 schema validation error
...
If $.detail.kind=medication_request:
Check (by schemata) the $.detail.quantity.system field’s value is MEDICATION_UNIT.
Return 422 ('value is not allowed in enum')
Check the $.detail.quantity.code field’s value equals to dosage.denumerator_unit of one of INNMs of a INNM_DOSAGE where innms with is_primary = true
Return 422 ('Code field of quantity object should be equal to denumerator_unit of one of medication’s innms')
If $.detail.kind is other than medication_request:Check the $.detail.quantity.system field is not present.Return 422 ('System field ofquantityobject is not allowed for kind other than medication_request')
Check the $.detail.quantity.code field is not present.Return 422 ('Code field ofquantityobject is not allowed for kind other than medication_request')
If $.detail.kind=service_request:
Check that $.detail.quantity.system field’s value is SERVICE_UNIT, if submitted.
Return 422 ('value is not allowed in enum')
If care plan category is class_23, class_24 or class_25:Check $.detail.quantity.system and $.detail.quantity.code are set, $.detail.quantity.code = MINUTEReturn 422 ('Code field of quantity object should be in MINUTE for care plan’s category <category code>')
Set remaining_quantity.value = $.detail.quantity.value, and use for remaining_quantity.system, remaining_quantity.code, remaining_quantity.unit fields, which were specified in $.detail.quantity object.
...
Check the value is valid reference o employee resource
Check employee is active and approved
Return 422 ('Invalid employee status')
10. Daily amount
If submitted, check $.detail.daily_amount has the same code and system as quantity field.
Return 422 ('Units of daily_amount field should be equal to units of quantity field')
Validate value in the field $.detail.daily_amount, if submitted.Check activity kind is medication_requestReturn 422 ('Field is allowed for medication request activities only') in case kind is not medication_request
Validate $.detail.daily_amount.system, $.detail.daily_amount.code fields and their values in the object $.detail.daily_amountIf $.detail.kind=medication_request:Check (by schemata) the $.detail.daily_amount.system field’s value is MEDICATION_UNIT.Return 422 ('value is not allowed in enum')
Check the $.detail.daily_amount.code field’s value equals to dosage.denumerator_unit of one of INNMs of a INNM_DOSAGE where innms with is_primary = trueReturn 422 ('Code field ofdaily_amountobject should be equal to denumerator_unit of one of medication’s innms')
If $.detail.kind is other than medication_request:Check the $.detail.daily_amount.system field is not present.Return 422 ('System field ofdaily_amountobject is not allowed for kind other than medication_request')
Check the $.detail.daily_amount.code field is not present.Return 422 ('Code field ofdaily_amountobject is not allowed for kind other than medication_request')
11. Medical program
Validate field exists for kind = medication_request
...
Save signed content to media storage
Save data to care_plan_activities collection in DB according to Care plan data model
for kind = medication_requestadd
unit
(and its value) field intoquantity
,daily_amount
, objects based onsystem
,code
out of MEDICATION_UNIT or SERVICE_UNIT dictionary.add
system
,code
,unit
fields intoremaining_quantity
based onquantity
object
Save link from media storage to the $.signed_content_links field in care plan activities collection
If Care plan has status = new:
Set care plan status = active
Check if patient has another active or/and new Care plans with such condition code in the addresses field and the same terms of service:
If such Care plans found - set these Care plans statuses to TERMINATED (related activities doesn`t change their status)
Set $.details.remaining_quantity_type:
If $.details.kind = medication_request check $.details.quantity:
if $.details.quantity = null then set $.details.remaining_quantity_type = null
if $.details.quantity is not null then:
set $.details.remaining_quantity_type = for_request
If $.details.kind = service_request check $.details.quantity:
if $.details.quantity = null then set $.details.remaining_quantity_type = null
if $.details.quantity is not null then check $.details.quantity.code:
if $.details.quantity.code is not null then set $.details.remaining_quantity_type = for_request
if $.details.quantity.code = null then set $.details.remaining_quantity_type = for_use
Create job and return it’s id.
Response structure examples
See on API-specification (посилання на сторінку з API-специфікацією)Description of the REST API response structure, example
Expand | ||
---|---|---|
| ||
|
...
Response code | HTTP Status code | Message | Internal name | Description | |||||
---|---|---|---|---|---|---|---|---|---|
1 | Базові | ||||||||
2 | 201 | Response | Sync. Use payload from response | ||||||
3 | 202 | Response | Async: default method. use Get job details to get processing result. Response payload will be returned in the job details | ||||||
4 | 401 | Invalid access token |
| ||||||
5 | 401 | Unauthorized | Помилка підтвердження | 6 | 403 | Access denied |
| ||
76 | 403 | Access denied. Party is not verified | |||||||
87 | 403 | Your scope does not allow to access this resource. Missing allowances: care_plan:write | |||||||
9 | 1000 | 404 | Composition not found | COMPOSITION_NOT_FOUND_404 | Не знайдено медичний висновок | ||||
108 | 404 | Program not found | |||||||
119 | 409 | client_id refers to legal entity that is not active |
| ||||||
1210 | 409 | client_id refers to legal entity with type that is not allowed to create medical events transactions | |||||||
1311 | 409 | Care Plan from url does not match to Care Plan ID specified in body | |||||||
1412 | 409 | Person is not active | |||||||
1513 | 409 | Patient is not verified | |||||||
1614 | 409 | Signer DRFO doesn't match with requester tax_id | |||||||
1715 | 422 | Another activity with status ‘scheduled' or ‘in_progress' already exists i | |||||||
1816 | 422 | Activity with such id already exists | |||||||
1917 | 422 | Another activity with status ‘scheduled' or ‘in_progress' already exists in the current Care plan | |||||||
2018 | 422 | Author’s specialty doesn't allow to create activity with medical program from request | |||||||
2119 | 422 | Bounds duration must be within care plan period range | |||||||
2220 | 422 | Code field of quantity object should be equal to denumerator_unit of one of medication’s innms | |||||||
2321 | 422 | Care plan with such id is not found | |||||||
2422 | 422 | Care Plan end date is expired | |||||||
2523 | 422 | Clinical impression with patient category does not correspond to rule engine rule | |||||||
2624 | 422 | Cannot refer to service for kind = medication_request | |||||||
2725 | 422 | Clinical impression with patient category should be present in request for this medical program | |||||||
2826 | 422 | Cannot refer to medication for kind = service_request | |||||||
2927 | 422 | Care plan’s terms of service are not allowed for the medical program | |||||||
3028 | 422 | Code field of quantity object should be in MINUTE for care plan’s category <category code> | |||||||
3129 | 422 | Clinical impression with patient category exceeds validity period | |||||||
3230 | 422 | Care plan diagnosis is not allowed for the medical program | |||||||
3331 | 422 | document must be signed by 1 signer but contains 0 signatures | |||||||
3432 | 422 | Division is not active | |||||||
3533 | 422 | Event is not within care plan period range | |||||||
3634 | 422 | Forbidden to create care plan activity for this medication! | |||||||
3735 | 422 | High must be within care plan period range | |||||||
3836 | 422 | Invalid care plan status | |||||||
3937 | 422 | Invalid employee status | |||||||
4038 | 422 | Invalid employee type | |||||||
4139 | 422 | Low must be within care plan period range, less than high, have the same code as high | |||||||
4240 | 422 | <medical event type> with such ID is not found | |||||||
4341 | 422 | Medication should be active | |||||||
4442 | 422 | Medication does not exist | |||||||
4543 | 422 | Medical program must be submitted for kind = medication_request | |||||||
4644 | 422 | Medication is not included in the program | |||||||
4745 | 422 | not allowed in enum | |||||||
4846 | 422 | Only one of the parameters must be present | |||||||
4947 | 422 | Period end time must be within care plan period range, after period start date | |||||||
5048 | 422 | Period start time must be within care plan period range | |||||||
5149 | 422 | Program not found | |||||||
5250 | 422 | Service group is not included in the program | |||||||
5351 | 422 | <Service/Service group> should be active | |||||||
5452 | 422 | String does not match pattern | |||||||
5553 | 422 | Service is not included in the program | |||||||
5654 | 422 | User is not allowed to create care plan activity for the employee | |||||||
5755 | 422 | Value is not allowed in enum | |||||||
5856 | 422 | User is not allowed to create care plan activity for this care plan | |||||||
5957 | 422 | Units of daily_amount field should be equal to units of quantity field | |||||||
6058 | Специфічні | ||||||||
61 | 422 | Only for active MPI record can be created medication request!59 |
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 | ||||
---|---|---|---|---|
|
...