How it works

Evidence, not reassurance.

Nayki turns real-world signals into a risk level you can read, with the reasons beside it. This page explains the rules the backend follows and the shape of the system.

The risk model

Four levels. No "safe".

Every route and area gets one of these, plus the numbers that explain it.

  • lower_riskThe evidence points to fewer concerns. It is not a promise.
  • moderate_riskSome concerns show up in the evidence.
  • higher_riskSeveral concerns show up, or a strong one does.
  • unknownThere is not enough evidence to say anything.

Fig. 3 How one route's level is built. Four signals fill the bars and the level and a confidence value follow. With no data at all the result is unknown, never safe. The values shown are examples, not real data.

Every answer carries its evidence

Four numbers and a list of reasons.

01

confidence

From 0.0 to 1.0. How far to trust the level.

02

evidence_count

How many records stand behind the answer.

03

coverage_status

unavailable, limited, moderate or strong.

04

risk_reasons

The named reasons behind the level, from a fixed list.

  • poor_lighting
  • recent_incident
  • isolated_road
  • limited_data
  • help_far_away
  • night_time
  • government_data
  • user_reports_unverified

When no evidence exists, the backend must return coverage_status: "unavailable", low confidence and a null score. It must never invent a high-safety claim to fill the gap.

Architecture

An app, an API, a spatial database.

  1. Android app

    Kotlin and Jetpack Compose. Search, compare routes, see help nearby, report, trigger SOS.

  2. FastAPI service

    Python 3.12, Pydantic v2, SQLAlchemy 2. Auth, routes, places, safety, incidents, SOS and privacy endpoints.

  3. Postgres with PostGIS, and Redis

    Spatial data on an H3 grid at resolution 9, with Redis for caching.

  4. Outside sources

    Clients for Google Places and Routes, GraphHopper, OpenStreetMap Overpass and Firebase push.

Privacy rules in the code

Built to know less about you.

01

No coordinates in logs

Exact latitude and longitude are stripped by log processors. Only H3 cells or general regions may be logged.

02

Hashed audit trail

Client IP addresses are hashed with SHA-256 before they reach the audit table.

03

Aggregated nearby data

Nearby incidents are grouped onto H3 cells, so people who report a hazard are not pinpointed.

04

Export and delete

Endpoints for exporting your data and deleting your account, with device tokens revoked.

API surface

What the backend exposes.

AreaPathPurpose
Health/healthService status.
Auth/authSign-in with Firebase tokens. A mock bypass exists for local development only.
Profile/meProfile, emergency contacts and devices.
Places/places/search, /places/helpDestination search and nearby help.
Routes/routesEvaluate and compare routes.
Safety/safetyRisk analysis and aggregated nearby data.
Reports/reportsCrowd-sourced incident reports.
SOS/sosCreate, cancel, respond to and close alerts.
Privacy/privacyData export and account deletion.