This enhanced package adds live data fetching from data.gov.in (with local CSV fallback), robust crop/state matching (including fuzzy matching), cross-state district comparison, policy advisory scaffolding, and improved trend/correlation analysis.
config.py— Put your API keys and resource IDs here.data_fetcher.py— Fetch datasets from data.gov.in with local caching and fallback.matching.py— Name cleaning and fuzzy matching utilities.analysis.py— Trend analysis, growth rates, correlation utilities.enhanced_handler.py— An upgradedhandle_question()skeleton tying everything together.requirements.txt— Suggested Python packages.example_run.py— Small script that shows how to call the main handler.CHANGELOG.md— Notes about what was added.
- Install dependencies:
pip install -r requirements.txt
- Edit
config.pyto include your API key and resource IDs (already prefilled). - Run
python example_run.pyto see an example query flow. - Integrate
enhanced_handler.handle_questioninto your existing codebase — it falls back to local CSVs if live fetching is unavailable.
- This environment couldn't call the API while packaging; the code is ready to run locally or on a server with internet access.
- Caching folder:
./cache/— fetched CSVs are stored there to avoid repeated downloads.