Margi

Complete Project & UI Design Brief

Signal drops. The critical minute doesn't.

Road Safety Hackathon 2026 · RoadSoS Track
IIT Madras · CoERS & RBG Labs · MoRTH
Document for UI/UX design · Includes P0 shipped + Refinement plan
Generated May 2026 · github.com/Stormynubee/novadrive

Table of contents

  1. Executive summary & product vision
  2. Deep analogies (present to judges)
  3. Hackathon alignment & deliverables
  4. System architecture
  5. Design system — Night-Highway HUD
  6. Screen inventory (current + planned)
  7. User flows & navigation map
  8. START triage FSM (medical)
  9. Golden Hour Packet & QR relay
  10. Journey, CrashEngine, Trip Info
  11. AI chatbot layer
  12. Data, SQLite POI, location fixes
  13. Refinement plan (full — R1–R9)
  14. P0 file map & known bugs
  15. What we rejected
  16. Tech stack & repo map
  17. Demo script & acceptance tests
  18. Glossary & related documents

1. Executive summary

Margi is an offline-first emergency co-pilot for Indian highways. When mobile signal fails after a crash, victims and bystanders still get START medical triage, trauma-tier hospital routing (not “nearest pin”), a human-readable Golden Hour Packet (GHP) for 108, and a QR bystander relay until any phone regains network.

ItemDetail
Primary appnovadrive-mobile/ — Expo SDK 54, Android via Expo Go / APK
Web mirrornovadrive/ — Next.js prototype
DeadlineMay 31, 2026, 11:59 PM IST (Unstop)
P0 statusBuilt & working — airplane-mode demo path
NextRefinement plan (UI polish) — pending “go” from product owner

2. Deep analogies

Dead-zone phone call: You try 108 — one bar, then silence. Margi writes the perfect handoff note before the call drops.
Wrong fire station: Nearest clinic ≠ trauma center. RED patients route to tier-1/2 trauma, not closest pin.
GHP = pilot mayday: One screen a dispatcher reads in 10 seconds — triage, location, facility, ETA, hash.
QR sneakernet: Your phone offline; bystander scans QR; packet rides on their phone until SMS to 108 works.
LLM skin, FSM spine: Chat understands “not breathing”; START FSM alone decides RED/YELLOW/GREEN/BLACK.
Calm co-pilot: No screaming alarms or auto-dial at crash countdown zero — user always confirms.

3. Hackathon (RoadSoS)

CriterionMargi response
OfflineFSM + SQLite POI + GHP + QR on device
AI chatbotText UI + offline keyword parser; optional LLM online
Location servicesGPS + trauma-tier routing + Trip Info corridor (planned)
Valid contactsVerified phones in DB; “unverified” if missing — never fake hospital as 108

Submit: GitHub, emergency_seed.db, 7 slides, Word doc, working APK demo.

4. System architecture

flowchart TB subgraph mobile [novadrive-mobile] J[Journey GPS HUD] FSM[START FSM] DB[(SQLite POI)] GHP[GHP + QR] J --> FSM --> DB --> GHP end subgraph relay [Bystander] QR[Scan QR] --> SMS[SMS 108] end GHP --> QR

5. Design system — Night-Highway HUD

Tone: Calm, authoritative, night-driving HUD. Not panic red fullscreen loops.

TokenHexUse
Background#0B1220App bg
Surface#151D2ECards
Surface 2#1C2636Inputs
Border#2A3A52Dividers
Text#E8EDF4Primary text
Muted#8B9BB0Secondary / grey lines on splash
Amber#FBBF24Primary CTA, logo accent
Cyan#22D3EEOnline, GPS, coords
Safe green#6EE7B7GREEN triage
Urgent#FB7185RED triage, SOS (sparingly)

Typography (refinement)

  • Display / logo: Barlow Condensed or DM Sans Bold
  • Body: DM Sans
  • GHP / dispatch: JetBrains Mono
  • Accessibility slider: 100%–145% font scale (planned R3)

