Skip to content

Add Redis caching and history endpoint for predictions#88

Open
Naren50-5 wants to merge 3 commits into
InnovAIte-Deakin:mainfrom
Naren50-5:feature/redis-history1
Open

Add Redis caching and history endpoint for predictions#88
Naren50-5 wants to merge 3 commits into
InnovAIte-Deakin:mainfrom
Naren50-5:feature/redis-history1

Conversation

@Naren50-5
Copy link
Copy Markdown

Summary

This PR enables Redis caching and historical data retrieval in the Firefusion API.

Changes

  • Cached incoming predictions into Redis
  • Added /api/history endpoint to retrieve stored predictions
  • Ensured real-time WebSocket broadcasting remains unchanged

Fix

  • Standardised Redis usage to use LIST instead of STRING to avoid WRONGTYPE errors

Testing

  • Verified predictions are stored in Redis
  • Confirmed /api/history returns stored data
  • Checked WebSocket still broadcasts correctly

@darbata
Copy link
Copy Markdown
Collaborator

darbata commented Apr 24, 2026

This is better. Two things that need fixing:

  1. don't replace the /bushfire-forecast endpoint, instead only add the new history endpoint
  2. the logic for the new endpoint returns the entire history, it should instead expect a date parameter (for now) and return the FeatureCollection for that date.

@Naren50-5
Copy link
Copy Markdown
Author

  • Added optional date filter to /history endpoint
  • Updated ForecastService to support date-based Redis history lookup
  • Fixed merge conflicts after stashing changes

@darbata
Copy link
Copy Markdown
Collaborator

darbata commented Apr 29, 2026

Use a different REDIS key for the history. Also don't remove the logic to push most recent to prediction key.

You should be adding functionality not overwriting current as the frontend has already implemented logic that works with it.

For example, in on_prediction_message this same logic could've been done by appending the rpush().

Please try again and be more careful.

@darbata
Copy link
Copy Markdown
Collaborator

darbata commented Apr 29, 2026

We are adding a functionality for the frontend to get historic data not replacing the logic for them to fetch the most recent prediction.

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.

2 participants