Skip to content

Three Layers of Data — Static, Periodic & Live

Three Layers of Data — Static, Periodic & Live

Section titled “Three Layers of Data — Static, Periodic & Live”

Not all data on a river page is the same.

Some facts about a river never change. Some change slowly — weekly or monthly. Some change by the minute.

If we treated all three the same way, we would either update the site constantly (exhausting and error-prone) or leave time-sensitive data permanently stale (useless and misleading).

Instead, Our Rivers uses three clearly separated data layers. Each layer has its own source, its own update frequency, and its own rendering strategy.


LayerTypeUpdate frequencyWho owns itExample fields
Layer 1StaticRarely — only on verified correctionsNadikosh editorial teamriver_name, length_km, origin_point, zone
Layer 2PeriodicWeekly — automated cron rebuildNadikosh DB + cronpollution_index, avg_annual_flow_cumecs, last_data_updated
Layer 3LiveReal-time — by the minuteTriveni-net (external)DO, BOD, turbidity, current flow rate

These layers never mix. A field belongs to exactly one layer.


Static data is the bedrock.

Facts like where a river begins, how long it is, which states it flows through — these do not change unless there is a genuine error or a rare political event (like a state bifurcation changing which state a river flows through).

Static data is entered by a contributor, verified by an editor, and then left alone.


Some facts about a river change over time — slowly, but they do change.

A river’s pollution level might worsen after an industrial discharge event. Average flow readings shift across seasons and years. A new monitoring station might come online.

We do not update these facts in real time — that would require the site to rebuild constantly.

Instead, the site rebuilds once a week from the latest database state. Every river page then shows a small badge that says when it was last updated.

You might see: “Data last updated: 4 days ago”

This is honest. It tells the reader exactly how fresh the data is without pretending it is live when it is not.


Triveni-net: Early Phase

Live data is the most ambitious layer.

Imagine visiting a river page and seeing a small strip at the top that shows — right now, updated minutes ago — the dissolved oxygen level at the nearest sensor, the turbidity of the water, and the current flow rate.

Like a live subscriber counter on a YouTube channel, but for a river’s health.

That is what the live layer will eventually be. For now, it is reserved space — the component is there, but it shows “data coming soon” until Triveni-net is connected.


  1. Cron job triggers
    A scheduled task runs once a week (exact day configurable).
    It sends a rebuild signal to the Astro deployment pipeline.

  2. Astro queries the database
    At build time, Astro queries the full rivers table in Postgres.
    Every row is fetched. Every field is read.

  3. Pages are regenerated
    For each river row, all 7 sub-pages are regenerated using the latest field values.
    The last_data_updated field is read and converted to a relative timestamp badge (“last updated 3 days ago”) at render time.

  4. Static pages are unchanged
    Pages that do not read from the DB — blueprint files, zone stubs, /misc pages — are rebuilt from their source files unchanged.

  5. Deployment
    The freshly built site replaces the previous version.
    Readers visiting the site now see the latest periodic data without any manual intervention.


What each layer looks like on a river page

Section titled “What each layer looks like on a river page”

When all three layers are active, a river’s health.mdx page will show:

health.mdx — data rendering order (top to bottom)
[Layer 3] TriveniLiveStrip component
→ Live DO, BOD, turbidity readings
→ Updated in real time by Triveni-net
[Layer 2] Pollution index badge
→ colour-coded: low / moderate / high / critical
→ "Last updated 4 days ago" timestamp
[Layer 2] Main pollution sources
→ List pulled from DB at last cron build
[Layer 2] Known hotspot stretches
→ List pulled from DB at last cron build
[Layer 1] River identity context
→ Zone, type, states covered — static, never stale

The layers stack visually: live data at the top, periodic data in the middle, static context at the bottom. Freshness decreases as you scroll — the most time-sensitive information is always first.


Continue reading: How to Build the POC →