This project is a web-based application designed to streamline and manage various citizen services and complaints within a city. It provides separate interfaces for citizens and administrators to manage and track the lifecycle of complaints and services offered.
- User Registration and Login: Citizens can create an account and log in to the platform.
- Dashboard: After logging in, citizens can view a dashboard that displays a list of all their submitted complaints and their current statuses.
- Submit Complaints: Citizens can submit new complaints related to various services, providing details such as the service, a description of the issue, and the location.
- Track Complaint Status: Citizens can track the status of their submitted complaints (e.g., Pending, In Progress, Resolved).
- Admin Login: Administrators have a separate login to access the admin panel.
- Dashboard: The admin dashboard provides a comprehensive overview of all complaints, including statistics on complaint statuses, complaints per service, and complaints by location.
- Complaint Management: Admins can view and manage all citizen complaints and update their statuses.
- User Management: Admins can view a list of all registered citizens.
- Service Management: Admins have full CRUD (Create, Read, Update, Delete) functionality for the services offered in the city.
- Reporting: A dedicated reporting section provides insights into complaint trends, including complaints by status, service, time, and location, as well as the average time to resolve a complaint.
- Backend:
- Python
- Flask
- mysql-connector-python
- Frontend:
- HTML
- CSS
- JavaScript
- Database:
- MySQL
-
Clone the repository:
git clone <repository-url> cd Smart_City_Project
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install the dependencies:
pip install -r requirements.txt
-
Set up the database:
- Create a MySQL database.
- Import the
schema.sqlfile to set up the necessary tables:mysql -u <your-username> -p <your-database-name> < schema.sql
-
Configure environment variables:
- Create a
.envfile in the root of the project. - Add the following environment variables:
FLASK_SECRET=<your-flask-secret-key> DB_HOST=<your-database-host> DB_USER=<your-database-user> DB_PASSWORD=<your-database-password> DB_NAME=<your-database-name> FLASK_ENV=development
- Create a
-
Verify database connection (optional):
- To check if your database connection is configured correctly, you can run the following script:
You should see a "Database connection successful!" message.
python check_db.py
- To check if your database connection is configured correctly, you can run the following script:
-
Run the application:
flask run
-
Access the application:
- Citizen Interface: Open your web browser and go to
http://127.0.0.1:5000 - Admin Interface: Access the admin panel via
http://127.0.0.1:5000/admin/login
- Citizen Interface: Open your web browser and go to
To create an admin user, you can use the add_admin.py script.
-
Set the required environment variables:
export ADMIN_PASSWORD='your_desired_admin_password'
(Note: The
DB_PASSWORDshould already be set in your.envfile as per the installation instructions.) -
Run the script:
python add_admin.py
This will create an admin user with the username
adminand the password you provided. If the user already exists, it will update the password.
Smart_City_Project/
├── app.py # Main Flask application file
├── requirements.txt # Project dependencies
├── schema.sql # Database schema
├── .env # Environment variables
├── blueprints/ # Application blueprints
│ ├── admin.py # Admin routes and logic
│ └── citizen.py # Citizen routes and logic
├── Frontend/ # HTML templates
│ ├── admin_dashboard.html
│ ├── citizen_dashboard.html
│ └── ...
├── static/ # Static assets
│ ├── css/
│ └── js/
└── venv/ # Virtual environment