Components

ComponentVariants / rules
NovaButtonprimary (amber), secondary, ghost, danger — min height 48dp
SeverityChipRED/YELLOW/GREEN/BLACK — always text + color
ProgressRailLocate → Triage → Route → Packet → Relay
HoldSOSButtonHold 1.5s — not tap
DispatchCardMonospace GHP block
FacilityCardDistance km, tier, verified badge
CrashCandidateModalCalm 15s — no auto action at 0
NovaLogo (planned R1)SVG highway + pulse mark

6. Screen inventory

6.1 Onboarding (current + planned)

Splash — CURRENT → REFINEMENT R1

CURRENT: Text “Margi”, tagline, grey body copy, Get started.

PLANNED: Logo animation 0.8s → wordmark → tagline → grey subline “Offline triage · trauma routing · QR relay” → Get started button fade-in.

Auth — REFINEMENT R2

CURRENT: “Email optional”, Continue as Guest, Continue.

PLANNED: Email (required for Login), “Continue with email”, “Continue as Guest (demo)”, footer legal line.

Medical profile

Blood type, allergies, conditions, emergency contact — stored local/Guest.

Accessibility — REFINEMENT R3

CURRENT: Toggles for large text, high contrast, reduce motion, TTS stub.

PLANNED: Slider for text size with live preview line.

6.2 Home & journey

Home — REFINEMENT R4

CURRENT: “Happy journey, Guest”, Start journey, Emergency, Scan QR, Replay onboarding.

PLANNED: Hero dashboard — greeting, hero card “Ready for the highway?”, large Start journey, secondary actions row.

Journey depart — NEW R5

Transition screen 1.2–1.8s: “Starting journey…”, animated route line, then auto-enter HUD.

Journey HUD — CURRENT

Large speed km/h, status ACTIVE, Hold for SOS (1.5s), Simulate crash, End journey.

Trip plan A→B — NEW R6

Point A (GPS) / Point B → Plan trip → scroll cards: trauma centers, accident zones, dead zones, precautions, contacts. Chat: “Ask about this route”.

6.3 Emergency flow

Locate — FIX R7

CURRENT BUG: Shows “Chennai–Trichy corridor (demo)” and facilities 800km away if user not in Chennai.

FIX: Real reverse geocode; POI bbox 100km; honest message if no local POIs.

Triage

START questions + chat “Describe emergency” → offline keywords prefill FSM.

Route

Trauma-tier sorted facilities — tap to select → Packet.

Packet

GHP monospace text + QR code (lz-string + SHA-256).

Relay

Cache for bystander, SMS 108 when online, link to Scan QR.

Scan QR (bystander)

Camera scan → verify hash → SecureStore → SMS 108.

7. Navigation map

flowchart LR splash --> auth --> medical --> a11y --> home home --> journeyDepart --> journeyHUD home --> tripPlan home --> emergencyLocate journeyHUD --> emergencyLocate emergencyLocate --> triage --> route --> packet --> relay home --> scanQR

8. START triage FSM

States: AMBULATORY → BREATHING_CHECK → AIRWAY_REPOSITION → RESPIRATORY_RATE → PERFUSION_CHECK → MENTAL_STATUS → TAGGED

ConditionResult
Can walkGREEN
Airway failsBLACK
Airway OK after reposition→ RR check (NOT instant RED)
RR > 30RED
Bad perfusionRED
No commandsRED
All pass, non-ambulatoryYELLOW

9. Golden Hour Packet

MARGI GHP
Triage: RED
Location: NH48 km 87 (13.08270, 80.27070)
Facility: Apollo Highway Trauma (~12km, ~18min)
Phone: 044-27428888
Hash: nd-a3f2c891

QR: ND1: + lz-string compressed JSON { id, triage, lat, lng, integrity }.

10. Journey & CrashEngine

