Getting Data Out

Hi
Let me share how I would approach this. To me, this would be a prime use case for pyODK with Flask.
I would create Python Flask API end-points to get the request parameters.
Then i would call pyODK or the Central API using python requests function to get the relevant data for the requisite ProjectID and XMLFormID.
Depending on the use case, I will get one or multiple forms.

For attachments, Central API has end points to het a list of attachments associated with a form submission. I will loop over the list and get binary data associated with each attachment. I tried that yesterday with PostMan API client.

For data analysis, I will get all data ysing PyODK and convert to a Pandas dataframe and do data manipulation/filtration in the dataframe or run data analysis and store results. The ODK YouTube channel has a video on PyOdK with Pandas.

Then I will return the response as a HTML in Flask using render_template. Or use PyPDF to generate a PDF.

Granted all this requires getting hands dirty with python, basic HTML, basic CSS styling etc

I am planning on testing this out on one of my datasets this week. Will report back with sample code.

Best wishes
Vivek

2 Likes

I've finally been able to access images - I made a sort of proxy with PHP, that allowed me to pass the bearer token in the URL instead of the header. It's working great but isn't the tidyest of code, only works with JPEGs and doesn't manipulate the image in any way. Would love for someone to enhance it further.

My code/setup can be viewed here, hopefully it will help others.

Marked as solution because whilst it's still a lot of work to report with the API, I can at least use Jasper, PowerBI, Excel etc to embed images now and I don't believe there's a simpler option.

1 Like