<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ekram Zafar</title>
    <description>The latest articles on DEV Community by Ekram Zafar (@ekram_zafar_f31942cd01173).</description>
    <link>https://dev.to/ekram_zafar_f31942cd01173</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1870195%2Fa9a39edd-bbd1-4430-b7fa-ced7c351002a.jpg</url>
      <title>DEV Community: Ekram Zafar</title>
      <link>https://dev.to/ekram_zafar_f31942cd01173</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ekram_zafar_f31942cd01173"/>
    <language>en</language>
    <item>
      <title>When My AI Stress Dashboard Started Making Up the Data</title>
      <dc:creator>Ekram Zafar</dc:creator>
      <pubDate>Sun, 23 Aug 2026 18:20:14 +0000</pubDate>
      <link>https://dev.to/ekram_zafar_f31942cd01173/when-my-ai-stress-dashboard-started-making-up-the-data-387n</link>
      <guid>https://dev.to/ekram_zafar_f31942cd01173/when-my-ai-stress-dashboard-started-making-up-the-data-387n</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/bugsmash"&gt;DEV's Summer Bug Smash: Clear the Lineup&lt;/a&gt; powered by &lt;a href="https://sentry.io/" rel="noopener noreferrer"&gt;Sentry&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  When My AI Stress Dashboard Started Making Up the Data
&lt;/h1&gt;

&lt;p&gt;I built NeuroSense AI as a human-centered stress insight assistant powered by Gemma.&lt;/p&gt;

&lt;p&gt;The idea is simple: a user describes how they are feeling naturally, the AI analyzes the text, and the application presents stress and emotion insights through a dashboard.&lt;/p&gt;

&lt;p&gt;Everything appeared to be working.&lt;/p&gt;

&lt;p&gt;Gemma was returning meaningful results.&lt;/p&gt;

&lt;p&gt;The database was storing sessions.&lt;/p&gt;

&lt;p&gt;The dashboard was displaying a stress trend.&lt;/p&gt;

&lt;p&gt;But when I looked more closely at the dashboard, I found a problem:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The trend wasn't actually coming from the AI results.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The dashboard was generating its own stress numbers.&lt;/p&gt;

&lt;p&gt;That turned what looked like a working visualization into a data correctness bug.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;NeuroSense AI is a Streamlit-based AI application that allows users to express their thoughts naturally and receive emotional insights.&lt;/p&gt;

&lt;p&gt;The application uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Streamlit&lt;/li&gt;
&lt;li&gt;OpenRouter&lt;/li&gt;
&lt;li&gt;Gemma 3&lt;/li&gt;
&lt;li&gt;SQLite&lt;/li&gt;
&lt;li&gt;Pandas&lt;/li&gt;
&lt;li&gt;Plotly&lt;/li&gt;
&lt;li&gt;Sentry&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The original data flow looked roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
  ↓
Streamlit Chat
  ↓
Gemma AI
  ↓
Analysis
  ↓
SQLite
  ↓
Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The goal was for the dashboard to represent the actual AI analysis produced for each session.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bug
&lt;/h2&gt;

&lt;p&gt;While inspecting the dashboard implementation, I found this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;stress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="mi"&gt;100&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;stress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The problem was that &lt;code&gt;score&lt;/code&gt; had no relationship to the stress level returned by Gemma.&lt;/p&gt;

&lt;p&gt;It only depended on the number of sessions.&lt;/p&gt;

&lt;p&gt;For example, with four sessions, the dashboard could generate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Session 1 → 38
Session 2 → 46
Session 3 → 54
Session 4 → 62
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;even if the AI had actually classified those sessions as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Low
Low
High
Low
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The visualization therefore suggested an increasing stress trend that the user had never actually produced.&lt;/p&gt;

&lt;p&gt;This was a data correctness problem rather than just a UI issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Root Cause
&lt;/h2&gt;

&lt;p&gt;The root cause was that the original database schema did not store structured stress information.&lt;/p&gt;

&lt;p&gt;The original table contained:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;history
├── id
├── message
└── response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AI response was stored as a general response, while the dashboard only knew the total number of sessions.&lt;/p&gt;

&lt;p&gt;Because the dashboard did not have access to an actual &lt;code&gt;stress_level&lt;/code&gt; field, it generated a synthetic trend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixing the AI Data Pipeline
&lt;/h2&gt;

&lt;p&gt;I changed the Gemma response format so that the model returns structured JSON containing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"stress_level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Low"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"emotion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Anxious"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"explanation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The user expresses calmness but also acknowledges a slight worry regarding upcoming exams."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"recommendations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Practice relaxation techniques and focus on preparing for exams to reduce worry."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application validates the returned fields and only accepts these stress categories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Low
Moderate
High
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives the rest of the application structured information instead of treating the complete AI response as one block of text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the Gemma Integration
&lt;/h2&gt;

&lt;p&gt;I tested the updated AI pipeline using natural-language input.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I feel calm today but slightly worried about my exams.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gemma returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Stress Level: Low
Emotion: Anxious
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;along with an explanation and recommendations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnnwdnenysxprm9wka5ek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnnwdnenysxprm9wka5ek.png" alt=" " width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The important part is that the result is now structured and can be persisted as individual fields.&lt;/p&gt;

&lt;h2&gt;
  
  
  Updating the Database
&lt;/h2&gt;

&lt;p&gt;I extended the SQLite history table to store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;history
├── id
├── message
├── response
├── stress_level
└── emotion
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also added a safe migration for existing databases.&lt;/p&gt;

&lt;p&gt;Instead of deleting the existing database, the application checks whether the new columns exist and adds them when necessary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PRAGMA table_info(history)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;columns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;()]&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;stress_level&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ALTER TABLE history ADD COLUMN stress_level TEXT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emotion&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ALTER TABLE history ADD COLUMN emotion TEXT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allowed me to introduce the fix without throwing away previously stored sessions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replacing the Synthetic Dashboard
&lt;/h2&gt;

&lt;p&gt;The dashboard was then changed to read the actual &lt;code&gt;stress_level&lt;/code&gt; stored for each session.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the dashboard now uses the stored AI classification.&lt;/p&gt;

&lt;p&gt;Because Gemma returns categorical values rather than numerical stress scores, I use visualization positions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;stress_mapping&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Low&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;33&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Moderate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;66&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;High&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These values are &lt;strong&gt;only chart coordinates&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;They are not claimed to be numerical stress scores generated by Gemma.&lt;/p&gt;

&lt;p&gt;The chart labels remain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Low
Moderate
High
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the visualization represent the actual AI classifications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsimrl8vp95pch9j40k14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsimrl8vp95pch9j40k14.png" alt=" " width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the data flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Input
    ↓
Gemma
    ↓
Structured AI Analysis
    ↓
Stress Level + Emotion
    ↓
SQLite
    ↓
Dashboard
    ↓
Actual Session Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding Sentry for AI Failures
&lt;/h2&gt;

&lt;p&gt;Fixing the dashboard solved the data correctness problem, but I also wanted the AI failure path to be observable.&lt;/p&gt;

&lt;p&gt;Previously, an API exception could interrupt the Streamlit application.&lt;/p&gt;

&lt;p&gt;I added Sentry monitoring around the AI analysis and persistence operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;analyze_with_gemma&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;save_history&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;explanation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;stress_level&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emotion&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;sentry_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;capture_exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI analysis failed. Please try again.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a much safer failure path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gemma API failure
       ↓
Unhandled exception
       ↓
Application failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  After
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gemma API failure
       ↓
Exception
   ┌───┴────┐
   ↓        ↓
Sentry    User
   ↓        ↓
Trace    Friendly
captured  message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most importantly, the database write occurs only after a successful AI response.&lt;/p&gt;

&lt;p&gt;Therefore, a failed AI request is not recorded as a successful analysis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best Use of Sentry
&lt;/h2&gt;

&lt;p&gt;To verify that the monitoring path actually worked, I temporarily introduced a controlled exception:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;NeuroSenseAI Sentry test: simulated AI failure&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application caught the exception and displayed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AI analysis failed. Please try again.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sentry also received the exception and recorded the Python traceback.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu682govtest3n1kwlqqi.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu682govtest3n1kwlqqi.jpeg" alt=" " width="719" height="1600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This confirmed that the application can report failures from the AI analysis path to Sentry.&lt;/p&gt;

&lt;p&gt;The simulated exception was used only for testing and was removed immediately afterward.&lt;/p&gt;

&lt;p&gt;I did not use Sentry to claim that it discovered the original dashboard bug. The dashboard bug was identified by inspecting the application's data flow; Sentry was added to provide observability for runtime failures in the AI pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before vs After
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Before
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gemma
  ↓
AI response
  ↓
SQLite
  ↓
Dashboard
  ↓
Synthetic trend

38 → 46 → 54 → 62
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  After
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gemma
  ↓
Structured result
  ↓
Stress Level + Emotion
  ↓
SQLite
  ↓
Dashboard
  ↓
Actual AI results
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application now has a consistent path from AI analysis to stored data to visualization.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Changed Technically
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Area&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;AI output&lt;/td&gt;
&lt;td&gt;Unstructured response&lt;/td&gt;
&lt;td&gt;Structured JSON&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stress level storage&lt;/td&gt;
&lt;td&gt;Not stored separately&lt;/td&gt;
&lt;td&gt;Stored in SQLite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Emotion storage&lt;/td&gt;
&lt;td&gt;Not stored separately&lt;/td&gt;
&lt;td&gt;Stored in SQLite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dashboard data&lt;/td&gt;
&lt;td&gt;Synthetic&lt;/td&gt;
&lt;td&gt;Actual AI classifications&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Existing database&lt;/td&gt;
&lt;td&gt;No migration&lt;/td&gt;
&lt;td&gt;Safe column migration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI failure handling&lt;/td&gt;
&lt;td&gt;Could interrupt execution&lt;/td&gt;
&lt;td&gt;Exception captured&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Error monitoring&lt;/td&gt;
&lt;td&gt;No Sentry monitoring&lt;/td&gt;
&lt;td&gt;Sentry exception monitoring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Failed analysis&lt;/td&gt;
&lt;td&gt;Could become problematic output&lt;/td&gt;
&lt;td&gt;Not persisted as a successful session&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;I tested the application locally after making the changes.&lt;/p&gt;

&lt;p&gt;The testing process included:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Starting the Streamlit application.&lt;/li&gt;
&lt;li&gt;Sending natural-language input through the Chat page.&lt;/li&gt;
&lt;li&gt;Confirming that Gemma returned structured analysis.&lt;/li&gt;
&lt;li&gt;Confirming that the stress level and emotion were stored.&lt;/li&gt;
&lt;li&gt;Opening the Dashboard and verifying that the trend was based on stored AI classifications.&lt;/li&gt;
&lt;li&gt;Testing the Sentry exception path with a controlled error.&lt;/li&gt;
&lt;li&gt;Confirming that Sentry received the exception.&lt;/li&gt;
&lt;li&gt;Removing the temporary test exception.&lt;/li&gt;
&lt;li&gt;Running &lt;code&gt;git diff --check&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Confirming that the working tree was clean.&lt;/li&gt;
&lt;li&gt;Pushing the final changes to GitHub.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The final Git state was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;The biggest lesson from this bug was that a visualization can look completely reasonable while still representing incorrect data.&lt;/p&gt;

&lt;p&gt;The original dashboard was technically capable of rendering a graph, but the graph wasn't connected to the actual source of truth.&lt;/p&gt;

&lt;p&gt;The fix wasn't about making the chart prettier.&lt;/p&gt;

&lt;p&gt;It was about making sure that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AI result
   =
Stored result
   =
Displayed result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also learned that AI applications need explicit failure handling. An AI API failure shouldn't silently become application data. It should be observable, recoverable, and excluded from successful-session history.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source Code
&lt;/h2&gt;

&lt;p&gt;The complete project is available here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ekramzafar/NeuroSenseAI" rel="noopener noreferrer"&gt;NeuroSenseAI on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This bug started as a simple dashboard inspection and turned into a broader data-flow improvement.&lt;/p&gt;

&lt;p&gt;NeuroSense AI now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stores structured AI analysis results.&lt;/li&gt;
&lt;li&gt;Preserves stress and emotion information with each session.&lt;/li&gt;
&lt;li&gt;Displays actual AI classifications instead of a synthetic stress progression.&lt;/li&gt;
&lt;li&gt;Handles AI failures without storing them as successful sessions.&lt;/li&gt;
&lt;li&gt;Reports runtime exceptions to Sentry.&lt;/li&gt;
&lt;li&gt;Preserves existing database data through a safe schema migration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For me, the most important part of the fix was making the dashboard tell the truth about the data behind it.&lt;/p&gt;

