<?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: Dien</title>
    <description>The latest articles on DEV Community by Dien (@dien).</description>
    <link>https://dev.to/dien</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%2F19114%2F91a6ca5a-2aa8-46f2-bed4-38e6d365574e.png</url>
      <title>DEV Community: Dien</title>
      <link>https://dev.to/dien</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dien"/>
    <language>en</language>
    <item>
      <title>Allergy &amp; Diet Guard — Protecting My Friend with Local Open-Source AI</title>
      <dc:creator>Dien</dc:creator>
      <pubDate>Fri, 02 Oct 2026 11:20:52 +0000</pubDate>
      <link>https://dev.to/dien/allergy-diet-guard-protecting-my-friend-with-local-open-source-ai-7hn</link>
      <guid>https://dev.to/dien/allergy-diet-guard-protecting-my-friend-with-local-open-source-ai-7hn</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-weekend-2026-10-01"&gt;Hacktoberfest Weekend Challenge: Build for a Friend&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




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

&lt;p&gt;I built &lt;strong&gt;Allergy &amp;amp; Diet Guard (SafeBite)&lt;/strong&gt; for my friend &lt;strong&gt;Sarah&lt;/strong&gt;, who lives with an unforgiving combination of dietary hazards:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Severe Peanut Allergy&lt;/strong&gt; (life-threatening anaphylactic shock)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Celiac Disease&lt;/strong&gt; (strict gluten-free requirement)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lactose Intolerance&lt;/strong&gt; (no dairy)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eating out at local restaurants, street food stalls, or night markets with Sarah is usually stressful. Menus and product labels rarely say &lt;em&gt;"Peanut"&lt;/em&gt; or &lt;em&gt;"Wheat"&lt;/em&gt;; they list obscure culinary terms like &lt;strong&gt;"arachis oil"&lt;/strong&gt;, &lt;strong&gt;"seitan"&lt;/strong&gt;, &lt;strong&gt;"malt extract"&lt;/strong&gt;, &lt;strong&gt;"casein"&lt;/strong&gt;, or &lt;strong&gt;"modified starch"&lt;/strong&gt;. A single contaminated bite can mean an emergency hospital visit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Allergy &amp;amp; Diet Guard&lt;/strong&gt; is a local, privacy-first food safety sentinel. It takes any food description, ingredients list, or menu item and runs a dual-layer open-source safety analysis to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Detect both direct allergens and obscure hidden derivatives (e.g. flagging &lt;em&gt;arachis oil&lt;/em&gt; as a peanut risk).&lt;/li&gt;
&lt;li&gt;Highlight high-risk kitchen cross-contamination vectors (shared fryers, woks, cutting boards).&lt;/li&gt;
&lt;li&gt;Issue an unmistakable verdict: &lt;strong&gt;🔴 DANGER&lt;/strong&gt;, &lt;strong&gt;🟡 WARNING&lt;/strong&gt;, or &lt;strong&gt;🟢 SAFE&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Generate a one-click, bilingual (English &amp;amp; Indonesian) &lt;strong&gt;Chef Safety Card&lt;/strong&gt; that Sarah can show directly to the waiter or kitchen staff.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When I showed the prototype to Sarah, she breathed a huge sigh of relief:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Finally, something I can use in the basement food court without needing an internet signal or wondering if my medical details are being tracked by an ad network!"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Web App (Hosted on Render):&lt;/strong&gt; &lt;a href="https://hacktoberfest-2026.onrender.com/weekend/" rel="noopener noreferrer"&gt;https://hacktoberfest-2026.onrender.com/weekend/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unified Challenge Portal:&lt;/strong&gt; &lt;a href="https://hacktoberfest-2026.onrender.com/" rel="noopener noreferrer"&gt;https://hacktoberfest-2026.onrender.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The app runs as a zero-dependency lightweight web dashboard, deployed live as a Python web service on &lt;strong&gt;Render&lt;/strong&gt;, or runnable locally at &lt;code&gt;http://localhost:8080&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-world Test Scenarios:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Test 1: Pad Thai with hidden Peanut oil&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input:&lt;/strong&gt; &lt;em&gt;"Pad thai noodles with fried egg, bean sprouts, crushed peanuts, scallions, cooked with arachis oil and fish sauce."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verdict:&lt;/strong&gt; &lt;code&gt;🔴 DANGER: DO NOT CONSUME&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detected Hazards:&lt;/strong&gt; Direct peanuts + obscure alias &lt;code&gt;arachis oil&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kitchen Risks:&lt;/strong&gt; Shared woks and cold-pressed peanut oils.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Test 2: Vegan Stew with hidden Gluten&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input:&lt;/strong&gt; &lt;em&gt;"Vegetarian plant-based BBQ bowl with roasted seitan chunks, malt extract sauce, steamed corn, and barley pearls."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verdict:&lt;/strong&gt; &lt;code&gt;🔴 DANGER: Celiac / Gluten Violation&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detected Hazards:&lt;/strong&gt; &lt;code&gt;seitan&lt;/code&gt;, &lt;code&gt;malt extract&lt;/code&gt;, and &lt;code&gt;barley pearls&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Test 3: Clean Atlantic Salmon&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input:&lt;/strong&gt; &lt;em&gt;"Pan-seared Atlantic salmon fillet with extra virgin olive oil, sea salt, cracked black pepper, steamed broccoli, and jasmine rice."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verdict:&lt;/strong&gt; &lt;code&gt;🟢 SAFE&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chef Safety Card Output (English &amp;amp; Indonesian):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;⚠️ ALLERGY NOTICE FOR THE CHEF:
Hello, I am ordering for my friend Sarah.
STRICT ALLERGIES: Peanut / Groundnut, Gluten / Wheat / Celiac Risk, Dairy / Milk / Casein
DIETARY PREFERENCES: None
Please ensure food contains NO traces of these ingredients and clean cookware/utensils are used to avoid cross-contamination. Thank you!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;p&gt;The code is completely open-source and structured for immediate zero-dependency execution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/dieennn/hacktoberfest-2026/tree/main/00-weekend-allergy-guard" rel="noopener noreferrer"&gt;github.com/dieennn/hacktoberfest-2026/tree/main/00-weekend-allergy-guard&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Project Architecture:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;app.py&lt;/code&gt;: Standalone Python web server &amp;amp; REST API using purely Python 3 standard library (&lt;code&gt;http.server&lt;/code&gt; &amp;amp; &lt;code&gt;socketserver&lt;/code&gt;). Zero &lt;code&gt;pip install&lt;/code&gt; required.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analyzer.py&lt;/code&gt;: Open clinical taxonomy engine mapping FDA Big 9 and EU 14 allergens, cross-contamination rules, and local inference bridge.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;static/index.html&lt;/code&gt;: Responsive, accessible web UI with friend profile presets and instant safety feedback.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test_analyzer.py&lt;/code&gt;: Self-contained assert-based automated test suite.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;The core engine is built on a &lt;strong&gt;hybrid open-source AI architecture&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Embedded Clinical Semantic Ontology (100% Offline &amp;amp; Deterministic):&lt;/strong&gt;
We codified FDA Big 9 and EU 14 allergens into an open clinical knowledge base with dozens of obscure culinary aliases (e.g. &lt;em&gt;arachis&lt;/em&gt;, &lt;em&gt;valencias&lt;/em&gt;, &lt;em&gt;seitan&lt;/em&gt;, &lt;em&gt;farro&lt;/em&gt;, &lt;em&gt;spelt&lt;/em&gt;, &lt;em&gt;caseinate&lt;/em&gt;, &lt;em&gt;surimi&lt;/em&gt;, &lt;em&gt;albumen&lt;/em&gt;) and cross-contact risk patterns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local Open-Weights LLM Integration (Ollama):&lt;/strong&gt;
When Ollama is running locally (&lt;code&gt;llama3.2&lt;/code&gt;, &lt;code&gt;gemma2&lt;/code&gt;, or &lt;code&gt;qwen2.5&lt;/code&gt;), the system passes the matched hazards to the local open model to generate tailored culinary advice and allergen-free ingredient swaps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failsafe Design Ladder:&lt;/strong&gt;
Safety cannot rely on probabilistic guesswork. If either the deterministic clinical rules or the local open model identifies a risk, the system escalates to &lt;strong&gt;DANGER&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;Why not just use a closed proprietary API like ChatGPT or Claude?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Works Completely Offline in Low-Connectivity Environments:&lt;/strong&gt;
Food courts, basement restaurants, rural markets, and international travel frequently suffer from poor or zero internet connectivity. Closed APIs fail completely. Open-source local inference works everywhere, every time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health Data Privacy &amp;amp; Sovereignty:&lt;/strong&gt;
A person's medical allergies and health conditions are strictly sensitive personal data. Running open-source models locally guarantees zero data telemetry and zero tracking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Cost &amp;amp; Zero Rate Limits:&lt;/strong&gt;
Friends shouldn't have to pay subscription fees or worry about API token credits just to know if their dinner is safe to eat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic Failsafe Control:&lt;/strong&gt;
Closed AI models change behind closed doors and frequently suffer from hallucinations on complex ingredient derivatives. With open code and local weights, we enforce strict verification and safety boundaries.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;p&gt;This project was built and validated during our Hacktoberfest 2026 preparation session using the DevRelay harness.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hacktoberfest Open-Source AI Challenge&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Build for a Friend Theme&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Render&lt;/strong&gt;: Deployed the live unified AI food safety application as a cloud web service on Render, serving both the interactive UI and the real-time inference API.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>weekendchallenge</category>
      <category>hf26challenge</category>
    </item>
  </channel>
</rss>
