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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

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

/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] Qualify Service request by ID [API-007-010-001-0316]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

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

Date of update

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

Method API ID

PI-007-010-001-0316

Microservices (namespace)

ME

Component

Service request

Component ID

COM-007-010

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

https://medicaleventsmisapi.docs.apiary.io/#reference/service-requests/manage-service-requests

Resource

{{host}}api/service_requests

Scope

service_request:read

Protocol type

REST

Request type

GET

Sync/Async

Sync

Public/Private

Public

Purpose

This method checks the possibility of using the direction according to the program.

Logic

https://e-health-ua.atlassian.net/wiki/x/CwPGIg

Configuration parameters

N/A

Dictionaries

N/A

Input parameters

Input parameter

Mandatory

Type

Description

Example

1

service_request_id

 

String

Unique service request identifier

aff00bf6-68bf-4b49-b66d-f031d48922b3

2

Request structure

See on API-specification

 Example
{
  "programs": [
    {
      "identifier": {
        "type": {
          "coding": [
            {
              "system": "eHealth/resources",
              "code": "medical_program"
            }
          ]
        },
        "value": "9183a36b-4d45-4244-9339-63d81cd08d9c"
      }
    }
  ]
}

Headers

Headers

Request data validation

Authorize

Request to process the request using a token in the headers

  • 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)Processing

    2. Validate request using JSON Schema

      Return 422 with the list of validation errors in case validation fails

Validate request

  1. legal entity(client_id)

    1. Check legal_entity.type in me_allowed_transactions_le_types config parameter and legal_entity.status = ACTIVE 

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

  2. service request

    1. validate SR.program_processing_status in (new,In Queue,In Progress)

      1. in case error return 409, “service request has wrong status“

    2. validate SR.status = Active

      1. in case error return 409, “service request has wrong status“

    3. If SR.based_on is present:

      1. Verify submitted Activity:

        1. It has scheduled, in_progress status

          1. in case of error return 409, "Invalid activity status")

        2. if quantity was set, then validate remaining_quantity greater then zero:

          1. in case of error return 409, "The number of available services according to the care plan activity has been exhausted"

      2. Verify Care plan:

        1. It should be in active status

          1. in case of error return 409, "Care plan is not active"

        2. Care plan's period end (if exist) should be greater than current date or equal.

          1. in case of error return 409, “Care plan expired“

    4. Validate remaining quantity of services is still available:

      1. If SR has quantity:

        1. Validate remaining_quantity within SR is greater then zero

          1. in case of error return 409 (The number of available services according to the service request has been exhausted)

      2. If SR has no quantity, but it is based on activity with quantity:

        1. Validate remaining_quantity within Activity is greater then zero

          1. in case of error return 409 (The number of available services according to the care plan activity has been exhausted)

  3. program

    1. For each program validate it is an existing service program with type=service

      1. in case not found or is_active==false write result in Data collection according to apiary

      2. in case type!= service write result in Data collection according to apiary - "Invalid program type"

    2. For each program validate that service(or service_group) is an active member of the program

      1. Select is_active from PRM.program_services where service_id(or group_id) == $.signed_content.code.identifier.value and program_id=$.program.identifier.value

        1. if not found or is_active==false write result in Data collection according to apiary - "Service is not included in the program"

Response structure examples

See on API-specification

 Example
{
  "meta": {
    "code": 200,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": [
    {
      "program_id": "59781de0-2e64-4359-b716-bcc05a32c10f",
      "program_name": "Fee-For-Service",
      "status": "INVALID",
      "rejection_reason": "Service is not included in the program"
    }
  ]
}

Prepare & return response data structure

  1. For each program in array prepare response

  2. If it is any or some errors from validations return “NOT VALID“ with error msg

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

401

invalid scopes

3

401

Unauthorized

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

4

409

Action is not allowed for the legal entit

5

409

Care plan is not active

6

409

Care plan expired

7

409

Invalid activity status

8

409

service request has wrong statu

9

409

The number of available services according to the service request has been exhausted

10

Специфічні

11

422

Only for active MPI record can be created medication request!

Post-processing processes

N/A

Technical modules where the method is used

List of pages describing technical modules where the method is used

  • No labels