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

[DRAFT] Get Service requests by search params [API-007-010-001-0309]

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-007-010-001-0309

Microservices (namespace)

ME

Component

Service request

Component ID

COM-007-010

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

https://medicaleventsmisapi.docs.apiary.io/#reference/service-requests/manage-service-requests-in-patient-context/get-service-requests-by-search-params

Resource

{{host}}/api/patients/{{patient_id}}/service_requests

Scope

service_request:read

Protocol type

REST

Request type

GET

Sync/Async

Sync

Public/Private

Public

Purpose

Service returns all Service requests related to the person filtered by submitted parameters.

Logic

Description of the working algorithm of the API method and the interaction of services with each other add Service logic (if necessary)

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

Input parameter

Mandatory

Type

Description

Example

Input parameter

Mandatory

Type

Description

Example

1

 

 

 

 

 

2

 

 

 

 

 

Request structure

See on Apiary

See on API-specification

Headers

Key

Value

Mandatory

Description

Example

Key

Value

Mandatory

Description

Example

1

Content-Type

application/json

M

Тип контенту

Content-Type:application/json

2

Authorization

Bearer {{access_token}}

 

 

Authorization:Bearer {{access_token}}

3

API-key

{{secret}}

 

 

API-key:{{secret}}

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:read')

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

Request to process the request using a token in the headers

Processing

  1. Get all Service requests by person_id from service_request (MongoDB)

  2. Validate data consistency:

    • Ensure that requested Service requests have ABAC context

      • Return 403 ('Access denied') in case of error

  3. Filter list above by submitted search parameters

  4. Render a response according to specification with found Service requests entities.

Response structure examples

See on Apiary

See on API-specification

{ "meta": { "code": 200, "url": "http://example.com/resource", "type": "object", "request_id": "req-adasdoijasdojsda" }, "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" } ] } } ], "paging": { "page": 2, "page_size": 50, "total_entries": 1000, "total_pages": 20 } }
{ "meta": { "code": 404, "url": "http://example.com/resource", "type": "object", "request_id": "req-adasdoijasdojsda" }, "error": { "type": "NOT_FOUND", "message": "Patient not found" } }

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

 

200

 

 

 

3

 

401

 

Unauthorized

 

4

 

403

Access denied

 

 

5

 

403

 

Invalid scopes

 

6

 

404

 

Episode or patient not found

 

7

Специфічні

8

 

 

 

 

 

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

 

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