A multilingual USSD application for calculating BMI (Body Mass Index) and providing personalized health tips. The application supports English, French, and Swahili languages.
# BMI USSD Calculator
A multilingual USSD application for calculating BMI (Body Mass Index) and providing personalized health tips. The application supports English, French, and Kinyarwanda languages.
## Features
- **Multilingual Support**: English, French, and Kinyarwanda
- **BMI Calculation**: Accurate BMI calculation using weight (KG) and height (CM)
- **Health Categories**: Classifies users as underweight, normal, overweight, or obese
- **Personalized Health Tips**: Provides specific health advice based on BMI category
- **Session Management**: Maintains user sessions using Redis or in-memory storage
- **Africa's Talking Integration**: Ready for deployment on Africa's Talking platform
- **Input Validation**: Validates user inputs for realistic weight and height ranges
## BMI Categories
- **Underweight**: BMI < 18.5
- **Normal Weight**: BMI 18.5 - 24.9
- **Overweight**: BMI 25.0 - 29.9
- **Obese**: BMI ≥ 30.0
## Prerequisites
- Node.js (v14 or higher)
- Redis (optional, falls back to in-memory storage)
- Africa's Talking account (for production deployment)
## Installation
1. Clone the repository:
```bash
git clone
github.com
cd ussd
```
2. Install dependencies:
```bash
npm install
```
3. Configure environment variables:
```bash
cp config.env.example config.env
```
Edit `config.env` with your settings:
```
PORT=3000
REDIS_URL=redis://localhost:6379
AT_API_KEY=your_africas_talking_api_key
AT_USERNAME=your_africas_talking_username
```
## Running the Application
### Development Mode
```bash
npm run dev
```
### Production Mode
```bash
npm start
```
The server will start on port 3000 (or the port specified in your config).
## API Endpoints
### USSD Endpoint
- **URL**: `POST /ussd`
- **Content-Type**: `application/x-www-form-urlencoded`
- **Parameters**:
- `sessionId`: Unique session identifier
- `serviceCode`: USSD service code
- `phoneNumber`: User's phone number
- `text`: User input (can be empty …