Skip to content

saurabh49548/PolicyLens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏛️ Policy Analysis and Management Portal

An interactive web application built with Flask that facilitates government policy management, public feedback, and advanced demographic sentiment analysis.

✨ Key Features

  • 🔐 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

🛠️ Tech Stack

  • Backend: Python 3, Flask
  • Frontend: HTML5, CSS3, Jinja2 Templates
  • Data & NLP: Python lists/dicts (In-memory mock DB), TextBlob (for Sentiment/Polarity Analysis)

📂 Project Structure

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

🚀 Getting Started

Follow these instructions to run the project locally.

1. Prerequisites

Make sure you have Python 3.x installed on your system.

2. Installation Setup

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 textblob

3. Running the Application

Run the Flask application using:

python app.py

After executing, the server will start on http://127.0.0.1:5004/. You can access this link using any web browser.

💼 Usage Guide

As an Administrator:

  1. Go to the login page.
  2. Use the default admin credentials (pre-configured in app.py):
    • Email: admin@gov.in
    • Password: admin123
  3. 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.

As a Citizen / Standard User:

  1. Click on Register to create an account. You will provide basic demographic details (Age Group, Gender, State).
  2. Login to see the available policies.
  3. Select a policy to read its complete details and submit comments.
  4. Once typed, your comment's sentiment will immediately be computationally judged and appended to the feedback history!

🔮 Future Enhancements (Suggestions)

  • Database Integration: Migrate the in-memory mock database (users, policies, comments dictionaries) 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.

About

PolicyLens is designed to bring people closer to policymaking. It allows citizens to express their views on government policies while automatically analyzing their sentiments. The platform also helps administrators understand public opinion across states, age groups, and genders, making policy analysis more data-driven and transparent.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors