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

[DRAFT] REST API Approve Person Request [API-010-001-005-0376]

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

 

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

[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-010-001-005-0376

Microservices (namespace)

MPI

Component

Master Patient Index

Component ID

COM-010-001

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

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/person-requests/approve-person-request

Resource

{{host}}/api/person_requests/{{id}}/actions/approve

Scope

person_request:write

Protocol type

REST

Request type

PATCH

Sync/Async

Sync

Public/Private

Public

Purpose

Use this method to approve previously created Person Request.

Key features

  1. Only authenticated and authorized user can use this service

  2. Only NEW person request can be activated

  3. The request can be activated only by the employee who works in the same legal entity in which the request was made.

Logic

94f7c8b0-7b45-47f8-a0e2-67e29e7b9f50.png

Preconditions

Person request must be created.

Configuration parameters

Description of the configuration parameters that are used when processing a request in the system

Dictionaries

  • GENDER

  • DOCUMENT_TYPE

  • ADDRESS_TYPE

  • COUNTRY

  • SETTLEMENT_TYPE

  • STREET_TYPE

  • PHONE_TYPE

  • CONFIDANT_PERSON_TYPE

  • PREFERRED_WAY_COMMUNICATION

  • DOCUMENT_RELATIONSHIP_TYPE

Provides a list of links to dictionaries that are available in Confluence

Input parameters

Input parameter

Mandatory

Type

Description

Example

Input parameter

Mandatory

Type

Description

Example

1

id

 

String

Required

eeebb86d-5cba-43c9-885b-6482ecaf826b

2

 

 

 

 

 

Request structure

See on API-specification

{ "verification_code": 6598 }

Headers

Key

Value

Mandatory

Description

Example

Key

Value

Mandatory

Description

Example

1

Content-Type

application/json

 

Тип контенту

Content-Type:application/json

2

Authorization

Bearer {token}

 

Перевірка користувача

Authorization:Bearer {token}

3

api-key

{secret}

 

Секретний ключ

api-key: {secret}

Request data validation

  1. Validate request using JSON schema

    1. In case validation failed - generate 422 error

JSON Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "verification_code": { "type": "string" } }, "required": [ "verification_code" ], "additionalProperties": false }

Processing

Get person request details

Get person request from IL_DB.person_request

Determine authorization method

Get authorization_method from IL_DB.person_request

SELECT IL_DB.person_request.authentication_method FROM IL_DB.person_request WHERE IL_DB.person_request.id = :id

 If authentication_method is NA - return error

If person have block confidant_person - check uploaded the confidant person's document and the document which confirms the guardianship.

If person's authentication_method == OFFLINE - check uploaded documents

If authentication_method = OTP (or THIRD_PERSON.auth_method = OTP)  - verify SMS code and add phone to db.verification.verified_phones

If authentication_method =  THIRD_PERSON and third_person.auth_method = OFFLINE - check uploaded documents from third person

Invoke verification module to verify OTP

OTP Verification

Check uploaded documents

Invoke Media Content Storage to check documents exist

Media Content Storage

Generate printout form

Invoke MAN to render print form.

Request mapping:

Parameter

Source

Parameter

Source

Parameter

Source

Parameter

Source

id

PERSON REQUEST

 cURL example

curl --request POST \ --header 'Accept: text/html' \ --header 'Content-Type: application/json' \ {:host}/templates/{:person_request_printout_id}/actions/render

 Set IL.person_request.printout_content:

MANResponse.$.data

Change person request

  1. Change entity status in IL_DB.person_request to APPROVED

  2. Set updated_at - now() (Get current date-time)

  3. Set updated_by - user_id (Extract user from token)

Response structure examples

See on API-specification

{ "meta": { "code": 201, "url": "https://example.com/resource", "type": "object", "request_id": "req-adasdoijasdojsda" }, "data": { "status": "SIGNED", "id": "eeebb86d-5cba-43c9-885b-6482ecaf826b", "person": { "id": "13001c60-45a0-4b5a-b425-9505e1de18bd", "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "birth_date": "2009-07-05", "birth_country": "Україна", "birth_settlement": "Вінниця", "gender": "MALE", "email": "email@example.com", "no_tax_id": false, "tax_id": "3999869394", "secret": "secret", "documents": [ { "type": "BIRTH_CERTIFICATE", "number": "АА120518", "issued_by": "Рокитнянським РВ ГУ МВС Київської області", "issued_at": "2017-02-28", "expiration_date": "2027-02-28" } ], "addresses": [ { "type": "RESIDENCE", "country": "UA", "area": "Житомирська", "region": "Бердичівський", "settlement": "Київ", "settlement_type": "CITY", "settlement_id": "b075f148", "street_type": "STREET", "street": "вул. Ніжинська", "building": "15", "apartment": "23", "zip": "02090" } ], "phones": [ { "type": "MOBILE", "number": "+380503410870" } ], "authentication_methods": [ { "type": "THIRD_PERSON", "phone_number": "+380508887700", "value": "c282f8a9-e709-40aa-94b4-dde1402bf4b6", "alias": "husband" } ], "unzr": "20090705-00011", "emergency_contact": { "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "phones": [ { "type": "MOBILE", "number": "+380503410870" } ] }, "confidant_person": [ { "relation_type": "PRIMARY", "first_name": "Петро", "last_name": "Іванов", "second_name": "Миколайович", "birth_date": "1972-10-26", "birth_country": "Україна", "birth_settlement": "Вінниця", "gender": "MALE", "tax_id": "2659719350", "secret": "secret", "unzr": "19900101-00099", "preferred_way_communication": "email", "documents_person": [ { "type": "PASSPORT", "number": "АА120518", "expiration_date": "2021-02-28", "issued_by": "Рокитнянським РВ ГУ МВС Київської області", "issued_at": "2017-02-28" } ], "documents_relationship": [ { "type": "BIRTH_CERTIFICATE", "number": "АА120518", "issued_by": "Рокитнянським РВ ГУ МВС Київської області", "issued_at": "2017-02-28" } ], "phones": [ { "type": "MOBILE", "number": "+380503410870" } ], "email": "emaill@example.com" } ], "preferred_way_communication": "email" }, "patient_signed": false, "process_disclosure_data_consent": true, "content": "Person content", "channel": "MIS", "authorize_with": "cc949559-5dfe-420f-ac05-065e443b2cc6" } }

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

 

201

Response

 

 

3

 

401

 

 

 

4

 

403

Invalid scope

 

 

5

 

422

Invalid verification code

 

 

6

Специфічні

7

 

422

Only for active MPI record can be created medication request!

 

 

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

 

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