Oracle3
Oracle3: 예측시장 거래 엔진·MCP 서버
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
🎉 Production-Ready! This application has been hardened for production deployment with comprehensive security, monitoring, testing, and legal compliance.
A comprehensive platform for transparent, auditable publication of government allocations, spending, borrowing, and audits with extensible multi-country support.README 전문 보기 ↗For routine previews with synthetic, persistent local data, see isolated local development. It uses ports 13080 and 18080 and does not load production Supabase credentials.
🎉 Production-Ready! This application has been hardened for production deployment with comprehensive security, monitoring, testing, and legal compliance.
A comprehensive platform for transparent, auditable publication of government allocations, spending, borrowing, and audits with extensible multi-country support.
✅ Security Hardened - Rate limiting, audit logging, secure configuration
✅ Fully Tested - 70% test coverage with CI/CD integration
✅ Monitored - Sentry, Prometheus metrics, structured logging
✅ Performant - Redis caching, database indexes, connection pooling
✅ Resilient - Retry logic, exponential backoff, graceful degradation
✅ Compliant - Privacy policy, terms of service, Kenya DPA 2019 ready
📊 Production Readiness: 95/100
See PRODUCTION_FIXES.md for implementation details.
audit_app/
├── backend/ # FastAPI backend
├── frontend/ # Next.js frontend
├── etl/ # Data extraction and processing
├── infra/ # Deployment configurations
├── admin/ # Admin UI components
└── docs/ # Documentation
Follow isolated local development. Its launcher checks for inherited remote endpoints, supplies synthetic persistent fixtures, and runs on ports 13080/18080 so an existing preview can keep running.
The frontend includes Playwright E2E tests that use mocked API responses, so you can test the UI without running the backend:
cd frontend
npm run test:e2e # Run all E2E tests
npm run test:e2e:ui # Run with Playwright UI
See frontend/E2E_ARCHITECTURE.md for details on how the mock system works.
The application includes a comprehensive seeding system to populate the database with real government data from Controller of Budget, OAG, and KNBS sources.
# Ensure database migrations are applied
cd backend
alembic upgrade head
# Bootstrap reference data (Kenya country + counties)
python3 bootstrap_data.py
# Test with dry-run (no database writes)
python3 -m seeding.cli seed --domain counties_budget --dry-run
# Seed counties budget data
python3 -m seeding.cli seed --domain counties_budget
# Seed all domains
python3 -m seeding.cli seed --all
counties_budget - County budget execution dataaudits - Audit findings from OAGpopulation - Population statistics from KNBSeconomic_indicators - CPI, GDP, unemployment datanational_debt - Government debt bulletinslearning_hub - Educational Q&A contentConfigure data sources in backend/.env:
# Development: Use local real data (run from project root)
SEED_BUDGETS_DATASET_URL=file://backend/seeding/real_data/budgets.json
# Production: Use real government APIs
SEED_BUDGETS_DATASET_URL=https://opendata.go.ke/api/views/xyz/rows.json
📚 Complete Documentation: See docs/seeding-guide.md for:
Admin API endpoints are available for monitoring ingestion jobs:
# List recent jobs
GET /api/v1/admin/ingestion-jobs
# Get job details
GET /api/v1/admin/ingestion-jobs/{job_id}
# Get statistics
GET /api/v1/admin/ingestion-jobs/stats/summary
# Test endpoints
python3 test_admin_api.py
See docs/seeding-guide.md#monitoring for complete API documentation.
Need to validate the seeding pipeline without hitting upstream services? Use the VS Code task "Seed Database (Dry Run)". It runs python3 -m seeding.cli seed --all --dry-run while pointing each domain to the real data under backend/seeding/real_data/.
To execute the same flow manually from the project root:
set SEED_POPULATION_DATASET_URL=backend\seeding\fixtures\population.json
set SEED_BUDGETS_DATASET_URL=backend\seeding\fixtures\budgets.json
set SEED_AUDITS_DATASET_URL=backend\seeding\fixtures\audits.json
set SEED_ECONOMIC_INDICATORS_DATASET_URL=backend\seeding\fixtures\economic_indicators.json
C:/Users/rodge/projects/audit_app/venv/Scripts/python.exe -m seeding.cli seed --all --dry-run
(Use export instead of set on Unix shells.)
All deployments require passing tests. See comprehensive testing documentation:
Quality Requirements:
Running All Tests Locally:
# Backend
cd backend && pytest tests/ -v --cov=. --cov-fail-under=50
# Frontend (full suite)
cd frontend
npm run lint -- --max-warnings=0
npm test -- --ci
npm run build
npm run test:e2e
# ETL
cd etl && python3 -m pytest --cov=. -v
Deployments are automatically blocked if any tests fail.
>=24.22.1 <25 (use frontend/.nvmrc; Docker and frontend CI select Node 24, and build/start checks verify the actual patched binary)For routine UI and API work, use isolated local development.
It sets both processes to alternate loopback ports and supplies persistent,
clearly synthetic data. The older manual .env and default-port startup path
is not the supported preview workflow.
cd etl
pip install -r requirements.txt
python3 -m etl.downloader
python3 -m etl.extractor
All endpoints return data with complete provenance information:
{
"value": 1000000,
"currency": "KES",
"provenance": [
{
"source_document_id": "123",
"url": "https://treasury.go.ke/budget-2024.pdf",
"page": 15,
"snippet": "County Health Allocation: KES 1,000,000",
"confidence": 0.95
}
]
}
GET /api/v1/countries - List countries with summariesGET /api/v1/entities - Government entities with filtersGET /api/v1/entities/:id - Detailed entity profileGET /api/v1/documents/:id - Document metadata and downloadGET /api/v1/search - Full-text search across all dataPOST /api/v1/annotations - Add comments to budget linesPOST /api/v1/documents/upload - Manual document uploadPOST /api/v1/verification/:id/approve - QA approval# Backend tests
cd backend && python3 -m pytest
# Frontend tests
cd frontend && npm test
# ETL tests
cd etl && python3 -m pytest
cd backend
alembic revision --autogenerate -m "Description"
alembic upgrade head
Run venv/bin/python scripts/local_dev.py check from the isolated checkout.
If using PostgreSQL, run venv/bin/python scripts/local_dev.py db-up first.
See isolated local development for dependencies.
venv/bin/python scripts/local_dev_smoke.pyvenv/bin/python scripts/local_dev.py frontendThe isolated preview uses 18080 for the API, 13080 for the frontend, and 55432 for optional PostgreSQL. Stop only the conflicting process you own; the launcher deliberately leaves any services on 8000/3000 alone.
# Build and deploy
docker-compose up -d
# or
./scripts/deploy.sh
MIT License - see LICENSE file for details