Trouble Downloading Repeat Data Using pyODK

1. What is the issue? Please be detailed.

I am using pyODK API to download all submissions from the household registration form [ODK Central Server]. My goal is to join the main form submission with the repeat data (member_details) using pandas. This combined data will be used for follow-up forms, and I want to push the joined data as a CSV to other follow-up forms on the same project as media file.

However, I am having trouble downloading the repeat (member_details) data. I have read the pyODK documentation on working with repeats, but I still can't figure out what is wrong.

2. What have you tried to fix the issue?

I have successfully downloaded the main submission data from the household registration form using the following code:

main_form = client.submissions.get_table(form_id="new_household_registrationv2", project_id=1)
main_form_df = pd.json_normalize(main_form['value'], sep='/')

This works perfectly and converts the data to a Jupyter DataFrame.

However, the issue arises when I try to download the repeat table data (member_details). I use the following code:

member_details = client.submissions.get_table(form_id="new_household_registrationv2", project_id=1, table_name="Submissions.member_details")

I have double-checked the name of the repeat group, and it matches what I am using in the code. Despite this, I still can't figure out what I am doing wrong.

Hello @Joseph_Muganga, Since you haven't uploaded the ODK form, one thing I can ask you to check is if you have the repeat group in another group. e.g., if you have a group called "households" and inside this group you have the repeat "member_details", then you can access this group in this way: "Submissions.households.member_details"
I have something similar to this, and this is how I access my repeat groups.
I hope this works!

2 Likes

Hi Chimwemwe,

Thank you for your quick reply. It works! It is funny how small things can have a big impact.

Thanks again!

2 Likes