Skip to content

feat: implement report caching — skip generation if a report already …#172

Merged
BigBen-7 merged 2 commits intoLead-Studios:mainfrom
Kaylahray:feat/report-generation-cache
Mar 27, 2026
Merged

feat: implement report caching — skip generation if a report already …#172
BigBen-7 merged 2 commits intoLead-Studios:mainfrom
Kaylahray:feat/report-generation-cache

Conversation

@Kaylahray
Copy link
Copy Markdown
Contributor

Closes #156

What changed

  • src/config.py — added REPORT_CACHE_MINUTES: int = 60 env var with default.
  • src/report_service.py — added create_generated_reports_table, insert_report_metadata, and check_report_cache helpers. Updated generate_daily_report_csv signature to accept event_id, force_regenerate, and cache_minutes; returns (path, cache_hit: bool) tuple.
  • src/types_custom.py — added event_id and force_regenerate: bool = False to DailyReportRequest; added cache_hit: bool to DailyReportResponse.
  • src/main.py — startup now calls create_generated_reports_table; endpoint unpacks the tuple and forwards all new params; response message differs on hit vs miss.
  • tests/test_report_caching.py — full test suite: cache hit, cache miss (no engine), stale file fallback, force_regenerate bypasses cache, cache_hit flag in API response, REPORT_CACHE_MINUTES forwarded from settings.
  • Updated existing test_daily_report.py and test_standard_modules_unittest.py callers to unpack the new return tuple.

Checklist

  • check_report_cache queries generated_reports by {report_date, event_id, format} within REPORT_CACHE_MINUTES
  • Cache hit returns existing path with no regeneration
  • cache_hit: bool in DailyReportResponse
  • force_regenerate: bool skips cache check entirely
  • Tests: hit, miss, force regenerate

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@Kaylahray Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@BigBen-7 BigBen-7 merged commit 7422915 into Lead-Studios:main Mar 27, 2026
1 of 4 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.

feat: implement report caching — skip generation if a report for the same date/event already exists

2 participants