ЕСОЗ - публічна документація
[DRAFT] Approve merge request [API-010-001-002-0354]
Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.
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 Processing
- 11 Response structure examples
- 12 HTTP status codes
- 13 Post-processing processes
- 14 Technical modules where the method is used
Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | [DRAFT] Approve merge request [API-010-001-002-0354] |
Guideline ID | GUI-0011 |
Author | @ |
Document version | 1 |
Document status | DRAFT |
Date of creation | ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD) |
Date of update | ХХ.ХХ.ХХХХ (дата зміни версії) |
Method API ID | API-010-001-002-0354 |
Microservices (namespace) | MPI |
Component | Master Patient Index |
Component ID | COM-010-001 |
Link на API-специфікацію | |
Resource | {{host}}/api/merge_requests/{{id}}/actions/approve |
Scope | merge_request:write |
Protocol type | REST |
Request type | PATCH |
Sync/Async | Sync |
Public/Private | Public |
Purpose
This WS serves for receiving approval from a person on the action of merging with preperson.
Logic
Only authenticated and authorized SPECIALIST, ASSISTANT or RECEPTIONIST employees can use this WS.
Usage of this WS allowed in EMERGENCY or OUTPATIENT legal entities.
Person should confirm merge with preperson by auth method chosen on create patient request or create declaration request processes.
The request can be approved only by employee who made the request.
Change status should be logged in the Event manager.
Configuration parameters
N/A
Dictionaries
GENDER
DOCUMENT_TYPE
ADDRESS_TYPE
COUNTRY
SETTLEMENT_TYPE
STREET_TYPE
PHONE_TYPE
CONFIDANT_PERSON_TYPE
PREFERRED_WAY_COMMUNICATION
DOCUMENT_RELATIONSHIP_TYPE
Input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 | id |
| String | Identifier of the merge request. Required | 7c3da506-804d-4550-8993-bf17f9ee0404 |
2 |
|
|
|
|
|
Request structure
See on API-specification
Headers
Request data validation
Authorize
Verify the validity of access token
Return 401 in case validation fails
Check user scopes in order to perform this action (scope = 'merge_request:write')
Return 403 in case invalid scope(s)
Check the employee has created this merge request. Thus select inserted_by from il.merge_requests of this merge request and compare it with user_id from the token.
If not match - return 403 error (Only author of merge request is allowed to approve it)
Check that client_id from the token maches with il.merge_requests.legal_entity_id
If not match - return 422 error (User doesn’t belong to legal entity where the merge request was created)
Validate schema
Validate request using schema (TBD)
Validate merge request
Validate merge request id exists in DB
In case of error - return 404
Check merge request status is NEW
In case of error - return 422 (Incorrect status to approve merge request)
Validate legal entity
Validate legal entity as on create merge request process.
Validate person
Validate person as on create merge request process.
Validate preperson
Validate preperson as on create merge request process, but w/o searching pending merge requests and episodes.
Processing
Determine authorization method
Get authorization_method from il.merge_requests.authentication_method_current.
Next steps is similar to determine authorization method and check OTP/check Documents process on approve patient request.
Get preperson episodes
Get all the preperson episodes for the printout form (mongodb, episodes collection).
Generate printout form
Check if person has confidant_person block:
if has - select printout form with confidant person
if not - select printout form w/o confidant person
Invoke MAN to render print form.
Request mapping:
Parameter | Source |
---|---|
id | MERGE REQUEST |
Set
il.merge_requests.printout_form
Update object in DB
il.merge_requests table
Parameter | Source | Description |
---|---|---|
status | Request: status | Status of the request, required. Set APPROVED |
data | Request: data | Request data for sign, required. Save master_person and merge_person blocks with detailed information, printout form, merge request id, patient_signed (master person) and status field. |
printout_form | text | Generated printout form (PREPERSON MERGE REQUEST) |
updated_by | uuid | Extract user from token |
updated_at | timestamp | Get current date-time |
Response structure examples
See on API-specification
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 |
| 200 | Response |
|
|
3 |
| 401 |
| Access token validation failed |
|
4 |
| 403 | Only author of merge request is allowed to approve it
| Validation failed |
|
5 |
| 403 | Invalid scope |
|
|
6 |
| 404 |
| Validation failed |
|
7 |
| 422 | User doesn’t belong to legal entity where the merge request was created
| Validation failed |
|
8 |
| 422 | Incorrect status to approve merge request |
|
|
9 | Специфічні | ||||
10 |
|
|
|
|
|
Post-processing processes
N/A
Technical modules where the method is used
ЕСОЗ - публічна документація