RuleValue
Active whenJourney status = ACTIVE only
Speed before> 25 km/h
Accel peak> threshold in 8s window
Speed after< 5 km/h
On trigger15s calm dialog — user confirms — NO auto 108
JudgesSimulate crash button
Scream / voice crash: NOT in scope — battery, privacy, false positives. Optional P1 push-to-talk on SOS only.
Phone throw on desk: Will NOT trigger (no 25 km/h). Use Simulate crash for demo.

11. Trip Info cards (R6)

Card typeContent
Route summaryDistance, est. time A→B
Trauma centers en routeTop 3 from SQLite along corridor
Accident-prone zonescorridor_hazards table
Low-network zonesdead_zones table
PrecautionsNight, rain, NH rules
Contacts108 + verified hospital

12. AI chatbot

  • Emergency flow: offline keywords → FSM slots
  • Trip flow (R6): keywords → show relevant cards
  • Online optional: LLM fills slots only — never overrides triage

Keywords: can't walk, not breathing, unconscious, breathing fast, weak pulse, etc.

13. Refinement plan — FULL SPEC (R1–R9)

Status: Design / planning only — do not code until you say go or continue. Builds on P0 shipped in novadrive-mobile/ (Expo SDK 54).

13.0 Executive summary

P0 proved the medical spine (START FSM, GHP, QR relay, airplane mode). Refinement covers: brand splash, auth/accessibility UX, Happy Journey home, journey transition, Trip Info (A→B) for judges, real GPS + sensible routing distances, CrashEngine tuning, cohesive UI pass.

Out of this pass: always-on scream/voice crash (battery, privacy, false positives); production Supabase auth (stub only); NGO marketplace, OS crash APIs (P2).

13.1 Your feedback → mapped work

#Your askRoot cause todayPhase
1Splash: logo popup, tagline, Get StartedText-only splash, no motion/brand markR1
2Real email + Login; accessibility slider“Email optional” + toggle not sliderR2, R3
3Happy Journey home; Start → transition → HUDPlain home + abrupt navigationR4, R5
4Trip info A→B + chatbot retrievalP1 deferred; not builtR6
5Real location; facilities not 800 km awayHardcoded NH48 landmark; POI seeded Chennai onlyR7
6UI inspiration / reference imagesMinimal components beyond tokensR9
7Scream on loud sound; crash on phone throwScream not implemented; CrashEngine too strictR8
8Replay full onboarding from splashAdded “Replay onboarding” on homeKeep

13.2 Design direction (locked)

  • Aesthetic: Night-Highway HUD — calm, not panic. Navy, amber actions, cyan for online/live.
  • Motion: One hero moment per flow (splash reveal, journey handoff). Respect reduceMotion.
  • Typography: Barlow Condensed or DM Sans (display); DM Sans (body); JetBrains Mono (GHP).
  • Logo (in-app SVG): Highway lane + pulse node in shield/hex; wordmark Nova (white) + Drive (amber); 2s scale + fade on splash.

13.3 Phase R1 — Splash screen

Sequence (~2.5s before button enabled):

  1. 0–0.8s: Logo mark scales in (spring), subtle amber glow ring
  2. 0.8–1.4s: Wordmark “Margi” fades up
  3. 1.4–2.0s: Tagline: “Signal drops. The critical minute doesn’t.”
  4. 2.0s+: Grey subline: “Offline triage · trauma routing · QR relay for 108”
  5. Get started button fades in (primary amber)
FileChange
app/splash.tsxReanimated sequence; use NovaLogo
src/components/NovaLogo.tsxNew — SVG mark + wordmark

Acceptance: First launch feels like a product; reduceMotion skips animations; Get started → /auth.

13.4 Phase R2 — Sign-in

  • Email field required (valid format)
  • Primary: Continue with email (stores in profile; Supabase later)
  • Secondary: Continue as Guest (demo) for judges
  • Footer: “No password stored on device.”

13.5 Phase R3 — Accessibility slider

  • Replace boolean “Larger text” with slider 100% → 145%
  • Live preview: “Can the injured person walk?”
  • Persist a11y.fontScale; ScreenShell applies globally
  • High contrast toggle unchanged

