Inspiration
Walking home alone late at night, the moment you need help is the moment you can't unlock a phone, find an app and press a button. And the people who could fix a dark street, like student government, usually hear about it much later. We built TrojanPulse for both problems.
By Trojans For Trojans
Why USC needs this
- USC's night Lyft program carries over 30,000 rides a week. In a Daily Trojan survey, students described waits of up to an hour, so some walk instead.
- DPS crime alerts this year include evening sidewalk robberies near Jefferson and Figueroa. DPS's own advice: travel with friends.
- USG and GSG are trusted by students and can reach them early, on campus and off campus, including international students who may not know where else to turn.
What it does
TrojanPulse is a voice-triggered safety platform for USC students walking alone.
- Hands-free alert. Start a walk and put your phone away. Say your safe phrase and a 10 second countdown begins. If you don't cancel, your walking pod, your emergency contacts and the campus dashboard get an alert with what you said and the nearest street.
- Risk-aware routing. Choose the safest or the fastest route. Both run on the real OpenStreetMap street graph. The safest route avoids streets with broken lights, recent incidents, closed businesses and little foot traffic.
- Walking pods. Get matched with students heading the same way at the same time.
- Campus Pulse. A real-time operations dashboard for USG and GSG: live alerts, walk demand, hazard reports, wait times and a ride demand forecast. Live at trojan-pulse.replit.app/dashboard.
How the AI works
During a walk, the phone sends 3 second audio clips. Groq Whisper transcribes each one, and a scoring step decides whether to start the countdown. The safe phrase always triggers. Otherwise, distress phrases, sound and movement are fused into one score:
$$ \text{score} = 1 - (1 - p_{speech})(1 - p_{sound})(1 - p_{stop}) $$
No single weak signal can cross the threshold alone, so a shout at a party does not send an alert. An LLM extracts incidents from safety alert text and writes the hazard summaries. A scikit-learn model forecasts ride demand from three weeks of requests.
Design decisions
- A phrase that sounds ordinary. The safe phrase (like "red umbrella") is chosen so saying it out loud gives nothing away. When speaking isn't possible, Hold for help sends the same alert without a word.
- A 10 second cancel window. Every alert can be stopped with one tap before anything is sent, so a false alarm costs a second, not a panic.
- Prevention first. Risk-aware routes and walking pods lower the risk before anything happens, so the alert is the last line, not the only one.
- Simple, explainable models on purpose. The ride forecast is a linear model so it can start producing useful estimates while real data accumulates, and it can be swapped for a stronger model without touching the apps.
- Privacy by default. The microphone is on only during a walk, audio is transcribed and not stored, and nothing is sent before the countdown ends.
How we built it
FastAPI and WebSockets on the backend, React and TypeScript for both apps, Leaflet for maps, OSMnx and NetworkX for routing. We agreed on one typed API contract first, generated the frontend types from it, and four of us built in parallel. One server hosts everything on Replit.
Challenges we ran into
- Browsers record audio as a stream that can't be transcribed in pieces. We restart the recorder every 3 seconds so each clip is a complete file.
- "Blue umbrella" is 80% similar to "red umbrella". Matching the phrase word by word removed that false alarm.
- A phrase can be cut in half between two clips, so we score the last two transcripts together.
- The LLM model we started with was retired by the provider. Our rule-based fallbacks kept the app running until we switched models.
Accomplishments that we're proud of
It works end to end on the deployed app: sign in, plan a route, join a pod, say the phrase, and the alert appears on the dashboard. 54 automated tests pass.
What we learned
Safety software is mostly about what happens when something fails. Every external dependency in TrojanPulse has a fallback, and every screen says clearly when data is simulated.
What's next
The product is built and deployed. The data is simulated, so the next step is a campus pilot.
How USC could run it next semester
- Owner: USG & GSG, with USC Transportation and DPS. Live alerts go to the student's walking pod and emergency contacts first, and DPS stays one tap away.
- Data: it already exists. DPS publishes crime alerts (our LLM step already turns alert text into geocoded incidents), USC Transportation has ride logs, and streetlight outages are reported. Each dataset sits behind a single loader, so real feeds replace simulated ones without touching the services or the apps.
- Cost: about $15 a month to host on Replit, plus about 4 cents of speech to text per 20 minute walk.
- Pilot plan: USC single sign-on with safe phrase and contact setup at sign-up, and real push or SMS delivery to pods and contacts.
Sources: USC Transportation · Daily Trojan · USC DPS crime alerts · Groq Whisper pricing
Built With
- fastapi
- groq
- leaflet.js
- llm
- networkx
- numpy
- openstreetmap
- osmnx
- pydantic
- pytest
- python
- react
- replit
- scikit-learn
- typescript
- vite
- websockets
- whisper