Since our data got larger, CSV export function got slower to process, triggering HTTP timeout. We added a quick solution by uploading CSV dump to AWS, and downloading that dump when the user clicks on the "Results CSV" button. There are 2 obvious issue with that hack,
the CSV could be out of date, since we don't run the backup dump all the time. It's being run manually.
the user cannot filter their download. Whatever filter the user applied cannot be applied to the CSV dump.
The scalable solution to fix the CSV export is to rebuild it to properly handle our expanded database. This feature would be similar to how regular database backup works. The task of the actual backup would happen in the background. The HTTP response that we return to the user would only mean that we received their request to process the CSV.
Since our data got larger, CSV export function got slower to process, triggering HTTP timeout. We added a quick solution by uploading CSV dump to AWS, and downloading that dump when the user clicks on the "Results CSV" button. There are 2 obvious issue with that hack,
The scalable solution to fix the CSV export is to rebuild it to properly handle our expanded database. This feature would be similar to how regular database backup works. The task of the actual backup would happen in the background. The HTTP response that we return to the user would only mean that we received their request to process the CSV.
User flow
This is the flow we want to follow --> https://www.loom.com/share/d9a69fcdf2c0482a96ea5a418a3baa28?sid=a9920bb3-fe0c-4eb2-bdf8-612d10016106. For Participedia, this would be
Backend logic
Once the user clicks on "Results CSV", the frontend calls the API to generate the CSV, the API
4223531689036093
.csv_export
(new table, need migration script). This will storeid
requested_timestamp
finished_timestamp
(blank to begin with)download_url
(link to our AWS, blank to begin with)type
(case/method/organization)csv/
)finished_timestamp
anddownload_url
with the URL to the file on AWS.