Skip to content

Conversation

@BharatVe
Copy link
Collaborator

@BharatVe BharatVe commented May 19, 2025

Closes #136 #145

1. Helpers

  • Added generate_data_dump_filename(ext) → optimap_data_dump_.
  • Added cleanup_old_data_dumps(dir, keep) to prune old files beyond the retention count

Tasks (publications/tasks.py)

  • Swapped out hard-coded names in regenerate_geojson_cache/regenerate_geopackage_cache for the new helpers
  • Call cleanup after each dump
  • Fixed cache_dir resolution in geopackage task

2. Config

  • .env.example: OPTIMAP_DATA_DUMP_RETENTION=3
  • settings.py: loads into DATA_DUMP_RETENTION (default 3)

Views (publications/views.py)

  • data() now globs for the latest optimap_data_dump_*.{geojson,gpkg}, humanizes size, and computes “Last updated”
  • download_geojson()/download_geopackage() regenerate and serve the actual timestamped filenames

3. Tests (tests/test_geo_data.py)

  • Import fixes (tempfile, gzip)
  • Tests glob for optimap_data_dump_* instead of static names
  • New tests for the filename generator and cleanup logic

4. Add log statement

  • Gather the modification times of the GeoJSON, GZIP and GPKG dumps and emit a logger.warning if they differ by more than one hour.

@BharatVe BharatVe marked this pull request as ready for review May 19, 2025 20:06
@nuest
Copy link
Member

nuest commented May 20, 2025

Well done.

@nuest nuest merged commit 645db4c into main May 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "optimap" and timestamp to the download files names

3 participants