Logo Lanfrica

ugberaeseac/isda_soil_client

Domaine:

agriculture

Type de record:

software
Créateur:
ugb
Hôte:
A Python program that fetches soil properties for any location in Africa using the iSDAsoil API and feed the soil properties to a Large Language Model (LLM) to provide basic fertilizer recommendation. # iSDASoil Client - Coding Exercise ## Overview This project is a **Python command-line tool** that integrates with the **iSDAsoil API** and **GroqCloud LLM** to provide **basic fertilizer recommendations** for farmers in Africa. The script: - Authenticates with the iSDAsoil API - Fetches soil property data (Nitrogen, Phosphorus, Potassium, pH) for a given location and depth - Classifies soil nutrient levels into **LOW**, **MODERATE**, or **HIGH** - Uses **Groq’s LLM** to generate a simple fertilizer recommendation, limited to approved fertilizers --- ## Tech Stack - **Python 3.10+** - Requests – HTTP requests - python-dotenv – environment variable management - **iSDAsoil API** – soil data source - **Groq LLM API** – natural language recommendation engine --- ## Setup 1. Clone the repository: ```bash git clone github.com cd isda-soil-client ``` 2. Create and activate a virtual environment: ```bash python -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows ``` 3. Install dependencies: ```bash pip install -r requirements.txt ``` 4. Copy `.env.sample` to `.env` and fill in your credentials: ```bash cp .env.sample .env ``` --- ## Environment Variables In your `.env` file: ```ini # iSDAsoil API settings BASE_URL="api.isda-africa.com" # iSDAsoil login credentials ISDA_EMAIL="your_email@example.com" ISDA_PASSWORD="your_password_here" # Groq API settings GROQ_API_KEY="your_groq_api_key_here" GROQ_API_URL="api.groq.com" ``` --- ## Usage Run the client script: ```bash python run_client.py ``` You’ll be prompted for: - **Latitude** (decimal degrees) - **Longitude** (decimal degrees) - **Depth** (currently only `0-20` supported) Example interaction: ```bash Enter lattitude of the location in Africa: -0.7196 Enter longitude of the location in Africa: 35.2400 Enter the depth: 0-20 ``` --- ## Example Output ```text The soil clas …