13.6 Phase R4 — Home (“Happy Journey”) hero

  • Top: Nova mark + time-of-day greeting (Good evening, Guest)
  • Hero card: “Ready for the highway?” + golden hour / offline subcopy
  • Large Start journey CTA
  • Secondary: Emergency · Scan QR
  • Tertiary: Replay onboarding (existing)
  • Optional chip: last journey / POI count in region

Note: Start journey does not start GPS yet — only after R5 transition.

13.7 Phase R5 — Journey transition → HUD

Home [Start journey]
  → /journey/depart (new, 1.2–1.8s)
      “Starting journey…” + route line anim + progress bar
  → /journey (HUD, auto-start GPS + CrashEngine)
FileChange
app/journey/depart.tsxNew — Reanimated transition
app/home.tsxNavigate to depart, not journey directly
app/journey.tsxOn mount: startJourney() if not ACTIVE

13.8 Phase R6 — Trip Info (A → B)

New screen /trip/plan from Home before Start journey.

FieldBehavior
Point ADefault = current GPS; editable
Point BText / preset corridors (Chennai → Trichy)
Plan tripBuilds corridor briefing cards

Briefing cards (scroll): Route summary · Trauma centers en route (top 3) · Accident-prone zones (corridor_hazards) · Low-network zones (dead_zones) · Precautions · Emergency contacts (108 + verified hospital).

Chatbot: “Ask about this route” — offline keywords → cards; online LLM only selects cards, text from DB.

corridor_hazards (id, name, lat, lng, severity, nh_code, note);
dead_zones (id, name, lat, lng, radius_km, note);

13.9 Phase R7 — Real location (fix 800 km bug) — BUILD FIRST

Current bugs: locate.tsx forces landmark: 'Chennai–Trichy corridor (demo)' and NH48 km 87. POI DB centers Chennai (~13.08, 80.27) — users elsewhere see facilities hundreds of km away.
FixDetail
A. Reverse geocodeexpo-location geocode OR offline NH lookup
B. Remove demo stringsCity/district from geocode; NH km only if matched
C. Bbox filterOnly POIs within 100 km; honest message if none
D. Regional POI seedingestCorridors.py for user’s state or Overpass on first online launch
E. Cap displayWarn if facility > 150 km: “Outside offline pack — verify by phone”

13.10 Phase R8 — CrashEngine & scream (honest scope)

ApproachVerdict
Always-on mic + scream MLRejected — battery, privacy, false positives
Push-to-talk “I need help”P1 optional
Accel + speed crashKeep — honest for hackathon

Why phone throw fails: Requires speed before >25 km/h AND accel peak >~2.8g AND speed after <5 km/h. Sofa drop: speed ≈ 0 → by design no crash. Use Simulate crash for judges.

Tuning: Driving mode keeps gates; Dev overlay shows accel peak; High sensitivity lowers accel to ~2.0g (lab only).

13.11 Phase R9 — UI polish

  1. Share reference images in docs/design/refs/
  2. Extract spacing, radius, icon style, CTA hierarchy
  3. Apply via NovaButton, ScreenShell, FacilityCard, ProgressRail, DispatchCard
  4. Test 5.5" and 6.7" Android; safe areas; 48dp touch targets

13.12 Recommended build order

OrderPhaseEst.Why
1R7 Real GPS + POI bbox2dWrong distances kill trust
2R1 Splash + logo1dBrand entrance
3R2 Auth0.5d
4R3 A11y slider0.5d
5R4 Home hero1d
6R5 Journey transition1d
7R6 Trip Info A→B2dJudges wow
8R8 CrashEngine tune1d
9R9 UI pass2dLast

Say go for full refinement or go slim to skip R6 (R1–R5, R7, R8 only, ~4–5 days).

13.13 Files touched (estimate)

