Cubeseed Africa is a livestock trading platform that match buyers to livestock sellers
# AI-Powered Livestock Matching Service
A serverless AWS application that matches livestock buyers with sellers using AI-powered natural language processing. Built with AWS Chalice, DynamoDB, and Terraform.
## Architecture
- **API**: AWS Chalice (Python serverless framework)
- **Database**: DynamoDB single table design
- **Infrastructure**: Terraform for AWS resource management
- **Data**: Excel-based livestock and seller information
## Features
- Natural language query processing for livestock searches
- Real-time seller matching based on location, price, and product type
- Relevance scoring algorithm for optimal seller recommendations
- RESTful API with health checks and product listings
- Scalable serverless architecture
## Data Structure
### Products
Each product in the DynamoDB table has the following structure:
```json
{
"ProductName": "Broiler",
"Species": "Poultry",
"BasePrice": 123390.5,
"MinPrice": 112513.0,
"MaxPrice": 134268.0,
"SellerIds": [...]
}
```
### Sellers
Embedded seller information includes:
```json
{
"SellerId": "SELL1006",
"Name": "Farm 1006",
"City": "Ibadan",
"State": "Oyo",
"Phone": "+2347739699689",
"Rating": 4.1,
"QuantityTonsAvailable": 9.0,
"StockScore": 100.0,
"PriceScore": 100.0,
"DeliveryScore": 33.3
}
```
## Available Products
- **Poultry**: Broiler, Layer, Noiler
- **Fish**: Tilapia, Catfish, Heterotis
- **Cattle**: Sokoto Gudali, White Fulani, Muturu
- **Sheep**: Yankasa, Balami, Uda
- **Goat**: Sokoto Red
## Quick Start
### Prerequisites
- Python 3.8+
- AWS CLI configured
- Terraform installed
- AWS account with appropriate permissions
### 1. Deploy Infrastructure
```bash
cd deployment-package/infrastructure/terraform
terraform init
terraform plan
terraform apply
```
### 2. Load Sample Data
```bash
cd data/data_loader
python single_table_loader.py
```
### 3. Deploy Chalice Application
```bash
cd deployment-package
chalice deploy
```
## API Endpoints
### Search Livestock
```http
POST /search
Content-Type: applica …