Closed vinayvenu closed 5 months ago
There is a corresponding migration that has not been done as part of this card.
@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?
@mahalakshme some reports are expecting cancel datetime in the encounter table. We will be breaking the contract by removing the rows
@vinayvenu oh okay got it.
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