File size: 2,141 Bytes
e02ef7a
199bfa3
 
 
 
e02ef7a
199bfa3
e02ef7a
 
 
199bfa3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: CSH2 DELPHI  Pump Analytics
emoji: ⚙️
colorFrom: yellow
colorTo: gray
sdk: docker
app_file: app.py
pinned: false
---

# CSH2 DELPHI -- Pump Analytics Dashboard

Interactive Streamlit dashboard for the CSH2 cryogenic hydrogen pump test platform.
Connects to TimescaleDB for real-time and historical sensor analytics across 74 sensors,
with LLM-powered diagnostic analysis via Claude API.

## Pages

1. **Data Explorer** -- Browse sensor time-series with NL query support (ask in plain English)
2. **Testing Cycles** -- Browse pre-computed pump test cycles with summary metrics
3. **Cycle Detail** -- Deep-dive into a single cycle with multi-sensor overlay plots
4. **Variation Analysis** -- LLM-powered analysis of within-cycle stabilizations and variations
5. **Cycle Comparison** -- Side-by-side comparison of two cycles with LLM diagnostic commentary
6. **Advanced Data Explorer** -- NL-to-SQL analytical pipeline with structured operation execution

## Secrets (Required)

Set these as Space Secrets in the HuggingFace Space settings:

| Secret | Description |
|--------|-------------|
| `DB_HOST` | TimescaleDB hostname |
| `DB_PORT` | Connection port |
| `DB_NAME` | Database name |
| `DB_USER` | Read-only database user |
| `DB_PASSWORD` | Database password |
| `ANTHROPIC_API_KEY` | Claude API key (optional -- pages 1-3 work without it) |

Without `ANTHROPIC_API_KEY`, the NL query parser (page 1), variation analysis (page 4),
cycle comparison (page 5), and advanced explorer interpretation (page 6) will show a
graceful fallback message. All data browsing and charting works without it.

## Architecture

- `core/config.py` -- Reads secrets from `st.secrets` (Streamlit Cloud / HF Spaces) first, falls back to `os.environ` / `.env`
- `core/db_connector.py` -- Singleton PostgreSQL connector with smart table routing (raw / 1sec / 15sec aggregates)
- `analysis/` -- LLM analyzer, NL-to-SQL parser, domain knowledge YAML retriever, cycle detection
- `ui/` -- Custom HUD-themed components, Plotly chart builders, CSS injection
- `pages/` -- Streamlit multi-page app (6 pages)

Built for Clear Skies Hydrogen (CSH2).