ЕСОЗ - публічна документація

[DRAFT] Resend SMS on Service request [API-007-010-001-0314]

Сторінка знаходиться в процесі розробки. Інформація на ній може бути застарілою.

https://e-health-ua.atlassian.net/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)

Properties of a REST API method document

Document type

Метод REST API

Document title

[DRAFT] Resend SMS on Service request [API-007-010-001-0314]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)

Date of update

ХХ.ХХ.ХХХХ (дата зміни версії)

Method API ID

API-007-010-001-0314

Microservices (namespace)

ME

Component

Service request

Component ID

COM-007-010

Link на API-специфікацію

MEDICAL EVENTS MIS API · Apiary

Resource

{{host}}/api/patients/{{patient_id}}/service_requests/{{service_request_id}}/actions/resend

Scope

service_request:use

Protocol type

REST

Request type

PATCH

Sync/Async

Async(def)/Sync

Public/Private

Public

Purpose

This WS is designed to resend sms with OTP-code to the person’s verified phone on service request in case OTP wasn’t delivered in first time.

Logic

Method to resend sms on service request. It can be processed in both sync and async methods depends on Server decision.

Service logic

  1. Send SMS to patient (if authentication_method_current == SMS)

    1. Template = SERVICE_REQUEST_CREATE_SMS

  1. Get person's authentication_method of MPI

  2. If authentication_method == OTP - send SMS:

    1. Generate text SMS (call Man method- templates rendering service with template SERVICE_REQUEST_CREATE_SMS.

  3. Send SMS

  4. Save internal information to corresponding DB

Configuration parameters

N/A

Dictionaries

N/A

Input parameters

Input parameter

Mandatory

Type

Description

Example

Input parameter

Mandatory

Type

Description

Example

1

patient_id

 

String

Unique patient identifier

7075e0e2-6b57-47fd-aff7-324806efa7e5

2

service_request_id

 

String

Unique service request identifier

aff00bf6-68bf-4b49-b66d-f031d48922b3

Request structure

See on API-specification

Headers

Headers

Request data validation

Authorize

  • Verify the validity of access token

    • Return (401, 'unauthorized') in case of validation fails

  • Verify that token is not expired

    • in case of error - return (401, 'unauthorized')

  • Check user scopes in order to perform this action (scope = 'service_request:write')

    1. Return (403, 'invalid scopes') in case of invalid scope(s)

Request to process the request using a token in the headers

Validate transition

  1. Check if service request with service_request_id from request is exist

    1. in case of error - return 404 (“Not found”) in case of validation fails

  2. Validate person

    1. Check if person with patient_id from request is exist

      1. in case of error - return 404 (“Not found”) in case of validation fails

    2. Check if person with patient_id from request is not preperson

      1. in case of validation fails skip all steps below

  3. Validate legal entity

    1. Check that legal_entity_type is included in chart variables ME_ALLOWED_TRANSACTIONS_LE_TYPES config parameter

      1. in case of error return 409 "Action is not allowed for the legal entity"

    2. Check that legal_entity has status = active

      1. in case of error return 409 "Action is not allowed for the legal entity" 

  4. Validate service_request

    1. Check that status = ‘active' and ProgramProcessinStatus in (’new', ‘in_queue')

      1. in case of error - return 409 error ('You can not resend SMS for service request in status %status%')

      2. in case of error - return 409 error ('You can not resend SMS for service request in program processing status %program_processing_status%')

Processing

N/A

Response structure examples

See on API-specification

{ "data": { "id": "90a9e15b-b71b-4caf-8f2e-ff247e8a5600", "requisition": "AX654654T", "status": "active", "program": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "medical_program" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "program_processing_status": "new", "status_history": [ { "status": "closed", "status_reason": { "coding": [ { "system": "eHealth/service_request_recall_reasons", "code": "cured" } ] }, "inserted_at": "2018-08-02T10:45:16.000Z" } ], "program_processing_status_history": [ { "program_processing_status": "new", "inserted_at": "2018-08-02T10:45:16.000Z", "inserted_by": "f7bdce4c-9d6e-4b08-913c-97c4b972f9be" } ], "program_service": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "program_service" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "intent": "order", "priority": "routine", "based_on": [ { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "care_plan" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" } }, { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "activity" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" } } ], "category": { "coding": [ { "system": "eHealth/SNOMED/service_request_categories", "code": "409063005" } ] }, "code": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "service" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "subject": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "patient" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "context": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "encounter" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "occurrence_period": { "start": "2018-08-02T10:45:16.000Z", "end": "2018-08-02T11:00:00.000Z" }, "requester_employee": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "employee" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "requester_legal_entity": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "legal_entity" } ] }, "value": "75a6d991-0bf7-476f-b3cf-bec83f044b2a" }, "display_value": "null" }, "reason_references": [ { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "condition" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" } ], "supporting_info": [ { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "episode_of_care" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" } ], "note": "Some notes", "patient_instruction": "Some patient instructions", "expiration_date": "2018-08-02T10:45:16.000Z", "permitted_resources": [ { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "episode_of_care" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" } ], "used_by_employee": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "legal_entity" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "inserted_at": "2018-08-02T10:45:16.000Z", "updated_at": "2018-08-02T10:45:16.000Z", "completed_with": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "diagnostic_report" } ] }, "value": "9183a36b-4d45-4244-9339-63d81cd08d9c" }, "display_value": "null" }, "used_by_legal_entity": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "legal_entity" } ] }, "value": "c5a6d991-0bf7-476f-b3cf-bec83f044b2a" }, "display_value": "null" }, "performer": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "legal_entity" } ] }, "value": "c5a6d991-0bf7-476f-b3cf-bec83f044b2a" }, "display_value": "Опанасенко Олексій Володимирович" }, "location_reference": { "identifier": { "type": { "coding": [ { "system": "eHealth/resources", "code": "division" } ] }, "value": "c5a6d991-0bf7-476f-b3cf-bec83f044b2a" }, "display_value": "null" }, "performer_type": { "coding": [ { "system": "SPECIALITY_TYPE", "code": "DIETETICS" } ] } }, "meta": { "code": 201, "url": "http://example.com/resource", "type": "object", "request_id": "req-adasdoijasdojsda" } }
{ "data": { "status": "pending", "eta": "2018-08-02T10:45:16.000Z", "links": [ { "entity": "job", "href": "/Jobs/NBXk9EyErUZv1RhXgyvgg" } ] }, "meta": { "code": 202, "url": "http://example.com/resource", "type": "object", "request_id": "req-adasdoijasdojsda" } }

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

 

201

Use payload from response

sync

 

3

 

202

Use Get job details to get processing result. Response payload will be returned in the job details

async: default method

 

4

 

403

iInvalid scopes

 

 

5

 

404

Not found

 

 

6

 

409

Action is not allowed for the legal entity

 

 

7

 

409

You can not resend SMS for service request in status %status%

 

 

8

 

409

You can not resend SMS for service request in program processing status %program_processing_status%

 

 

9

Специфічні

10

 

 

 

 

 

Post-processing processes

N/A

Technical modules where the method is used

List of pages describing technical modules where the method is used

 

ЕСОЗ - публічна документація