Generating a unique ID for each household member entered in the survey

Hello everyone,

I am quite new to ODK and would really appreciate the help of ODK experts :slight_smile:

1. What is the problem? Be very detailed.

I am designing a household level survey. The survey first asks the name of the individuals living in the same household. It then has a number of repeat functions that ask details (such as age, gender etc) for each household member. When I export the data collected I get one csv for each repeat function. Thus, I would like to have a unique ID for each household member in order to match members through the different csv files. At the moment I have a unique id for each household but not for each member of the household

2. What app or server are you using and on what device and operating system? Include version numbers.

I am using excel to write the xlsform. And I have ODK collect v1.28.2

3. What you have you tried to fix the problem?
I have tried generating an ID at the beginning of each repeat function using the calculation function. However, this creates different IDs for the same individuals in different csv. This does not allow for matching.

4. What steps can we take to reproduce the problem?
I have attached a snippet of my xls form for reference
ODK_snippet_unique_ID.xlsx (24.1 KB)

Thank you so much for your help in advance!
Have a good day

Olimpia

Assuming you're collecting the names and then asking the details in the same order per household member: I think if you generate the ID for them while you're creating the "register" of people in the household (function_repeat_number_people) you'll then be able to grab it in the same way you grab their names for hh_rname_q4.

An alternative which would mean you wouldn't need an ID to link them together is to use one repeat for the household members. The enumerator could still follow the same flow of getting everyone's names up front but then use the :heavy_plus_sign: button (assuming you're using Collect) to add the next person and then navigate between household members using the hierarchy menu (:arrow_lower_right: button). This is maybe a little clunkier but can be more versatile as you don't need to question members in exactly the same order.

1 Like

The CSV files normally contain IDs already which you can use to reconnect the data. Normally I think its the last columns. If you look at the automatically created columns you should find some IDs that map between the CSV files.

If you want to generate IDs in real time on the mobile device, then that is more complicated but just for the data analysis afterwards there should be no need for extra fields.

Just to add that you have GPS is required but with no relevancy. This causes two big problems in that there is then no way to get consent from a person before collecting the GPS location of their home and if the GPS fails which it often does, its impossible to finish the form. Will avoid lots of problems if you adjust the logic around that question.

1 Like

Hi @seadowg and @noel_cartong,

Thank you very much for your replies and your suggestions. I have now managed to fix the problem. I am just going to write my approach to it in case people in the future face the same challenge :slight_smile:

I have generated the ID for each individual when creating the register of people as @seadowg suggested. I have considered using one repeat for the household member but that would change the scope of our survey and does not work in our case. And regarding the already generated ID at the end of the csv file, this will allow me to match households but not the individuals within the households.

Anyway, thank you very much for all your suggestions, it was all really useful

Best,

Olimpia

3 Likes

Hello, can you please share your form with us how you solved your problem?