Skip to content

full-stack web application designed to assist farmers in selecting the right crop at the right time based on their **region** and **season**. The system displays an interactive crop calendar with monthly agricultural activities for different crops.

Notifications You must be signed in to change notification settings

Anithpavan/Crop-Calendar-Awareness-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# Advanced Crop Calendar Awareness System

A comprehensive web-based agricultural planning and management tool that provides farmers and agricultural professionals with detailed crop calendar information based on region, season, and crop type.

## 🌟 Features

### Core Functionality
- **Interactive Crop Calendar**: View detailed agricultural activities by month
- **Multi-filter System**: Filter by region, season, and crop type
- **Real-time Search**: Search through activities, crops, and months
- **Data Export**: Export filtered results to CSV format
- **Statistics Dashboard**: Overview of total records, regions, seasons, crops, and activities

### User Interface
- **Modern Design**: Gradient backgrounds and glassmorphism effects
- **Responsive Layout**: Optimized for desktop, tablet, and mobile devices
- **Interactive Elements**: Hover effects, animations, and smooth transitions
- **Activity Badges**: Color-coded activity types for easy identification
- **Loading States**: Professional loading indicators and error handling

### Technical Features
- **RESTful API**: Clean API endpoints for data retrieval
- **Error Handling**: Comprehensive error handling and logging
- **CORS Support**: Cross-origin resource sharing enabled
- **Data Validation**: Input validation and sanitization

## πŸš€ Getting Started

### Prerequisites
- Python 3.7+
- pip (Python package installer)

### Installation

1. **Clone the repository**
   ```bash
   git clone <repository-url>
   cd crop-calendar-system
   ```

2. **Install dependencies**
   ```bash
   pip install flask pandas flask-cors
   ```

3. **Prepare data**
   - Create a `data` directory in the project root
   - Place your `crop_data.csv` file in the `data` directory
   - Ensure CSV has the required columns (see Data Format section)

4. **Run the application**
   ```bash
   python app.py
   ```

5. **Access the application**
   - Open your browser and navigate to `http://localhost:5000`

## πŸ“Š Data Format

The system expects a CSV file (`data/crop_data.csv`) with the following columns:

| Column | Description | Example |
|--------|-------------|---------|
| Region | Geographic region code | AP, TS |
| Season | Growing season | Kharif, Rabi, Summer |
| Month | Month name | January, February, etc. |
| Crop | Crop name | Rice, Wheat, Cotton |
| Activity | Agricultural activity | Sowing, Harvesting, Fertilizer Application |
| Duration_Days | Activity duration in days | 15, 30, 45 |
| Water_Requirement_mm | Water requirement in millimeters | 150, 200, 300 |
| Fertilizer_NPK | NPK fertilizer ratio | 20:20:20, 10:26:26 |
| Temperature_Range_C | Temperature range in Celsius | 25-30, 20-25 |
| Soil_Type | Suitable soil type | Clay, Loamy, Sandy |
| Yield_Tons_Per_Ha | Expected yield in tons per hectare | 3.5, 4.2, 5.0 |

## πŸ”§ API Endpoints

### GET `/api/calendar`
Retrieve crop calendar data with filters.

**Parameters:**
- `region` (required): Region code
- `season` (required): Season name
- `crop` (optional): Crop name filter

**Example:**
```
GET /api/calendar?region=AP&season=Kharif&crop=Rice
```

### GET `/api/regions`
Get list of available regions.

### GET `/api/seasons`
Get list of available seasons.

### GET `/api/crops`
Get list of available crops, optionally filtered by region and season.

**Parameters:**
- `region` (optional): Region code
- `season` (optional): Season name

### GET `/api/stats`
Get dashboard statistics including total records, regions, seasons, crops, and activities.

## πŸ—οΈ Project Structure

```
crop-calendar-system/
β”œβ”€β”€ app.py                 # Flask application and API routes
β”œβ”€β”€ templates/
β”‚   └── index.html        # Main HTML template
β”œβ”€β”€ static/
β”‚   └── styles.css        # Enhanced CSS styles
β”œβ”€β”€ data/
β”‚   └── crop_data.csv     # Crop calendar data
└── README.md             # This file
```

## 🎨 UI Components

### Dashboard Statistics
- Total Records: Complete database count
- Regions: Number of available regions
- Seasons: Number of growing seasons
- Crops: Total crop varieties
- Activities: Types of agricultural activities
- Filtered: Current filtered results count

### Filter Controls
- **Region Selector**: Choose geographic region
- **Season Selector**: Select growing season
- **Crop Selector**: Optional crop filter (updates based on region/season)
- **Search Box**: Real-time text search
- **Action Buttons**: View Calendar, Clear Filters, Export CSV

### Data Table
- **Sortable Columns**: Click headers to sort
- **Activity Badges**: Color-coded activity types
- **Hover Effects**: Enhanced row highlighting
- **Responsive Design**: Adapts to screen size

## 🎯 Activity Types & Color Coding

| Activity | Color | Description |
|----------|-------|-------------|
| Land Preparation | Blue | Soil preparation activities |
| Sowing | Green | Seed planting activities |
| Weeding | Orange | Weed control activities |
| Fertilizer Application | Pink | Nutrient application |
| Harvesting | Purple | Crop harvesting |
| Irrigation | Teal | Water management |
| Pest Control | Red | Pest and disease management |

## πŸ“± Responsive Design

The application is fully responsive and optimized for:
- **Desktop** (1200px+): Full feature set with optimal spacing
- **Tablet** (768px-1199px): Condensed layout with touch-friendly controls
- **Mobile** (320px-767px): Stack layout with simplified navigation

## πŸ”’ Error Handling

- **File Not Found**: Graceful handling when CSV data is missing
- **API Errors**: Proper HTTP status codes and error messages
- **Data Validation**: Input sanitization and validation
- **Loading States**: User feedback during data operations

## πŸ“ˆ Performance Features

- **Efficient Filtering**: Client-side filtering for responsive search
- **Lazy Loading**: Data loaded on demand
- **Caching**: Optimized data retrieval
- **Minimal Dependencies**: Lightweight external libraries

## πŸ› οΈ Customization

### Adding New Regions
1. Update your CSV data with new region codes
2. Modify the `getRegionName()` function in the JavaScript to include full region names

### Styling Modifications
- Edit `styles.css` for visual customizations
- Modify CSS variables in `:root` for consistent theming
- Update gradient definitions for different color schemes

### Data Fields
- Add new columns to your CSV data
- Update the table headers in `index.html`
- Modify the export function to include new fields

## πŸ› Troubleshooting

### Common Issues

1. **CSV Not Loading**
   - Verify `data/crop_data.csv` exists
   - Check file permissions
   - Ensure proper CSV format

2. **Empty Dropdown Lists**
   - Check data consistency in CSV
   - Verify column names match expected format
   - Check for special characters in data

3. **Search Not Working**
   - Ensure JavaScript is enabled
   - Check browser console for errors
   - Verify API endpoints are accessible

## πŸ“ License

This project is open source and available under the [MIT License](LICENSE).

## 🀝 Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## πŸ“ž Support

For support and questions:
- Create an issue in the repository
- Check the troubleshooting section
- Review the API documentation

## πŸ”„ Version History

- **v1.0.0** - Initial release with core features
  - Crop calendar visualization
  - Multi-filter system
  - CSV export functionality
  - Responsive design
  - Statistics dashboard

---

**Built with ❀️ for the agricultural community**

About

full-stack web application designed to assist farmers in selecting the right crop at the right time based on their **region** and **season**. The system displays an interactive crop calendar with monthly agricultural activities for different crops.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published