Skip to content

feat(backend): fetch disease symptoms and treatments from Supabase dy…#61

Open
Tirthpanchori wants to merge 1 commit into
jpdevhub:mainfrom
Tirthpanchori:feat/crop-diseases-supabase-migration
Open

feat(backend): fetch disease symptoms and treatments from Supabase dy…#61
Tirthpanchori wants to merge 1 commit into
jpdevhub:mainfrom
Tirthpanchori:feat/crop-diseases-supabase-migration

Conversation

@Tirthpanchori

Copy link
Copy Markdown

Summary

Replaces hardcoded DISEASE_SYMPTOMS and DISEASE_TREATMENTS dictionaries in main.py with dynamic Supabase queries against the existing crop_diseases table.

Related Issue

Closes #49

Changes

  • Removed hardcoded DISEASE_SYMPTOMS and DISEASE_TREATMENTS dicts from main.py
  • Added _get_disease_data(class_name) helper that fetches symptoms and treatment from the crop_diseases table by class_key
  • Updated _get_symptoms() and _get_treatments() to use the new DB helper instead of dict lookups
  • Fixed GET /api/wiki/diseases/{disease_id} endpoint to query by class_key instead of id, with UUID fallback

Testing

  • Tested locally
    • Ran supabase db reset to apply the existing 20260603000000_crop_diseases_wiki.sql migration
    • Verified 86 rows populated in crop_diseases table via Supabase Studio
    • Started backend with uvicorn, confirmed Application startup complete with no errors
    • Confirmed _get_symptoms and _get_treatments resolve correctly via DB lookup

Checklist

  • Code follows the project's Python style conventions
  • No secrets or .env values are committed
  • CI passes

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

@Tirthpanchori is attempting to deploy a commit to the karan3431's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

🎉 Thanks for your contribution, @Tirthpanchori!

Please make sure CI passes and the checklist in the PR template is complete. A maintainer will review this soon.

— The AgroNavis team

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Tirthpanchori, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 9 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e8f1087-9c7d-4c72-b673-60e06be972b4

📥 Commits

Reviewing files that changed from the base of the PR and between fe43800 and cfd2989.

📒 Files selected for processing (1)
  • backend/main.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Tirthpanchori

Copy link
Copy Markdown
Author

any issue?

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agronavis-ai-farm-assiatant Ready Ready Preview, Comment Jun 19, 2026 1:41pm

@jpdevhub

Copy link
Copy Markdown
Owner

Great idea to move this to the database, but you forgot to include the Supabase SQL migration script to seed the crop_diseases table! If we merge this now, the database will be empty and the feature will break. Please add the .sql migration file with the INSERT statements for the data you deleted from main.py

@Tirthpanchori

Copy link
Copy Markdown
Author

Hi! The migration file already exists in the repo at backend/supabase/migrations/20260603000000_crop_diseases_wiki.sql — it was committed in v2.0.0, before I started working on this issue (confirmed via git log). It contains the full CREATE TABLE crop_diseases statement plus all 86 INSERT statements.

I ran supabase db reset locally and confirmed all 86 rows are correctly populated. My PR only changes main.py — replacing the hardcoded DISEASE_SYMPTOMS/DISEASE_TREATMENTS dicts with queries against this existing table.

Could you double check if this migration file is present on your end? If main is missing it for some reason, that would explain the empty-table concern — but it's not something I removed or need to re-add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move Disease Wiki to Supabase Database

2 participants