Logo Lanfrica

nka-coder/drought-forecast

Domaine:

climateagriculture

Type de record:

model
Créateur:
nka
Hôte:
Statistical ML model to forecast drought in villages in risk in Africa # Drought Forecast REST API Deployment Guide ## Overview This API provides Drought forecasting capabilities for various sites in multiple countries. It uses historical Earth skin temperature (TS), rainfall and SPEI01 data, and machine learning models to predict drought risks based on current weather patterns. ## Prerequisites - Docker installed on your system - AWS CLI configured with appropriate permissions - Access to the ECR repository containing the API image - Store the dataset in an s3 bucket on your AWS account ## Deployment ### 1. Pull the Docker Image from AWS ECR ```bash # Authenticate Docker with AWS ECR aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 237710157910.dkr.ecr.eu-west-1.amazonaws.com # Pull the image docker pull 237710157910.dkr.ecr.eu-wes… ``` ### 2. Environment Variables Configuration Create a `.env` file with the following variables: ```ini # S3 Configuration S3_BUCKET=your-s3-bucket-name S3_DATASET_PREFIX=dataset AWS_REGION=your-aws-region # Optional AWS credentials (only needed if not using IAM roles) # AWS_ACCESS_KEY_ID=your-access-key # AWS_SECRET_ACCESS_KEY=your-secret-key ``` ### 3. Run the Container locally ```bash docker run -d \ --name drought \ -p 8000:8000 \ --env-file .env \ 237710157910.dkr.ecr.eu-wes… ``` ### 4. Verify Deployment Check the health endpoint: ```bash curl localhost ``` ## API Endpoints ### 1. Root Endpoint - **GET** `/` - Returns a welcome message ### 2. Site List - **GET** `/site-list` - Returns a list of all available sites with their coordinates ### 4. Drought Forecast - **POST** `/forecast/drought` - Request Body: ```json { "country": "string", "sitename": "string", "spei_threshold": "float", "month_to_forecast": "int" } ``` - Returns drought forecast with model metrics ### 5. Health Check - **GET** `/health` - Returns service health status ## Usage Exam …