Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
REST API method / Метод REST API (настанова) (
Info
Info

/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)

...

Page Properties
idpage_properties_method_REST API
https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/manage-client-configuration/get-client-detailsRequest type

Document type

Метод REST API

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

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

Date of update

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

Method API ID

API-005-002-002-0044

Microservices (namespace)

MPIIL

Component

AuthContracts

Component ID

COM-001005-001002

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

Resource

{{host}}//api.ehealth.gov.ua/api/patients/id/encounter_package

Scope

Protocol type

/contract_requests/{{id}}/actions/assign

Scope

contract_request:update

Protocol type

REST

Request type

PATCH

Sync/Async

Sync

Public/Private

Purpose

Describe the purpose of the API method, add Key points (if necessary)

Logic

...

Private

Purpose

This WS is designed to appoints an executor (employee), who should Update Contract Request from NHS side.

Logic

This WS is designed for NHS employees. Before rewieving contract request it must be assign to NHS employee who will be responsible for this request. To assign employee contract it must be in status NEW, IN_PROCESS. After assigner was updated, contract request status will be changed to IN_PROCESS.
This query is also use to update existing assigner in Contract request.

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

Description of input parameters

Input parameter

Mandatory

Type

Description

Example

1

composition_id

 M 

String ($uuid) (path)

Composition object ID

 89678f60-4cdc-4fe3-ae83-e8b3ebd35c59

Contract request identifier. Required

d290f1ee-6c54-4b01-90e6-d701748f0851

2

Request structure

See on API-specification (посилання на сторінку з API-специфікацією)

Description of the REST API request structure, example

Expand
titleExample
Code Block
{
	"query": "mutation AssignContractRequestMutation($input: AssignContractRequestInput!) {contractRequest: assignContractRequest(input: $input) {contractRequest {id __typename}__typename}}",
	"variables": {
		"input": {
			"employeeId": "RW1wbG95ZWU6NTE4YmEwYmEtNGYyMC00YjU0LWJhMDYtZTQzYmMxZjM3OWNl",
			"id": "Q2FwaXRhdGlvbkNvbnRyYWN0UmVxdWVzdDo4ODIxYzdhYi04ODg3LTRmYjItOGRiZC02ZThmZmQxOGJlYzU="
		}
	}
}

Headers

Key

Value

Mandatory

Description

Example

1

Content-Type

application/json

M

Тип контенту

Content-Type:application/json

2

Authorization

Bearer c2778f3064753ea70de870a53795f5c9

M

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

Authorization:Bearer c2778f3064753ea70de870a53795f5c9c2778f3064753ea70de870a53795f5c99

3

Request data validation

Describe the process of checking the input data transmitted in the request for compliance with the given rules and restrictions set in the API

Processing

...

Validate user

extract user_id from token

extract client_id from token

  1. Check if user is active

    1. in case error return “User is not active”

  2. check nhs_legal_entity is active

    1. in case error return “Client is not active”

  3. Check user role = "NHS ADMIN SIGNER"

    1. in case error return "You don't have permission to access this resource"

Validate contract request id and status

  1. Validate contract request ID exist

    1. in case of error return “Contract Request not found”

  2. Check contract_request.status in ('NEW', 'IN_PROCESS')

    1. in case error return “Incorrect status of contract_request to modify it"

Validate request

  1. Fetch prm.employees by $employee_id. Validate:

    1. employees.legal_entity_id=$client_id

      1. in case of error return “Invalid legal entity id”

    2. employees.status=APPROVED

      1. in case of error return “Invalid employee status”

    3. check employee.party→ party_users→ users_roles→ roles exist role with name = 'NHS ADMIN SIGNER'

      1. in case of error return “Employee doesn't have required role”

Processing

  1. Update contract_requests.assignee_id (IL) - set $employee_id from request

  2. Update contract_requests.status to ‘IN_PROCESS’

  3. Update updated_at = now()

  4. Update updated_by = $user_id

Response structure examples

Description of the REST API response structure, example

Examples:

Expand
titleResponse example (success)
Code Block
{
  "data": {
    "contractRequest": {
      "__typename": "AssignContractRequestPayload",
      "contractRequest": {
        "__typename": "CapitationContractRequest",
        "id": "Q2FwaXRhdGlvbkNvbnRyYWN0UmVxdWVzdDo4ODIxYzdhYi04ODg3LTRmYjItOGRiZC02ZThmZmQxOGJlYzU"
      }
    }
  },
  "extensions": {
    "requestId": "80032d98-3441-4169-b245-acbd35eb5335#13"
  }
}
Expand
titleResponse example (error)
Code Block
Expand
titleExample
Code Block
{
    "data": {
        "contractRequest": null
    },
    "errors": [
        {
            "extensions": {
                "code": "FORBIDDEN"
            },
            "locations": [
                {
                    "column": 78,
                    "line": 1
                }
            ],
            "message": "Employee doesn't have required role",
            "path": [
                "contractRequest"
            ]
        }
    ],
    "extensions": {
        "requestId": "931c0790-ddfe-45e5-960a-eb6ba9f24e19#41"
    }
}
Expand
titleResponse example (authorization error)
Code Block
{
    "error": {
        "message": "Invalid access token",
        "type": "access_denied"
    },
    "meta": {
        "code": 401,
        "url": "http://api.dev.edenlab.com.ua:8000/graphql",
        "request_id": "931c0790-ddfe-45e5-960a-eb6ba9f24e19#65",
        "type": "object"
    }
}

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

200

 Response

 

3

401

Access denied

Invalid token

4

401

Unauthorized

Помилка підтвердження

5

403

Your scope does not allow to access this resource. Missing allowances: {{scope}}

Scope is missing

6

1000

404

Composition not found

COMPOSITION_NOT_FOUND_404

Не знайдено медичний висновок

3

401

Unauthorized

Помилка підтвердження

47

Специфічні

58

422

Only for active MPI record can be created medication request!

Post-processing processes

...

Add status to event manager

After status was changed (status = IN_PROCESS) - add new record to event_manager

field

value

event_type

StatusChangeEvent

entity_type

ReimbursementContractRequest

CapitationContractRequest

entity_id

$.id

properties.status.new_value

$.status

event_time

$.updated_at

changed_by

$.updated_by

Technical modules where the method is used

List of pages describing technical modules where the method is used

Page Properties Report
headingsID ТМ, Статус
cqllabel = "tr-mis"

...