AreaNewModified
Splash / brandNovaLogo.tsxsplash.tsx
Auth / a11yauth.tsx, accessibility.tsx, ScreenShell.tsx
Home / journeyjourney/depart.tsx, trip/plan.tsxhome.tsx, journey.tsx
Location / POIgeocode.tslocate.tsx, facilitiesDb.ts, ingestCorridors.py
Trip / chattripBriefing.ts, parseTripQuery.tsAppContext.tsx
CrashcrashEngine.ts, dev overlay

13.14 Before you say go — decisions needed

  1. Reference images in repo or linked (3+ screenshots)
  2. Logo: in-app SVG (fast) vs external PNG (Anti-Gravity)
  3. Your region for POI seed priority (state/highway)
  4. Trip Info: full R6 vs slim static NH48 corridor only
  5. Scream: confirm reject for May vs P1.5 push-to-talk on SOS only

13.15 Refinement sprint acceptance

  • Full onboarding replay: splash animation → auth → medical → a11y slider → home hero
  • Start journey → transition → HUD
  • Trip plan A→B shows corridor cards (if R6 in scope)
  • Real GPS; nearest facility distance believable
  • Airplane mode test still passes
  • npm test FSM tests still pass

14. P0 shipped — file map (novadrive-mobile)

PathPurpose
app/splash.tsxOnboarding entry
app/auth.tsxGuest / email stub
app/medical.tsxBlood type, allergies, emergency contact
app/accessibility.tsxA11y toggles (slider planned R3)
app/home.tsxHappy journey hub + replay onboarding
app/journey.tsxGPS HUD, Hold SOS, Simulate crash
app/emergency/locate.tsxGPS capture (demo landmark bug)
app/emergency/triage.tsxSTART FSM + chat
app/emergency/route.tsxTrauma-tier facility list
app/emergency/packet.tsxGHP + QR
app/emergency/relay.tsxBystander cache + SMS 108
app/scan.tsxQR scan bystander flow
src/lib/startTriageFSM.tsMedical decision machine
src/lib/ghp.tsGHP build, lz-string QR, SHA-256 (expo-crypto)
src/lib/facilitiesDb.tsSQLite ~50 POIs Chennai corridor
src/lib/crashEngine.tsAccel + speed fusion
src/lib/parseEmergencyText.tsOffline keyword → FSM slots
src/context/AppContext.tsxJourney, crash dialog, triage, GHP state
src/theme/colors.tsNight-Highway HUD tokens

15. Known bugs & limitations (today)

IssueImpactFix phase
Locate shows Chennai–Trichy demo landmarkJudges see fake locationR7
POI DB Chennai-only800+ km distances elsewhereR7
Phone throw won’t trigger crashNeeds driving speed contextR8 / use Simulate
Scream detectionNot implemented (by design)Rejected / P1.5 optional
Onboarding skips splash after first runAsyncStorage nd_onboardedReplay onboarding button

16. What we rejected

PWA-only core demo · always-on scream ML · auto-dial at crash 0s · background GPS like Uber · BLE mesh · Base64 SMS to 108 · fake OS crash APIs · dummy buttons · NGO marketplace (P2)

17. Tech & repo

novadrive-mobile/     Expo SDK 54, Expo Router (PRIMARY)
novadrive/            Next.js mirror
docs/                 Plans + this PDF source
scripts/              ingestCorridors.py → POI DB

18. Demo & tests

90s script: Problem → Journey → Simulate crash (calm) → SOS → Triage RED → GHP + QR → Airplane mode → Second phone scan → SMS.

Replay onboarding: Home → “Replay onboarding (from splash)”.

Run: npm run start:tunnel in novadrive-mobile (hotspot); Expo Go SDK 54.

19. Glossary

TermMeaning
STARTSimple Triage And Rapid Treatment
GHPGolden Hour Packet for 108
FSMMedical decision state machine
Trauma tier1=best trauma center … 3=clinic
RelayBystander QR handoff
RoadSoSHackathon track
Rah-VeerMoRTH ₹25k Good Samaritan (P1)

20. Related documents