Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Purpose

This method allows to search for a Person (MPI) without disclosing personal data.

Specification

Page Properties
idAPI_Specification

Link

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/persons/search-for-a-person

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

Resource

/api/persons

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

Scope

person:read

Scope для доступу

Components

Patient registry

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

Microservices

API paragraph not found

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

Protocol type

REST

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

Request type

GET

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

Sync/Async

Sync

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

Public/Private/Internal

Public

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

Logic

API paragraph not found

Filters

See on Apiary

Request structure

API paragraph not found

Authorize

Request to process the request using a token in the headers

Headers

Наприклад:

Content-Type:application/json

Request data validation

When flag `USE_DEDUPLICATION_MODEL` is turn onturned ON, use this logic.

Validate request

    1. Validate mandatory query params

      1. first_name

      2. last_name

      3. birth_date

    2. Validate optional query params

      1. second_name

      2. tax_id

      3. birth_certificate

      4. phone_number (phone_number or auth_number)

Processing

Search existing MPI entity

Search only active persons - MPI.persons.is_active=true.

We are looking for such parameters:

  1. tax_id and phone_number

  2. tax_id and last_name(

...

  1. by MetaPhoneRu)

  2. birth_certificate and phone_number

  3. birth_certificate and last_name(

...

  1. by MetaPhoneRu)

  2. phone_number and last_name(

...

  1. by MetaPhoneRu)

  2. birth_date and last_name( by MetaPhoneRu)  and first_name(

...

  1. by MetaPhoneRu)

When search by phone use mpi.person_phones.number and mpi.person_auth_method.phone_number. If person has auth_method = third_person, don't search by third_person.auth_method.phone_number

After the search we get the clusters (maximum 6) and display them one by one - persons from the first cluster, then from the second, etc.

And within each cluster we sort:

  1. last_name_distance == 0

  2. last_name_distance + first_name_distance + tax_id_distance (Ascending)

Return empty array if no data found

Return only requested params (if equal tax_id, birth_certificate, birth_date, phone_number), last_name(if match by metaphone ) id, first_name, second_name, gender, birth_place and merged_persons if data found.

Response structure

Example:

Expand
titleResponse example. Code: 200
Code Block
{
  "meta": {
    "code": 200,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "6617aeec-15e2-4d6f-b9bd-53559c358f97#17810"
  },
  "data": [
    {
      "id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
      "first_name": "Петро",
      "last_name": "Іванов",
      "second_name": "Миколайович",
      "birth_date": "1991-08-19",
      "gender": "FEMALE",
      "tax_id": "3126509816",
      "phones": [
        {
          "type": "MOBILE",
          "number": "+380503410870"
        }
      ],
      "birth_settlement": "Вінниця",
      "birth_country": "Україна",
      "merged_persons": [
        {
          "id": "57e30ea3-16f1-4f8e-adcd-1a05e99e2d22",
          "inserted_at": "2019-05-08T15:34:00Z",
          "merge_person_id": "bdadc2a7-7283-4f24-bc99-8d8d9808af80",
          "person_id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
          "updated_at": "2019-05-08T15:34:00Z"
        }
      ]
    }
  ]
}
Expand
titleResponse example. Code: 403
Code Block
{
  "meta": {
    "code": 403,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "6617aeec-15e2-4d6f-b9bd-53559c358f97#17810"
  },
  "error": {
    "type": "too_many_results",
    "message": "This API method returns only exact match results, please retry with more specific search result"
  }
}

Post-processing processes

API paragraph not found

HTTP status codes

Page Properties
idAPI_HTTP status codes

HTTP status code

Message

What caused the error

 200

 Response

 

 403

 This API method returns only exact match results, please retry with more specific search result

 Too many results


Tests