...

  1. Extract client_id from token (token.client_id == legal_entity_id)

  2. Check legal entity status (status = ACTIVE, SUSPENDED)

    1. In case of error - return 409 (Legal entity must be ACTIVE or SUSPENDED)

Validate

...

ID

Check person_id ID exists and belongs to preperson

  1. Check ID exists in MPI.personsCheck there is no

    1. In case error - 404

  2. Check the entry in MPI.persons with this person_idID has flag preperson=true

    1. In case error - return 422 (Person_id doesn’t belong to preperson)

    Convert person_id into patient_id. Check patient_id exists in medical_data.patients collection

    1. In case error - 404

  3. Check preperson has status=active

    1. In case error - return 422 (Preperson is not active)

...

  1. Check external_id is not empty.

    1. In case of error - return 422 (external_id should not be empty)

Update object in DB

...

persons table

Parameter

Source

Description

external_id

Request: external_id

Identifier from external system, required. Get from request body. Required

updated_at

timestamp: now()

Get current date-time

updated_by

uuid

Extract user from token