Future Idea Comments

This commit is contained in:
fraxle
2026-05-18 20:38:19 +01:00
parent 9e810e2f8d
commit 31233c713f
4 changed files with 341 additions and 0 deletions
+80
View File
@@ -81,6 +81,46 @@ export function buildHourlyRows({ forecast, airQuality, location, vehicleType, v
const mugwortPollen= getAq('mugwort_pollen', iso);
const olivePollen = getAq('olive_pollen', iso);
const ragweedPollen= getAq('ragweed_pollen', iso);
// ── FUTURE FEATURE: Activity "What If" Modifier ───────────────────────────
// Add two extra columns driven by a user-selected activity level. These are
// intentionally kept SEPARATE from the core columns above so that baseline
// profile data stays consistent and comparable across profiles.
//
// The user picks an activity from a simple UI picker (no live data needed —
// this is a forecast/planning tool, not a tracker):
// Resting → Walking → Cycling → Running → Sport/Intense
//
// Two output columns only (keep it clean):
//
// adjustedSafeTime — baseline UV safe exposure time × an activity multiplier.
// Higher activity = shorter safe time, because:
// • metabolic heat raises core body temp
// • sweating washes away sunscreen faster
// • more skin blood flow = higher UV sensitivity
// Suggested multipliers (tune with real data):
// Resting: 1.0 (no change)
// Walking: 0.85
// Cycling: 0.75
// Running: 0.60
// Sport: 0.50
//
// heatStressLevel — a simple label: 'Low' | 'Moderate' | 'High' | 'Very High'
// Derived from UTCI + activity heat load. A runner at
// UTCI 28°C should read 'High' even if a resting person
// would read 'Moderate' at the same UTCI.
// Colour code in the UI: 🟢 🟡 🟠 🔴
//
// Implementation sketch:
// 1. Accept `activityLevel` as a new param to buildHourlyRows() alongside
// vehicleType, buildingType etc.
// 2. Define ACTIVITY_PRESETS in utils.js (multiplier + utciOffset per level).
// 3. Compute adjustedSafeTime = baseSafeTime * preset.multiplier
// 4. Compute heatStressLevel from (utci + preset.utciOffset) banded into labels.
// 5. Add both fields to the returned row object below.
// 6. In components.js, render these as optional columns that only appear when
// an activity other than 'Resting' is selected — keeps the default table clean.
// ─────────────────────────────────────────────────────────────────────────────
return {
iso, dt, Ta, RH, dew, va, wd, gust, dir, dif, glob,
cc, ccLow, ccMid, ccHigh, cloudCat,
@@ -114,5 +154,45 @@ export function buildHourlyRows({ forecast, airQuality, location, vehicleType, v
day.rows.push(row);
});
// ── FUTURE FEATURE v2: Today Summary + Alert System ──────────────────────────
// After grouping rows into days, generate a per-day summary object that powers
// a stylish "Today at a Glance" panel shown above or below the main dial.
//
// The summary is NOT a live alert/push system — it's a forecast digest that
// refreshes with the forecast data. Think of it as a smart briefing card.
//
// WHAT TO COMPUTE (per day, from that day's rows):
// • Peak UTCI+P and time it occurs → heat stress headline
// • Min UTCI+P and time → cold stress headline
// • Peak UV index and time → UV warning
// • Max precipitation rate and time → rain/ice warning
// • Max vehicle cabin temp → "dangerous to leave pets/children in car"
// • Max pollen level + type → pollen advisory
// • Road condition risk (low air temp + precip → ice risk)
//
// ALERT CATEGORIES (each generates a styled warning card if threshold exceeded):
// 🌡️ Heat warning UTCI+P > 32°C
// 🥶 Cold warning UTCI+P < 0°C
// ☀️ UV warning UV index > 6
// 🌧️ Heavy rain precip > 4mm/h
// 🧊 Ice/road risk Ta < 3°C + any precip (or recent precip overnight)
// 🚗 Vehicle danger vehicleT > 35°C ("don't leave pets or children in car")
// 🌿 High pollen any pollen type > 50 grains/m³
//
// DESIGN NOTES:
// • Cards should be concise — one line of bold text + a short explanation
// • Colour-coded to match the existing UTCI stress band palette
// • Collapsible — show top 2-3 alerts by default, expand for full list
// • For today only (days[0]); optionally extend to day tabs in a later pass
// • The "X°C above seasonal norm" historical context line (see app.js comment)
// could live here too, as a subtle subheading under the dial temperature
//
// Suggested return shape — add to the return value below:
// daySummaries: days.map(day => buildDaySummary(day.rows))
//
// where buildDaySummary() is a new helper in this file (or a separate
// summary.js module if it grows large).
// ─────────────────────────────────────────────────────────────────────────────
return { hourlyRows, days, utcOffsetMs };
}