Skip to content

feat(backend): Multi-Modal Produce Shelf-Life & Spoilage Decay API - #1345

Open
hrshjswniii wants to merge 5 commits into
Nitya-003:mainfrom
hrshjswniii:feature/multimodal-produce-shelflife
Open

feat(backend): Multi-Modal Produce Shelf-Life & Spoilage Decay API#1345
hrshjswniii wants to merge 5 commits into
Nitya-003:mainfrom
hrshjswniii:feature/multimodal-produce-shelflife

Conversation

@hrshjswniii

Copy link
Copy Markdown
Contributor

📌 Overview

This PR implements [feature] : Multi-Modal Produce Shelf-Life & Spoilage Decay API combining IoT thermal degree-hours via Arrhenius kinetic decay equation ($k = A \cdot e^{-E_a / (R \cdot T)}$), computer vision spot/necrosis ratios, and humidity respiration penalties to calculate real-time remaining shelf-life days and produce decay index percentages (0-100%).

Key Changes Introduced:

  1. Multi-Modal Spoilage Engine:
    • Updated [backend/services/spoilageDetectionService.js]implementing calculateMultiModalShelfLife(params).
  2. Backend API Endpoint:
    • Updated [backend/routes/aiRoutes.js] with POST /api/ai/predict-shelflife.
  3. Automated Unit Test Suite:
    • Created [backend/tests/spoilageDecay.test.js] testing Arrhenius kinetic decay calculations, remaining days estimations, and high-heat spoilage alerts (2/2 tests passing).

🛠️ Type of Change

  • ⛓️ Smart Contract (Solidity changes, Gas optimization)
  • 💻 Frontend (UI/UX, React components)
  • ⚙️ Backend / AI ML (Express API, Arrhenius kinetics, Spoilage calculation)
  • 📄 Documentation (README, Roadmap updates)
  • 🧪 Testing (Jest unit tests)

🔗 Related Issue

Closes #1289


🧪 Testing & Verification

  • Smart Contracts: npx hardhat test passed? (N/A)
  • Backend: npx jest tests/spoilageDecay.test.js passed? (Yes) — 2/2 tests passing in 35s.

✅ PR Checklist

  • My code follows the project's style guidelines.
  • I have commented my code, particularly in complex areas (e.g., Arrhenius activation energy constants & humidity multipliers).
  • I have updated the documentation accordingly.
  • My changes generate no new warnings.

💬 Additional Notes

  • Updated [backend/services/spoilageDetectionService.js]
  • Updated [backend/routes/aiRoutes.js]
  • Created [backend/tests/spoilageDecay.test.js]

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

@hrshjswniii is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[feature] : Multi-Modal Produce Shelf-Life & Spoilage Decay API

1 participant