CrisisLens is a monorepo with a Next.js command-center UI and a Python ML workspace.
apps/web: Next.js 14 app (App Router), React 18, TypeScript, Three.js globe, API routes, and tests.apps/ml: Python model training code and model artifacts.
- Node.js 20+
pnpm(workspace package manager)- Python 3.10+
pnpm installpnpm run generate:data
pnpm run devOpen http://localhost:3000.
pnpm run lint
pnpm run typecheck
pnpm run test
pnpm run test:unit
pnpm run test:e2e
pnpm run test:allAll root scripts delegate to apps/web.
python -m venv .venv
source .venv/bin/activate
pip install -r apps/ml/requirements.txtpython apps/ml/models/train_model.py- Frontend tests live in
apps/web/tests(Vitest + Playwright). - Web data generation script lives at
apps/web/scripts/generate-country-metrics.mjs. - Optional env var:
NEXT_PUBLIC_GLOBE_WS_URLfor real-time globe highlights.
Set these env vars in apps/web/.env.local:
DATABRICKS_HOSTDATABRICKS_TOKENDATABRICKS_WAREHOUSE_IDCRISIS_TABLE_FQNAI_MODEL
Optional compatibility overrides (if your workspace does not expose AI Gateway path):
DATABRICKS_AI_CHAT_PATH(example:/api/2.0/ai-gateway/chat/completions)DATABRICKS_AI_ENDPOINT(serving endpoint name to call via/serving-endpoints/{name}/invocations)
Quick checks:
curl -s "http://localhost:3000/api/geo/metrics?iso3=HTI"curl -s "http://localhost:3000/api/geo/insight?iso3=HTI"curl -s -X POST "http://localhost:3000/api/geo/query" \
-H "Content-Type: application/json" \
-d '{"question":"Which countries have lower funding coverage than Mali and where should funding increase?"}'