<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hospital Climate Resilience Dashboard</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); color: #fff; height: 100vh; overflow: hidden; }
.dashboard { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 80px 1fr; gap: 20px; padding: 20px; height: 100vh; }
.header { grid-column: 1 / -1; background: rgba(0,0,0,0.3); border-radius: 15px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; backdrop-filter: blur(10px); }
.header h1 { font-size: 2em; }
.status-alert { padding: 10px 20px; border-radius: 25px; font-weight: bold; }
.alert-critical { background: #ff4757; }
.alert-warning { background: #ffa502; }
.alert-ok { background: #2ed573; }
.section { background: rgba(255,255,255,0.1); border-radius: 15px; padding: 20px; backdrop-filter: blur(10px); position: relative; }
.section h2 { margin-bottom: 20px; font-size: 1.5em; }
.metric { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 10px; background: rgba(255,255,255,0.05); border-radius: 10px; }
.metric-value { font-size: 2em; font-weight: bold; }
.metric-label { opacity: 0.8; }
.chart-container { height: 200px; margin-top: 20px; }
.controls { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
button { padding: 12px 24px; border: none; border-radius: 25px; background: #00d2d3; color: white; font-weight: bold; cursor: pointer; transition: all 0.3s; }
button:hover { background: #00b7b8; transform: translateY(-2px); }
button:disabled { background: #666; cursor: not-allowed; transform: none; }
button.danger { background: #ff6b6b; }
button.danger:hover { background: #ff5252; }
.evac-status { font-size: 1.2em; padding: 15px; border-radius: 10px; text-align: center; margin-top: 10px; }
.evac-ready { background: #2ed573; }
.evac-warning { background: #ffa502; }
.evac-critical { background: #ff4757; animation: pulse 1s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }
.unified-command { grid-column: 1 / -1; grid-row: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
@media (max-width: 1200px) { .dashboard { grid-template-columns: 1fr; grid-template-rows: 80px repeat(4, 1fr); } .unified-command { grid-row: 5; } }
</style>
</head>
<body>
<div class="dashboard">
<div class="header">
<h1>🏥 Hospital Climate Resilience Dashboard</h1>
<div class="status-alert alert-ok" id="globalStatus">ALL SYSTEMS NOMINAL</div>
</div>
<!-- HVAC Redundancy Section -->
<div class="section">
<h2>🔧 HVAC Redundancy</h2>
<div class="metric">
<span class="metric-label">Primary Status</span>
<span class="metric-value" id="hvacPrimary">ONLINE</span>
</div>
<div class="metric">
<span class="metric-label">Backup Status</span>
<span class="metric-value" id="hvacBackup">STANDBY</span>
</div>
<div class="metric">
<span class="metric-label">Redundancy Level</span>
<span class="metric-value" id="hvacRedundancy">100%</span>
</div>
<div class="chart-container">
<canvas id="hvacChart"></canvas>
</div>
<div class="controls">
<button onclick="switchHVAC()">Switch to Backup</button>
<button onclick="testHVAC()">Test Redundancy</button>
</div>
</div>
<!-- Medication Cold Chain Section -->
<div class="section">
<h2>🧊 Medication Cold Chain</h2>
<div class="metric">
<span class="metric-label">Fridge Temp</span>
<span class="metric-value" id="fridgeTemp">4°C</span>
</div>
<div class="metric">
<span class="metric-label">Integrity Score</span>
<span class="metric-value" id="coldChainScore">99%</span>
</div>
<div class="metric">
<span class="metric-label">Backup Power Uptime</span>
<span class="metric-value" id="backupPower">100%</span>
</div>
<div class="chart-container">
<canvas id="coldChainChart"></canvas>
</div>
<div class="controls">
<button onclick="activateColdChainBackup()">Activate Backup Cooling</button>
</div>
</div>
<!-- Patient Evacuation Triggers Section -->
<div class="section">
<h2>🚨 Patient Evacuation Triggers</h2>
<div class="metric">
<span class="metric-label">Internal Temp</span>
<span class="metric-value" id="internalTemp">22°C</span>
</div>
<div class="metric">
<span class="metric-label">External Weather</span>
<span class="metric-value" id="externalWeather">Sunny, 25°C</span>
</div>
<div class="metric">
<span class="metric-label">Power Outage</span>
<span class="metric-value" id="powerOutage">0 min</span>
</div>
<div class="evac-status evac-ready" id="evacStatus">EVACUATION: NOT REQUIRED</div>
<div class="chart-container">
<canvas id="evacChart"></canvas>
</div>
</div>
<!-- Unified Command Interface -->
<div class="section unified-command">
<h2>🎮 Unified Command Center</h2>
<p>One-click resilience activation for all systems.</p>
<div class="controls" style="gap: 20px; margin-top: 30px;">
<button onclick="fullResilienceMode()" style="font-size: 1.2em; padding: 20px 40px;">🚀 ACTIVATE FULL RESILIENCE MODE</button>
<button class="danger" onclick="initiateEvacuation()" style="font-size: 1.2em; padding: 20px 40px;">🚑 EMERGENCY EVACUATION</button>
<button onclick="resetAll()" style="background: #ffa502;">🔄 Reset Simulation</button>
</div>
<div style="margin-top: 20px; font-size: 1.1em;">
<strong>Log:</strong> <span id="commandLog">Ready for commands...</span>
</div>
</div>
</div>
<script>
// Mock data and simulation state
let simData = {
hvacPrimary: true,
hvacBackup: false,
redundancy: 100,
fridgeTemp: 4,
coldChainScore: 99,
backupPower: 100,
internalTemp: 22,
powerOutage: 0,
weather: 'Sunny, 25°C',
evacRequired: false
};
let charts = {};
let interval;
// Initialize charts
function initCharts() {
charts.hvac = new Chart(document.getElementById('hvacChart'), {
type: 'doughnut',
data: { labels: ['Primary', 'Backup'], datasets: [{ data: [100, 0], backgroundColor: ['#2ed573', '#ffa502'] }] },
options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'bottom' } } }
});
charts.coldChain = new Chart(document.getElementById('coldChainChart'), {
type: 'line',
data: { labels: ['T-5', 'T-4', 'T-3', 'T-2', 'T-1', 'Now'], datasets: [{ label: 'Fridge Temp (°C)', data: [4, 4.1, 4, 4.2, 4.1, 4], borderColor: '#00d2d3', tension: 0.4 }] },
options: { responsive: true, maintainAspectRatio: false, scales: { y: { min: 0, max: 10 } } }
});
charts.evac = new Chart(document.getElementById('evacChart'), {
type: 'bar',
data: { labels: ['Temp', 'Power', 'Weather Risk'], datasets: [{ data: [22, 0, 10], backgroundColor: ['#ff6b6b', '#2ed573', '#ffa502'] }] },
options: { responsive: true, maintainAspectRatio: false, indexAxis: 'y' }
});
}
// Update display
function updateDisplay() {
document.getElementById('hvacPrimary').textContent = simData.hvacPrimary ? 'ONLINE' : 'FAILED';
document.getElementById('hvacPrimary').parentElement.style.background = simData.hvacPrimary ? 'rgba(46,213,115,0.3)' : 'rgba(255,71,87,0.3)';
document.getElementById('hvacBackup').textContent = simData.hvacBackup ? 'ACTIVE' : 'STANDBY';
document.getElementById('hvacBackup').parentElement.style.background = simData.hvacBackup ? 'rgba(255,165,2,0.3)' : 'rgba(255,255,255,0.1)';
document.getElementById('hvacRedundancy').textContent = simData.redundancy + '%';
document.getElementById('fridgeTemp').textContent = simData.fridgeTemp + '°C';
document.getElementById('fridgeTemp').parentElement.style.background = simData.fridgeTemp > 8 || simData.fridgeTemp < 2 ? 'rgba(255,71,87,0.3)' : 'rgba(46,213,115,0.3)';
document.getElementById('coldChainScore').textContent = simData.coldChainScore + '%';
document.getElementById('backupPower').textContent = simData.backupPower + '%';
document.getElementById('internalTemp').textContent = simData.internalTemp + '°C';
document.getElementById('powerOutage').textContent = simData.powerOutage + ' min';
document.getElementById('externalWeather').textContent = simData.weather;
const evacEl = document.getElementById('evacStatus');
evacEl.textContent = simData.evacRequired ? '🚨 EVACUATION REQUIRED!' : 'EVACUATION: NOT REQUIRED';
evacEl.className = 'evac-status ' + (simData.evacRequired ? 'evac-critical' : simData.internalTemp > 30 || simData.powerOutage > 20 ? 'evac-warning' : 'evac-ready');
// Global status
const critical = !simData.hvacPrimary || simData.fridgeTemp > 8 || simData.evacRequired;
const warning = simData.internalTemp > 30 || simData.powerOutage > 20;
const statusEl = document.getElementById('globalStatus');
statusEl.textContent = critical ? 'CRITICAL ALERT' : warning ? 'WARNING' : 'ALL SYSTEMS NOMINAL';
statusEl.className = 'status-alert ' + (critical ? 'alert-critical' : warning ? 'alert-warning' : 'alert-ok');
// Update charts
charts.hvac.data.datasets[0].data = [simData.redundancy, 100 - simData.redundancy];
charts.hvac.update();
charts.coldChain.data.datasets[0].data = [4, 4.1, Math.random()*0.5+4, simData.fridgeTemp];
charts.coldChain.update();
charts.evac.data.datasets[0].data = [simData.internalTemp, simData.powerOutage, simData.internalTemp > 35 ? 100 : 10];
charts.evac.update();
}
// Simulation loop
function startSimulation() {
interval = setInterval(() => {
// Simulate environmental stress
if (Math.random() < 0.02) simData.hvacPrimary = false; // Random HVAC failure
if (Math.random() < 0.01) simData.fridgeTemp += 0.5; // Temp drift
simData.internalTemp += 0.1 + Math.random()*0.2;
if (!simData.hvacPrimary) simData.powerOutage += 1;
if (simData.powerOutage > 0 && Math.random() < 0.1) simData.backupPower = Math.max(0, simData.backupPower - 5);
// Auto-triggers
simData.evacRequired = simData.internalTemp > 35 || simData.powerOutage > 30;
simData.coldChainScore = Math.max(0, simData.coldChainScore - 0.5);
simData.redundancy = simData.hvacBackup ? 100 : Math.max(0, simData.redundancy - 2);
updateDisplay();
}, 2000);
}
// Commands
function switchHVAC() {
simData.hvacBackup = !simData.hvacBackup;
simData.redundancy = 100;
logCommand('HVAC switched to backup.');
updateDisplay();
}
function testHVAC() {
simData.redundancy = 95;
logCommand('HVAC redundancy test passed.');
updateDisplay();
}
function activateColdChainBackup() {
simData.fridgeTemp = 4;
simData.coldChainScore = 100;
simData.backupPower = 100;
logCommand('Cold chain backup activated.');
updateDisplay();
}
function fullResilienceMode() {
simData.hvacBackup = true;
simData.redundancy = 100;
simData.fridgeTemp = 4;
simData.coldChainScore = 100;
simData.backupPower = 100;
logCommand('FULL RESILIENCE MODE ACTIVATED - All systems stabilized.');
updateDisplay();
}
function initiateEvacuation() {
simData.evacRequired = true;
logCommand('🚨 EMERGENCY EVACUATION INITIATED - Protocols engaged.');
document.getElementById('globalStatus').textContent = 'EVACUATION IN PROGRESS';
document.getElementById('globalStatus').className = 'status-alert alert-critical';
}
function resetAll() {
clearInterval(interval);
Object.assign(simData, {
hvacPrimary: true, hvacBackup: false, redundancy: 100,
fridgeTemp: 4, coldChainScore: 99, backupPower: 100,
internalTemp: 22, powerOutage: 0, weather: 'Sunny, 25°C', evacRequired: false
});
logCommand('Simulation reset.');
updateDisplay();
startSimulation();
}
function logCommand(msg) {
document.getElementById('commandLog').textContent = msg;
}
// Init
initCharts();
updateDisplay();
startSimulation();
</script>
</body>
</html>
🚀 Deployment & Features Overview
Save the code above as hospital-dashboard.html and open in any browser. It's a fully interactive, self-contained prototype—no servers needed.
Key Integrated Features:
- HVAC Redundancy: Monitors primary/backup status, redundancy %. Buttons to switch/test. Auto-fails in sim.
- Medication Cold Chain: Tracks fridge temp (2-8°C safe), integrity score, backup power. One-click backup cooling.
- Patient Evacuation Triggers: Watches internal temp (>35°C), power outage (>30min), weather. Auto-triggers evac status.
- Unified Command Interface:
- Full Resilience Mode: One button stabilizes all systems (HVAC switch + cold chain backup).
- Emergency Evacuation: Overrides to critical mode.
- Real-time charts (Chart.js), alerts, mobile-responsive grid.
- Simulation: Auto-stresses systems (random failures, temp rises) every 2s for testing. Reset anytime.
Extensibility for Production:
This ties everything into one command interface—test it under stress! Questions or mods? I'm on the case. 🕵️♂️