LifeOps Project (Part 6): 360° Analytics Dashboard with Multi-Dimensional Filtering, Recharts and Co

LifeOps Project (Part 6): 360° Analytics Dashboard with Multi-Dimensional Filtering, Recharts and Co

Leader ●5 ●92 ●168
calendar_today • schedule6 min read
— Originally published at datalaria.com

In Part 5 of our engineering series, we achieved a major milestone: deploying the entire LifeOps architecture 24/7 in production at zero cost ($0/month) by combining Netlify, Render, and Supabase, optimizing mobile ergonomics for smartphones, and installing the app as a native PWA.

However, once you start logging dozens of daily activities (workouts, bike rides, books read, movies watched, and Kanban tasks), a critical analytical challenge emerges: data without analysis lacks operational value.

Having 40 or 50 records in a PostgreSQL database is of little use if opening the dashboard doesn't immediately answer operational questions such as:

  • “How many kilometers did I run this month compared to last month?”
  • “What percentage of my training went into sprint intervals versus long endurance runs?”
  • “How has my daily consistency evolved, and what is my current active day streak?”
  • “How can I filter exclusively by Running to inspect average pace and calories burned without mixing in gym workouts or movies?”

In this sixth installment, we tackle the full evolution of the 360° Analytics Dashboard, addressing both the deterministic client-side aggregation design and the most notorious UX challenge of zero-cost serverless infrastructure: cloud container sleep periods (cold-starts).

💡 Try the analytics live: You can test the new 360° Dashboard with interactive data in Sandbox mode at https://datalaria.com/apps/lifeops/#/?mock=true&lang=en or log in with your Supabase account at https://datalaria.com/apps/lifeops/#/?lang=en.


1. Architecture Decision: External BI (Grafana / Metabase) vs. Native React Engine (ADR-013) ⚖️

When planning advanced charts and timeframe filters, the first engineering instinct is often to reach for established Business Intelligence tools like Grafana, Metabase, or Apache Superset. However, evaluating our requirements against our project constraints led to architectural decision ADR-013:

Evaluation Factor External BI Tool (Grafana / Metabase) Native React 19 + Recharts 3.10 Engine (Our Choice)
Multi-Tenant Security (RLS) ❌ Requires static direct database connection. Passing individual Supabase Auth JWTs requires expensive Enterprise licenses or custom proxy tokens. ✅ Perfect Isolation: consumes secure user-scoped REST endpoints protected by Row-Level Security (auth.uid() = user_id).
Infrastructure Cost ❌ Requires a separate container running 24/7 with dedicated RAM, or paid cloud plans. ✅ $0.00/month: compiles directly into the Netlify static bundle.
Sandbox Demo Mode (?mock=true) ❌ Impossible to feed an external iframe using in-memory mock state. ✅ 100% Compatibility: runs instantly with deterministic synthetic data.
Filter Latency ⚠️ Every click triggers a remote SQL round-trip to the cloud. ✅ 0 ms: the timeframe dataset filters in client memory using pure useMemo hooks.
Mobile UX & Aesthetics ⚠️ Visual disconnect from Glassmorphism Dark Mode and nested iframe scroll friction on mobile. ✅ Unified Design: seamless responsive layout tailored to our design system.
Data Flow Architecture
  1. API Layer: FastAPI REST API / Supabase PostgreSQL (GET /api/v1/activities/details?limit=200).
  2. Local Cache: Stale-While-Revalidate (SWR) cache in localStorage (lifeops_swr_v1:<user_id>).
  3. Client Engine: Deterministic Client Analytics Engine (lib/analyticsEngine.js).
  4. Control Bar: Timeframes (7D, 30D, Month, 90D, Year), period comparisons (vs. prev.), and category/subcategory drill-downs.
  5. Visual Suite: 4 dynamic KPI cards with Δ%, multi-metric ComposedChart time-series, PieChart donut breakdowns, and a 16-week consistency heatmap.

2. Multi-Dimensional Cascading Filters & Period-over-Period Deltas ⏱️📊

The cornerstone of the new experience is the Analytics Control Bar, enabling three levels of analytical exploration without page reloads:

Analytics Control Bar in LifeOps

A. Timeframe Resolution

The engine supports five time horizons powered by the deterministic resolveTimeWindows() function:

  1. 7 Days (week): Rolling last 7 days vs. immediately preceding 7 days.
  2. 30 Days (month): Rolling last 30 days vs. immediately preceding 30 days.
  3. By Month (calendar_month): Dynamic month selector (January to December) and year, compared against the preceding calendar month.
  4. 90 Days (quarter): Rolling last 90 days aggregated into weekly buckets.
  5. By Year (year): Full annual overview with 12 monthly buckets vs. prior year.
B. Invariant INV-8: Safe Percentage Delta Calculation (Δ%)

To compare current performance (V_curr) against the previous period (V_prev) without division-by-zero errors when starting a new discipline:

  • If V_prev = 0 and V_curr = 0 → Δ% = 0% (Stable).
  • If V_prev = 0 and V_curr > 0 → Δ% = +100% (Baseline creation).
  • In any other case → Δ% = round(((V_curr - V_prev) / V_prev) * 100).
export function computeDelta(currentVal, prevVal, unit = '', language = 'en') {
  const curr = Number(currentVal) || 0;
  const prev = Number(prevVal) || 0;
  const vsLabel = language === 'es' ? 'vs. ant.' : 'vs. prev.';

  if (prev === 0 && curr === 0) {
    return { positive: true, deltaPct: 0, text: 'Stable (0% vs. prev.)' };
  }
  if (prev === 0 && curr > 0) {
    return { positive: true, deltaPct: 100, text: `+100% (+${curr}${unit} ${vsLabel})` };
  }

  const diff = curr - prev;
  const pct = Math.round((diff / prev) * 100);
  const sign = diff >= 0 ? '+' : '';
  return {
    positive: diff >= 0,
    deltaPct: pct,
    diff,
    text: `${sign}${pct}% (${sign}${diff.toFixed(1)}${unit} ${vsLabel})`,
  };
}

