Spaces:
Sleeping
A newer version of the Streamlit SDK is available: 1.56.0
Utrecht Air Quality Monitoring Application ππ¨
Welcome to the Utrecht Air Quality Monitoring application! This interactive app, built with Streamlit, provides timely insights into the levels of key air pollutantsβNOβ and Oββin Utrecht, helping users monitor and forecast air quality based on WHO standards.
π Features
- Real-Time Monitoring: Stay updated on todayβs air quality with data updated every 6 hours.
- 3-Day Forecasts: View predicted NOβ and Oβ levels for the upcoming three days.
- User & Admin Dashboards: Easy-to-use interfaces for general users and detailed analytics for admins.
- Comprehensive MVC Structure: Organized codebase for easy navigation, maintenance, and scalability.
π Folder Structure
streamlit_src/
βββ controllers/
β βββ home_controller.py # Manages logic for the main dashboard and user access
β βββ user_controller.py # Controls data display on the user dashboard
β βββ admin_controller.py # Extends user_controller for admin-specific features
β
βββ json_interactions/ # Handles JSON data interactions for configuration and storage
β βββ (JSON handling scripts)
β
βββ models/
β βββ air_quality_model.py # Contains model loading, preprocessing, and prediction logic
β
βββ views/
β βββ home_view.py # Sets up the main interface and role selection
β βββ user_view.py # Displays air quality data and forecasts for users
β βββ admin_view.py # Presents analytics and monitoring tools for admins
β
βββ README.md # Documentation for the Streamlit application
βββ __init__.py # Initializes the streamlit_src package
βββ app.py # Main entry point to run the Streamlit application
βοΈ Design Pattern: MVC
To make the application easy to manage and extend, weβve structured it using the Model-View-Controller (MVC) design pattern. Hereβs how each part contributes:
1. Model (air_quality_model.py)
Our Model forms the backbone of the application, handling:
- Data loading and preprocessing to ensure consistency in predictions.
- Air quality prediction models for NOβ and Oβ, using data collected over past days.
- Prediction logic that leverages our trained models to provide accurate, actionable forecasts.
2. Views (home_view.py, user_view.py, admin_view.py)
The View components shape the look of the application, providing different displays for each user role:
home_view.py: Sets up the main page layout, including a field for users to switch roles or log in as an admin.user_view.py: Manages the visual elements and display of air quality forecasts for NOβ and Oβ on the user dashboard.admin_view.py: Handles all visual elements on the admin dashboard, including advanced metrics, monitoring tools, and model performance data.
3. Controllers (home_controller.py, user_controller.py, admin_controller.py)
Our Controller modules serve as intermediaries, connecting the model's data and logic with the viewsβ visual representation. Each controller is aligned with a specific view:
home_controller.py: Manages the logic for the main dashboard, handling user access and controlling the display of either the user or admin dashboard.user_controller.py: Manages the logic for the user dashboard, making use of theuser_view.pyscript to correctly format the user dashboard including.admin_controller.py: Manages the logic for the admin dashboard, extending theUserControllerto provide additional features tailored to admin needs.
π How to Run the App
To launch the Utrecht Air Quality Monitoring application, follow these simple steps:
Navigate to the
streamlit_srcfolder in your terminal where the app files are located.Run the Streamlit application by entering the following command:
streamlit run app.py > [!TIP] > **Alternative Path**: If you are not in the `streamlit_src` folder, provide the full path to `app.py`. For example, from the root directory: > - **Windows**: > ```bash
streamlit run .\streamlit_src\app.py
- **macOS/Linux**: ```bash streamlit run ./streamlit_src/app.py