An interactive web application built with Flask that facilitates government policy management, public feedback, and advanced demographic sentiment analysis.
- 🔐 User & Admin Authentication: Role-based access control for standard users and administrators.
- 📄 Policy Management: Admins can easily post, edit, view, and delete policies.
- 💬 Public Engagement: Registered users can read policies and share their opinions via comments.
- 🧠 Automated Sentiment Analysis: Every comment is automatically analyzed for sentiment (Positive 😊, Neutral 😐, Negative 😞) using NLP (
TextBlob). - 📊 Demographic Analytics: Admins have access to a rich dashboard breaking down public sentiment by:
- 🗺️ Indian State
- 🎂 Age Group
- ⚧️ Gender
- Backend: Python 3, Flask
- Frontend: HTML5, CSS3, Jinja2 Templates
- Data & NLP: Python lists/dicts (In-memory mock DB), TextBlob (for Sentiment/Polarity Analysis)
Mini project/
│
├── app.py # Main entry point & Flask backend routing logic
├── static/ # CSS stylesheets
│ ├── admin.css, home.css, login.css, policy.css, demographic_analysis.css...
└── templates/ # Jinja2 HTML views
├── admin_dashboard.html, demographic_analysis.html, edit_policy.html
├── home.html, login.html, post_policy.html, register.html, view_policy.html
Follow these instructions to run the project locally.
Make sure you have Python 3.x installed on your system.
Navigate to the project directory:
cd "d:\Mini project"Install the required Python dependencies: (Ensure you are in a virtual environment if you prefer isolating your packages)
pip install Flask textblobRun the Flask application using:
python app.pyAfter executing, the server will start on http://127.0.0.1:5004/. You can access this link using any web browser.
- Go to the login page.
- Use the default admin credentials (pre-configured in
app.py):- Email:
admin@gov.in - Password:
admin123
- Email:
- Explore the Admin Dashboard to:
- Create and publish new policies.
- Edit policy statuses or delete obsolete ones.
- View demographic analytics and sentiment breakdowns on public feedback.
- Click on Register to create an account. You will provide basic demographic details (Age Group, Gender, State).
- Login to see the available policies.
- Select a policy to read its complete details and submit comments.
- Once typed, your comment's sentiment will immediately be computationally judged and appended to the feedback history!
- Database Integration: Migrate the in-memory mock database (
users,policies,commentsdictionaries) to a robust relational database like SQLite, PostgreSQL, or MySQL using SQLAlchemy. - Visualization: Implement JavaScript chart libraries (e.g., Chart.js or D3.js) on the demographics page for better visual insights.
- Security Check: Hash user passwords before storage rather than storing them in plain text.