Production-ready analysis platform for UN General Assembly speeches
The UNGA Analysis App is a comprehensive platform for analyzing United Nations General Assembly speeches from 1946 to 2025. It provides advanced AI-powered analysis, cross-year trend analysis, document context analysis, and interactive visualizations for UN member states and development partners.
- Secure user registration and authentication
- Admin portal for user management
- Role-based access control
- Session management
- New Analysis: AI-powered speech analysis with multiple models
- Cross-Year Analysis: Historical trend analysis across 80 years
- Document Context: Upload and analyze documents with context
- Database Chat: Direct interaction with UNGA database
- Visualizations: Interactive charts and graphs
- Data Explorer: Comprehensive data exploration tools
- 11,093 speeches from 1946-2025
- 199 countries represented
- 80 years of historical data
- Complete embeddings for semantic search
- African vs Development Partner classification
- Multiple AI model support (GPT-4, Claude, etc.)
- Semantic search with embeddings
- Document classification
- Sentiment analysis
- Topic extraction
- Cross-reference analysis
unga_analysis/
βββ src/unga_analysis/ # Main application package
β βββ core/ # Core business logic
β β βββ auth.py # Authentication
β β βββ classify.py # Document classification
β β βββ enhanced_search_engine.py # Advanced search
β β βββ llm.py # LLM integration
β β βββ openai_client.py # OpenAI client
β β βββ prompts.py # AI prompts
β β βββ startup.py # Application startup
β β βββ user_auth.py # User authentication
β βββ data/ # Data management
β β βββ cross_year_analysis.py # Cross-year analysis
β β βββ data_ingestion.py # Data ingestion
β β βββ ingest.py # Data processing
β β βββ simple_vector_storage.py # Vector database
β βββ ui/ # User interface
β β βββ auth_interface.py # Authentication UI
β β βββ components/ # UI components
β β βββ tabs/ # Tab implementations
β β βββ ui_components.py # UI utilities
β β βββ unified_search_interface.py # Search interface
β βββ utils/ # Utilities
β β βββ country_manager.py # Country management
β β βββ export_utils.py # Export functionality
β β βββ logging_config.py # Logging configuration
β β βββ security.py # Security utilities
β β βββ utils.py # General utilities
β β βββ visualization.py # Visualization utilities
β βββ config/ # Configuration
β βββ countries.py # Country definitions
β βββ questions.py # Analysis questions
βββ tests/ # Test suite
βββ docs/ # Documentation
βββ scripts/ # Deployment scripts
βββ artifacts/ # Data artifacts
βββ requirements.txt # Dependencies
βββ main.py # Application entry point
βββ README.md # This file
- Python 3.13+
- Virtual environment (recommended)
-
Clone the repository
git clone <repository-url> cd unga-analysis-app
-
Create virtual environment
python3 -m venv unga80 source unga80/bin/activate # On Windows: unga80\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
cp env.template .env # Edit .env with your configuration -
Initialize database
python setup_database.py
-
Run the application
python main.py # Or: streamlit run main.py
- Email:
[email protected] - Password:
OSAAKing!
Create a .env file with the following variables:
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Admin Configuration
ADMIN_EMAIL=[email protected]
ADMIN_PASSWORD=OSAAKing!
# Database Configuration
DATABASE_URL=sqlite:///unga_vector.db
USER_DATABASE_URL=sqlite:///user_auth.db
# Application Configuration
APP_NAME=UNGA Analysis App
APP_VERSION=1.0.0
DEBUG=FalseThe application uses two databases:
unga_vector.db: Main speech database with embeddingsuser_auth.db: User authentication database
The application comes with a complete UNGA corpus (1946-2025):
- Total Speeches: 11,093
- Countries: 199
- Years: 1946-2025 (80 years)
- Embeddings: 100% coverage for semantic search
- β No duplicates
- β Complete country mapping
- β Proper African vs Development Partner classification
- β Full temporal coverage
- β Semantic search capabilities
- π New Analysis: Create new speech analyses
- π Cross-Year Analysis: Historical trend analysis
- π Document Context: Upload and analyze documents
- π All Analyses: View past analyses
- π Visualizations: Interactive charts and graphs
- πΊοΈ Data Explorer: Explore the database
- ποΈ Database Chat: Chat with the database
- π Error Insights: System monitoring
- π‘οΈ Admin Portal: User management (admin only)
- Regular Users: All analysis and visualization features
- Admin Users: Additional user management capabilities
- Secure password hashing
- Session management
- Input validation
- SQL injection prevention
- XSS protection
- CSRF protection
# Run tests
pytest tests/
# Run with coverage
pytest --cov=src tests/- Database: Optimized with proper indexing
- Search: Semantic search with embeddings
- Caching: Efficient country and data caching
- Memory: Optimized for large datasets
streamlit run main.py --server.port 8501See docs/DEPLOYMENT.md for detailed deployment instructions.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Built for UN OSAA (Office of the Special Adviser on Africa)
- Supports: PDF, DOCX, MP3 file formats
- Auto-classifies: African Member States vs Development Partners
- Developed by: SMU Data Team
For support and questions:
- Email: [email protected]
- Documentation: See
docs/directory - Issues: Create an issue in the repository
πΊπ³ UNGA Analysis App - Empowering UN Member States with Data-Driven Insights