Skip to content
justhashimPublic

About

Trust layer for IoT soil sensors: scores readings, flags stuck or drifting probes, opens tickets. Express + Next.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

63 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STVE

Sensor Trust Verification Engine: a trust layer that scores IoT soil-sensor readings so a stuck or drifting probe doesn't drive irrigation.

What it does

  • Ingests readings (moisture, temperature, EC, pH, plus air temperature, rain and irrigation flags) over a REST API.
  • Re-scores the sensor on every reading, per parameter, so you can see which probe is at fault.
  • Gives each score a status (Healthy, Warning, Anomalous), root-cause codes, a severity and a plain-text diagnostic.
  • Opens a maintenance ticket when a sensor goes Anomalous. One open ticket per sensor, and none for zone-wide events.
  • Dashboard with summary cards, sensor table, trust distribution chart, zones and a maintenance page.

How it works

Reading in, trust engine (backend/src/modules/trustEngine.js), score and ticket out, dashboard polls.

Each parameter gets three checks:

Check Looks for
Temporal SPIKE (jump against rolling mean), STATIC (frozen, low range over history), DRIFT (regression slope)
Cross-sensor ZONE_MISMATCH (this sensor deviates, zone neighbours don't) vs FIELD_EVENT (neighbours moved too, so it's real)
Physical IMPOSSIBLE_VALUE, WEATHER_MISMATCH (for example very wet soil with no rain or irrigation)

They combine as T_param = 0.3 * temporal + 0.5 * cross + 0.2 * physical, and sensor trust is the mean over parameters. The cross-sensor check carries the most weight on purpose: it's what separates a broken sensor from a changing field.

Other behaviour:

  • A sensor with stale or mostly-null data is SENSOR_OFFLINE, scored 0.0, severity Critical.
  • Health trend (stable, improving, degrading) comes from the slope of recent scores.
  • Scores are stored per evaluation, so history is kept and sensors can recover.
  • The score row also stores an irrigationSafe flag.

Data lives in PostgreSQL via Prisma: Sensor, Reading, TrustScore, Ticket. The dashboard polls the API every 10 to 15 seconds.

API: /api/sensors, /api/readings (and /batch), /api/tickets, /api/dashboard/summary, /zones, /activity, /api/health. There is an optional X-API-Key check and per-route rate limits.

Stack

  • Backend: Node.js, Express, Prisma 5, PostgreSQL
  • Frontend: Next.js 16, React 19, Tailwind CSS 4, Recharts

Run it locally

Needs Node.js, PostgreSQL and a database to point at.

cd backend
npm install
# create backend/.env with DATABASE_URL (see below)
npx prisma migrate dev
npm run upload            # wipes the DB, loads Dataset/Historical
npm run dev               # API on :5000

In a second terminal, simulate live readings from Dataset/Realtime:

cd backend
npm run realtime:continuous

In a third:

cd frontend
npm install
npm run dev               # dashboard on :3000

Env vars: DATABASE_URL (required). Optional: PORT, NODE_ENV, API_KEY, CORS_ORIGIN (see backend/.env.example). The frontend reads NEXT_PUBLIC_API_URL, default http://localhost:5000.

QUICK_START.md has curl examples for registering a sensor and sending a reading. Its npm run seed step points at a file that doesn't exist; use npm run upload instead.

Notes

A team project, MIT licensed (see LICENSE). Trust engine work by Alwin Johnson, dataset generation by Tinil K Benny, docs by Harikrishnan Santhosh. The datasets are generated, not real field data: 50 sensors across 5 fields, with a few spike and stuck sensors injected on purpose. The project was originally called Probos, and some scripts still say so.

About

Trust layer for IoT soil sensors: scores readings, flags stuck or drifting probes, opens tickets. Express + Next.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages