How yamanalrifaii/air-quality-monitoring-system works
Project type and purpose
• This is a static, multi‑page front‑end web application (“Air‑Quality‑Monitoring‑System”) deployed on a static‐hosting service (e.g. GitHub Pages).
• Purpose: provide real‑time Air Quality Index (AQI) data on a map, compare AQI across cities, and calculate Carbon Footprint (CFP).
File structure
• Top level: a README plus a set of HTML/CSS/JS triads, one per feature:
• index.html/.css/.js – landing/home page
• login.html/.css/.js – authentication UI
• .html/.css/.js – interactive map showing AQI
• compare.html/.css/.js – side‑by‑side city comparison
• cfp.html/.css/.js – carbon footprint calculator
• A shared main.css for global styling.
• No backend code or server‑side components—entirely client‑side.
Key insights from the README
• Deployed as a web dashboard for authorities and general users.
• Relies on “real‑time” AQI data—implies external third‑party APIs (e.g., World Air Quality Index project, OpenWeather, or similar).
• Offers mapping (likely using a tile API or a JS mapping library like Leaflet).
• CFP calculations are done client‑side via embedded JavaScript.
Components
a. Client (Browser)
• UI Pages:
• Home (index.html)
• Login (login.html)
• View (map.html + map.js + map.css)
• Comparison view (compare.html + compare.js + compare.css)
• CFP calculator (cfp.html + cfp.js + cfp.css)
• Shared assets: main.css
• JavaScript modules for API calls, UI logic, data parsing
b. Static Hosting Layer
• GitHub Pages / CDN hosting all HTML/CSS/JS assets
c. External Services
• AQI Data API (REST endpoints providing air quality metrics)
• Tile Service (e.g., OpenStreetMap, Mapbox tiles)
• (Optional) Authentication Provider (OAuth or custom auth API)
d. Data Flows & Interactions
• Browser → Static Hosting: fetch HTML/CSS/JS
• Browser → AQI API: GET requests for current AQI, pollutant concentration
• Browser → Map Tile Service: GET tile images or vector tiles
• Browser (login page) → Auth API: authenticate user (if implemented)
• Browser (CFP page) → local JS module: client‑side CFP calculation
Architectural patterns & design principles
• Static web‑tier pattern: purely client‑side, no dedicated backend server
• Multi‑page application (MPA) with per‑feature JS modules—each page loads only the code it needs
• Separation of concerns:
• Presentation: HTML + CSS
• Behavior: Feature‑specific JS
• Styling: page‑specific CSS + main.css for global styles
Putting it all together—what to capture
• Clear labels: page names, service names, hosting platform
• Boundaries: group all static assets under “Static Hosting.” Group each page’s code under the “Browser.”
• Data flows: show where real‑time data comes from, where map tiles come from, and where calculations occur
• Callouts: note which JS file in each page handles which API or feature (e.g., map.js → loads tiles + AQI data; cfp.js → local CFP logic)