&lt;p&gt;Thanks to the DEV and Sentry teams for organizing the Summer Bug Smash!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>bugsmash</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>Lightkeeper — Defending the Last Light of the Solstice</title>
      <dc:creator>Ekram Zafar</dc:creator>
      <pubDate>Sun, 21 Jun 2026 18:08:52 +0000</pubDate>
      <link>https://dev.to/ekram_zafar_f31942cd01173/lightkeeper-defending-the-last-light-of-the-solstice-4bah</link>
      <guid>https://dev.to/ekram_zafar_f31942cd01173/lightkeeper-defending-the-last-light-of-the-solstice-4bah</guid>
      <description>&lt;h2&gt;
  
  
  Video Demo
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/zgXRaWc8H_E"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Live Demo
&lt;/h2&gt;

&lt;p&gt;Play the game here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://your-vercel-link.vercel.app" rel="noopener noreferrer"&gt;https://your-vercel-link.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the June Solstice Game Jam 2026.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Every year, the June Solstice marks the longest day of the year—a celebration of light at its strongest moment. But that moment is also a turning point. After reaching its peak, daylight slowly begins to fade and darkness gradually returns.&lt;/p&gt;

&lt;p&gt;That idea inspired me to create &lt;strong&gt;Lightkeeper&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Rather than using the solstice as a simple visual theme, I wanted to transform it into a gameplay mechanic. The player is not merely observing the struggle between light and darkness—they are actively participating in it.&lt;/p&gt;

&lt;p&gt;In Lightkeeper, you become the final guardian of a fading world. Darkness spreads relentlessly across the land, shadow creatures emerge from forgotten places, and the last remaining source of hope rests in your hands.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsfb18cqjtrjr69fznat8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsfb18cqjtrjr69fznat8.png" alt=" " width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your mission is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep the light alive.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The challenge, however, becomes increasingly difficult as darkness grows stronger with every passing moment.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Story Behind the Game
&lt;/h1&gt;

&lt;p&gt;Long ago, the world was protected by the Eternal Sun, a magical force that maintained balance between day and night.&lt;/p&gt;

&lt;p&gt;Every solstice, the Sun's power would reach its maximum strength and illuminate every corner of the world.&lt;/p&gt;

&lt;p&gt;But during one fateful solstice, something changed.&lt;/p&gt;

&lt;p&gt;A mysterious force known as the Shadow King emerged from the Void and began consuming the world's light.&lt;/p&gt;

&lt;p&gt;Ancient temples collapsed.&lt;/p&gt;

&lt;p&gt;Sacred forests fell silent.&lt;/p&gt;

&lt;p&gt;Entire civilizations disappeared beneath endless darkness.&lt;/p&gt;

&lt;p&gt;As the final solstice approaches, only one guardian remains—the Lightkeeper.&lt;/p&gt;

&lt;p&gt;Armed with fragments of the Eternal Sun, the Lightkeeper must collect scattered light energy, defend the remaining sanctuaries, and confront the darkness before the world is lost forever.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0zjou3nk7jqrvysg7onq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0zjou3nk7jqrvysg7onq.png" alt=" " width="800" height="579"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Gameplay Overview
&lt;/h1&gt;

&lt;p&gt;Lightkeeper is a real-time survival game built around resource management, exploration, and increasing difficulty.&lt;/p&gt;

&lt;p&gt;The player must constantly make decisions while under pressure.&lt;/p&gt;

&lt;p&gt;Should you chase a distant orb to restore energy?&lt;/p&gt;

&lt;p&gt;Should you risk fighting enemies to protect your remaining health?&lt;/p&gt;

&lt;p&gt;Should you focus on survival or maximize your score?&lt;/p&gt;

&lt;p&gt;The game continuously asks these questions while darkness spreads throughout the world.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flm43iot3u0jheycvckd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flm43iot3u0jheycvckd8.png" alt=" " width="800" height="577"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Core Gameplay Loop
&lt;/h1&gt;

&lt;p&gt;The gameplay loop is built around four interconnected systems:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Explore
&lt;/h3&gt;

&lt;p&gt;The player moves around the map searching for Light Orbs.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Collect
&lt;/h3&gt;

&lt;p&gt;Collecting orbs restores energy and slows the spread of darkness.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Survive
&lt;/h3&gt;

&lt;p&gt;Shadow creatures actively pursue the player.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Endure
&lt;/h3&gt;

&lt;p&gt;The longer the player survives, the stronger the darkness becomes.&lt;/p&gt;

&lt;p&gt;This simple loop creates a constant sense of urgency.&lt;/p&gt;




&lt;h1&gt;
  
  
  Resource Systems
&lt;/h1&gt;

&lt;p&gt;One of the primary goals of the project was creating multiple systems that influence one another.&lt;/p&gt;

&lt;p&gt;Rather than relying on a single health bar, the game introduces several survival mechanics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Health System
&lt;/h2&gt;

&lt;p&gt;Health represents the physical condition of the Lightkeeper.&lt;/p&gt;

&lt;p&gt;Taking damage from enemies reduces health.&lt;/p&gt;

&lt;p&gt;If health reaches zero:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Game Over.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This encourages players to avoid unnecessary risks.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw0y9jk9k0vd8ox32ht5p.png" alt=" " width="800" height="584"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Energy System
&lt;/h2&gt;

&lt;p&gt;Energy is the magical fuel that powers the Lightkeeper.&lt;/p&gt;

&lt;p&gt;Unlike health, energy decreases continuously over time.&lt;/p&gt;

&lt;p&gt;This means the player cannot remain idle.&lt;/p&gt;

&lt;p&gt;To survive, players must actively seek out Light Orbs scattered across the map.&lt;/p&gt;

&lt;p&gt;This creates a natural exploration mechanic without requiring explicit objectives.&lt;/p&gt;




&lt;h2&gt;
  
  
  Darkness System
&lt;/h2&gt;

&lt;p&gt;The Darkness Meter is the heart of the game.&lt;/p&gt;

&lt;p&gt;Darkness increases continuously throughout the match.&lt;/p&gt;

&lt;p&gt;As darkness grows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visibility decreases&lt;/li&gt;
&lt;li&gt;Tension increases&lt;/li&gt;
&lt;li&gt;Survival becomes more difficult&lt;/li&gt;
&lt;li&gt;Boss encounters become possible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Darkness acts as both a timer and a difficulty scaling system.&lt;/p&gt;

&lt;p&gt;If darkness reaches 100%, the world is consumed and the game ends.&lt;/p&gt;




&lt;h2&gt;
  
  
  Score System
&lt;/h2&gt;

&lt;p&gt;Players earn points through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Collecting orbs&lt;/li&gt;
&lt;li&gt;Surviving longer&lt;/li&gt;
&lt;li&gt;Avoiding damage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The score system encourages replayability and allows players to challenge themselves after mastering the mechanics.&lt;/p&gt;




&lt;h1&gt;
  
  
  Enemy Design
&lt;/h1&gt;

&lt;p&gt;The enemies represent manifestations of the spreading darkness.&lt;/p&gt;

&lt;p&gt;Their purpose is not only to damage the player but to create pressure and force movement.&lt;/p&gt;

&lt;p&gt;If players stay in one area for too long, enemies eventually surround them.&lt;/p&gt;

&lt;p&gt;This prevents passive gameplay and keeps the experience dynamic.&lt;/p&gt;




&lt;h2&gt;
  
  
  Shadow Creatures
&lt;/h2&gt;

&lt;p&gt;Shadow Creatures are the first enemies encountered.&lt;/p&gt;

&lt;p&gt;Characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Constant pursuit behavior&lt;/li&gt;
&lt;li&gt;Moderate movement speed&lt;/li&gt;
&lt;li&gt;Continuous pressure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although individually weak, they become dangerous in groups.&lt;/p&gt;




&lt;h2&gt;
  
  
  Boss Encounter
&lt;/h2&gt;

&lt;p&gt;When darkness reaches dangerous levels, a powerful boss appears.&lt;/p&gt;

&lt;p&gt;The boss symbolizes the darkness reaching its peak strength.&lt;/p&gt;

&lt;p&gt;Unlike regular enemies, the boss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Has increased size&lt;/li&gt;
&lt;li&gt;Has significantly higher health&lt;/li&gt;
&lt;li&gt;Creates a dramatic shift in gameplay&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The boss encounter serves as the climax of each run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fodomj2lhy26uoua43w40.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fodomj2lhy26uoua43w40.png" alt=" " width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Visual Design
&lt;/h1&gt;

&lt;p&gt;The visual direction was inspired by fantasy worlds where light and darkness are constantly in conflict.&lt;/p&gt;

&lt;p&gt;Key visual goals included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Strong contrast between light and shadow&lt;/li&gt;
&lt;li&gt;Bright collectible objects&lt;/li&gt;
&lt;li&gt;Dark atmospheric environments&lt;/li&gt;
&lt;li&gt;Clear visual feedback&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The player character uses bright colors to immediately communicate safety and hope.&lt;/p&gt;

&lt;p&gt;Enemies use darker colors and shadow-inspired designs to emphasize danger.&lt;/p&gt;




&lt;h1&gt;
  
  
  Visual Effects
&lt;/h1&gt;

&lt;p&gt;Several effects were added to improve player feedback.&lt;/p&gt;

&lt;h3&gt;
  
  
  Orb Collection Effect
&lt;/h3&gt;

&lt;p&gt;When collecting a Light Orb:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A flash effect appears&lt;/li&gt;
&lt;li&gt;The player receives immediate feedback&lt;/li&gt;
&lt;li&gt;The action feels rewarding&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Darkness Overlay
&lt;/h3&gt;

&lt;p&gt;As darkness increases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The environment becomes darker&lt;/li&gt;
&lt;li&gt;The atmosphere changes gradually&lt;/li&gt;
&lt;li&gt;Players feel increasing tension&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This effect visually reinforces the game's core mechanic.&lt;/p&gt;




&lt;h1&gt;
  
  
  Technical Implementation
&lt;/h1&gt;

&lt;p&gt;The project was developed using modern web technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frontend
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;Vite&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Game Engine
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Phaser.js&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Language
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Planned AI Integration
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Future Google AI Integration&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Architecture
&lt;/h1&gt;

&lt;p&gt;The game is structured around several independent systems:&lt;/p&gt;

&lt;h3&gt;
  
  
  Player System
&lt;/h3&gt;

&lt;p&gt;Handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Movement&lt;/li&gt;
&lt;li&gt;Health&lt;/li&gt;
&lt;li&gt;Energy&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Enemy System
&lt;/h3&gt;

&lt;p&gt;Handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spawning&lt;/li&gt;
&lt;li&gt;AI movement&lt;/li&gt;
&lt;li&gt;Pursuit behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Orb System
&lt;/h3&gt;

&lt;p&gt;Handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Collection&lt;/li&gt;
&lt;li&gt;Energy restoration&lt;/li&gt;
&lt;li&gt;Darkness reduction&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  UI System
&lt;/h3&gt;

&lt;p&gt;Handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Health bar&lt;/li&gt;
&lt;li&gt;Energy bar&lt;/li&gt;
&lt;li&gt;Score display&lt;/li&gt;
&lt;li&gt;Darkness display&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Boss System
&lt;/h3&gt;

&lt;p&gt;Handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spawn conditions&lt;/li&gt;
&lt;li&gt;Boss state&lt;/li&gt;
&lt;li&gt;Endgame pressure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Separating these systems made development significantly easier.&lt;/p&gt;




&lt;h1&gt;
  
  
  Challenges During Development
&lt;/h1&gt;

&lt;p&gt;Game jams always involve solving unexpected problems.&lt;/p&gt;

&lt;p&gt;This project was no exception.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning Phaser
&lt;/h2&gt;

&lt;p&gt;Although I had prior programming experience, building a real-time game introduced new challenges.&lt;/p&gt;

&lt;p&gt;Understanding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scenes&lt;/li&gt;
&lt;li&gt;Physics systems&lt;/li&gt;
&lt;li&gt;Collision handling&lt;/li&gt;
&lt;li&gt;Object groups&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;required significant experimentation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Balancing Darkness
&lt;/h2&gt;

&lt;p&gt;Darkness became the most difficult mechanic to tune.&lt;/p&gt;

