avniproject / avni-etl

GNU Affero General Public License v3.0
0 stars 6 forks source link

Cancelled rows stay as zombies in the encounter* table #95

Closed vinayvenu closed 5 months ago

vinayvenu commented 6 months ago

When an encounter or program_encounter is cancelled, then the corresponding row in the etl's encounter* table is left as a zombie and never updated.

The cancel_date_time is mentioned in the encounter* tables, but anything with a cancel_date_time is never updated. For those querying the table, it feels as if there is a planned encounter that never got done, but it is actually cancelled, but the row was never updated in the table.

A side impact of this behaviour is that if a row was cancelled before the first run of ETL, then it will show up only on the _cancel table and not on the encounter table. This makes behaviour inconsistent.

Fix

vinayvenu commented 6 months ago

There is a corresponding migration that has not been done as part of this card.

mahalakshme commented 3 months ago

@vinayvenu we could have deleted the row in encounter table to keep it consistent instead of updating the cancel_date_time? Was there a reason we didn't do it that way?

vinayvenu commented 3 months ago

@mahalakshme some reports are expecting cancel datetime in the encounter table. We will be breaking the contract by removing the rows

mahalakshme commented 3 months ago

@vinayvenu oh okay got it.