You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue targets the "Temporal Freshness Tracking" item on the Phase 2 roadmap. Because different fish species spoil at different rates depending on biological factors and ambient storage conditions, users need to know when their fish will cross critical freshness thresholds (e.g., moving from Grade B to C, or C to Spoiled).
This issue involves creating a backend decay-calculation model and displaying an interactive decay-rate timeline chart on the frontend dashboard.
Proposed Solution
1. Backend (Model & Endpoint)
Decay Constants: In backend/fusion.py (or a new module), define baseline freshness decay coefficients (or half-life rates) for major species categories (e.g., Freshwater like Rohu Carp vs. Saltwater species).
Projection Logic: Write a formula to calculate freshness scores at 4-hour intervals for the next 48 hours based on:
Selected storage temperature: Refrigerated/Iced (0-4°C) vs. Ambient (25°C).
Baseline species decay speed.
The initial scanned freshness_index.
API Route: Add a new endpoint GET /api/v1/scans/{scan_id}/decay-projection?temp=ambient (or return the data array within the existing /api/v1/scans/{scan_id} JSON response under a new decay_projection field).
2. Frontend (Decay Chart & Temperature Toggle)
Interactive Chart: Embed a responsive line chart (e.g., using recharts or a similar lightweight chart library) in src/pages/AnalysisDashboard.tsx.
Threshold Reference Bands: Color-code zones on the chart:
Fresh Zone (Score >= 80)
Caution Zone (50-79)
Spoiled Zone (Score < 50)
Temperature Switch: Provide a simple UI toggle tab (e.g., [ Iced (0-4°C) ] vs [ Room Temp (25°C) ]) that dynamically re-renders or updates the graph projection to visually demonstrate how refrigeration preserves fish shelf-life.
Tasks & Checklists
Backend:
Implement species decay coefficients registry in backend/fusion.py.
Create the decay projection formula calculating 48-hour timelines.
Add the API endpoint /api/v1/scans/{scan_id}/decay-projection in backend/main.py.
Add unit tests in backend/tests/ to verify the projection math limits bounds (must stay between 0 and 100).
Frontend:
Add the decay_projection field to client TypeScript types in src/lib/types.ts.
Update src/lib/api.ts to support fetching the projection data.
Create the chart component card in src/pages/AnalysisDashboard.tsx.
Description
This issue targets the "Temporal Freshness Tracking" item on the Phase 2 roadmap. Because different fish species spoil at different rates depending on biological factors and ambient storage conditions, users need to know when their fish will cross critical freshness thresholds (e.g., moving from Grade B to C, or C to Spoiled).
This issue involves creating a backend decay-calculation model and displaying an interactive decay-rate timeline chart on the frontend dashboard.
Proposed Solution
1. Backend (Model & Endpoint)
backend/fusion.py(or a new module), define baseline freshness decay coefficients (or half-life rates) for major species categories (e.g., Freshwater like Rohu Carp vs. Saltwater species).0-4°C) vs. Ambient (25°C).freshness_index.GET /api/v1/scans/{scan_id}/decay-projection?temp=ambient(or return the data array within the existing/api/v1/scans/{scan_id}JSON response under a newdecay_projectionfield).2. Frontend (Decay Chart & Temperature Toggle)
rechartsor a similar lightweight chart library) insrc/pages/AnalysisDashboard.tsx.[ Iced (0-4°C) ]vs[ Room Temp (25°C) ]) that dynamically re-renders or updates the graph projection to visually demonstrate how refrigeration preserves fish shelf-life.Tasks & Checklists
Backend:
backend/fusion.py./api/v1/scans/{scan_id}/decay-projectioninbackend/main.py.backend/tests/to verify the projection math limits bounds (must stay between 0 and 100).Frontend:
decay_projectionfield to client TypeScript types insrc/lib/types.ts.src/lib/api.tsto support fetching the projection data.src/pages/AnalysisDashboard.tsx.Files to Modify
backend/fusion.pybackend/main.pysrc/lib/types.tssrc/lib/api.tssrc/pages/AnalysisDashboard.tsx