&lt;p&gt;When darkness increased too slowly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The game felt easy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When darkness increased too quickly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The game became frustrating.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finding a balance required many rounds of testing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Enemy Spawning
&lt;/h2&gt;

&lt;p&gt;Enemies needed to feel threatening without creating unfair situations.&lt;/p&gt;

&lt;p&gt;Several adjustments were made to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spawn locations&lt;/li&gt;
&lt;li&gt;Movement speed&lt;/li&gt;
&lt;li&gt;Spawn frequency&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;to achieve a better balance.&lt;/p&gt;




&lt;h2&gt;
  
  
  UI Design
&lt;/h2&gt;

&lt;p&gt;Creating useful UI elements took more time than expected.&lt;/p&gt;

&lt;p&gt;Players need immediate access to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Health&lt;/li&gt;
&lt;li&gt;Energy&lt;/li&gt;
&lt;li&gt;Score&lt;/li&gt;
&lt;li&gt;Darkness level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without clear information, decision-making becomes difficult.&lt;/p&gt;




&lt;h1&gt;
  
  
  What I Learned
&lt;/h1&gt;

&lt;p&gt;This project helped me improve my skills in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript game development&lt;/li&gt;
&lt;li&gt;Phaser.js&lt;/li&gt;
&lt;li&gt;Game balancing&lt;/li&gt;
&lt;li&gt;Resource management systems&lt;/li&gt;
&lt;li&gt;Player feedback design&lt;/li&gt;
&lt;li&gt;Debugging interactive applications&lt;/li&gt;
&lt;li&gt;Real-time event handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most importantly, I learned how small mechanics can combine to create meaningful gameplay experiences.&lt;/p&gt;




&lt;h1&gt;
  
  
  Future Plans
&lt;/h1&gt;

&lt;p&gt;The current version is only the beginning.&lt;/p&gt;

&lt;p&gt;Future updates could include:&lt;/p&gt;

&lt;h2&gt;
  
  
  Gemini AI Events
&lt;/h2&gt;

&lt;p&gt;Dynamic story events generated by Google Gemini.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ancient shrines&lt;/li&gt;
&lt;li&gt;Wandering spirits&lt;/li&gt;
&lt;li&gt;Random quests&lt;/li&gt;
&lt;li&gt;World-changing events&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This would make every playthrough unique.&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional Enemy Types
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Shadow Brutes&lt;/li&gt;
&lt;li&gt;Shadow Mages&lt;/li&gt;
&lt;li&gt;Flying Wraiths&lt;/li&gt;
&lt;li&gt;Elite Hunters&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  New Bosses
&lt;/h2&gt;

&lt;p&gt;Multiple bosses with unique abilities and attack patterns.&lt;/p&gt;




&lt;h2&gt;
  
  
  Skill Tree
&lt;/h2&gt;

&lt;p&gt;Unlockable upgrades:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Increased speed&lt;/li&gt;
&lt;li&gt;Improved energy efficiency&lt;/li&gt;
&lt;li&gt;Light shields&lt;/li&gt;
&lt;li&gt;Special abilities&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Procedural Maps
&lt;/h2&gt;

&lt;p&gt;Randomly generated worlds for increased replayability.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sound Design
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ambient music&lt;/li&gt;
&lt;li&gt;Boss themes&lt;/li&gt;
&lt;li&gt;Collection effects&lt;/li&gt;
&lt;li&gt;Environmental audio&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sound would dramatically improve immersion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;GitHub Repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ekramzafar/lightkeeper" rel="noopener noreferrer"&gt;https://github.com/ekramzafar/lightkeeper&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Prize Categories
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Best Google AI Usage
&lt;/h2&gt;

&lt;p&gt;Lightkeeper is designed with future Gemini-powered dynamic events in mind.&lt;/p&gt;

&lt;p&gt;The goal is to use AI not simply for text generation, but to influence gameplay and create unique experiences for players.&lt;/p&gt;




&lt;h2&gt;
  
  
  Best Overall Game
&lt;/h2&gt;

&lt;p&gt;The project combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Survival mechanics&lt;/li&gt;
&lt;li&gt;Resource management&lt;/li&gt;
&lt;li&gt;Enemy AI&lt;/li&gt;
&lt;li&gt;Boss encounters&lt;/li&gt;
&lt;li&gt;Dynamic difficulty&lt;/li&gt;
&lt;li&gt;Strong theme integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;into a cohesive gameplay experience centered around the June Solstice.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Lightkeeper began as a simple question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if the June Solstice itself became a game mechanic?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From that idea emerged a world where light and darkness are not just visual themes, but active forces that shape every decision the player makes.&lt;/p&gt;

&lt;p&gt;The project challenged me to think about gameplay, balance, visual feedback, and storytelling in new ways.&lt;/p&gt;

&lt;p&gt;While there is still much more I would like to build, I am proud of what was accomplished during the jam.&lt;/p&gt;

&lt;p&gt;Thank you for taking the time to play, review, and experience Lightkeeper.&lt;/p&gt;

&lt;p&gt;May the light endure.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gamechallenge</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Building NeuroSense AI: A Human-Centered Stress Insight Assistant Powered by Gemma</title>
      <dc:creator>Ekram Zafar</dc:creator>
      <pubDate>Sun, 24 May 2026 18:26:03 +0000</pubDate>
      <link>https://dev.to/ekram_zafar_f31942cd01173/building-neurosense-ai-a-human-centered-stress-insight-assistant-powered-by-gemma-3aag</link>
      <guid>https://dev.to/ekram_zafar_f31942cd01173/building-neurosense-ai-a-human-centered-stress-insight-assistant-powered-by-gemma-3aag</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnvgmde06yd6kffcjxumb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnvgmde06yd6kffcjxumb.png" alt=" " width="800" height="304"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuon1wl7xaaaatszf1w10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuon1wl7xaaaatszf1w10.png" alt=" " width="799" height="411"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0e04gukmrumt415oaz2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0e04gukmrumt415oaz2d.png" alt=" " width="800" height="388"&gt;&lt;/a&gt;# Building NeuroSense AI: A Human-Centered Stress Insight Assistant Powered by Gemma&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the Gemma 4 Challenge: Build With Gemma&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;AI systems are often designed to answer questions, summarize information, or generate content. But I wanted to explore a different question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can AI understand emotional context and provide supportive insights rather than only responding with text?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That question led me to build &lt;strong&gt;NeuroSense AI&lt;/strong&gt;, a human-centered stress insight assistant powered by Gemma.&lt;/p&gt;

&lt;p&gt;The goal of this project is not medical diagnosis. Instead, it aims to understand conversational signals and generate meaningful insights that help users better reflect on emotional patterns.&lt;/p&gt;

&lt;p&gt;Students, developers, and professionals frequently experience stress from exams, deadlines, projects, and workload pressure. Traditional systems often generate generic responses without understanding emotional context.&lt;/p&gt;

&lt;p&gt;NeuroSense AI attempts to make interactions more meaningful.&lt;/p&gt;




&lt;h2&gt;
  
  
  What NeuroSense AI Does
&lt;/h2&gt;

&lt;p&gt;Users can enter natural messages such as:&lt;/p&gt;

&lt;p&gt;"I have exams tomorrow and I haven't slept properly for two days."&lt;/p&gt;

&lt;p&gt;The system analyzes the conversation and generates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Emotional understanding&lt;/li&gt;
&lt;li&gt;Stress indicators&lt;/li&gt;
&lt;li&gt;Contextual explanations&lt;/li&gt;
&lt;li&gt;Personalized recommendations&lt;/li&gt;
&lt;li&gt;Session tracking&lt;/li&gt;
&lt;li&gt;Dashboard insights&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why I Selected Gemma
&lt;/h2&gt;

&lt;p&gt;For this project I needed more than keyword matching.&lt;/p&gt;

&lt;p&gt;I specifically needed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Context understanding&lt;/li&gt;
&lt;li&gt;Human-like reasoning&lt;/li&gt;
&lt;li&gt;Flexible deployment&lt;/li&gt;
&lt;li&gt;Efficient inference&lt;/li&gt;
&lt;li&gt;Meaningful response generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gemma was selected because emotional conversations require understanding relationships between ideas rather than detecting isolated words.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Keyword matching might simply detect:&lt;/p&gt;

&lt;p&gt;"exam"&lt;/p&gt;

&lt;p&gt;But Gemma can understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pressure&lt;/li&gt;
&lt;li&gt;exhaustion&lt;/li&gt;
&lt;li&gt;emotional state&lt;/li&gt;
&lt;li&gt;context across the message&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That difference was important for this project.&lt;/p&gt;




&lt;p&gt;How Gemma Powers NeuroSense AI&lt;/p&gt;

&lt;p&gt;Gemma serves as the core reasoning engine behind NeuroSense AI. Rather than relying solely on keyword detection, Gemma analyzes the full conversational context to identify emotional patterns, stress indicators, and underlying concerns.&lt;/p&gt;

&lt;p&gt;For each user interaction, Gemma helps:&lt;/p&gt;

&lt;p&gt;Understand emotional context&lt;br&gt;
Generate meaningful stress insights&lt;br&gt;
Provide personalized recommendations&lt;br&gt;
Produce human-centered responses&lt;br&gt;
Support reflective self-awareness&lt;/p&gt;

&lt;p&gt;This enables NeuroSense AI to deliver more context-aware and meaningful guidance compared to traditional rule-based approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  System Architecture
&lt;/h2&gt;

&lt;p&gt;User&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;NeuroSense Interface&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;Gemma Processing&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;Emotion Analysis&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;Stress Insights&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;Dashboard Visualization&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5sjt83ez2ed0l66fcpi9.png" alt=" " width="799" height="299"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Features Implemented
&lt;/h2&gt;

&lt;p&gt;✅ Emotional analysis&lt;/p&gt;

&lt;p&gt;✅ Stress insight generation&lt;/p&gt;

&lt;p&gt;✅ AI-powered recommendations&lt;/p&gt;

&lt;p&gt;✅ Session history tracking&lt;/p&gt;

&lt;p&gt;✅ Dashboard visualization&lt;/p&gt;

&lt;p&gt;✅ Privacy-focused design&lt;/p&gt;

&lt;p&gt;✅ Human-centered interaction flow&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69d1eeba0y0m8lffiquw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69d1eeba0y0m8lffiquw.png" alt=" " width="799" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Technology Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Streamlit&lt;/li&gt;
&lt;li&gt;SQLite&lt;/li&gt;
&lt;li&gt;Plotly&lt;/li&gt;
&lt;li&gt;Gemma&lt;/li&gt;
&lt;li&gt;Hugging Face Spaces&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Live Project
&lt;/h2&gt;

&lt;p&gt;GitHub Repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ekramzafar/NeuroSenseAI" rel="noopener noreferrer"&gt;https://github.com/ekramzafar/NeuroSenseAI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Live Demo:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://huggingface.co/spaces/ekram7/NeuroSenseAI" rel="noopener noreferrer"&gt;https://huggingface.co/spaces/ekram7/NeuroSenseAI&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://drive.google.com/file/d/1iWYGloEBF_wlLFnHVJG6_RQI8UKkpnxr/view?usp=sharing" rel="noopener noreferrer"&gt;https://drive.google.com/file/d/1iWYGloEBF_wlLFnHVJG6_RQI8UKkpnxr/view?usp=sharing&lt;/a&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Future Improvements
&lt;/h2&gt;

&lt;p&gt;Future ideas include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Voice emotion analysis&lt;/li&gt;
&lt;li&gt;Multilingual support&lt;/li&gt;
&lt;li&gt;Wearable integrations&lt;/li&gt;
&lt;li&gt;Personalized long-term trends&lt;/li&gt;
&lt;li&gt;Context memory&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Building NeuroSense AI changed the way I think about AI systems.&lt;/p&gt;

&lt;p&gt;The goal should not always be making AI larger.&lt;/p&gt;

&lt;p&gt;Sometimes the goal is making AI more meaningful.&lt;/p&gt;

&lt;p&gt;AI should not only generate answers.&lt;/p&gt;

&lt;p&gt;It should understand people.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gemmachallenge</category>
      <category>gemma</category>
      <category>ai</category>
    </item>
    <item>
      <title>From Models to Meaning: How Building NeuroSense AI with Gemma 4 Changed My View of Local AI</title>
      <dc:creator>Ekram Zafar</dc:creator>
      <pubDate>Sat, 23 May 2026 20:25:01 +0000</pubDate>
      <link>https://dev.to/ekram_zafar_f31942cd01173/from-models-to-meaning-how-building-neurosense-ai-with-gemma-4-changed-my-view-of-local-ai-ckk</link>
      <guid>https://dev.to/ekram_zafar_f31942cd01173/from-models-to-meaning-how-building-neurosense-ai-with-gemma-4-changed-my-view-of-local-ai-ckk</guid>
      <description>&lt;p&gt;There is a strange thing I noticed while learning and building around AI.&lt;/p&gt;

&lt;p&gt;Every time a new model appears, the first conversations usually sound very similar.&lt;/p&gt;

&lt;p&gt;People ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How many parameters does it have?&lt;/li&gt;
&lt;li&gt;How fast is it?&lt;/li&gt;
&lt;li&gt;Which benchmark did it beat?&lt;/li&gt;
&lt;li&gt;How does it compare against another model?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I understand why those questions matter.&lt;/p&gt;

&lt;p&gt;Benchmarks matter.&lt;/p&gt;

&lt;p&gt;Performance matters.&lt;/p&gt;

&lt;p&gt;Reasoning matters.&lt;/p&gt;

&lt;p&gt;But after spending time thinking about a project idea called &lt;strong&gt;NeuroSense AI&lt;/strong&gt;, I slowly realized that I was becoming interested in a very different question.&lt;/p&gt;

&lt;p&gt;Not:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How powerful is this model?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What kind of experiences can this model create for people?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That question stayed with me.&lt;/p&gt;

&lt;p&gt;And unexpectedly, it started from something very ordinary.&lt;/p&gt;

&lt;p&gt;Not from a research paper.&lt;/p&gt;

&lt;p&gt;Not from a benchmark chart.&lt;/p&gt;

&lt;p&gt;Not from a technical conference.&lt;/p&gt;

&lt;p&gt;It started from student life.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Moment I Started Thinking About This Differently
&lt;/h2&gt;

&lt;p&gt;As students, we all experience moments that feel strangely familiar.&lt;/p&gt;

&lt;p&gt;You sit down to study.&lt;/p&gt;

&lt;p&gt;You open your laptop.&lt;/p&gt;

&lt;p&gt;You create a plan.&lt;/p&gt;

&lt;p&gt;Maybe:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;finish assignments&lt;/li&gt;
&lt;li&gt;prepare for examinations&lt;/li&gt;
&lt;li&gt;complete projects&lt;/li&gt;
&lt;li&gt;revise notes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything feels manageable.&lt;/p&gt;

&lt;p&gt;Then something changes.&lt;/p&gt;

&lt;p&gt;You check one notification.&lt;/p&gt;

&lt;p&gt;You remember another deadline.&lt;/p&gt;

&lt;p&gt;You realize you forgot about another task.&lt;/p&gt;

&lt;p&gt;Suddenly your brain becomes noisy.&lt;/p&gt;

&lt;p&gt;Your thoughts become:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I am behind."&lt;/p&gt;

&lt;p&gt;"I am running out of time."&lt;/p&gt;

&lt;p&gt;"Why can't I focus?"&lt;/p&gt;

&lt;p&gt;"Why am I feeling overwhelmed?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I think many people have experienced some version of this.&lt;/p&gt;

&lt;p&gt;Now imagine opening an AI assistant and writing:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I have exams tomorrow and I feel exhausted."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most systems would probably generate something like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Take a break and stay positive."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Technically that is not wrong.&lt;/p&gt;

&lt;p&gt;But something felt incomplete to me.&lt;/p&gt;

&lt;p&gt;Because human conversations are rarely only about the words we type.&lt;/p&gt;

&lt;p&gt;Human conversations contain invisible things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;emotion&lt;/li&gt;
&lt;li&gt;context&lt;/li&gt;
&lt;li&gt;uncertainty&lt;/li&gt;
&lt;li&gt;stress&lt;/li&gt;
&lt;li&gt;frustration&lt;/li&gt;
&lt;li&gt;fear&lt;/li&gt;
&lt;li&gt;pressure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The sentence itself may be small.&lt;/p&gt;

&lt;p&gt;But what sits behind that sentence may be much larger.&lt;/p&gt;

&lt;p&gt;That became the starting point for an idea I called:&lt;/p&gt;

&lt;h1&gt;
  
  
  NeuroSense AI
&lt;/h1&gt;




&lt;h2&gt;
  
  
  What Is NeuroSense AI?
&lt;/h2&gt;

&lt;p&gt;NeuroSense AI is a privacy-focused AI assistant concept designed around emotional context and stress insight.&lt;/p&gt;

&lt;p&gt;I intentionally use the word &lt;strong&gt;insight&lt;/strong&gt; instead of diagnosis.&lt;/p&gt;

&lt;p&gt;The purpose is not to replace professionals.&lt;/p&gt;

&lt;p&gt;The purpose is not to become a medical system.&lt;/p&gt;

&lt;p&gt;The goal is much simpler:&lt;/p&gt;

&lt;p&gt;Create a system capable of listening more intelligently.&lt;/p&gt;

&lt;p&gt;I started imagining an interaction like this:&lt;/p&gt;

&lt;p&gt;User:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I haven't slept properly in three days and I cannot focus."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Traditional interpretation:&lt;/p&gt;

&lt;p&gt;A sentence.&lt;/p&gt;

&lt;p&gt;Potential contextual interpretation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;possible stress indicators&lt;/li&gt;
&lt;li&gt;exhaustion patterns&lt;/li&gt;
&lt;li&gt;emotional strain&lt;/li&gt;
&lt;li&gt;repeated negative sentiment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then I started asking myself:&lt;/p&gt;

&lt;p&gt;Can an AI system understand conversations in a way that feels closer to human interaction?&lt;/p&gt;

&lt;p&gt;Not perfect understanding.&lt;/p&gt;

&lt;p&gt;Not magical understanding.&lt;/p&gt;

&lt;p&gt;Just better understanding.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Made Me Think About Local AI
&lt;/h2&gt;

&lt;p&gt;As soon as I started thinking about systems involving emotional conversations, another issue immediately appeared.&lt;/p&gt;

&lt;p&gt;Privacy.&lt;/p&gt;

&lt;p&gt;Mental well-being conversations are different from ordinary prompts.&lt;/p&gt;

&lt;p&gt;People may discuss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stress&lt;/li&gt;
&lt;li&gt;emotional struggles&lt;/li&gt;
&lt;li&gt;personal thoughts&lt;/li&gt;
&lt;li&gt;educational pressure&lt;/li&gt;
&lt;li&gt;private experiences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This raises an interesting question:&lt;/p&gt;

&lt;p&gt;Where should that information live?&lt;/p&gt;

&lt;p&gt;For many AI systems today, information usually travels somewhere else.&lt;/p&gt;

&lt;p&gt;User input moves to remote infrastructure.&lt;/p&gt;

&lt;p&gt;Processing happens remotely.&lt;/p&gt;

&lt;p&gt;Response comes back.&lt;/p&gt;

&lt;p&gt;That process works.&lt;/p&gt;

&lt;p&gt;But I started wondering:&lt;/p&gt;

&lt;p&gt;What if AI could stay closer to users?&lt;/p&gt;

&lt;p&gt;That was where Gemma 4 became interesting.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I Chose Gemma 4
&lt;/h2&gt;

&lt;p&gt;One lesson I keep learning during development is:&lt;/p&gt;

&lt;p&gt;Choosing a model is not about selecting the biggest option available.&lt;/p&gt;

&lt;p&gt;A good model choice should solve a problem.&lt;/p&gt;

&lt;p&gt;For NeuroSense AI I needed several things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;understanding of conversational context&lt;/li&gt;
&lt;li&gt;support for longer interactions&lt;/li&gt;
&lt;li&gt;flexibility for future environments&lt;/li&gt;
&lt;li&gt;strong reasoning capability&lt;/li&gt;
&lt;li&gt;opportunities for more private experiences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gemma 4 became interesting because it felt less like one model and more like an ecosystem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Understanding the Gemma 4 Family Through a Builder's Perspective
&lt;/h2&gt;

&lt;p&gt;Instead of asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Which model is strongest?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I started asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Which model fits which problem?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Small Models (2B and 4B)
&lt;/h3&gt;

&lt;p&gt;Smaller models immediately stood out to me.&lt;/p&gt;

&lt;p&gt;Historically, smaller models often meant sacrificing capability.&lt;/p&gt;

&lt;p&gt;But efficient models create interesting opportunities.&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;p&gt;A student carrying an AI study assistant on a phone.&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;p&gt;An educational application operating in lower-resource environments.&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;p&gt;AI systems running on devices closer to users.&lt;/p&gt;

&lt;p&gt;That changes accessibility.&lt;/p&gt;

&lt;p&gt;Because not every developer owns expensive hardware.&lt;/p&gt;

&lt;p&gt;Not every student owns powerful systems.&lt;/p&gt;

&lt;p&gt;Smaller capable models reduce barriers.&lt;/p&gt;




&lt;h3&gt;
  
  
  31B Dense Model
&lt;/h3&gt;

&lt;p&gt;Larger dense models become useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deeper conversational workflows&lt;/li&gt;
&lt;li&gt;research assistance&lt;/li&gt;
&lt;li&gt;document understanding&lt;/li&gt;
&lt;li&gt;advanced reasoning tasks&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Mixture-of-Experts Architecture
&lt;/h3&gt;

&lt;p&gt;This architecture fascinated me because it approaches computation differently.&lt;/p&gt;

&lt;p&gt;Instead of activating everything all the time:&lt;/p&gt;

&lt;p&gt;specific experts become active depending on the task.&lt;/p&gt;

&lt;p&gt;The idea itself feels interesting because it resembles something humans often do.&lt;/p&gt;

&lt;p&gt;Humans do not use every skill simultaneously.&lt;/p&gt;

&lt;p&gt;We use different abilities depending on the situation.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Feature That Completely Changed My Thinking
&lt;/h2&gt;

&lt;p&gt;Initially I looked at the &lt;strong&gt;128K context window&lt;/strong&gt; and reacted like many people:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"That sounds impressive."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then I stopped looking at the number.&lt;/p&gt;

&lt;p&gt;I started looking at possibilities.&lt;/p&gt;

&lt;p&gt;What becomes possible when systems remember more?&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;p&gt;A semester-long student assistant.&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;p&gt;A research assistant reading multiple papers simultaneously.&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;p&gt;An emotional support system recognizing patterns across conversations.&lt;/p&gt;

&lt;p&gt;Without context:&lt;/p&gt;

&lt;p&gt;AI gives responses.&lt;/p&gt;

&lt;p&gt;With context:&lt;/p&gt;

&lt;p&gt;AI starts understanding situations.&lt;/p&gt;

&lt;p&gt;That difference matters much more than I initially thought.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Biggest Lesson I Learned
&lt;/h2&gt;

&lt;p&gt;The most surprising lesson was not technical.&lt;/p&gt;

&lt;p&gt;It was human.&lt;/p&gt;

&lt;p&gt;As developers we often optimize for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;speed&lt;/li&gt;
&lt;li&gt;architecture&lt;/li&gt;
&lt;li&gt;memory&lt;/li&gt;
&lt;li&gt;benchmarks&lt;/li&gt;
&lt;li&gt;parameters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But users think differently.&lt;/p&gt;

&lt;p&gt;Users usually ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Will this help me?"&lt;/p&gt;

&lt;p&gt;"Can I trust it?"&lt;/p&gt;

&lt;p&gt;"Does this understand me?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Behind every prompt there is usually a person.&lt;/p&gt;

&lt;p&gt;Behind every message there is usually a story.&lt;/p&gt;

&lt;p&gt;And sometimes behind that story there are emotions invisible to machines.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Before exploring Gemma 4, I thought mostly about capability.&lt;/p&gt;

&lt;p&gt;Now I think more about responsibility.&lt;/p&gt;

&lt;p&gt;Powerful AI matters.&lt;/p&gt;

&lt;p&gt;But meaningful AI matters more.&lt;/p&gt;

&lt;p&gt;Maybe the future of AI is not only larger systems.&lt;/p&gt;

&lt;p&gt;Maybe it is systems that understand people better.&lt;/p&gt;

&lt;p&gt;Because eventually the question stops being:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Can we build intelligent systems?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And becomes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Can we build systems that create better human experiences?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the question I want to keep exploring.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gemmachallenge</category>
      <category>gemma</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