3. The Visual Suite with Recharts: Contextual KPIs, Time-Series & Donut Charts 📈🍩

Selecting a category or drilling down into a subcategory (for example, filtering by Sport ➔ Running) dynamically updates the entire dashboard:

360 Analytics Dashboard View

  1. 4 Contextual KPI Cards:
    • In Sport: adapt metrics to the selected discipline:
      • Sessions: workout count with Δ% badge and personal bests (PB).
      • Distance: cumulative mileage and average km per session.
      • Time & Pace: active duration and average pace (min/km in running or km/h in cycling).
      • Calories & Effort: calories burned, average heart rate (bpm), and elevation gain (+m).
  2. Multi-Metric Time-Series Chart (ComposedChart):
    • Renders current period bars color-coded by category and overlays a dashed trendline of the previous period when the ⇄ Compare vs. prev. toggle is active.
    • Built-in metric switcher: toggle on the fly between Sessions, Distance (km), Calories (kcal), Duration (h), or Elevation Gain (m).
  3. Subcategory Distribution (PieChart Donut):
    • Displays percentage and absolute shares for each activity type. Clicking any slice or legend item applies an automatic drill-down into that subcategory.

4. 16-Week Consistency Daily Heatmap (Strava / GitHub Style) 🔥🗓️

Habit formation and athletic progression rely on consistency. To provide clear visual accountability, we built a 112-day grid (16 weeks × 7 days, Monday to Sunday):

Daily Consistency Heatmap

The algorithm evaluates daily activity volume across 5 intensity tiers (level-0 to level-4) and computes in real time:

  • Active days during the evaluated window.
  • Current active streak: counting consecutive active days backwards from today or yesterday.
  • All-time best streak.

5. Overcoming the Free-Tier Cloud UX Challenge: Cold-Start Mitigation ⚡🛡️

Deploying full-stack web applications on free cloud tiers (such as Render.com's Free Web Service) introduces an unavoidable reality: the container sleeps after 15 minutes of inactivity.

When a user visits after several hours, the initial request takes 20 to 40 seconds while the virtual machine boots. In early versions, this lag produced a terrible UX: users saw blank charts and KPI cards showing 0, leading them to believe their data was lost or deleted.

To eliminate this friction while staying strictly within our $0.00/month budget, we engineered a 3-layer mitigation system:

Cloud Synchronization Banner & Cold Start Feedback

Layer 1: Silent Pre-Warming (wakeUpServer)

The moment the browser loads the SPA inside AuthContext.jsx—before the user even finishes entering credentials or navigating to the Dashboard—a non-blocking background fetch pings /health. This gives the container a 5-to-10 second head start to spin up.

Layer 2: User-Scoped Stale-While-Revalidate (SWR) Local Cache

Every read request (GET /api/v1/activities/details, /tasks, /stats/dashboard) is cached in localStorage under a strict user-prefixed key (lifeops_swr_v1:<user_id>:<endpoint>).

  • On subsequent visits, cards and charts hydrate in under 10 milliseconds (effectively 0 ms).
  • The user sees their data immediately while background network calls fetch fresh updates.
  • Any write operation (POST, PATCH, DELETE) automatically invalidates the local cache to guarantee consistency.
Layer 3: Foreground Synchronization Banner and Skeletons

If a user accesses the app from a clean browser and must wait through a cold start:

  1. Never show misleading zeros: KPI cards display waiting indicators (···) instead of 0.
  2. Transparent Status Banner: displays an animated spinner, live elapsed seconds counter (0s, 1s, 2s...), visual progress bar, and active phase badges:
    • ✓ Authenticated Session (Supabase Auth)
    • ⟳ Waking API Engine on Render Cloud
    • ⏳ Hydrating Activities & 360° Analytics
  3. If the wait exceeds 4 seconds, the banner explicitly explains that the free cloud container is spinning up and that all data is 100% safe.
  4. Automatic Timeframe Fallback: if the query returns activities but none fall within the last 30 days (e.g. after a vacation), the dashboard automatically switches to 90 Days or By Year so charts appear populated immediately.

With this update, LifeOps evolves from a plain activity logger into a full personal operations intelligence system. Combining deterministic client-side analytics with a resilient cold-start mitigation architecture proves that it is entirely possible to build fast, secure, and visually stunning software on a $0.00/month infrastructure bill.


If you enjoyed this technical breakdown, explore more open engineering articles and quantitative apps at www.datalaria.com.

Want more #webdev & #react deep dives?

Join 6,178+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

Project LifeOps (Part 2): React Frontend with Glassmorphism, 360° Dashboard, and Dark Mode Design Sy

Datalaria - Sep 13

Telemetry: Shared Analytics and Crash Reporting in Kotlin Multiplatform

kmp-bits - Oct 9

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

How to pick and measure your activation event

JustOneCX - Nov 22

Dashboard Operasional Armada Rental Mobil dengan Python + FastAPI

Masbadar - Mar 12
chevron_left
8.1k Points • 265 Badges
Spain • datalaria.com
101Posts
21Comments
33Connections
Digital Logbook: Data, AI, Tech, and the Industry.

Telecom Eng, MBA & Big Data in Defense & Securit... Show more

Related Jobs

View all jobs →

Commenters (This Week)

20 comments
7 comments
2 comments

Contribute meaningful comments to climb the leaderboard and earn badges!