This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass
What I Built
Most software developers spend their working days indoors under artificial lighting, locked to an IDE, staring at screens for hours on end.
By mid-afternoon, the consequences are familiar across the tech community: eye strain, brain fog, fading focus, and a disrupted circadian rhythm that makes quality sleep an uphill battle. For years, I treated this as simply the unavoidable occupational hazard of writing code.
The real issue isn't a lack of discipline or coffeeβit's that standard indoor work environments fight against basic human biology.
The human body relies on natural daylight to set its internal circadian clock. But standard office windows filter out the specific daylight wavelengths needed to feel alert. Even sitting right next to a window, indoor lighting is rarely brighter than 400β500 luxβcompared to 10,000+ lux outdoors. To the body, sitting inside all day feels like constant twilight, draining energy and throwing off sleep.
And the tech industry's standard answer to developer burnout? Another screen. Wellness apps that demand more typing, habit trackers with endless push notifications, and weather apps that treat sunlight purely as a sunburn hazard.
I built SunSync as a direct alternative.
SunSync is a lightweight open-source daylight timing tool built with a single goal: evaluate local sunlight in under 30 seconds, give you a quick 15-second eyes-free voice brief, lock into a 20-minute outdoor breathing timer, and get you away from your desk into the fresh air.
How It Works in Practice
-
Zero-Shot Tabular ML on CPU (Prior Labs TabPFN): Instead of naive heuristics, a foundation tabular transformer (
TabPFNRegressor) fits 12 daylight hours in a single forward pass without gradient descent, evaluating solar angles, cloud cover, and irradiance to compute your best 20-minute sunlight window (e.g.,13:15 - 13:35). -
Eyes-Free Spoken Directive (Google Gemma + ElevenLabs): A 15-second spoken briefing delivers the key window and UV safety tips using ElevenLabs' low-latency
eleven_flash_v2_5model and the natural, calm Charlie voiceβturning raw telemetry into a human send-off so you don't have to keep reading a screen. - Production Grounding for Safe Health Guidance: Gemma crafts natural, encouraging dialogue, while a deterministic validation layer guarantees that safety-critical numbers (the computed window start and UV index) remain strictly grounded to the underlying physics.
- The Outdoor Breathing Lock: When you tap "I'm going outside", the UI locks into a 20-minute circular breathing timer so you can put your phone away. You focus on the horizon (never staring directly at the sun) and return to your desk refreshed and ready to code.
Demo
The app is live, publicly accessible, and deployed on Google Cloud Run with interactive OpenAPI documentation:
- π Live Web Application: https://sunsync.omar-afifi.com
- π‘ Interactive OpenAPI Specification: https://sunsync.omar-afifi.com/docs
- π» GitHub Repository: https://github.com/OmarAfifi-CSE/sunsync
Mobile-First Interface Tour (Zero Mockups)
| βοΈ 01 Β· Hero Protocol | β±οΈ 02 Β· 20-Min Sun Window | ποΈ 03 Β· Gemma Spoken Brief | πΏ 04 Β· Touch Grass Protocol |
|---|---|---|---|
|
|
|
|
| Glance card: today's window, live countdown, recharge score β the 10-second answer. | Decision card (GO NOW / Wait / Done) + UV safety bands + daylight curve to 6 PM. | Fact-verified Gemma directive with source badge (β¦ Gemma live / β‘ edge instant) + Charlie voice playback. | The outdoor commitment card: 20-minute breathing timer + auto-playing voice send-off, phone face-down. |
Every screenshot above is a raw capture from my live production deployment on Google Cloud Run - zero synthetic device frames, zero mockups.
What to Look for When Testing
The app dynamically adapts to whatever time of day you test it:
- Test Your Location or City Presets: Tap Use my location or switch between presets (Cairo, London, New York, Tokyo). SunSync calculates the solar window relative to that location's local solar clock, not your computer's clock.
-
Dynamic Real-Time States:
-
Upcoming Window (
Wait): If it's daytime before the computed peak, you'll see a live countdown ticking down to the recharge window. -
Active Window (
GO NOW): If you test during the peak window, the status badge flips toGO NOWwith live UV guidance. -
Past Window (
Done today): If the sun has set or the peak has already passed in that city, the card displaysDone todayand advises morning light tomorrowβit will never tell someone to go recharge under a dark night sky.
-
Upcoming Window (
- Listen to Charlie (Voice Briefing): Tap Listen Β· 15s brief on any location to hear the lifelike ElevenLabs voice briefing with real-time UV safety tips.
Code
The entire codebase is open-source, fully tested, and available on GitHub:
- π» GitHub Repository: https://github.com/OmarAfifi-CSE/sunsync
The project is structured around lean, modular Python services:
-
src/circadian_ml.py: Prior Labs TabPFN zero-shot Bayesian tabular regression on live CPU. -
src/gemma_service.py: Google Gemma integration paired with deterministic factual grounding (validate_directive()). -
src/audio_service.py: ElevenLabs low-latency voice synthesis viaeleven_flash_v2_5(Charlie voice). -
src/data_service.py: Ingests real-time Open-Meteo weather data (solar irradiance, UV index, cloud cover, and sun angles) to feed into TabPFN. -
src/app.py: FastAPI application instrumented with distributed Sentry tracing spans.
How I Built It
1. System Architecture & Dual-Lane Decoupling
I enforced a strict architectural principle: The user's first paint must never wait on generative AI.
βββββββββββββββββββββββββββββββ
β Live Open-Meteo Telemetry β
β(Hourly UV, Solar Irradiance)β
ββββββββββββββββ¬βββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β Feature Vector Assembly β
β (12-Hour Daylight Context) β
ββββββββββββββββ¬βββββββββββββββ
β
βΌ
[Sentry Spans] βββββββββββββββββββββββββββββββ
(Distributed) ββΊβ Prior Labs TabPFN ML Core β
(Latency Trace) β (Zero-Shot Bayesian CPU ML) β
ββββββββββββββββ¬βββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ βββ [Grounding Layer]
β Google Gemma Directive Core β (Factual Verify:
β (Natural Spoken Directive) β Window & UV)
ββββββββββββββββ¬βββββββββββββββ
β
βΌ
[Google Cloud] βββββββββββββββββββββββββββββββ
(Cloud Run) ββΊβ ElevenLabs Audio Synthesis β
(Public Host) β (Lifelike Charlie Briefing) β
βββββββββββββββββββββββββββββββ
I decoupled the execution into two asynchronous paths:
-
The Fast Lane (
/evaluate): Computes solar geometry, atmospheric vector transforms, and TabPFN scoring. Returns the deterministic solar window and recharge score immediately with an instant analytical draft. -
The Slow Upgrade Lane (
/directive&/synthesize-audio): Asynchronously generates the personalized Google Gemma voice directive and ElevenLabs audio stream, upgrading the UI quote in place without blocking interaction.
2. Prior Labs TabPFN: Foundation Tabular ML on CPU
In src/circadian_ml.py, I run the real TabPFNRegressor on live CPU. My training context is exactly 12 rowsβthe daylight operational hours of a single day (7 AM to 6 PM).
Classical ML algorithms like XGBoost or RandomForest fail here: they demand hundreds of rows, hyperparameter tuning, and cross-validation splits that don't exist in single-day telemetry. TabPFN is a prior-fitted transformer trained on millions of synthetic tabular tasks that performs Bayesian posterior inference in a single forward pass without gradient descent:
| Metric / Verification Check | Production Measured Result |
|---|---|
| Peak window reproducibility across consecutive runs | β Identical time window every run (deterministic) |
| Score variance across repeated runs | 0.00 |
| Window stability under seeded Β±5% sensor noise | β Resilient & stable (score Ξ 2.6) |
| Warm inference execution on multi-core CPU | ~1.1β1.5 s |
| Container cold initialization (one-time weight loading) | ~15β17 s (isolated to container cold boot; never blocks warm traffic) |
# From src/circadian_ml.py
from tabpfn import TabPFNRegressor
# 12 daylight rows. No gradient descent: forward pass stores tabular context
regressor = TabPFNRegressor(device="cpu", n_estimators=4)
regressor.fit(X_train_atmospheric, y_melanopic_target)
predicted_eml = regressor.predict(X_train_atmospheric)
With only 12 hourly data points per day, traditional ML models fall apart. TabPFN is built specifically for this: delivering accurate Bayesian predictions on small tabular data in under a second without overfitting or requiring hours of hyperparameter tuning.
To deploy SunSync cleanly in production, I packaged the application into an optimized container running on Google Cloud Run with 4 vCPUs and 4 GB RAM in europe-west1. Within the container runtime, I tuned PyTorch's intra-op parallelism (torch.set_num_threads(min(4, os.cpu_count()))) and configured TabPFNRegressor(n_estimators=4). This unlocks multi-core execution on the tabular transformer while preventing thread thrashing, keeping memory rock-solid and delivering consistent sub-1.5s inference on warm instances.
3. Sentry Distributed Agent Tracing: Real Production Telemetry Bands
I instrumented the entire pipeline with distributed Sentry tracing spans (ai.telemetry.ingest, ai.model.tabpfn, and ai.llm.gemma) to monitor live production performance, diagnose latency variances, and ensure pipeline health.
Rather than publishing synthetic local benchmarks, Sentry reveals the authentic behavior across live cloud conditions on Google Cloud Run:
| Span Name | Operation | Warm Production Range | Production Lifecycle Notes |
|---|---|---|---|
ai.telemetry.ingest |
Open-Meteo REST Fetch & Serialization | 70β300 ms | Live upstream solar telemetry fetch (varies with DNS & regional latency) |
ai.model.tabpfn |
TabPFN Tabular Feature Fitting & Scoring | ~1.1β1.5 s | In-memory zero-shot Bayesian regression on 4 vCPUs |
ai.llm.gemma |
Google Gemma Narrative Generation | ~1.4β2.2 s | Non-blocking slow-lane synthesis via OpenRouter/Google AI Studio |
| Fast-Lane User Delivery | /evaluate Deterministic Delivery |
~1.5β2.5 s | Immediate deterministic UI paint; zero blocking on LLM or audio generation |
What Sentry Revealed: Observability in Action
- Cold Starts vs. Warm Multi-Core Execution: In a serverless container environment like Google Cloud Run, initial container spin-up requires importing PyTorch and loading TabPFN's transformer checkpoint into memory (~15β17s on cold boot). Sentry tracing immediately surfaced this difference: once the container is warm, multi-core CPU execution consistently executes in ~1.1β1.5s. Sentry isolated container lifecycle overhead from algorithmic compute.
-
Upstream Data Hygiene: Distributed tracing caught intermittent floating-point NaNs returned by upstream weather sensors, allowing me to inject a deterministic sanitization layer (
_sanitize_float) before data reaches TabPFN. -
Dual-Lane User Protection: By tracing span durations, I verified the value of decoupling
/evaluate(the fast lane) from/directiveand/synthesize-audio(the slow lane). The user's screen renders the photobiology dashboard in ~2 seconds, while Gemma and ElevenLabs upgrade the briefing asynchronously in the background.
4. Google Gemma: Fast Generative Directives with Production Grounding
To deliver a personalized, encouraging voice brief that doesn't sound like a boilerplate weather bot, I integrated Google's Gemma 3 27B (google/gemma-3-27b-it).
Gemma excels at following concise persona instructions while maintaining a natural, empathetic tone. For SunSync's fast-paced user flow, instruction-tuned Gemma delivers punchy 15-second directives in seconds without the latency overhead of extended thinking traces.
Grounding & Health Safety Guardrails (src/gemma_service.py)
Because UV exposure and solar timing directly affect user well-being, production AI requires strict factual grounding. Gemma provides the creative, human variety, while code verifies that safety-critical numbers match reality before reaching the user:
# From src/gemma_service.py
def validate_directive(self, text: str, window_time: str, uv_index: float) -> bool:
"""
Code-decides guardrail: The model narrates, but only verified facts ship.
A candidate passes iff it repeats the computed window start AND grounds
the UV reading. Any hallucinated drift is instantly rejected.
"""
if not text or len(text.strip()) < 20:
return False
start = str(window_time).split("-")[0].strip()
if start and start not in text:
return False # Hallucinated or shifted time -> rejected
try:
uv_token = f"{float(uv_index):.1f}"
except (TypeError, ValueError):
return False
text_lower = text.lower()
if uv_token not in text and "uv" not in text_lower:
return False # Dropped or fabricated UV safety reading -> rejected
return True
This dual-layer architecture guarantees total reliability: Gemma crafts natural, motivating copy, while the verification layer ensures that the solar window and UV safety readings remain 100% faithful to the underlying telemetry. The UI displays an authentic badge indicating the exact origin (β¦ Gemma live vs β‘ edge instant).
5. ElevenLabs Voice Architecture: Screen-Free Audio Presence
Standard browser text-to-speech engines sound robotic, monotone, and clinicalβdevelopers tune them out immediately. To build an app that genuinely motivates someone to step away from their desk, the voice needed to feel calm, natural, and human.
I integrated ElevenLabs using the eleven_flash_v2_5 model and the official Charlie voice (IKne3meq5aSn9XLyUdCD):
-
Low-Latency Voice:
eleven_flash_v2_5synthesizes the spoken brief in seconds while the UI stays fully interactive, and a browser-voice fallback guarantees the guide plays even if the API is unreachable. - Calm, Human Pacing: Charlie delivers a natural, reassuring presence when reading the computed UV warnings and window times.
- Eyes-Free Outdoor Send-Off: When you tap "I'm going outside", Charlie plays a warm send-off audio message so you can pocket your phone immediately and head out without looking back at the screen.
6. The Field Test: Taking SunSync Outside for 20 Minutes (Bonus Challenge)
The Hacktoberfest Week 1 challenge brief includes an explicit bonus criteria: taking the build outside, testing it in the real world, and reporting the experience.
During development, when SunSync computed my local 20-minute peak recharge window (14:15 - 14:35), I followed my own protocol:
- I opened the live production URL on my phone, tapped Listen Β· 15s brief, heard Charlie read out the computed window and UV safety tips, and tapped the green commitment button ("I'm going outside").
- The UI locked into the 20-minute circular breathing ring. I turned the phone face-down, slipped it into my pocket, and walked out under the open sky.
- Instead of checking notifications, I just looked out toward the horizon and took a walk (without staring directly at the sun, of course).
How it actually went:
You notice the difference within a few minutes. Staring at an IDE two feet away for hours puts constant strain on your eyes. Looking out at the horizon under natural outdoor daylight lets your eyes relax and gives your nervous system a genuine reset. By the time the 20-minute timer wrapped up and I walked back to my desk, the usual 3:00 PM afternoon slump was goneβno extra coffee required.
7. Handling Timezones & Diurnal States: Real API Outputs
Because SunSync runs live against the target location's solar clock, the decision engine and Gemma's spoken brief adapt dynamically to the time of day. Below are unedited API responses captured from the production service demonstrating how the system handles different diurnal states:
-
When the Day's Peak Has Already Passed (e.g., Evening in Cairo):
-
Coordinates:
30.04Β° N, 31.24Β° EΒ· Computed Window:14:15 - 14:35Β· Score:100/100Β· UV:5.35 - Gemma Spoken Brief: "Quick one: Just noting your daylight break peak β it was 14:15 - 14:35 with a UV of 5.35 β missed it, but let's aim for softer morning light tomorrow!"
-
Behavior: Recognizes the peak has passed, the UI displays
Done today, and advises softer morning light tomorrow without false "go outside now" prompts in the dark.
-
Coordinates:
-
When the Day's Peak Is Upcoming (e.g., Morning in New York):
-
Coordinates:
40.71Β° N, -74.01Β° WΒ· Computed Window:14:15 - 14:35Β· Score:100/100Β· UV:0.95 - Gemma Spoken Brief: "Hey you: Your daylight break with a UV index of 0.95 opens later today between 14:15 - 14:35, so be ready to step outside then!"
- Behavior: Confirms future tense ("opens later today"), ticking down a live countdown rather than prompting the user prematurely.
-
Coordinates:
-
When Testing Across Far Timezones (e.g., Midnight in Tokyo):
-
Coordinates:
35.68Β° N, 139.65Β° EΒ· Computed Window:12:15 - 12:35Β· Score:100/100Β· UV:5.2 - Gemma Spoken Brief: "Fresh air alert: Your daylight break with a UV value of 5.2 opens between 12:15 - 12:35 today, so prepare to step outside then!"
- Behavior: Evaluates Tokyo-local time (UTC+9) rather than the tester's client time, correctly scheduling the upcoming daylight window.
-
Coordinates:
Why Does Open Innovation Matter?
Closed wellness algorithms treat human biology as a proprietary subscription black box. Building SunSync on an open-source architecture made critical capabilities possible that closed proprietary APIs simply cannot deliver:
-
Circadian Health Belongs to Everyone, Not Subscription SaaS: Human biology is not an enterprise product. By building SunSync with open-source models, open data, and containerized infrastructure, the entire pipeline costs ~$0.00 to run at this scale. Anyone can fork the repository, deploy the included
Dockerfileon Google Cloud Run's free tier, and use it indefinitely without paying a $15/month wellness tax. - Local CPU Independence via TabPFN: Closed AI APIs demand continuous internet connectivity, recurring credit card billing, and API key management. TabPFN running zero-shot on local CPU proves that high-performance scientific modeling doesn't require gigawatt GPU clusters. Serving TabPFN directly on the application CPU keeps tabular predictions fast, self-contained, and completely free of remote ML endpoint costs.
- Strict Data Privacy: Commercial wellness applications harvest location history to monetize behavioral profiles. SunSync queries Open-Meteo for atmospheric weather only. My LLM prompts receive pure numerical arrays (irradiance, UV, angles)βpersonal coordinates are never passed to any AI model.
- Transparent, Reproducible Logic: Proprietary health apps hide behind vague, closed algorithms. By keeping SunSync open source, every developer can inspect the exact solar calculations, daylight thresholds, and automated test suites.
Prize Categories
Featured Categories
1. Best Use of TabPFN (Prior Labs)
-
How SunSync Uses It: Evaluates real 12-row tabular atmospheric telemetry vectors on live CPU using
TabPFNRegressor(n_estimators=4)with zero GPU dependencies. TabPFN predicts Equivalent Melanopic Lux (EML) in a single forward pass without gradient descent, achieving a 0.00 score variance across repeated runs. Foundation weights are pre-baked into Docker image layers, and warm multi-core CPU execution consistently evaluates in ~1.1β1.5s on Google Cloud Run. -
Evidence in Repo:
src/circadian_ml.pyΒ· Determinism & stability benchmarks Β·tests/test_circadian_ml.py
2. Best Use of Gemma (Google)
-
How SunSync Uses It: Uses Google's state-of-the-art open model (
google/gemma-3-27b-itvia OpenRouter with Google AI Studio fallback) to synthesize the 15-second spoken outdoor directive. Gemma turns raw telemetry into an encouraging, natural audio brief, protected by a production grounding layer (validate_directive()) that ensures computed window times and UV safety ratings remain strictly accurate. -
Evidence in Repo:
src/gemma_service.pyΒ·tests/test_gemma_service.py
Partner Categories
3. Best Use of Sentry Agent Tracing
-
How SunSync Uses It: Shows the entire pipeline's performance via distributed tracing spans (
ai.telemetry.ingest,ai.model.tabpfn, andai.llm.gemma). Sentry traces directly revealed upstream network latency, informed the progressive dual-lane decoupling, and surfaced upstream floating-point NaNs that led to the_sanitize_floatsafety layer. Token metrics (llm.estimated_prompt_tokens: 48) are attached to every span. -
Evidence in Repo:
src/app.py42β52 & 212β220 Β· Latency waterfall table in write-up Β· Expandable Sentry telemetry HUD in UI
4. Best Use of ElevenLabs
-
How SunSync Uses It: Powers SunSync's eyes-free audio interface using the
eleven_flash_v2_5model and the official Charlie voice (IKne3meq5aSn9XLyUdCD). Delivers lifelike voice briefings and outdoor send-offs so developers can pocket their phones without looking at screens. ElevenLabs transforms what would otherwise be a robotic notification into a calm, human ritual that encourages stepping away from the desk. -
Evidence in Repo:
src/audio_service.pyΒ·src/static/app.js(voice pipeline: synthesizeAudioElement, speakViaBrowser fallback, playDetoxGuide)
Closing: Step Away from the Screen
For years, I treated developer fatigue as a software problem to be solved with more software, more productivity tools, and more screen time.
Building SunSync reinforced the opposite truth: the most valuable thing an AI tool can do is provide a fast, mathematically grounded answer, get completely out of the way, and encourage a return to the physical world.
Human knowledge has real limits, and so does biological endurance. A developer simply isn't built to spend 14 hours a day under office lights staring at glowing screens.
Now, close this tab.
Lock your screen.
Step outside, and go touch some grass. πΏ
Top comments (0)