Table of Contents |
---|
...
Death registration
- type (il.dictionary: name='PERSONS_DEACTIVATION_IDENTITIES')
- number
- deathDate death_date
- file example: person_example.csv
- file example with person_id: PERSON_D.csv
Termination by declaration_id
- declaration_id
- file example: declaration.csv
- declaration_id
Reset authentication method
- person_id
- file example: reset_auth.csv
- person_id
...
- Validate that $document.type
- 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.
- Validate MPI_ID
- 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}$")
- show the row with not found MPI_ID with status "error"
- in case MPI_ID was not found in mpi.persons.id OR medical_data.patients
- show the row with MPI_ID with status "not_found"
- in case MPI_ID was found in mpi.persons, but could not be deactivated
- show row with MPI_ID with status "processed"
- in case MPI_ID wasn't found in mpi.persons, but was found in medical_data.patients (preperson was found)
- show row with MPI_ID with status "processed"
- 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}$")
- Validate deathDate Validate death_date if exists
- in case deathDate case death_date <> valid date ()
- show the row with MPI_ID with status "date_error"
- in case deathDate death_date does not exist
- show the row with MPI_ID with status "date_error"
- in case deathDate death_date year < 1900
- show the row with MPI_ID with status "date_error"
- in case deathDate death_date < birth_date
- show the row with MPI_ID with status "date_error"
- in case deathDate case death_date <> valid date ()
...
3. Validate headers in file: type, number, deathDatedeath_date. In case of error show the 422 error 'Incorrect headers in file'
...
Name | Source | Description |
---|---|---|
id | $batch_id | id=batch_id from il.registers |
file_name | $file_name | file_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 | $type | type=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_at | user_id | |
inserted_by | :timestamp | |
updated_at | user_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 | Source | Description |
---|---|---|
id | ||
register_id | the unique id for the batch upload | |
person_type | enum(employee,patient, preperson) | |
type | $type | document_type |
number | $number | document_number |
status |
| |
inserted_at | user_id | from token |
inserted_by | :timestamp | |
updated_at | user_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
- update declarations.status to `terminated`
- update persons.status='INACTIVE'
- change declarations.reason to $"auto_"||type
- update il.registers.status='matched'
- update mpi.persons.death_date = $deathDate$death_date
If the person was found, but declaration not in status "active" - il.registers.status='matched'
...
If declaration_id was matched
- update ops.declarations.status to `terminated`
- update ops.declaration.updated_at = now()
- update ops.declaration.updated_by = $user_id
- change declarations.reason to $"auto_"||type
- update il.registers.status='matched'
- involve Event Manager for changed status
Reset authentication method
If the person was matched then
- update mpi.person_authentication_methods.type to `NA`
- update mpi.person_authentication_methods.phone_number to `null`
- update mpi.person_authentication_methods.updated_at to `now`
- update il.registers.status='matched'
...
If the person was found, but declaration doesn't exist - il.registers.status='matched'
...
matched
...
update medical_data.patients.status='inactive'
...
update il.registers.status='matched'
...
update medical_data.patients.death_date = $death_date
...
update medication requests related to preperson if status is NEW. Set status = 'REJECTED'.
...
update medication request request related to preperson if status is ACTIVE. Set status = 'REJECTED'.
...
'
...
servece request has ACTIVE status
service program status is empty or in (NEW, IN QUEUE)
If the person
...
was not matched then
- update il.registers.status='not_found'
...