Implement common logic for saving to disk & writing to db for arcgis_feature_layer
and comapeo_observations
#89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Towards #86.
Screenshots
For CoMapeo, a GeoJSON file is now saved in the same location as attachments
What I changed
save_export_file
tosave_data_to_file
to clarify that it is a generic function that can be used at any time to save data to disk, not only when exporting.save_data_to_file
function instead of providing its own bespoke logic to do so.save_data_to_file
andsave_geojson_to_postgres
.download_and_transform_comapeo_data
now transforms the incoming CoMapeo Archive Server data into a GeoJSON Feature Collection.CoMapeoDBWriter
class was removed entirely. Any business logic e.g. about convertingdocId
was moved todownload_and_transform_comapeo_data
. Also, one line of code about truncating table names was moved to the GeoJSON-to-Potgres script (as it is good practice for any usage of this script).What I'm not doing here