Versions Compared

Key

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

Table of Contents

Purpose

...

  1. Death registration

    • type (il.dictionary: name='PERSONS_DEACTIVATION_IDENTITIES')
    • number
    • death_date deathDate 
  2. Termination by declaration_id

  3. Reset authentication method

...

  1. Validate that $document.type 
    1. one of from dictionary (name='PERSONS_DEACTIVATION_IDENTITIES') or is MPI_ID. If type is not as in dictionary or not MPI_ID show the row in the errors field.
  2. Validate MPI_ID
    1.  in case MPI_ID is not UUID ("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$")
      1. show the row with not found MPI_ID with status "error"
    2. in case MPI_ID was not found in mpi.persons.id OR medical_data.patients
      1. show the row with MPI_ID with status "not_found"
    3. in case MPI_ID was found in mpi.persons, but could not be deactivated
      1. show row with MPI_ID with status "processed"
    4. in case MPI_ID wasn't found in mpi.persons, but was found in medical_data.patients (preperson was found)
      1. show row with MPI_ID with status "processed"
  3. Validate death_date Validate deathDate if exists
    1. in case death_date case deathDate <> valid date ()
      1. show the row with MPI_ID with status "date_error"
    2. in case death_date deathDate does not exist
      1. show the row with MPI_ID with status "date_error"
    3. in case death_date deathDate year < 1900
      1. show the row with MPI_ID with status "date_error"
    4. in case death_date deathDate < birth_date
      1. show the row with MPI_ID with status "date_error"

...

NameSourceDescription
id$batch_idid=batch_id from il.registers
file_name$file_namefile_name=file_name from il.registers
status[new, processing, processed ]

new - file was downloaded and not processed

processing - when processing entries>0

processed - when processing entries=0

type$typetype=type from il.dictionaries.name='REGISTER_TYPE'
qty

{not_found: number,

processing: number,

errors: number,

total: number}


errors["Row has length 4 - expected length 5 on line 5",
"Row has length 1 - expected length 5 on line 7"]

inserted_atuser_id
inserted_by:timestamp
updated_atuser_id
updated_by:timestamp


The data from file must be stored to il.register_entries. In case some rows had errors those entries will be shown in filed "errors" and won't be processed.

Name SourceDescription
id

register_id
the unique id for the batch upload
person_typeenum(employee,patient, preperson)
type$typedocument_type
number$numberdocument_number
status
  • processing
  • matched, not_found

inserted_atuser_idfrom token
inserted_by:timestamp
updated_atuser_id
updated_by:timestamp

After the file was processed the field "qty" from table il.registers must be updated.

...

If the person was matched then

  1. update declarations.status to `terminated`
  2. update persons.status='INACTIVE'
  3. change declarations.reason to $"auto_"||type
  4. update il.registers.status='matched'
  5. update mpi.persons.death_date = $death_date$deathDate

If the person was found, but declaration not in status "active" - il.registers.status='matched'

...

If declaration_id was matched

  1. update ops.declarations.status to `terminated`
  2. update ops.declaration.updated_at = now()
  3. update ops.declaration.updated_by = $user_id
  4. change declarations.reason to $"auto_"||type
  5. update il.registers.status='matched'
  6. involve Event Manager for changed status 

Reset authentication method

If the person was matched then

  1. update mpi.person_authentication_methods.type to `NA`
  2. update mpi.person_authentication_methods.phone_number to `null`
  3. update mpi.person_authentication_methods.updated_at to `now`
  4. update il.registers.status='matched'

...

  1. update medical_data.patients.status='inactive'

  2. update il.registers.status='matched'

  3. update medical_data.patients.death_date = $death_date$deathDate

If the person or preperson was not matched then

...