kobotoolbox / kpi

kpi is the (frontend) server for KoboToolbox. It includes an API for users to access data and manage their forms, question library, sharing settings, create reports, and export data.
https://www.kobotoolbox.org
GNU Affero General Public License v3.0
131 stars 177 forks source link

Move autonaming away from the form builder #3454

Open dorey opened 3 years ago

dorey commented 3 years ago

Description

Currently, autonaming of questions with no given "name" takes place in 2 places with different behavior.

In the project, names have been essential at 3 steps:

  1. When the form is deployed
  2. When a question is referenced in skip logic by another question (either in the form builder or in an XLSForm)
  3. Before a form is exported to XLSForm

After some consideration, it turns out only 1. above is absolutely essential.

The best place to do this essential autonaming would be on the back end.

Therefore, to avoid maintaining duplicate modules in coffeescript and python, I suggest we replace the autonaming with a simple function that assigns a unique string ($kuid) to the row, for purposes of skip logic, and then filter out those values on the back end, and replace with python-generated "autoname" values.

This approach will avoid touching the fragile skip logic / validation code.

There is no timeframe for this, but we can reference this issue when we run into autoname issues in the form builder in the future.

jnm commented 1 year ago

See also #623, https://www.notion.so/kobotoolbox/Improve-automatic-naming-of-question-names-and-response-values-23dda1dccaf94021a1ca81ac3fe24c16