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

(GraphQL, NHS) Search for Person (v2)

Purpose

This method allows to search for a Person (MPI).

Specification

Link

-

Посилання на Apiary або Swagger

Resource

/graphql

Посилання на ресурс, наприклад: /api/persons/create

Scope

person:read

Scope для доступу

Components

Patient registry

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

mpi/api

il/api (rpc)

fe/admin-web

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

GraphQL

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

POST

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

Sync

Метод є синхронним чи асинхронним?

Public/Private/Internal

Private

Потрібно зазначити тип методу за ступенем доступності

Logic

This is a graphQl query method used in Administration panel only to search for a Person . Only authenticated and authorized NHS employee with appropriate scope can search for a persons. User can filter list by search params.

Request structure

Example:

{"query":"query SearchPersonsQuery($first: Int $last: Int $before: String $after: String $filter: PersonFilter! $orderBy: PersonOrderBy) {persons(first: $first filter: $filter orderBy: $orderBy before: $before after: $after last: $last) {nodes {...Persons __typename } pageInfo {...PageInfo __typename} __typename}} fragment Persons on Person {id databaseId firstName lastName secondName birthDate unzr taxId insertedAt status updatedAt verificationStatus verificationDetails {dracsDeath { unverifiedAt verificationReason verificationStatus __typename } drfo { verificationReason verificationStatus __typename } manualRules { verificationReason verificationStatus __typename } __typename }} fragment PageInfo on PageInfo { endCursor hasNextPage hasPreviousPage startCursor __typename } ", "variables":{ "first":10, "filter":{ "identity":{ "lastName":"Сироїд", "firstName":"Павло" }, "personal":{ "authenticationMethod":{ "phoneNumber":"+380941455543" } } } } }

Authorize

Request to process the request using a token in the headers

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Verify that token is not expired

    1. in case of error - return (401, 'Invalid access token')

  3. Check user scopes

    1. person:read in order to search person

      1. Return 403 in case invalid scope(s) "Your scope does not allow to access this resource. Missing allowances: person:read

Request data validation

Validate legal entity

  • Extract client_id from token.

  • Check legal entity status (status = ACTIVE)

    • In case of error - return 409 ('client_id refers to legal entity that is not active')

Validate request

Validate query params

Parameters that could be sent to mpi from admin search:

  • tax_id

  • id

  • first_name + last_name + phone_number (phone number in authentification_method='OTP')

  • first_name + last_name + birth_date

  • document type & number + phone_number (phone number in authentification_method='OTP')

  • document type & number + birth_date

  • status (optional)

    • if no status sent return all statuses

Processing

Render persons array with results that match the search params. Return empty array if no data found

Response structure

Example:

{ "data": { "persons": { "__typename": "PersonConnection", "nodes": [ { "__typename": "Person", "birthDate": "1975-06-15", "databaseId": "9d1f3c8e-bec7-452a-8e9f-cab7e8dcae58", "firstName": "Павло", "id": "UGVyc29uOjlkMWYzYzhlLWJlYzctNDUyYS04ZTlmLWNhYjdlOGRjYWU1OA==", "insertedAt": "2021-03-13T19:44:28.426485Z", "lastName": "Сироїд", "secondName": "Пилипович", "status": "ACTIVE", "taxId": null, "unzr": null, "updatedAt": "2023-04-26T16:12:01.740166Z", "verificationDetails": { "__typename": "PersonVerificationDetail", "dracsDeath": { "__typename": "PersonDracsDeathVerification", "unverifiedAt": null, "verificationReason": "MANUAL_NOT_CONFIRMED", "verificationStatus": "VERIFIED" }, "drfo": { "__typename": "PersonDrfoVerification", "verificationReason": "ONLINE_TRIGGERED", "verificationStatus": "VERIFICATION_NEEDED" }, "manualRules": { "__typename": "PersonManualRulesVerification", "verificationReason": "RULES_PASSED", "verificationStatus": "VERIFIED" } }, "verificationStatus": "VERIFICATION_NEEDED" } ], "pageInfo": { "__typename": "PageInfo", "endCursor": "YXJyYXljb25uZWN0aW9uOjA=", "hasNextPage": false, "hasPreviousPage": false, "startCursor": "YXJyYXljb25uZWN0aW9uOjA=" } } }, "extensions": { "requestId": "f211af74-f3f9-40dc-baef-793532d4023a#18493" } }

HTTP status codes

HTTP status code

Message

What caused the error

HTTP status code

Message

What caused the error

200

 Response

 

401

Invalid access token

 Invalid token

403

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

Scope is missing

409

client_id refers to legal entity that is not active

Legal entity is not active

 

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