Versions Compared

Key

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

Table of Contents

...

The file is saving to database (il.registers) and based on it it 

  • Person
    • if the person was matched, declaration will be terminated and this id will have status "

...

    • MATCHED".
    • If the person wasn't matched the status will be "NOT_FOUND".
  • Declaration
    • if declaration was not found, the status of declaration_id will be "NOT_FOUND".
    • if declaration was found

...

    • in status=TERMINATED, declaration will not be terminated and this id will have status "PROCESSED"
    • if declaration was found in status<>TERMINATED, declaration will be terminated and status of declaration_id will be "MATCHED"
    • if unexpected error happened declaration_id will be in status "ERROR" 

Register file statuses

  1. If the file was processed with errors in lines or without it will be in status "PROCESSED"
  2. If the file could nor be parsed as it is not correct it will be in status "INVALID"
  3. If the file was just add - it will be in status "NEW"

File structure

  1. Death registration

  2. Termination by declaration_id

At least one of fields must be filled. Also choose the type of register (drop down list - dictionary: name='REGISTER_TYPE', type='death_registration,fraud'). 

Validation

Validate file

  1. In case file in not a csv file 
    1. set status INVALID and stop processing the file

In case file structure = Death registration of patients

  1. Validate that document $type one of from dictionary (name='DOCUMENT_TYPE'). If type is not as in dictionary show the row in the errors field. 

...

  1. Validate headers – should be type,number
    1. in case headers are different return error 422, msg 'Incorrect headers in file' 
  2. Validate that $type exists in dictionary (name='REGISTER_TYPE').
    1. In case error show the 422 error "value is not allowed in enum"
  3. Validate declaration_id
    1. in case declaration_id was not find in ops.declarations.id
      1. show the row with not found ID with status "not_found"
    2. in case $declaration_id.status <> active
      1. show the row with not found ID with status "processed"
    3. in case $declaration_id can not be deactivated
      1. show the row with declaration ID with status "error"
  4. In case technical error happened, but declaration found
    1. show the row with not found ID with status "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)
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'

...

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 

Backward compatibility

 is not possible for this kind of termination. In case the wrong declaration was terminated, the patient must sign the new one.

...