ЕСОЗ - публічна документація
[DRAFT] [NEW] Resend SMS on Composition [API-007-011-001-0474]
REST API method / Метод REST API (настанова) (remove the link block before publishing the document)
Properties of a REST API method document
Document type | Метод REST API |
---|---|
Document title | [DRAFT] [NEW] Resend SMS on Composition [API-007-011-001-0474] |
Guideline ID | GUI-0011 |
Author | @ |
Document version | 1 |
Document status | DRAFT |
Date of creation | ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD) |
Date of update | ХХ.ХХ.ХХХХ (дата зміни версії) |
Method API ID | API-007-011-001-0474 |
Microservices (namespace) | ME |
Component | Compositions_ME |
Component ID | COM-007-011 |
Link на API-специфікацію | |
Resource | {{host}}//api.ehealth.gov.ua/api/patients/id/encounter_package |
Scope |
|
Protocol type | REST |
Request type |
|
Sync/Async |
|
Public/Private |
|
Purpose
This WS is designed to resend SMS to the patient(or confidant person) with composition number in case it wasn’t delivered the first time.
Key points
Only authenticated and authorized user with appropriate scope can resend SMS.
SMS with composition number can be resent only to person with auth_method with type OTP.
SMS with composition number can be resent only for Composition in FINAL status.
Logic
N/A
Configuration parameters
N/A
Dictionaries
N/A
Input parameters
Input parameter | Mandatory | Type | Description | Example | |
---|---|---|---|---|---|
1 |
|
|
|
|
|
2 |
|
|
|
|
|
Request structure
See on API-specification
Headers
Request data validation
Validations
Validate person
Check if person with patient_id from request exists
in case of error - return 404 (“Not found”)
Check if person with patient_id from request is not preperson
in case of validation fails skip all steps below
Check if Composition with composition_id from request is exist
in case of error - return 404 (“Not found”) in case of validation fails
Validate Composition
Check that status is not 'entered_in_error'
in case of error - return 409 error ('You can not resend SMS for Composition in status %status%')
Validate legal entity
Check that legal_entity_type is included in chart variables
ME_ALLOWED_TRANSACTIONS_LE_TYPES
config parameterin case of error return 409 "Action is not allowed for the legal entity"
Check that legal_entity has status = active
in case of error return 409 "Action is not allowed for the legal entity"
Authorization
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 = 'composition:resend_sms')
return 403 (“Your scope does not allow to access this resource. Missing allowances: composition:resend_sms”) in case of invalid scope(s)
Processing
Call [Transferred] SMS timeout procedure to check if resending is allowed using:
COMPOSITION_MAX_ATTEMPTS_COUNT as MAX_ATTEMPTS_COUNT
COMPOSITION_SEND_TIMEOUT as SEND_TIMEOUT
"composition" as entity_name
composition_id as entity_id
in case of error - return 429 ("Sending SMS timeout. Try later. Next attempt will be available at <attempts.oldest.value + SEND_TIMEOUT>")
Get person's authentication_method according to logic:
If authorize_with exists in Composition and is not empty, check:
Authentication method exists in person_authentication_methods table in MPI DB (with is_active=true), is active (ended_at > now() or null)
Get value of
THIRD_PERSON_CONFIDANT_PERSON_RELATIONSHIP_CHECK
config parameterif it is set to
true
- for authentication method with type = THIRD_PERSON check that person from value is an approved confidant for a person from Composition:exists active and approved confidant person relationship between patient from the Composition and confidant_person_id from authentication method value (using following logic: Check confidant person relationship with
person_id
= person from request andconfidant_person_id
= value from auth method - expected:ok, :approved
response)
in case any validation failed - return 409 ('Authentication method doesn't exist or is inactive')
else - get authentication_method from authorize_with
If authorize_with does not exist in composition request or is empty - get default authentication_method of person from MPI using logic Determination of a default authentication method and return person's active auth_methods
If authentication_method == OTP or THIRD_PERSON (with OTP)
Generate text SMS with template
CREATE_{{COMPOSITION_TYPE}}_COMPOSITION_SMS_TEMPLATE
.Send SMS
else, if authentication_method is not OTP or THIRD_PERSON (with OTP) return an error
return 409 ('Authentication method doesn't exist or is inactive')
Response structure examples
See on API-specification
HTTP status codes
Response code | HTTP Status code | Message | Internal name | Description | |
---|---|---|---|---|---|
1 | Базові | ||||
2 |
| 401 | Invalid access token |
|
|
3 |
| 403 | Your scope does not allow to access this resource. Missing allowances: composition:resend_sms |
|
|
4 |
| 404 | Not found |
|
|
5 |
| 409 | Action is not allowed for the legal entity |
|
|
6 |
| 409 | Authentication method doesn't exist or is inactive |
|
|
7 |
| 409 | Authentication method doesn't exist or is inactive |
|
|
8 |
| 409 | You can not resend SMS for Composition in status %status% |
|
|
9 |
| 429 | Sending SMS timeout. Try later. Next attempt will be available at <attempts.oldest.value + SEND_TIMEOUT> |
|
|
10 | Специфічні | ||||
11 |
|
|
|
|
|
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
Название | ID ТМ | Статус |
---|---|---|
TM0112 |
| |
|
|
ЕСОЗ - публічна документація