Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Logic

  1. if tax_id is not null and age>=16
    1. search via tax_id + first_name + last_name
  2. if tax_id is null and age>=16search via first_name + last_name + birth_date
  3. if age<16
    1. search via birth_certificatebirth_date

Calculate age

Code Block
age = MONTHS_BETWEEN (now(), $.birth_date) / 12


Search existing MPI entity

Search for existing entity using GET query parameters:

...

MPI attribute

...

Pre-condition

...

Condition

...

POST data attribute

...

always if $.person_age < 16

...

only active persons - MPI.persons.is_active=true

  1. if tax_id is not null and age>=14
    1. search fields: tax_id, birth_date
    2. additional fields: second_name, phone_number
  2. if tax_id is null and age>=14
    1. search fields: first_name, last_name, birth_date
    2. additional fields: tax_id, second_name, phone_number
  3. if age<14
    1. search fields: birth_certificate, birth_date
    2. additional fields:  first_name, last_name, second_name

Return empty array if no data found

Return only requested params,

...

id, first_

...

name, second_name, last_name, birth_place and merged_ids if data found


For example:

Code Block
languagexml
titleRequest
collapsetrue
http://ehealth.nebo15edenlabllc.com/api/persons?first_name=%D0%9F%D0%B5%D1%82%D1%80%D0%BE&last_name=%D0%86%D0%B2%D0%B0%D0%BD%D0%BE%D0%B2&birth_date=1991-08-19T00%3A00%3A00.000Z

...

Code Block
languagexml
titleResponse
collapsetrue
{
   "id":"b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
   "first_name":"Петро",
   "last_name":"Іванов",
   "second_name":"Миколайович",
   "birth_date":"1991-08-19T00:00:00.000Z19",
   "birth_country":"Україна",
   "birth_settlement":"Вінниця",
   "merged_ids":[
         "id":"7bca069f-21e4-4546-90cf-b65e3f39d93d"
   ]
}

...