No Hidden Space for Financial Misappropriation
OpenSquare makes public spending data accessible and understandable through conversational AI, empowering citizens, journalists, and donors to hold organizations accountable.
- Ask questions in plain language about public spending
- Natural language understanding powered by Google Vertex AI (Gemini)
- Multi-turn conversations with context awareness
- Upload financial documents (PDF, Excel, CSV)
- Automatic text extraction and processing
- Full-text search powered by Elasticsearch
- Set watchlists for keywords and topics
- Get notified when matching documents appear
- Monitor organizations in real-time
- Automatic anomaly detection
- Spending pattern analysis
- Comparative metrics across organizations
┌─────────────────────────────────────────┐
│ Frontend (React) │
│ - Chat Interface │
│ - Document Upload │
│ - Visualization │
└──────────────┬──────────────────────────┘
│ HTTP/REST API
┌──────────────▼──────────────────────────┐
│ Backend (Flask Python) │
│ - API Endpoints │
│ - RAG Pipeline │
│ - Document Processing │
└──────────────┬──────────────────────────┘
┌────────┼────────┐
│ │ │
┌────▼──┐ ┌───▼────┐ ┌─▼──────┐
│Elastic│ │Vertex │ │ Cloud │
│Search │ │ AI │ │Storage │
│ │ │(Gemini)│ │ │
└───────┘ └────────┘ └────────┘
- Python 3.11+
- Node.js 16+
- Google Cloud Account with billing enabled
- Elasticsearch Cloud account
- GitHub account
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/opensquare.git
cd opensquare/backend- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt-
Configure environment:
- Copy
.env.exampleto.env - Fill in your credentials:
GOOGLE_CLOUD_PROJECT: Your GCP project IDELASTIC_CLOUD_ID: From Elastic deploymentELASTIC_API_KEY: From ElasticELASTIC_ENDPOINT: Your Elastic URL
- Copy
-
Download service account key:
- Download JSON key from Google Cloud Service Accounts
- Place in backend folder as
service-account-key.json - Update
.envwith path
-
Run the backend:
python run.pyServer runs on http://localhost:5000
- Navigate to frontend:
cd ../frontend- Install dependencies:
npm install-
Configure API URL:
- Update
src/App.jsif backend is on different server - Default:
http://localhost:5000/api
- Update
-
Start development server:
npm startApp opens on http://localhost:3000
GET /api/health
Response: { status, services, timestamp }
GET /api/documents
Response: { count, documents[] }
POST /api/upload
Body: multipart/form-data with file
Response: { document_id, filename, size }
POST /api/chat
Body: { query: "string" }
Response: { answer, sources[], query }
POST /api/search
Body: { query: "string" }
Response: { results[], count }
POST /api/init
Response: Load sample documents
# Google Cloud
GOOGLE_CLOUD_PROJECT=opensquare-123456
GOOGLE_APPLICATION_CREDENTIALS=./service-account-key.json
VERTEX_AI_LOCATION=us-central1
VERTEX_AI_MODEL=gemini-1.5-pro
# Elasticsearch
ELASTIC_CLOUD_ID=your-cloud-id
ELASTIC_ENDPOINT=https://...
ELASTIC_API_KEY=your-api-key
# Application
FLASK_ENV=development
FLASK_DEBUG=True
SECRET_KEY=dev-secret-key
# AI Configuration
AI_TEMPERATURE=0.3
AI_MAX_OUTPUT_TOKENS=2048
RAG_TOP_K=5Terminal 1 - Backend:
cd backend
python run.pyTerminal 2 - Frontend:
cd frontend
npm startClick "Load Sample Data" button in the app to populate with demo documents.
Examples:
- "How much did Ministry of Health spend on COVID relief?"
- "Which organization has the lowest overhead costs?"
- "Show me spending trends over time"
- "Are there any suspicious patterns in the budget?"
Click the upload icon to add your own financial documents (PDF, Excel, CSV).
Set watchlists to monitor keywords and get notifications when new documents match.
cd backend
python -m pytestcd frontend
npm testcd backend
gcloud run deploy opensquare-backend \
--source . \
--platform managed \
--region us-central1 \
--set-env-vars GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_IDcd frontend
npm run build
firebase deploy --only hostingContributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- React 18
- Axios (HTTP client)
- Recharts (data visualization)
- Lucide React (icons)
- Flask (web framework)
- Elasticsearch (search engine)
- Google Vertex AI (LLM)
- Google Cloud Storage (file storage)
- Gemini 1.5 Pro (language model)
- Elastic ML (anomaly detection)
- RAG (Retrieval Augmented Generation)
- Google Cloud Platform
- Elasticsearch Cloud
- GitHub (version control)
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check existing GitHub issues
- Create a new issue with details
- Contact the maintainers
- Mobile app (iOS/Android)
- Advanced alert system
- Multi-language support
- Integration with government APIs
- Blockchain verification
- Community features
- Export to reports
- Built for AI Accelerate Hackathon
- Powered by Elastic and Google Cloud
- Inspired by financial transparency advocates worldwide
OpenSquare Team
- GitHub: @opensquare
- Email: info@opensquare.app
Made with ❤️ for financial transparency