I have a Kobo form called Structural Quality Checklist that records the infrastructure quality of education centres. Originally, we created it to assess one classroom, but recently adapted it to collect multiple classrooms using a repeat group.
I understand it’s possible to edit submissions manually, one by one, in the Enketo editor but this isn’t possible because of the high number of existing submissions. We have over 100 submissions that we’d like to shift the data from old variables to new variables. The variables are named the same (e.g. item_2, item_3) but are recorded as different variables when we pull the data out using an API because they sit in different groups. I.e., their xform paths have changed.
We would like to edit the old data so it is treated as if it was collected in the first repeat group. This is so that we can treat the old and new data the same in our Azure Synapse data pipeline.
Could you tell me the best way we could perform this kind of bulk edit?
Example old field: centre_open/classroom_checklist/ classroom_access/class_clean
Example new field: centre_open/classroom_checklist/class_repeat/classroom_access/class_clean
Not exactly. We’re looking to perform a bulk edit that moves data from outside a repeat group to the same fields within a repeat group. Whether we do this through an API or some other way is want we’d like advice on. Thanks!
@bop, It seems like you are trying to move the content from a variable that is outside the repeat group into the repeat group. Did you mean that you want to transfer the value from a single variable outside the repeat group to a variable inside the repeat group?
If that is your requirement, it may not work as expected. A single variable outside the repeat group would not carry the structure of a repeat group, since the repeat group can contain multiple iterations. As a result, each instance within the repeat group would end up having the same value from that single variable.
You might be able to accomplish something here, to avoid the tedious task of manually editing and re-entering every one, by:
download all the submissions from your original project as XML (via the API)
insert the desired new repeat group element name class_repeat into the submission XML of each submission, as you’ve outlined above. You should be able to write a simple XSLT script that will do this. It is just as transformation of an XML document, so the XSLT needed shouldn’t be too complex (perhaps even an AI can take a stab at writing it for you?)
then upload all the modified submissions back into your new Kobo project using a bulk upload.
Caveat: cant say I’ve done this particular transform in XSLT myself, yet, so I’m keen to hear how it goes.