Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download submissions in a single CSV filr #909

Closed
wants to merge 9 commits into from

Conversation

nrjadkry
Copy link
Member

I have created an api endpoint which downloads all the submissions in a single csv file.

Endpoint: projects/{project_id}/download_csv/

This will download a zip file containing submissions csv and the media folder for all the medias uploaded in the form.

I have moved these scripts from scripts directory to the project directory and arranged them.

@nrjadkry nrjadkry temporarily deployed to test October 13, 2023 06:10 — with GitHub Actions Inactive
@github-actions github-actions bot added the backend Related to backend code label Oct 13, 2023
@pre-commit-ci pre-commit-ci bot temporarily deployed to test October 13, 2023 06:13 Inactive
@spwoodcock
Copy link
Member

Sorry for the lack of input here. Initially I didn't understand the requirements fully.

This sort of functionality for interacting with ODKCentral ideally belongs in osm-fieldwork, to be called from FMTM. I think Rob left a message saying this somewhere.

If you see an easy way to do that, then go ahead.

Otherwise, I will review fully next week and see what we can do 👍

@robsavoye
Copy link
Collaborator

I'm not really sure we want to use any of the code "as is" from the scripts directory. Any interaction with ODK Central should be in osm-fieldwork/OdkCentral.py, and the FMTM backend should just use that,

@robsavoye
Copy link
Collaborator

I don't think we need expand_geopoints(). This is already handled by osm-fieldwork/json2osm.py, which produces a GeoJson file. osm-fieldwork/CSVDump.py also does the same thing, but with the CSV file from Central. We should use existing code as much as possible to avoid duplication.

project_submissions_unzipped() should also be in osm-fieldwork, not project_crud.py. There is already support in osm-fieldwork for downloading all the data and media, which should be used instead.

@robsavoye
Copy link
Collaborator

The JSON format is preferred over the CSV format as the CSV format can loose the location data when using data extracts. The JSON format doesn't appear to have the same issue.

@nrjadkry
Copy link
Member Author

Thanks @robsavoye, @spwoodcock
I have received submissions from osm-fieldwork and processed them in FMTM.
You guys are right. We should have this in osm-fieldwork, since this can me made modular.
I will make a new PR in osm-fieldwork.

@robsavoye
Copy link
Collaborator

When you migrate this to osm-fieldwork, it can't be just a cut & paste thing. The code will need to be refactored to use functionality already in osm-fieldwork. Otherwise we wind up with code duplication.

@nrjadkry
Copy link
Member Author

nrjadkry commented Oct 18, 2023

Since we will be doing this osm-fieldwork, I am closing this Pull Request.

@nrjadkry nrjadkry closed this Oct 18, 2023
@spwoodcock spwoodcock deleted the downloadSubmissions branch November 29, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants