DeepFlood SG is an AI-powered flood risk prediction model that leverages machine learning, geospatial analysis, and real-time weather data to forecast flood-prone areas. It integrates multiple data sources to provide real-time risk assessments. It empowers authorities and citizens with early warnings and tools for proactive decision-making.
- User registration and login
- Data exploration page
- Map view of devices
- Backend: Django, Django REST Framework
- Frontend: React, Axios
- Database: PostgreSQL
Clone the repository to run the program locally.
git clone - Database: Install PostgreSQL from https://www.postgresql.org/download/.
- Add to PATH.
- Create a user for postgres locally. This is the user that django has been configured to as well.
psql -U postgres CREATE USER adminuser WITH PASSWORD 'password'; CREATE DATABASE deepfloodsg OWNER admin;
-
Backend: Virtual Environment Set up a virtual environment in the repository.
pip install virtualenv python<version> -m venv <virtual-environment-name>To activate the virtual environment: On Mac OS:
source <virtual-environment-name>/bin/activateOn Windows:
<virtual-environment-name>/Scripts/activate.bat //In CMD <virtual-environment-name>/Scripts/Activate.ps1 //In Powershel -
Run the commands below to install dependencies and run the backend server.
cd backend pip install -r requirements.txt python manage.py migrate python manage.py runserver -
Run the following command to insert mock device data into the database.
python manage.py populate_db -
Run the following command to delete all mock device data from the database.
python manage.py clear_db
cd frontend
npm install
npm start
-
Note that if you make any changes to any models.py, run the following command to flush the changes to the database:
cd backend python manage.py makemigrations python manage.py migrateRestart the Django server to reflect the changes.
-
For models to show up within the Django admin page, you will need to ensure that it is
If any changes are made to the frontend, build and deploy the React app:
npm run build
npm run deploy- Head to: https://developers.google.com/maps and generate your API key.
2.Copy and paste it into .env under REACT_APP_GOOGLE_MAPS_API_KEY (reference .env.example for example .env config)
3.Uncomment line for google maps api key for prod in file MapWindow.js.
- Create superuser by running
python3 manage.py createsuperuserin terminal, anduser: admin,password: password - Go to admin panel at http://127.0.0.1:8000/admin/.
- Login with
user: superadmin,password: password
- POST
: /api/account/login/ - POST
: /api/account/register/ - POST
: /api/account/logout/
- GET
: /api/devices/getall/ - POST
: /api/devices/upload/