Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

Cypher

Finds the conflict stories nobody is covering and puts them on a map.

🥉 3rd place at CascadiaJS 2026, hosted by AWS, Box, and Apify.


Why we built it

When something dangerous happens, someone on the ground posts about it hours before it hits the wire. Most of that early signal just evaporates, and the incident never lands in any dataset anyone will train on. Cypher scrapes for those reports, archives them, and turns them into two things: a live map of areas to avoid, and a growing database for training later.

How it works

Apify scrapes news sites, X, and Telegram. Everything raw goes straight into Box before we touch it, so any claim on the map can be traced back to the exact article that caused it. Then Box AI and Gemini read the pile and fill in a form for each incident: what happened, where, when, how bad, and which link says so.

The interesting part is what happens next. If five people post about one explosion, a naive system draws five dots and makes everything look scarier than it is. So we check whether two reports are within ~5km and ~6 hours of each other, and if they are, we merge them into one event. Merging makes us more sure, not less: one anonymous post is a rumour, five unrelated sources describing the same shelling at the same hour is basically a fact. Every merge bumps that event's confidence, and low-confidence dots get drawn faded.

What you see

Hexagons (~36 km² each) coloured green to red for the general risk of an area, plus individual event dots on top. Hover a dot for the summary, the timestamp, how many independent sources reported it, and the links. Pick a country, hit refresh to kick off a live scan, browse the source archive.

Design rule we stuck to: readable by a scared civilian on a phone in daylight, not an analyst with three monitors. Calm wire-service tone, no flashing red "BREAKING" chrome.

The ML bit

Two models doing different jobs. Onset asks "this place has been quiet, is something about to start?" (XGBoost, anomaly detection against the hex's own baseline). Continuation asks "this is already active, is it about to get worse?" (a small GRU reading a 14-day sequence). Each hex routes to exactly one depending on whether anything happened there recently. We tried one combined model first and it was worse at both.

Last run scored 0.0256 AUC-PR on onset (base rate 0.0099) and 0.9906 on continuation (base 0.5906). Be skeptical of both: onset is barely better than guessing, and 0.99 is good enough that we'd want to rule out leakage before believing it. Hackathon numbers on a hackathon dataset.

Training and live scoring share the same feature engineering code, and each source is delayed by how long it realistically takes to publish (news +1 day, event data +3 days) so the model can't peek at data it wouldn't have had.

What's where

Folder Job Stack
frontend/ the map Vite, React 19, MapLibre, Remotion
backend/ main API + ML pipeline Python, FastAPI, XGBoost, PyTorch, Box AI
backend_apify_box/ news scraping into Box Node, Express, Apify, Box AI
cascadia/ social fusion engine TypeScript, Fastify, Apify, Box, Gemini

Two Node backends because we split up on the day. They overlap and should be one service.

Running it

Frontend plus the Python backend is enough to see something real. Everything degrades gracefully when keys are missing.

cd frontend && npm install && npm run dev            # → :5173
cd backend  && pip install -r requirements.txt && uvicorn app.main:app --port 8080

Without Box credentials the API still boots and serves demo hexes, so the map is never blank. For the full thing you need an Apify token, Box credentials (Box AI needs Enterprise Plus), and a Gemini key. Each service has a .env.example.

No keys at all? curl -X POST localhost:3000/api/test-pipeline replays a saved scrape through the whole cascadia pipeline.

Stuff that's broken

Dedupe state lives in memory and resets on restart (there's an EventRepository interface sitting there ready for PostGIS, we just ran out of time). ARCHITECTURE.md is the original target design and has drifted from the code, it still says Supabase and Mapbox. English only, no accounts.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages