Unified Prefetch Architecture β v5.1 Design
The Coach GPT App now runs on a unified prefetch architecture that separates data retrieval, normalization, and semantic report generation across Cloudflare and Railway. This ensures deterministic output, fixed schema contracts, and verifiable data lineage from Intervals.icu.
βοΈ Current Operational Pipeline
ββββββββββββββββββββββββββββββββ
β ChatGPT / CLI App β
β (Tool invocation layer) β
βββββββββββββββ¬βββββββββββββββββ
β HTTPS tool call
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β π©οΈ Cloudflare Worker (Edge) β
β β’ Auth + routing proxy β
β β’ Handles ?start/?end normalization β
β β’ Prefetches Intervals data β JSON context β
βββββββββββββββ¬βββββββββββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β π Railway Backend (FastAPI) β
β β’ Tier-0: Prefetch normalization β
β - DataFrame coercion + baseline columns β
β - Empty-source detection + AuditHalt β
β β’ Tier-1: Activity & wellness validation β
β - moving_time filtering, zero-checks β
β β’ Tier-2: Aggregation + enforcement β
β - Totals reconciliation, variance checks β
β β’ Outputs URF v5.1 Semantic JSON β
βββββββββββββββ¬βββββββββββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββ
β Intervals.icu API β
β (authoritative source) β
ββββββββββββββββββββββββββββββββ
π Cloudflare handles authentication, routing, and optional synthetic testing.
π Railway performs full computation, validation, and serialization.
π§© Architecture Guarantees
| Area | Implementation | Guarantee |
|---|---|---|
| Prefetch Flow | Cloudflare normalizes date params and injects optional test payloads | Safe staging tests without real data |
| Execution Model | Python execution on Railway (FastAPI + Pandas) | Deterministic, audited output |
| Tier-0 Validation | Baseline column checks (`moving_time`, `distance`, etc.) | No schema drift or missing fields |
| Tier-1 Audit | Filters invalid / null activities, computes daily summaries | Enforced numeric consistency |
| Tier-2 Enforcement | Lock totals, enforce logical consistency | No variance bleed between scopes |
| Serialization | Single-pass semantic JSON (no float loss) | Stable numeric precision |
| Observability | Structured logs at all Tier boundaries | Traceable audit chain (lightβfullβwellness) |
| Schema Version | URF v5.1 unified contracts | Cross-version compatibility with GPT tool API |
π¬ Contact
For integration, customization, or coaching inquiries, connect via GitHub link below or DM via Intervals.icu DM and contribute in Intervals.icu Forum.
github.com/revo2wheels
Built with β€οΈ for endurance athletes β by Clive King.
Powered by Intervals.icu, Cloudflare and the Railway Engine.