ODK central data management for revising questions on the form

I have a database on odk central where the mobile data collected on odk collect is stored. When the odk form is updated or new questions are added, the previous data moved to a new colulmn and the database holds only the recently collected data with the new form. Is there a way to manage this and have all the records in the same column and make the newly added questions empty for the previous records?

I appreciate for your responses ahead!
Thanks

If a field is removed, it will not be included in exports by default. You can ask for all fields that were ever referenced in previous Form versions when you export data. Renaming a field is the same as removing a field and then adding a new one.

You can also put a relevance of false() on the field so that it's still included by default in data exports but no longer shown to data collectors.

Source: https://docs.getodk.org/central-forms/#central-forms-updates

Dear Anokwa,
Thanks for the prompt answer. The issue I faced was that when I add a question on the xlsform and data entered on the new form the odk central database makes blank for all the existing variables and repeat the variables to the right with the new questions and show the data.

It sounds like you may be connecting other programming directly to the ODK database. As you've found out, this can be problematic as soon as you have multiple versions of your forms. You may want to consider adding a 2nd database where you can fully control the structure. Then, you can sync the data into your database using events, triggers, or the ODK api.

1 Like

Hi @Tewodrosw

What causes such a scenario:

This majorly occurs when we update the form structure / definition in a way that the variable associated with some label / question is changed. For example, let's say I have a text field capturing "Participant Name" for some form, so it would appear as following in the form definition:

type name label
text par_name Enter Participant Name:

And, let's say later I ended up updating the form definition for the same form assigning new variable to the "Participant Name":

type name label
text par_name1 Enter Participant Name:

Now, when I download the data for the submissions for this form, that would appear this way:

par_name par_name1 Remark
ABCD <- Submission made with a newer updated version of the form.
EFGH <- Submission made with a newer updated version of the form.
IJKL <- Submission made with an older version of the form.
MNOP <- Submission made with an older version of the form.

Best measures to handle the same:

  1. Being careful and sustaining the variable names when updating the form definition / structure can potentially avoid such a scenario.
  2. If not avoided, then the next best course of action to deal with it is when we clean the data for usage. This must be handled during the cleaning process, be it using power query, python, R, etc.

Hope it helps! :smile:

1 Like

May be another suggestion is to retain the par_name and changing it from type to calculate, you may then put the calculate as ${par_name1}.

This will copy the value of par_name1 to par_name in the newer form definition. Doing so, will actually consolidate the values in par_name field.

This trick shall work for text to calculate type only.

1 Like