Back to Home

Build Log #3: Week 2 — Tools & Calculators

By Picking Solutions AdminFebruary 3, 20269 min read
Build Log #3: Week 2 — Tools & Calculators

Week 1 gave us a blog and a data pipeline. Week 2 was about utility — giving visitors a reason to come back beyond reading articles. The thesis: market intelligence platforms need interactive tools, not just passive content.

Battery Revenue Calculator

The UK energy market has a peculiar feature: battery storage operators can earn revenue by arbitraging price differences throughout the day. Buy electricity when it's cheap (overnight, during high wind), sell when it's expensive (evening peak). The maths is straightforward but tedious to do manually.

We built a calculator that lets you input battery capacity (MW/MWh), efficiency, degradation rate, and market participation strategy — then shows projected annual revenue using real wholesale price data from the Elexon API.

Technical detail: the calculator pulls from our electricity_system_prices table (populated by the UK Energy Collector task, running every 6 hours via the Elexon API). Half-hourly settlement prices, 48 data points per day. The calculator runs the arbitrage simulation across actual historical data, not hypothetical curves.

Building it with DeepAgent was a good test of AI-assisted development for domain-specific tools. The AI could handle the React components and API routes flawlessly. The energy market logic — settlement periods, Triad avoidance, capacity market obligations — required human domain knowledge. That's the pattern: AI handles the engineering, the human provides the domain expertise.

Home Energy Savings Tool

For the consumer-facing side: a tool that estimates how much a UK household could save by switching tariff, adding solar panels, or installing a home battery. Less technical than the commercial calculator, but more accessible.

The interesting challenge was presenting complex multi-variable calculations (electricity unit rate, standing charge, solar generation profile, export tariff, battery cycling losses) in a UI that felt simple. Progressive disclosure: basic inputs upfront, advanced options behind an expand button.

The Prices Ticker

A real-time (well, near-real-time) scrolling ticker showing current electricity wholesale prices, gas prices, carbon intensity, and key crypto/traditional market data. Positioned at the top of the Lumen dashboard pages.

Data sources: Elexon API for electricity, National Grid ESO for carbon intensity, CoinGecko for crypto, Yahoo Finance API for traditional markets. All flowing through our /api/lumen/collect/all endpoint into dedicated database tables.

The ticker was an exercise in data freshness. Each data source has different update frequencies — half-hourly for settlement prices, every 30 minutes for carbon intensity, variable for crypto. We display the last-updated timestamp for each data point so users know exactly how fresh their data is.

The Insights Page

With multiple data sources flowing, we built the /insights page — a dashboard of 16 widgets covering energy generation mix, carbon intensity trends, crypto market overview, DeFi metrics, and more.

Each widget is a self-contained component that fetches its own data and handles its own loading/error states. This was a deliberate architectural choice: widgets can fail independently without bringing down the page. If the CoinGecko API is slow, the energy widgets still render instantly.

16 widgets sounds like a lot. It is. Some worked perfectly from day one. Others (the MAG-7 froth gauges, the VIX formatting — hi, GLB-012 and GLB-013) needed multiple iterations to get right. The lesson: dashboards are deceptively complex. Each widget is simple; the orchestration of 16 of them is not.

Infrastructure Growing Pains

By the end of week 2, we had 6 scheduled tasks running, 25+ Prisma models, and data tables that were growing by thousands of rows per day. The database was handling it fine (PostgreSQL doesn't flinch at this scale), but the codebase was getting unwieldy.

Key refactoring decisions:

    • Shared API utilities — authentication checks, error handling, response formatting extracted into helper functions
    • Component library — cards, badges, stat displays extracted into reusable UI components
    • Data transformation layer — Prisma returns uppercase relation names (Category, User); components expect lowercase (category, author). We added a transformation step rather than fighting the ORM.

Week 2 Numbers

New pages: 5 (Battery Calculator, Home Savings, Insights, individual tool pages). New API routes: 8. New scheduled tasks: 2 (Market Data Collector, content pipeline updates). Database tables: 25+. Total intelligence items: ~1,200. Blog posts: 40+ (mix of manual and imported).

The platform was starting to feel like a platform, not a blog with pretensions.

Next: Week 3 — Premium Lumen & Convergence Pillars →

Tags:

build-logtoolsenergycalculators

Recommended Reading