How kouser3485/women works
Project Type and Purpose
• This is a full-stack web application built with Flask (Python) on the backend and standard HTML/CSS/JavaScript on the frontend.
• Purpose: Allow women to generate, submit, and track legal complaints via an AI-powered interface, with location-based routing to police stations and an admin dashboard for police officers.
File Structure Analysis
• app.py: Flask application entry point.
• agents.py: AI “complaint generator” agents for natural-language → formal complaint translation.
• models/: Data layer (Complaint, PoliceStation schemas).
• routes/: HTTP endpoints (complaint submission, authentication, dashboard, tracking).
• utils/: Helpers (complaint_classifier).
• static/: Frontend assets (CSS, JS modules for auth, dashboard, emergency, mapping, tracking).
• templates/: Jinja2 HTML views (user pages, police login/dashboard, emergency, tracking, resources).
• requirements.txt: Dependencies (Flask, any ML libraries).
Key Architectural Patterns
• MVC-style separation:
• Models in models/
• Controllers in routes/
• Views in templates/ + static/
• Service layer for AI logic (agents.py, utils/complaint_classifier.py).
• External service integration: geolocation API or internal mapping for nearest police station.
• Single Flask app that bundles multiple functional modules (no microservices).
Main Components to Illustrate
A. Client Browser
– HTML/CSS/JS (templates + static assets)
– Sends HTTP(S) requests to Flask endpoints.
B. Flask Web Server
– app.py initializes Flask and registers Blueprints (routes/).
– routes/ modules handle request routing and invoke services.
C. AI Complaint Generator
– agents.py with ML/AI models in utils/complaint_classifier.py.
– Processes user input → generates complaint text.
D. Business Logic & Data Access
– models/ objects represent database schema.
– Data persistence (e.g., SQLite, PostgreSQL – not shown but implied).
E. Location & Rights Service
– Geolocation module (part of agents or utils) to find nearest police station.
– Rights lookup logic (could be a static JSON or external API).
F. Police Administration Dashboard
– Separate route modules (police_auth.py, police_dashboard.py).
– CRUD operations on complaints.
G. External Interfaces (optional)
– Email/SMS notifications.
– Map/Geolocation API.
Relationships and Data Flows
• User submits complaint form → HTTP POST to /complaint route → Flask controller invokes complaint_classifier → output complaint data.
• Flask controller queries models/ database to look up nearest police station → persists complaint record.
• Confirmation returned to user; status view polls /track endpoint to fetch updates.
• Police officer logs in → views all complaints via /police-dashboard → updates status → triggers notification back to user.
• Static and template files served directly by Flask for the UI.