Extract data from ODK server using python

How to extract data (Submissions) from ODK central Server using python for analysis

1 Like

Hi Chamisa,

I am probably not the best expert to chime in on this but just so you have a way to get started - you could export your results as a zip of csvs and read them into a python session

https://docs.getodk.org/central-submissions/#downloading-submissions-as-csvs

Reading in csv sets is easy with python's Pandas library https://stackoverflow.com/questions/26942476/reading-csv-zipped-files-in-python

If you want to take a faster approach, you might be able to get into the database directly using an adapter like psycopg2 and the database credentials you set up initially, but it depends on what you are trying to do.

It is best to use the API, here you can find a nice Python example:

1 Like

Hello @keynes That is the method I am currently using, but what I am looking for is a script that will collect data from the server without having to go there and download it manually.

Using the resources and ideas from our community above, and the live examples from the API documentation, you should be able to write exactly that.

If you have a write up of your use case and some working code, feel free to share here in the Showcase section.

Hello @husensofteng1 Thank you very much for the link. This is the useful information and I feel like I am almost there while finalizing my code

3 Likes