ЕСОЗ - публічна документація
[DRAFT] Close Episode [API-007-006-001-0272]
Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.
https://e-health-ua.atlassian.net/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)
- 1 Properties of a REST API method document
- 2 Purpose
- 3 Logic
- 4 Configuration parameters
- 5 Dictionaries
- 6 Input parameters
- 7 Request structure
- 8 Headers
- 9 Request data validation
- 10 Authorize
- 10.1 Validate token
- 10.2 Validate legal entity
- 10.3 Validate request
- 11 Processing
- 12 Response structure examples
- 13 HTTP status codes
- 14 Post-processing processes
- 15 Technical modules where the method is used
Properties of a REST API method document
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-007-006-001-0272 |
Microservices (namespace) | ME |
Component | Episode |
Component ID | COM-007-006 |
Link на API-специфікацію | https://medicaleventsmisapi.docs.apiary.io/#reference/medical-events/episode-of-care/close-episode |
Resource | {{host}}/api/patients/{{patient_id}}/episodes/{{episode_id}}/actions/close |
Scope | episode:write |
Protocol type | REST |
Request type | PATCH |
Sync/Async | Async |
Public/Private | Public |
Purpose
This web service is designed to close an episode.
Logic
This web service is designed to close an episode of care.
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 | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | patient_id |
| String | Patient identifier |
|
2 | episode_id |
| String | Episode identifier |
|
Request structure
See on Apiary
See on API-specification
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 | {{secret}} |
|
| API-key:{{secret}} |
Request data validation
Authorize
Request to process the request using a token in the headers
Verify the validity of access token
Return 401 in case validation fails
Verify token is not expired
in case of error return 401
Check user scopes in order to perform this action (scope = 'episode:write')
Return 403 in case invalid scope(s)
Validate token
check value of ALLOW_OTHER_LE_EMPLOYEES_TO_MANAGE_EPISODE variable in charts configuration
if its value is equal to false, verify that user’s employees from care_manager belongs to one of the user_id from token
in case of error - return 422 ('User is not allowed to perform this action')
otherwise, verify that user’s employees from care_manager belongs to the same Legal Entity as author of the episode
in case of error - return 422 ('User is not allowed to perfom this action')
Validate legal entity
Validate episode belongs to the legal entity where the current user works
ME.episode.managing_organization==token.client_id
in case of error return 422 "Managing_organization does not correspond to user`s legal_entity"
Validate request
Validate episode.status!= "entered_in_error" or "closed"
in case of error "Episode in {episode_status} can not be closed"
Validate that "closing_reason" is a valid value from the corresponding dictionary
$.closing_reason.coding[*].system == "eHealth/episode_closing_reasons"
Validate period as Period (consider period.start_date from the episode)
Processing
Set the status of the episode in "closed"
Set closing_reason in status_reason
Set closing_summary
Set period.end
Create a record in episode.status_history
Response structure examples
See on Apiary
See on API-specification
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 |
| 202 |
|
|
|
3 |
| 401 |
| Access token validation failed |
|
4 |
| 403 |
| Invalid scope |
|
5 |
| 404 | Patient not found |
|
|
6 |
| 422 | Managing_organization does not correspond to user`s legal_entity |
|
|
7 |
| 422 |
| Validation failed |
|
8 |
| 422 | User is not allowed to perform this action |
|
|
9 | Специфічні | ||||
10 |
|
|
|
|
|
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
ЕСОЗ - публічна документація