A modern, responsive web application for monitoring Air Quality Index (AQI) with real-time data visualization, encrypted logging, dynamic recommendations, and smart data persistence.
- Real-time AQI Monitoring: Display current air quality index with dynamic updates
- Circular Progress Display: Beautiful animated SVG progress ring that changes color based on AQI levels
- Interactive Bar Graph: Visual representation of AQI distribution across different quality ranges
- Encrypted Log Viewer: AES-256 encrypted historical data logs with terminal-style display
- Hidden Sidebar Navigation: Clean interface with slide-out navigation menu
- Dark/Light Theme: Toggle between themes with smooth transitions
- Dynamic Improvement Tips: Context-aware recommendations that only appear when needed
- Real Data Logging: Actual AQI readings stored locally and displayed in logs
- Data Persistence: Maintains AQI history across browser sessions
- Responsive Design: Optimized for all devices with mobile-first approach
- Color-coded AQI Scale: Easy-to-understand air quality categories
- Dynamic Status Updates: Real-time status messages based on current AQI levels
- Contextual Recommendations: Tips change based on air quality severity:
- Good (0-50): Maintenance and outdoor activity suggestions
- Moderate (51-100): Prevention and caution tips
- Unhealthy (101+): Protection measures and emergency guidelines
- Hidden Sidebar: Clean interface with hamburger menu navigation
- Modern UI: Professional interface with subtle animations
- Glassmorphism Effects: Modern translucent design elements
- Smooth Transitions: Professional animations and hover effects
- Mobile Optimized: Touch-friendly interface for all screen sizes
- Accessibility: High contrast ratios and proper semantic HTML
- Modern web browser (Chrome 90+, Firefox 88+, Safari 14+, Edge 90+)
- Basic web server (optional, for local development)
-
Clone the repository
git clone https://github.com/OMNIPOTENTHAVOC/aqi.git cd aqi -
Project Structure
aqi/ βββ index.html # Main HTML file with all pages βββ style.css # Complete stylesheet with responsive design βββ script.js # JavaScript with sidebar, navigation, and data persistence βββ README.md # This file -
Run the Application
- Simple: Open
index.htmldirectly in your web browser - Local Server (recommended):
# Using Python python -m http.server 8000 # Using Node.js npx http-server # Using PHP php -S localhost:8000
- Simple: Open
- Open Menu: Click the hamburger button (β°) in the top-left corner
- Navigate: Choose from Home, Logs, or About pages
- Close Menu: Click the X button, click outside the menu, or press Escape
- View Current AQI: Main page shows real-time air quality in circular display
- Refresh Data: Click the refresh button to get new readings
- Check Recommendations: Improvement tips appear automatically based on AQI level
- View History: Navigate to Logs page to see historical data
- Access Logs: Go to Logs page via sidebar menu
- Enter Password: Use any password to simulate decryption
- View Data: See actual timestamps and AQI readings from your monitoring sessions
To connect with a real AQI API, modify the refreshAqi() function in script.js:
// Replace the mock data section with actual API call
async function refreshAqi() {
try {
const response = await fetch(`YOUR_AQI_API_ENDPOINT`);
const data = await response.json();
const aqiValue = data.aqi; // Adjust based on your API response
// Update display with real data
updateAqiDisplay(aqiValue);
} catch (error) {
console.error('API Error:', error);
}
}- OpenWeatherMap Air Pollution API
- IQAir API
- EPA AirNow API
- PurpleAir API
- Custom APIs following standard AQI formats
Update the monitoring station name in script.js:
location: "your own location" // Change from "SRM Institute of Science and Tech, KTR"Modify improvement tip thresholds:
if (aqi 100) {
aqiHistory = aqiHistory.slice(-100);
}- AES-256 Encryption: Historical logs are encrypted for data privacy
- Client-side Processing: All encryption/decryption happens in the browser
- Local Data Storage: Uses browser localStorage for data persistence
- No External Dependencies: Self-contained security implementation
- Privacy First: No data collection or external tracking
The application stores:
- AQI History: Up to 100 recent readings with timestamps
- Theme Preference: User's light/dark mode choice
- Current Session: Latest AQI reading and status
{
timestamp: "2025-01-15T14:23:45.123Z",
aqi: 67,
status: "Moderate",
location: "SRM Institute of Science and Technology, Kattankulathur"
}- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow existing code style and formatting
- Test sidebar functionality on multiple devices
- Ensure data persistence works correctly
- Verify dynamic content updates based on AQI levels
- Test keyboard accessibility (Escape key, tab navigation)
- Mock Data: Uses simulated AQI readings for demonstration
- Static Bar Graph: Historical distribution uses sample data
- Browser Storage: Data limited to localStorage capacity
- Single Location: Currently supports one monitoring location
- Real-time API integration with multiple providers
- Multiple location monitoring
- Data export functionality (CSV, JSON)
- Advanced filtering and search in logs
- Historical data charts and trend analysis
- Push notifications for air quality alerts
- Multiple pollutant tracking (PM2.5, PM10, O3, NO2, CO, SO2)
- Weather correlation data
- Air quality forecasting
- Service Worker for offline functionality
- IndexedDB for larger data storage
- PWA (Progressive Web App) capabilities
- Multi-language support
- Advanced data visualization with Chart.js
- Chrome: 90+ (Recommended)
- Firefox: 88+
- Safari: 14+
- Edge: 90+
- Mobile: All modern mobile browsers
- First Load: < 1 second on broadband
- Navigation: Instant page switching
- Data Storage: Efficient localStorage usage
- Memory Usage: Optimized for long-term use
- Keyboard Navigation: Full keyboard support
- Screen Readers: Semantic HTML structure
- Color Contrast: WCAG 2.1 AA compliant
- Focus Management: Proper focus handling in sidebar
- Stanford Javascript Crypto Library - For AES encryption functionality
- Font Awesome - For comprehensive icon library
- Inter Font - For modern, readable typography
- CSS Grid & Flexbox - For responsive and flexible layouts
- localStorage API - For client-side data persistence
Q: Why doesn't the sidebar show by default? A: The sidebar is hidden to provide a clean, distraction-free interface. Click the hamburger menu (β°) to access navigation.
Q: Are the improvement tips real? A: Yes! The tips are dynamically generated based on actual AQI readings and follow EPA guidelines for air quality recommendations.
Q: Where is my data stored? A: All data is stored locally in your browser using localStorage. Nothing is sent to external servers.
Q: Can I use this with real AQI data?
A: Absolutely! Replace the mock data in refreshAqi() function with actual API calls to your preferred AQI data provider.
This application aims to raise awareness about air quality and encourage actions that lead to cleaner air. By providing real-time information and actionable recommendations, we hope to contribute to better environmental health outcomes.
Remember: Small actions today lead to cleaner air tomorrow. Use this tool to stay informed and take action for better air quality in your community.