Spaces:
Sleeping
Sleeping
Project Structure
participatory_planner/
β
βββ π± app/ # Main application package
β βββ __init__.py # Flask app initialization
β βββ analyzer.py # π€ AI model for classification (FREE!)
β β
β βββ models/
β β βββ models.py # Database models (Token, Submission, Settings)
β β
β βββ routes/
β β βββ auth.py # Login, logout, token generation
β β βββ submissions.py # Contribution submission
β β βββ admin.py # Admin dashboard & API endpoints
β β
β βββ templates/ # HTML templates (Jinja2)
β β βββ base.html # Base template
β β βββ login.html # Login page
β β βββ generate.html # Token generation page
β β βββ submit.html # Submission form
β β β
β β βββ admin/ # Admin templates
β β βββ base.html # Admin base template
β β βββ overview.html # Dashboard overview
β β βββ registration.html # Registration management
β β βββ tokens.html # Token management
β β βββ submissions.html # All submissions view
β β βββ dashboard.html # Analytics & visualizations
β β
β βββ static/ # Static files (auto-created)
β βββ css/
β βββ js/
β
βββ π run.py # Application entry point
β
βββ π¦ requirements.txt # Python dependencies
βββ π .env.example # Environment variables template
βββ .gitignore # Git ignore rules
β
βββ π Documentation
β βββ README.md # Full documentation
β βββ QUICKSTART.md # Quick start guide
β βββ AI_MODEL_COMPARISON.md # AI model options
β βββ PROJECT_STRUCTURE.md # This file
β
βββ π§ͺ test_analyzer.py # Test script for AI model
β
βββ πΎ Database (auto-created on first run)
βββ instance/
βββ participatory_planner.db # SQLite database
Key Components
π€ AI Analyzer (app/analyzer.py)
- Free Hugging Face model - No API keys needed!
- Zero-shot classification using
facebook/bart-large-mnli - Categories: Vision, Problem, Objectives, Directives, Values, Actions
- Runs completely offline after first download
ποΈ Database Models
- Token: User authentication tokens
- Submission: Participant contributions
- Settings: Application configuration
π¨ Frontend
- Bootstrap 5: Responsive UI
- Leaflet.js: Interactive maps
- Chart.js: Data visualizations
- Jinja2: Server-side templating
π API Endpoints
- Public routes (login, registration)
- Contributor routes (submission)
- Admin routes (dashboard, analytics, export)
Data Flow
1. Participant β Generate Token β Get unique access code
2. Participant β Login β Submit ideas (with optional location)
3. Admin β Analyze β AI categorizes submissions
4. Admin β View Analytics β Charts, maps, categorized data
5. Admin β Export β JSON/CSV for analysis
File Sizes
- Source code: ~50KB
- Dependencies: ~500MB (including PyTorch & Transformers)
- AI Model: ~1.5GB (one-time download, cached locally)
- Database: Grows with submissions (very small, ~few MB typically)
Technology Stack
| Component | Technology | Why? |
|---|---|---|
| Backend | Flask | Lightweight, easy to deploy |
| Database | SQLite | Simple, no setup needed |
| ORM | SQLAlchemy | Clean database operations |
| AI Model | Hugging Face | Free, offline, privacy-focused |
| Frontend | Bootstrap 5 | Responsive, modern UI |
| Maps | Leaflet.js | Free, powerful mapping |
| Charts | Chart.js | Simple, beautiful charts |
Deployment Ready
β Production-ready Flask setup β Environment variables for config β Database migrations ready β No external API dependencies β Completely self-contained
Happy participatory planning! π