participatory-planner / PROJECT_STRUCTURE.md
thadillo
Initial commit: Participatory Planning Application
23654e5
|
raw
history blame
4.41 kB

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! πŸŽ‰