akvo / akvo-lumen

Make sense of your data
https://akvo.org/akvo-lumen
GNU Affero General Public License v3.0
63 stars 18 forks source link

Undo and update constraints related to delete-columns don't work #3108

Closed tangrammer closed 3 years ago

tangrammer commented 3 years ago

Context

When we rerun transformations (update & undo) then lumen checks transformation constraints In case of delete-column https://github.com/akvo/akvo-lumen/blob/master/backend/src/akvo/lumen/lib/transformation/delete_column.clj#L41-L45 we query the db looking for visualisations that contain this columnName to ensure data consistency.

Problem or idea

The problem is that every time we generate a new derived column, we take last id eg: d3 and then we increment it resulting in d4. 1- Let's image we do the following transformation sequence: derive, derive, delete-last-column-derived, derive, delete-last-column-derived, derive we end with following columns d1, d2, d3 but we have 6 transformations 2- Now we make a viz that uses column d2 3- try to update the dataset

internally lumen tries following: 1- grab raw flow data ........................... OK 2- apply derive transformtion => d1 ..... OK 3- apply derive transformtion => d2 .... OK 3- delete last derive transformtion => d2 .... NOK thus d2 is used in viz

Solution or next step

Improve way of ensuring data-consistency on delete-columns