This project provides an analysis of flood risk across various administrative levels in Italy, including provinces, regions, and municipalities. The data is sourced from the IdroGEO API PIR (Hazards and risk indicators), and the shapefiles are acquired from ISTAT
Four Geoinformatics Engineering students at Politecnico di Milano
This project provides a dashboard for analyzing flood risk data in Italy. It allows users to view maps of flood risk, generate reports, and visualize data. There are two types of users: regular users and admin users. Admin users can update the database.
- View flood risk data on an interactive map
- Generate reports in CSV and Excel formats
- Visualize data using charts
- User authentication with different roles (user and admin)
- Python 3.7+
- PostgreSQL
- The following Python packages (listed in
requirements.txt):- Flask
- psycopg2
- pandas
- geopandas
- folium
- branca
- requests
- werkzeug
- IPython
- plotly
- xlsxwriter
- matplotlib
- fpdf
- jupyter
- ipykernel
-
Clone the repository:
git clone https://github.com/moeinp70/PolimiGeo.git cd PolimiGeo -
Create a virtual environment and install the required packages:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Install Jupyter Notebook and IPython Kernel:
pip install jupyter ipykernel python -m ipykernel install --user --name=venv
-
Setup PostgreSQL database:
- Create a new PostgreSQL database named
flood_se. - Update the
get_db_connectionfunction infunctions.pyif your database credentials are different.
- Create a new PostgreSQL database named
-
Run the
fetch_db_final.pyscript to populate the database:python fetch_db_final.py
-
Run the Flask application (
app.py):python app.py
-
Run the Jupyter Notebook for the dashboard:
jupyter notebook
-
Select the Virtual Environment Kernel:
- Open
dashboard.ipynbin Jupyter Notebook. - Click on
Kernel>Change kernel>venv.
- Open
- Open
dashboard.ipynbin Jupyter Notebook. - The first screen will prompt you to log in or sign up.
- Once logged in, you can view the dashboard:
- Select the administrative level (province, region, or municipality).
- Select a specific area to view detailed data and generate reports.
- Admin users can click the "Update Database" button to refresh the database with the latest data.
- Ensure PostgreSQL server is running before starting the application.
- Default admin credentials:
username: admin,password: admin.
This project is licensed under the MIT License.



