<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sammingas on Medium]]></title>
        <description><![CDATA[Stories by Sammingas on Medium]]></description>
        <link>https://medium.com/@fhaida?source=rss-1ad24d809bb9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NO_kgBwR5Qqhnt-C</url>
            <title>Stories by Sammingas on Medium</title>
            <link>https://medium.com/@fhaida?source=rss-1ad24d809bb9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:15:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fhaida/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Telugu N-gram Visualizer: From Corpus to Click-Ready GUI]]></title>
            <link>https://fhaida.medium.com/building-a-telugu-n-gram-visualizer-from-corpus-to-click-ready-gui-a90dd2a0f629?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a90dd2a0f629</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 01:58:53 GMT</pubDate>
            <atom:updated>2025-08-06T01:58:53.385Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>“If you can’t see it, you can’t debug it.”</em></blockquote><blockquote><em>— Every engineer, ever</em></blockquote><p>Natural-language processing often feels abstract. Probability tables, Markov assumptions, Laplace smoothing… it’s easy to lose the human touch that language deserves. That’s exactly why I decided to turn a classic NLP work-horse — the n-gram model — into a point-and-click visual story, focused on <strong>Telugu text written in English script with full emoji support</strong>.</p><p>In this article you’ll learn how the project is structured, how the model works under the hood, and how I wrapped everything in a modern Tkinter GUI for instant insight. All code is available on GitHub, but we’ll stay at 30,000 ft and only dive where it matters.</p><h3>Why Telugu, Why Emojis?</h3><ol><li><strong>Language Digitisation</strong> — South-Asian languages still lag behind English in open-source tooling.</li><li><strong>Roman Script</strong> — Most chat apps default to Latin keyboards; supporting “nenu intiki veltunnanu 🏃” is more practical than requiring native script.</li><li><strong>Emojis as Tokens</strong> — They’re semantically rich and ubiquitous. Treating them as first-class citizens makes the model future-proof for social-media data.</li></ol><h3>Project Anatomy</h3><pre>telugu-ngram-visualizer/<br>│<br>├── ngram_model.py     # Core N-gram logic<br>├── ngram_gui.py       # Tkinter front-end<br>├── telugu_corpus.py   # Sentence &amp; emoji factory<br>└── outputs/           # Auto-saved screenshots + logs</pre><h3>1. Corpus Generator (telugu_corpus.py)</h3><ul><li>Nine thematic buckets — Daily Activities, Food, Tech, etc.</li><li>Sentences are <strong>pre-processed</strong> so emojis become standalone tokens (🙂 → &#39;🙂&#39;).</li><li>Utility helpers:</li><li>generate_corpus() returns the full list.</li><li>get_random_suggestions() feeds the “🎲 Random” button.</li><li>get_category_suggestion() powers the category tiles.</li></ul><h3>2. The Engine (ngram_model.py)</h3><ul><li><strong>Pure-Python</strong>, no external NLP libs required.</li><li>Maximum-Likelihood Estimation on-the-fly:</li></ul><p>self.ngrams[context][target] += 1 probability = count / context_totals[context]</p><ul><li>Handles n = 2…5, pads sentences with &lt;START&gt; / &lt;END&gt;.</li><li>Returns both the <strong>predicted word</strong> and a <strong>full probability dict</strong> for visualisation.</li><li>get_calculation_steps() converts raw math into human-readable strings (“Count of ‘🏖️’: 3/15 → 0.20”).</li></ul><h3>3. The GUI (ngram_gui.py)</h3><ul><li>Built with <strong>Tkinter</strong> + <strong>ttkthemes</strong> for a modern “arc” look.</li><li><strong>ModernButton</strong> subclass adds hover effects in two lines of code.</li><li>Key widgets:</li><li>Dropdown to select N-gram order</li><li>Text field for context input</li><li>Speed slider (0.1× — 2×) controlling animation timing</li><li>Matplotlib canvas embedded via FigureCanvasTkAgg</li><li>Each prediction triggers:</li></ul><ol><li>Scrolling console that prints the step-by-step math, animated.</li><li>A bar chart showing probability distribution (gradient blues).</li><li>Auto-saving of both the terminal log and the chart into outputs/ with timestamps.</li></ol><h3>Walking Through a Prediction</h3><ol><li><strong>User types</strong>: “nenu coffee”</li><li>Context captured → [&#39;nenu&#39;, &#39;coffee&#39;] (with padding if needed)</li><li>Model computes counts within corpus:</li></ol><ul><li>Context: nenu coffee Count of &#39;taagutaara ☕&#39;: 4 Count of &#39;taagutunnanu 🥤&#39;: 1</li></ul><ol><li>Probabilities normalised, highest wins (taagutaara at 0.80).</li><li>GUI prints each line with a small delay (settable) for pedagogy.</li><li>Chart appears; user screenshots or just grazes over bars.</li></ol><h3>Design Choices &amp; Lessons Learned</h3><p>Challenge Decision Payoff Emojis messing up token splits Regex that inserts spaces around Unicode ranges Seamless tokenisation Tkinter’s dated look Drop-in ttkthemes + custom Style() Native-app aesthetic Teaching algorithmic steps Animated scrolled text Higher comprehension for beginners Data fatigue Nine themed categories + randomiser Fun input, keeps demos fresh</p><h3>Extending the Project</h3><ol><li><strong>Add Smoothing</strong> — Good-Turing or Kneser-Ney to tackle zero-frequency.</li><li><strong>Switch Scripts</strong> — Integrate Unicode Telugu input instead of Romanised text.</li><li><strong>Export Modes</strong> — One-click export to GIF or interactive HTML via Plotly.</li><li><strong>Bigger Corpora</strong> — Hook up Wikipedia dumps or Kaggle datasets to evolve beyond toy scale.</li></ol><h3>Try it Yourself</h3><pre>git clone &lt;https://github.com/sammingasainath/telugu-ngram-visualizer.git&gt;<br>cd telugu-ngram-visualizer<br>pip install -r requirements.txt<br>python ngram_gui.py</pre><p>No GPU, no heavyweight dependencies — just Python, Tkinter, and a dash of Matplotlib.</p><p>Github Link : <a href="https://github.com/sammingasainath/telugu-ngram-visualizer?tab=readme-ov-file#-output-examples">https://github.com/sammingasainath/telugu-ngram-visualizer</a></p><h3>Final Thoughts</h3><p>Language models don’t have to hide behind REST endpoints or notebooks. With a couple of hundred lines of code, you can transform math into something learners — especially non-technical — can <strong>see, click, and feel</strong>.</p><p>Whether you teach NLP, process vernacular data, or just love emojis, the Telugu N-gram Visualizer is a blueprint for turning algorithms into experiences. Fork it, swap the corpus, and bring your language to life.</p><p><em>Happy predicting! 😊</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a90dd2a0f629" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Word-Embedding Playground for Telugu ( Or Any Indian Language )  — A Behind-the-Scenes…]]></title>
            <link>https://fhaida.medium.com/building-a-word-embedding-playground-for-telugu-or-any-indian-language-a-behind-the-scenes-ce07ebbcd00c?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce07ebbcd00c</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 01:58:44 GMT</pubDate>
            <atom:updated>2025-08-06T01:58:44.015Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Word-Embedding Playground for Telugu ( Or Any Indian Language ) — A Behind-the-Scenes Tour</h3><blockquote><em>How we combined PyTorch, Tkinter, and a dash of Plotly to create an end-to-end CBOW trainer, visualiser, and teaching aid for a low-resource language.</em></blockquote><h3>1. Why This Project Exists</h3><p>Telugu is India’s fourth-most-spoken language, yet NLP resources for it lag far behind English, Hindi, or Chinese. Word-embedding models such as Word2Vec can bridge that gap, but the usual training/visualisation pipelines assume you are comfortable with notebooks and CLI-only workflows.</p><p>Our goal was to ship <strong>a single desktop app</strong> that lets students, teachers, and hobbyists:</p><ol><li>Paste Telugu text (transliterated into English script).</li><li>Click “Train” to fit a Continuous Bag-of-Words (CBOW) model.</li><li>Watch an animated t-SNE/PCA scatter plot bloom in real time.</li><li>Explore similar-word queries and classic “king − man + woman”-style analogies.</li></ol><p>All without touching a terminal.</p><h3>2. Zooming Out: Project Layout</h3><pre>📦 telugu-word-embeddings-visualiser<br>├── docs/                # screenshots for the article &amp; app<br>├── src/<br>│   ├── data/            # pre-processing &amp; dataset helpers<br>│   ├── model/           # CBOW network + negative-sampling loss<br>│   ├── visualization/   # t-SNE/PCA + fancy animations<br>│   ├── gui/             # 1300-line Tkinter powerhouse<br>│   └── main.py          # entry-point (python src/main.py)<br>└── requirements.txt</pre><p>Everything is plain Python (3.7+) and 20 open-source libraries. No compiled extensions, no Cython, no webserver — so anyone can pip install -r requirements.txt and run it.</p><h3>3. Data Pipeline: From Text to Tensor</h3><p>File: src/data/preprocessor.py</p><ol><li><strong>Cleaning &amp; Tokenising</strong></li></ol><p>We only need ASCII because users type Telugu words in English letters (e.g., nenu, vellanu). A couple of regexes remove punctuation &amp; digits.</p><p><strong>2. Vocabulary Build</strong></p><p>Counter → [PAD, UNK, …unique words…] → two dicts word2idx and idx2word.</p><p><strong>3. CBOW Pair Generation</strong></p><ol><li>Sliding window produces (context, target) tuples.</li><li>Returned as two torch.LongTensors, ready for batching.</li></ol><blockquote><em>✨ Pro-tip: The class has just ~160 lines; it’s a great template for any language.</em></blockquote><h3>4. The Model: Minimalistic yet Extensible</h3><p>File: src/model/cbow.py</p><pre>class CBOWModel(nn.Module):<br>    def __init__(self, vocab_size, embedding_size=100):<br>        self.embeddings = nn.Embedding(vocab_size, embedding_size)<br>        self.linear = nn.Linear(embedding_size, vocab_size)</pre><p>That’s <strong>all</strong> the learnable layers.</p><p>Forward pass = average context embeddings → linear classifier.</p><p>Loss = custom NegativeSamplingLoss, a drop-in replacement for nn.CrossEntropyLoss that speeds training when vocab is large.</p><p>Performance isn’t state-of-the-art, but the code is teachable, hackable, and GPU-friendly.</p><h3>5. Training Orchestration</h3><p>File: src/model/trainer.py</p><p>The CBOWTrainer object takes:</p><ul><li>a CBOWModel</li><li>a TeluguPreprocessor</li><li>hyper-parameters (LR, batch size, epochs)</li></ul><p>and adds:</p><ul><li>tqdm progress bars</li><li>optional callback hooks for the GUI</li><li>an in-memory loss history plot (matplotlib)</li><li>save_model/load_model helpers (PyTorch checkpoint dictionaries)</li></ul><p>Thanks to dependency injection, you could replace the CBOW core with Skip-Gram or FastText in minutes.</p><h3>6. Visualisation Magic</h3><p>File: src/visualization/embeddings_viz.py</p><ul><li><strong>Dimensionality Reduction</strong> — t-SNE (default) or PCA.</li><li><strong>Animated “unfolding”</strong> from random scatter → final embedding positions.</li><li><strong>Cluster colouring</strong> (k-means) and hover-tooltips.</li><li><strong>Heatmaps &amp; analogy arrows</strong> for deeper analysis.</li></ul><p>All heavy lifting is NumPy/Sklearn; final frames are fed back to the GUI via Matplotlib or Plotly.</p><h3>7. GUI: Turning PyTorch into a Toy</h3><p>File: src/gui/main_window.py (≈ 1.3 k lines)</p><p>Tkinter often gets a bad rap for being “ugly”, so we:</p><ol><li><strong>ThemedTk (“arc”)</strong> for modern widgets.</li><li>Three-tab layout: <strong>Training</strong>, <strong>Visualisation</strong>, <strong>Analysis</strong>.</li><li>Scrollable frames, responsive resizing, and balloon tooltips.</li><li>Background threads to keep the window snappy during training/dimensionality reduction.</li><li>Menu bar with load/save model, open text file, and “About” dialog.</li></ol><p>Result: a single binary (via PyInstaller) that launches on Windows/macOS/Linux.</p><h3>8. What We Learned</h3><ul><li><strong>Progress Hooks are Gold</strong> — short callbacks let the GUI stay responsive and reduce user anxiety.</li><li><strong>Animation Sells</strong> — watching points glide into clusters makes embeddings “click” for newcomers.</li><li><strong>Low-Resource ≠ Low-Quality</strong> — even with a few hundred sentences, the model captures gender pairs (anna/akka) surprisingly well.</li><li><strong>Tkinter is Alive</strong> — with ttkthemes and some TLC, you can ship attractive desktop tools without Electron heft.</li></ul><h3>9. Future Directions</h3><ol><li><strong>Skip-Gram + Sub-word</strong>: implement FastText-style character n-gram embeddings to handle rich Telugu morphology.</li><li><strong>Web Assembly Front-end</strong>: port the visualiser to a static React/Plotly page so users need only a browser.</li><li><strong>Dataset Hub</strong>: bundle curated Telugu corpora (news, Wikipedia) that users can download in-app.</li><li><strong>Explainable Embeddings</strong>: integrate SHAP or attention maps to demystify vector arithmetic.</li></ol><h3>10. Try It Yourself</h3><pre>git clone &lt;https://github.com/yourusername/telugu-word-embeddings-visualizer.git&gt;<br>cd telugu-word-embeddings-visualizer<br>python -m venv venv &amp;&amp; source venv/bin/activate   # Windows: venv\\\\Scripts\\\\activate<br>pip install -r requirements.txt<br>python src/main.py</pre><p>Paste some Telugu-in-English-letters text, click <strong>Start Training</strong>, grab a coffee ☕ — then dive into the animated plots!</p><h3>Final Thoughts</h3><p>Tools like this won’t replace large-scale research, but they <em>will</em> put powerful NLP concepts in the hands of teachers, students, and indie hackers who think “deep learning is only for English”. And that, in my book, is a win for linguistic diversity.</p><p><em>Happy embedding!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce07ebbcd00c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We, the Science and Technical Council RGIPT, Team, Turned a Soda Bottle into a Sky-High Water…]]></title>
            <link>https://fhaida.medium.com/how-we-the-science-and-technical-council-rgipt-team-turned-a-soda-bottle-into-a-sky-high-water-7e8636bfb9b6?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e8636bfb9b6</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 01:57:54 GMT</pubDate>
            <atom:updated>2025-08-06T01:57:54.794Z</atom:updated>
            <content:encoded><![CDATA[<h3>How We, the Science and Technical Council RGIPT, Team, Turned a Soda Bottle into a Sky-High Water Rocket</h3><h3>1. Why a Water Rocket?</h3><p>We wanted a rocket that needed no fire, no special permit, and no expensive parts. A water rocket was perfect: fill a plastic drink bottle with water, pump in air, and let it fly. When the water blasts out one way, the bottle shoots the other — that’s Newton’s third law in action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*9yi5QP-UyV6ZIwSDKvN4DA.jpeg" /></figure><h3>2. First Ideas</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iB4HRupNCfyslFRC3OtudQ.jpeg" /></figure><p>Before touching any tools, we sketched and read up on the basics. Two simple truths guided our design:</p><ol><li>A smaller, smooth nozzle sends water out faster, giving more push.</li><li>The bottle must stay strong while holding all that air pressure.</li></ol><p>Get those two right, and you’re already halfway to a good flight.</p><h3>3. Shaping the Nozzle with Simple Tools</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jr7cX97reaWFEKcbZhBLcw.jpeg" /></figure><p>No fancy machines here:</p><ul><li>We drilled a neat 6 mm hole in a spare bottle cap as the “throat.”</li></ul><p>• With sandpaper wrapped around a pencil, we widened the inside to about 12 mm, making a gentle taper.</p><p>• A rubber washer under the cap stopped leaks.</p><p>Plain hand tools, steady hands, and patience did the job.</p><h3>4. Making the Bottle Strong</h3><p>When you pump air into a bare bottle it balloons like chewing gum. We wrapped ours in a thin layer of carbon-fiber cloth and epoxy (strong packing tape also works). The wrap turned a flimsy bottle into a small pressure tank while adding only a few grams.</p><h3>5. Building Straight-Flying Fins</h3><p>Fins keep the rocket pointed upward. We cut three identical triangles from a plastic folder and glued them near the base. Symmetry was the key: if the fins match, the rocket flies straight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*tqFnTQ_BtmtlYaiL9CN_Yw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M_UPIA25iVXxUqAAaRRyJw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*l37_YhbbMmE1cweQYi8ryg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gYEIEoV5x0sUBrrzYM3NPg.jpeg" /></figure><h3>6. Launch Day</h3><p>On a calm Saturday morning we filled the rocket one-third with water, stood it on a simple launch stand, and pumped it up to 115 psi with a bicycle pump. One quick pull on the release cord and — WHOOSH! — all the water shot out in less than half a second, leaving a clean white plume behind.</p><h3>7. How High Did It Go?</h3><p>Using a phone video and a nearby light pole for scale, we estimated the peak height at about 100 meters — a football field standing on end. Not bad for something made from a drink bottle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uSxXiEH7XbTYCr2J5f2Fow.jpeg" /></figure><h3>8. What Worked and What Didn’t</h3><p>✔ Carbon wrap stopped bulging and leaks.</p><p>✔ Smooth, hand-shaped nozzle gave a high, straight flight.</p><p>✘ No parachute meant a hard landing, though the carbon wrap saved the bottle.</p><h3>9. Next Steps</h3><ul><li>Add a simple plastic-bag parachute so the rocket lands softly.</li></ul><p>• Try a slightly bigger bottle for more water and thrust.</p><p>• Build a sturdier launch stand so pumping feels safer.</p><h3>Final Thoughts</h3><p>For us on the Science and Technical Council Team, building a water rocket mixed school-level science with weekend fun. With a spare bottle, some tape or fiber wrap, and patience, you too can send everyday trash higher than most trees. Give it a try — water and air can take you farther than you might think.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e8636bfb9b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Retrieval-Augmented Recommender — A Deep-Dive]]></title>
            <link>https://fhaida.medium.com/building-a-retrieval-augmented-recommender-a-deep-dive-6c2fe2b1729c?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c2fe2b1729c</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 08:57:25 GMT</pubDate>
            <atom:updated>2025-07-01T08:57:25.596Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Retrieval-Augmented Recommender — A Deep-Dive</h3><p>From web-scraping to LLM-reranking, a complete tour of a production-ready Gen-AI stack powered by FastAPI, Supabase + pgvector, and Google’s Gemini.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6Bqj7Hka_UAkGg2rT4ugA.png" /></figure><h3>1. The Story We’re Solving</h3><p>SHL hosts hundreds of cognitive, personality and skills assessments. Recruiters look at a job description (JD) and wonder: <em>“Which 5–10 tests best predict success for this role?”</em></p><p>Our project answers that question automatically:</p><ol><li><strong>Understand</strong> the recruiter’s natural-language JD.</li><li><strong>Retrieve</strong> the most semantically similar assessments.</li><li><strong>Rerank</strong> them with an LLM that can reason about subtle context.</li><li><strong>Return</strong> a crisp JSON (or a pretty Streamlit table).</li></ol><p>Behind that apparently simple flow sits a full-stack codebase that:</p><ul><li>Scrapes the SHL website</li></ul><p>• Generates embeddings with Gemini</p><p>• Stores vectors in a Postgres/pgvector instance (via Supabase)</p><p>• Exposes a FastAPI backend with three functional domains: <em>Recommendations, Assessments CRUD,</em> and <em>Offline Evaluation</em></p><p>• Ships with a Streamlit front-end for demoing, plus an extensive test-harness &amp; scripts for DevOps.</p><p>Let’s peel the layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vOWHDwHR9S0dveE3QHarag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9VNtZUzh0VQzeAYdD1ayBA.png" /></figure><h3>2. File-Tree at a Glance</h3><pre>SHL_Intern_Assignment/<br>├─ shl_scraper/          # Crawling + raw → CSV<br>├─ backend/              # FastAPI microservice<br>│  ├─ routers/           # HTTP endpoints (recommend, assessments, eval)<br>│  ├─ services/          # Supabase, Gemini, RAG pipeline…<br>│  ├─ models/            # Pydantic request/response objects<br>│  └─ scripts/           # One-off CLI helpers (setup DB, embeddings…)<br>├─ frontend/             # Streamlit UI<br>└─ docker-compose.yml    # One-command deployment</pre><p>Keep this map in the back of your mind; every section below references one of these blocks.</p><h3>3. Data Ingestion — From HTML to Vectors</h3><h3>3.1 Scraping (shl_scraper/)</h3><ul><li>scraper.py uses requests + BeautifulSoup to walk through SHL’s catalog (see shl_scraper/data/debug/*.html for cached pages).</li><li>The raw HTML is parsed into structured JSON (id, name, duration, test-types, languages, …).</li><li>json_to_csv.py &amp; convert_to_csv.py transform those into tidy CSVs ready for analytics.</li></ul><h3>3.2 Embedding Generation</h3><p>An LLM can’t search raw text quickly, so we project each assessment description into a 768-dimensional vector:</p><pre>python scripts/generate_embeddings.py \\\\<br>       --input shl_scraper/data/processed/shl_assessments.csv \\\\<br>       --output backend/data/embeddings.npy</pre><p>Under the hood GeminiService.get_embedding():</p><ol><li>Talks to Google’s <strong>GenerativeAI v0.8.4</strong> embed_content endpoint.</li><li>Falls back to a deterministic <strong>mock</strong> vector when USE_MOCK_DATA=True (great for offline dev).</li><li>Retries (Tenacity) on network hick-ups.</li></ol><h3>3.3 Storing in Supabase (Postgres + pgvector)</h3><p>backend/scripts/setup_database.py &amp; friends run SQL such as:</p><pre>CREATE EXTENSION IF NOT EXISTS vector;<br>ALTER TABLE assessments ADD COLUMN embedding vector(768);<br>CREATE INDEX assessment_vec_idx ON assessments USING hnsw(embedding);</pre><p>so a <strong>cosine-distance</strong> lookup becomes a plain SQL call.</p><p>SupabaseService wraps Supabase’s client but degrades gracefully to an <strong>in-memory mock</strong> if keys are missing.</p><h3>4. Backend Microservice — FastAPI Done Right</h3><h3>4.1 Bootstrapping (backend/main.py)</h3><ul><li>Loads <strong>core/config.py</strong> (Pydantic Settings) – env-vars, CORS, debug flags.</li><li>Registers <strong>routers</strong> (/api/recommendations, /api/assessments, /api/evaluation).</li><li>Adds <strong>middleware</strong> for CORS and access-log timing.</li><li>Spins uvicorn with reload in dev.</li></ul><h3>4.2 Domain Routers</h3><ol><li><strong>Recommendations (</strong><strong>routers/recommendations.py)</strong> – POST a RecommendationRequest and get back top-k AssessmentResponse objects.</li></ol><p>• Extracts <em>implicit</em> filters from the JD using Gemini (gemini_service.extract_filters_from_query).</p><p>• Builds a merged filter-set and calls the <strong>RAG pipeline</strong>.</p><p>• Optionally re-ranks with Gemini to squeeze extra relevance when ALWAYS_USE_LLM_RERANKING=True.</p><p><strong>2. Assessments CRUD (</strong><strong>routers/assessments.py)</strong> – RESTful endpoints (GET list, POST create, PUT update, DELETE). File-upload of CSVs triggers a batch insert &amp; asynchronous embedding generation.</p><p><strong>3. Offline Evaluation (</strong><strong>routers/evaluation.py)</strong></p><p>• Stores ground-truth pairs (query ↔ relevant assessments).</p><p>• Runs metrics: Recall@K, Precision curve, Mean Average Precision (MAP).</p><p>• Persists every run under backend/data/evaluation/results/*.json for reproducibility.</p><h3>4.3 Service Layer</h3><ul><li><strong>SupabaseService</strong> (~900 LOC):</li><li>Thin data-access layer with <em>real</em> or <em>mock</em> mode.</li><li>match_assessments() executes SELECT *, 1 - (embedding &lt;=&gt; :query_vec) AS similarity … ORDER BY similarity DESC LIMIT :k.</li><li><strong>GeminiService</strong> (~550 LOC):</li><li>– Two jobs: get_embedding() and generate_recommendations() (LLM-rerank).</li><li>– Implements exponential backoff retries and structured parsing for JSON replies.</li><li><strong>RAGPipeline</strong> (Retrieval-Augmented Generation):</li></ul><pre>User Query<br>   │<br>   ├─► gemini.get_embedding()<br>   ├─► supabase.match_assessments()   # dense retrieval<br>   ├─► gemini.generate_recommendations()  # rerank indices<br>   └─► Assemble AssessmentResponse[]</pre><p>Because we retrieve <em>k × RETRIEVAL_MULTIPLIER</em> first, we keep recall high while still returning exactly <em>k</em> records after reranking.</p><ul><li><strong>EvaluationService</strong> glues RAGPipeline with metrics; everything async to avoid event-loop blocking.</li></ul><h3>5. Front-End — Streamlit Dashboard</h3><p>Open frontend/app.py:</p><ol><li><strong>Query Box</strong> — type a JD (or random text).</li><li><strong>Filters</strong> — multiselect job-levels, test-types, languages, max duration slider, remote toggle.</li><li><strong>Table</strong> — pretty st.dataframe with ranking, description, duration parsing, link to SHL page.</li><li><strong>Radar / Bar Charts</strong> — quick Plotly visuals to explain distribution of test-types vs job-level.</li></ol><p>Because Streamlit is stateless between users, any business secrets stay in the backend.</p><h3>6. Evaluation &amp; Experimentation</h3><p>Running:</p><pre>curl -X POST &lt;http://localhost:8000/api/evaluation/ground-truth&gt; \\\\<br>     -H &quot;Content-Type: application/json&quot; \\\\<br>     -d &#39;[{&quot;id&quot;:&quot;q1&quot;,&quot;query&quot;:&quot;Graduate analyst&quot;,&quot;relevant_assessments&quot;:[&quot;Numerical Reasoning&quot;,&quot;Inductive Reasoning&quot;]}]&#39;<br>curl -X POST &quot;&lt;http://localhost:8000/api/evaluation/run?k=10&gt;&quot;</pre><p>yields a JSON summary:</p><pre>{<br>  &quot;mean_recall_at_k&quot;: 0.67,<br>  &quot;mean_average_precision&quot;: 0.54,<br>  &quot;k_value&quot;: 10,<br>  &quot;total_queries&quot;: 5,<br>  &quot;timestamp&quot;: &quot;2025-04-07T09:14:45.123Z&quot;,<br>  &quot;evaluation_results&quot;: [...]<br>}</pre><p>Use these numbers to iterate on prompt engineering, embeddings, or schema tweaks.</p><h3>7. DevOps &amp; Local Development</h3><ul><li><strong>Environment Isolation</strong> — three requirements.txt (root, backend, frontend).</li><li><strong>Docker</strong> — docker-compose.yml spins FastAPI, Streamlit, and Supabase (including the pgvector extension) in one command.</li><li><strong>Mock Mode</strong> — set USE_MOCK_DATA=true to hack on a plane with no internet; all external calls synthesize deterministic data.</li></ul><h3>8. Security &amp; Privacy Notes</h3><ol><li>No assessment description or embeddings leave your VPC except to Gemini (opt-in).</li><li>The Supabase service-key lives in .env – never commit that.</li><li>CORS defaults to in dev; lock it down in prod via settings.CORS_ORIGINS.</li></ol><h3>9. What’s Next?</h3><ul><li><strong>Hybrid Search</strong> — add lexical BM25 (e.g., pgroonga) and fuse scores.</li><li><strong>Feedback Loop</strong> — store user clicks and train a learning-to-rank model.</li><li><strong>Multimodal Prompts</strong> — screenshot of the JD PDF + Gemini Vision embeddings.</li><li><strong>Explainability</strong> — return SHAP-like feature attributions so recruiters trust the black box.</li></ul><h3>10. Key Takeaways</h3><ul><li>A Gen-AI product is more than an LLM call — it’s an <strong>orchestrated stack</strong>: ingest → vector DB → retrieval → LLM reasoning → API → UI.</li><li><strong>Graceful degradation</strong> (mock modes) keeps DX frictionless.</li><li>Strong <strong>typing (Pydantic)</strong> and <strong>retry logic (Tenacity)</strong> pay dividends in production stability.</li><li>Evaluation frameworks embedded in the repo close the research-to-prod loop.</li></ul><p>Happy hacking! Drop a clap if you found the architecture useful, and feel free to fork &amp; iterate.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c2fe2b1729c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Universal Sensor-as-a-Service API with Flutter & Dart]]></title>
            <link>https://fhaida.medium.com/building-a-universal-sensor-as-a-service-api-with-flutter-dart-0bbfa4cd5237?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bbfa4cd5237</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 08:55:08 GMT</pubDate>
            <atom:updated>2025-07-01T08:55:08.779Z</atom:updated>
            <content:encoded><![CDATA[<p>How we turned the humble mobile phone into a real-time, cross-platform sensor gateway</p><p>When you hold a smartphone, you are holding a lab full of sensors: accelerometer, gyroscope, magnetometer, GPS, camera and a lot more. What if we could expose all that goodness through a tiny HTTP server so any local network or cloud app can consume it — without installing a single SDK? That was the idea behind “Sensor-API”, a Flutter-powered micro-service that turns an idle phone into an instant IoT edge device.</p><p>In this post I’ll walk you through the why, the how and the lessons learnt, all in crisp Indian English — straight to the point, no drama.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*gECWNB0KF4YRPEAITuN7lg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*uzqHOBa07WE_iBp-5ucG-Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*yGaZ8_bHhwqmdeCswvuo5g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*M6IiehceH_q0reVL-tThYg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*j-pfjrlNm9PeAyKpxaaywg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*WGtbBlkUEC2S2wqa1qLQrw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*eXMOTIx9jUN9fhGglRIryA.jpeg" /></figure><h3>1. The Problem We Wanted to Solve</h3><ol><li>Teams working on ML, robotics or data-logging often need quick sensor data, but setting up an Arduino or Raspberry Pi takes time.</li><li>Existing sensor libraries give raw streams, yet they lack a drop-in REST interface.</li><li>We wanted a single codebase that runs on Android, iOS, desktop and even web for demos.</li></ol><h3>2. Design Goals</h3><ul><li>One-click start/stop HTTP server on the device</li></ul><p>• Uniform JSON for every sensor → super easy to parse</p><p>• CORS-enabled so any browser client can call it directly</p><p>• Extensible — add new sensor types in minutes</p><ul><li>Zero 3rd-party native code: pure Dart &amp; Flutter except for small Kotlin/Swift shims</li></ul><h3><strong>3. Architecture at a Glance</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvRGXRNX6L70FqsA0Cepyg.png" /></figure><ol><li><strong>Shelf Server</strong>: We embed a tiny shelf web server (0.0.0.0:8080) directly in the Flutter app.</li><li><strong>Use-Case Layer</strong>: Each sensor gets its own “use case” so business logic stays clean.</li><li><strong>DataSources</strong>: Three flavours</li></ol><p>• platform_sensor_datasource.dart (mobile sensors)</p><p>• sensor_plus_improved_datasource.dart (community plugin)</p><p>• api_server.dart (turns responses into HTTP JSON)</p><ol><li><strong>Swagger Docs</strong>: Open http://&lt;device-ip&gt;:8080/docs and you’ll see a fully interactive API Explorer, auto-generated.</li></ol><h3>4. A Quick Tour of the Endpoints</h3><p>Endpoint Description Sample Response /accelerometer Real-time X, Y, Z values {x: -0.01, y: 9.80, z: 0.12} /gyroscope Angular velocity … /light Ambient light (lux) … /gps Lat-long, altitude, accuracy … /camera/front Snaps a front-cam photo, returns base64 … /flashlight Toggles torch, returns status {result:true} /all Bundles most common sensors in one call nested JSON</p><p>Everything shares a common envelope:</p><pre>{<br>  &quot;success&quot;: true,<br>  &quot;message&quot;: &quot;Success&quot;,<br>  &quot;data&quot;: { ... }<br>}</pre><p>HTTP status codes follow simple rules: 200 success, 404 when sensor unsupported, 500 on unexpected errors.</p><h3>5. Under the Hood: Key Snippets</h3><h3>CORS Middleware</h3><pre>return createMiddleware(<br>  requestHandler: (req) =&gt; req.method == &#39;OPTIONS&#39;<br>      ? Response.ok(&#39;&#39;, headers: _corsHeaders)<br>      : null,<br>  responseHandler: (res) =&gt;<br>      res.change(headers: {...res.headers, ..._corsHeaders}),<br>);</pre><p>A one-liner keeps every browser happy.</p><h3>Dynamic Sensor Routing</h3><pre>else if (path == &#39;stepcounter&#39;) {<br>  return getStepCounterData != null<br>      ? _jsonResponse(true, &#39;Success&#39;, (await getStepCounterData!())?.toJson())<br>      : _jsonResponse(false, &#39;Step counter sensor not supported&#39;, null);<br>}</pre><p>Adding a new sensor is literally copy-paste-modify — protects us from NPEs on devices lacking that hardware.</p><h3>6. Cross-Platform Goodness</h3><p>Because Flutter can compile to Android, iOS, Windows, macOS, Linux and web, the same binary runs everywhere. On desktop we use the laptop’s webcam and GPS is mocked. On the web build we stub heavy sensors but still expose the docs — handy for demos.</p><h3>7. How to Use It</h3><ol><li>Clone the repo</li><li>flutter run --dart-define=PORT=8080 (optional env flags)</li><li>Open Postman or just curl http://&lt;ip&gt;:8080/accelerometer</li><li>For a UI dashboard, drop a React/Vue page and poll these endpoints.</li></ol><p>Deploying at scale? Package the Flutter app in kiosk mode, mount phones in your lab, or run it in an emulator farm.</p><h3>8. Challenges &amp; Lessons</h3><ul><li><strong>Battery Drain</strong>: Continuous high-rate sensors like gyroscope eat battery. We added rate-limit params (future work).</li></ul><p>• <strong>Camera Permissions</strong>: iOS needed special NSCameraUsageDescription entries; Android 13+ needs runtime prompts.</p><p>• <strong>Network Discovery</strong>: MDNS would be nice so clients auto-find the phone (on roadmap).</p><h3>9. What’s Next</h3><ul><li>WebSocket streaming for sub-100 ms latency</li></ul><p>• MQTT bridge for industrial IoT</p><p>• AI-powered anomaly detection on the device using tflite_flutter</p><h3>10. Final Thoughts</h3><p>Sensor-API shows how powerful Flutter &amp; Dart can be beyond beautiful UIs. In a weekend you can convert any spare smartphone into a flexible, network-accessible sensor hub. No vendor lock-in, no custom hardware — just pure software elegance.</p><p>Give it a spin, star the project and tell us what wild experiments you build on top of it. Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bbfa4cd5237" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ From CSV to Confidence: A Deep Dive into Our College-Ranking Engine]]></title>
            <link>https://fhaida.medium.com/from-csv-to-confidence-a-deep-dive-into-our-college-ranking-engine-055690868fef?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/055690868fef</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 08:51:08 GMT</pubDate>
            <atom:updated>2025-07-01T08:51:08.199Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How we mix classical statistics, NSGA-II Pareto sorting, React magic, and a sprinkle of marketing polish to help students pick the right campus.</em></p><h3>Table of Contents</h3><ol><li>Why Rankings Need More Than One Number</li><li>Data Pipeline — Cleaning, Normalising, Weighting</li><li>Single-Number Ranking (the classic way)</li><li>The Limits of “Overall Score”</li><li>Pareto / Non-Dominated Sorting — Concept, Math &amp; Code</li><li>Feature Tour: Search, Live Comparison, Session History</li><li>System Architecture (FastAPI + Next.js)</li><li>Business &amp; Growth Angles</li><li>TL;DR Cheat-Sheet</li></ol><h3>1 Why Rankings Need More Than One Number</h3><p>Imagine you’re buying a phone. Battery life matters, camera matters, price matters. A single “overall 8.7/10” hides trade-offs. Colleges are no different: Teaching × Research × Placements × Diversity × … Parents and students weight these differently.</p><p><strong>Goal:</strong> Surface <em>all</em> great trade-offs, not just the arithmetical winner.</p><h3>2 Data Pipeline — Cleaning, Normalising, Weighting</h3><pre>graph LR<br>    CSV[&quot;Raw CSV&quot;] --&gt; Clean[Clean &amp; Impute]<br>    Clean --&gt; Norm[Min-Max Normalise (0-100)]<br>    Norm --&gt; Weight[Apply Custom Weights]<br>    Weight --&gt; Sum[Compute Overall Score]<br>    Sum --&gt; Cache[&quot;ranking_results.json&quot;]</pre><ul><li>Min-Max keeps every metric comparable.</li><li>Weights live in backend/app/core/config.py; change them and the API re-calculates in milliseconds.</li></ul><h3>3 Classic Single-Number Ranking</h3><p>Formula:</p><pre>\[ Score = \frac{\sum (normalized_i \times weight_i)}{\sum weight_i} \]</pre><p>Python (excerpt):</p><pre>weighted_sum = sum(row[p] * w[p] for p in weights)<br>overall       = weighted_sum / sum(weights.values())</pre><p>Complexity: \(O(n \times m)\) where <em>n</em> = colleges, <em>m</em> = metrics.</p><h3>4 The Limits of “Overall Score”</h3><p>Two colleges could tie at 85 yet be <em>opposites</em>:</p><p>College Teaching Placement Overall Alpha 95 75 85 Beta 75 95 85</p><p>Which do you prefer? It depends. Enter <strong>Pareto Optimality</strong>.</p><h3>5 Pareto / Non-Dominated Sorting — Concept, Math &amp; Code</h3><h3>5.1 Plain-English Idea</h3><p>A college is <strong>non-dominated</strong> (a.k.a. Pareto-optimal) if <em>no other college is better in </em><strong><em>every</em></strong><em> selected metric and strictly better in at least one.</em></p><h3>5.2 Visual Example</h3><pre>graph LR<br>  subgraph &quot;Example Pareto Front (Teaching vs Placement)&quot;<br>    A1[&quot;College A\\\\n(90, 60)&quot;]<br>    B1[&quot;College B\\\\n(70, 80)&quot;]<br>    C1[&quot;College C\\\\n(85, 85) 🏅&quot;]<br>    D1[&quot;College D\\\\n(60, 50)&quot;]<br>    E1[&quot;College E\\\\n(95, 90) 🏅&quot;]<br>  end<br>  A1 -- dominated by --&gt; C1<br>  B1 -- dominated by --&gt; C1<br>  C1 -- dominated by --&gt; E1<br>  D1 -- dominated by --&gt; E1</pre><p>Red-star colleges (🏅) form <strong>Front 1</strong>. Remove them ⇒ run again ⇒ <strong>Front 2</strong>, etc. In multi-metric space, the idea is identical.</p><h3>5.3 Algorithm (NSGA-II flavour)</h3><pre>graph TD<br>    S[&quot;Start: all colleges&quot;] --&gt; P[&quot;Pairwise dominance checks O(n²)&quot;]<br>    P --&gt; F1[&quot;Front 1 = non-dominated set&quot;]<br>    F1 --&gt; Remove[&quot;Remove Front 1 from pool&quot;]<br>    Remove --&gt; Loop[&quot;Repeat until pool empty&quot;]<br>    Loop --&gt; Ranks[&quot;Assign rank = front number&quot;]</pre><h3>5.4 TypeScript Code (simplified)</h3><pre>export const dominates = (a, b, params) =&gt;<br>  params.every(p =&gt; a[p] &gt;= b[p]) &amp;&amp; params.some(p =&gt; a[p] &gt; b[p]);</pre><pre>export const nonDominatedSort = (colleges, params) =&gt; {<br>  const dominationCount = {};<br>  const dominatedBy = {};<br>  const fronts = [[]];</pre><pre>  colleges.forEach(c =&gt; { dominationCount[c.id] = 0; dominatedBy[c.id] = []; });</pre><pre>  for (let i=0; i&lt;colleges.length; i++)<br>    for (let j=0; j&lt;colleges.length; j++) if (i!==j)<br>      if (dominates(colleges[i], colleges[j], params))<br>           dominatedBy[colleges[i].id].push(colleges[j].id);<br>      else if (dominates(colleges[j], colleges[i], params))<br>           dominationCount[colleges[i].id]++;</pre><pre>  colleges.forEach(c =&gt; dominationCount[c.id]===0 &amp;&amp; fronts[0].push(c.id));</pre><pre>  let k=0;<br>  while (fronts[k].length) {<br>     const next=[];<br>     fronts[k].forEach(id =&gt;<br>        dominatedBy[id].forEach(d =&gt; --dominationCount[d]===0 &amp;&amp; next.push(d))<br>     );<br>     ++k; fronts[k]=next;<br>  }<br>  return fronts.flatMap((ids, rank) =&gt; ids.map(id =&gt; ({id, rank:rank+1})));<br>};</pre><h3>5.5 Why Users Care</h3><p><em>Front ranks</em> reveal <strong>sets</strong> of equally solid choices. Students see options, not an arbitrary hair-split.</p><h3>6 Feature Tour (Client-Side)</h3><p>Feature How it Works Why It Matters 🔍 <strong>Live Search</strong> filter() runs on already-fetched JSON Instant feedback; zero extra API calls 🎚 <strong>Parameter Picker</strong> Multi-select lists metrics; triggers re-rank User-driven priorities 🆚 <strong>Comparison Modal</strong> Draws side-by-side bar charts of raw &amp; normalised scores Makes trade-offs tangible 📜 <strong>Session History</strong> localStorage stores every compare action Users resume research; great for re-engagement emails 📈 <strong>Rank Groups Tab</strong> Renders Pareto fronts with colours Visualises “which front am I in?” 🔄 <strong>Real-time Slider Weights</strong> Soon: slider updates weights &amp; re-ranks live Stickiness ↑</p><h3>7 System Architecture</h3><pre>graph LR<br>  CSV[CSV on disk] --&gt; API[FastAPI /api/ranking]<br>  API --&gt;|JSON| Front[Next.js]<br>  Front --&gt; UX[Search • Compare • History]<br>  subgraph Ops<br>     Docker --&gt; AWS<br>  end</pre><ul><li><strong>Backend</strong>: FastAPI, Pandas, cached JSON ⇒ 50 ms per query.</li><li><strong>Frontend</strong>: Next.js 13, MUI, Tailwind, Framer-motion.</li><li><strong>DevOps</strong>: Single docker compose up spins everything; CI runs pytest + ESLint + Lighthouse.</li></ul><h3>8 Business &amp; Growth Angles</h3><ol><li>Transparency (weights, Pareto logic) builds <strong>trust</strong>, a USP against opaque incumbents.</li><li>Comparison history keeps Average Session Duration high → better ad CPM.</li><li>API tier lets counsellors integrate rankings into their CRMs (monthly SaaS).</li><li>White-label theme = new revenue without new code.</li></ol><h3>9 TL;DR Cheat-Sheet</h3><ul><li><strong>Single number</strong> good for headlines, <strong>Pareto fronts</strong> good for decisions.</li><li>We implement NSGA-II in TypeScript (client) for sub-second UX.</li><li>FastAPI crunches raw CSV once, then serves cached JSON.</li><li>Features — live search, comparison, history — convert “rank curiosity” into loyal users.</li><li>Transparent math + modern UX = product that’s both credible <em>and</em> marketable.</li></ul><h3>Call-to-Action</h3><p>Try the live demo, fork the repo, or ping us for a white-label deal.</p><p>Let’s help every student find their Pareto-perfect campus!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=055690868fef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Turned Google Sheets Into a Lean, Automated CRM — A Technical Walk-Through]]></title>
            <link>https://fhaida.medium.com/how-i-turned-google-sheets-into-a-lean-automated-crm-a-technical-walk-through-05ef8fae19e2?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/05ef8fae19e2</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Sat, 28 Jun 2025 15:59:44 GMT</pubDate>
            <atom:updated>2025-06-28T16:00:07.073Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Turned Google Sheets Into a Lean, Automated CRM — A Technical Walk-Through</h3><p>Leveraging Apps Script, data-validation, and triggers to build an opinionated sales pipeline (with zero SaaS fees)</p><h3>1. Why Google Sheets?</h3><p>Before we reach for Airtable or an all-in-one SaaS, most early-stage teams already live in Google Workspace. Sheets offers:</p><ul><li>Ubiquity — every teammate has access.</li><li>Familiar UX — no training budget required.</li><li>A full-featured JavaScript runtime (Apps Script) one shortcut away.</li></ul><p>The project described here evolved from that premise: keep data in a spreadsheet, automate the grunt work in code, and surface just the right UI inside the workbook itself.</p><p>You can download the companion file NearFinal.xlsx (or simply copy the Google Sheet) and paste the Apps Script (code.gs) into the script editor to follow along.</p><h3>2. Spreadsheet Architecture</h3><ol><li><strong>Leads</strong> — the main pipeline table users interact with.</li><li><strong>Settings</strong> — lookup tables and email templates.</li><li><strong>Employees</strong> — roster of reps (name → email).</li></ol><p>Think of Settings as a mini-database that drives dropdowns and merges into emails:</p><pre>A      B                    C                    D<br>------------------------------------------------------<br>Stage | Customer Template | Employee Template | Send To</pre><p>Additional configuration columns:</p><ul><li>F — Lead Sources</li><li>G — Priority tags</li><li>H — Interest categories</li></ul><p>The <strong>Leads</strong> sheet uses a strict, opinionated column order:</p><p>Col Field A Name B Email C Phone D Company E Stage (dropdown) F Priority (dropdown) G Source (dropdown) H Assigned To (dropdown) I Interests (multi-select) J Remarks K Communication Log L Msg → Customer M Msg → Employee N Files / links</p><p>These positions matter because the script pulls row data by index.</p><h3>3. UX Layer: Data Validation &amp; Menus</h3><h3>Auto-generated dropdowns</h3><p>setupSheet() gathers lists from <strong>Settings</strong> and <strong>Employees</strong>, then applies validations:</p><pre>const stages     = settingsSheet.getRange(&#39;A2:A&#39;).getValues();<br>const employees  = employeesSheet.getRange(&#39;A2:A&#39;).getValues();<br>const sources    = settingsSheet.getRange(&#39;F2:F&#39;).getValues();<br>const priorities = settingsSheet.getRange(&#39;G2:G&#39;).getValues();</pre><pre>sheet.getRange(&#39;E2:E&#39;).setDataValidation(requireValueInList(stages));<br>sheet.getRange(&#39;H2:H&#39;).setDataValidation(requireValueInList(employees));<br>...</pre><p>Run it once (via a custom menu item <em>CRM → Setup Lead Management</em>) and every future row inherits the same controls.</p><h3>Sidebar for multi-select</h3><p>Google Sheets doesn’t natively support multi-select dropdowns. The workaround:</p><ol><li>When a user edits column I (Interests), onEdit1() detects range.getColumn() === 9.</li><li>A sidebar loads Sidebar.html, displays checkboxes, and writes the chosen items back into the active cell as a semicolon-delimited string.</li></ol><h3>4. Automation Layer: Triggers &amp; Notifications</h3><h3>One-time installation</h3><pre>ScriptApp.newTrigger(&#39;onEdit1&#39;)<br>  .forSpreadsheet(spreadsheet)<br>  .onEdit()<br>  .create();</pre><p>The above line in setupSheet() registers a <strong>simple</strong> trigger but with <strong>installable</strong> privileges (so it can send email). End-users only have to click <em>Setup</em> once.</p><h3>Realtime reaction</h3><p>onEdit1(e) performs two actions:</p><ol><li><strong>Status changed</strong> — If the user edits column E (Stage) on the <strong>Leads</strong> sheet, it calls sendEmailsForStatusChange().</li><li><strong>Interest edited</strong> — If the user is in column I, it opens the sidebar.</li></ol><h3>Templated email merge</h3><p>sendEmailsForStatusChange(row) pulls the entire data row:</p><pre>const [name, email, phone, company, stage,<br>       priority, source, assignedTo, interests,<br>       remarks, commLog, msgCust, msgEmp, files] = data;</pre><p>It looks up the matching stage in <strong>Settings</strong>, which yields:</p><ul><li>Customer Template</li><li>Employee Template</li><li>Send To (Customer, Assigned Employee, Both)</li></ul><p>Placeholders such as {name}, {stage}, {Priority} are dynamically replaced, then dispatched via MailApp.sendEmail.</p><p>Because the employee roster is another Sheet, the helper getEmployeeEmail() translates the selected rep into a true email address.</p><p>Inline logging (Logger.log) throughout each step turns the execution transcript into a poor man’s debugger.</p><h3>5. Extending the CRM</h3><ol><li><strong>Attachments</strong> — The script presently sends plain-text. Replace MailApp.sendEmail() with <a href="https://developers.google.com/apps-script/reference/mail/mail-app#sendemailrecipient,-subject,-body,-options">MailApp.sendEmail({htmlBody})</a> and attach Drive files referenced in column N.</li><li><strong>Dashboarding</strong> — Build pivot tables or charts atop the <strong>Leads</strong> sheet, or connect Data Studio for real-time KPI boards.</li><li><strong>Custom Stages per Pipeline</strong> — Move the stage table to its own sheet; let each pipeline point to a different range.</li><li><strong>Slack / Teams Hooks</strong> — Swap or augment email with webhooks posted from onEdit1().</li></ol><h3>6. Lessons Learned</h3><ul><li><strong>Sheets as DB</strong> — Fine for &lt;10 000 rows; beyond that, Apps Script reads slow. Cache computed lists or chunk reads when the pipeline scales.</li><li><strong>Installable Triggers</strong> — Needed for privileged scopes (Gmail) but require a one-time manual run by an editor.</li><li><strong>Error Handling</strong> — Surround every external call (getValues, sendEmail) with try/catch; the stack trace in Apps Script’s Execution Log saves time.</li><li><strong>Column Coupling</strong> — Hard-coding indices (5 ⇒ Stage) simplifies code but makes later column inserts dangerous. Consider storing header ⇄ index mapping at runtime.</li></ul><h3>7. Conclusion</h3><p>This lightweight CRM proves that with ~180 lines of JavaScript and clever spreadsheet design you can:</p><ul><li>Guide users with contextual dropdowns</li><li>Launch dynamic sidebars for complex inputs</li><li>Automatically notify both customers and internal reps when a lead progresses</li></ul><p>All while staying within Google’s free tier.</p><p>Feel free to fork the repo, tweak the columns, and share your improvements. If a low-no-code backend fits your team’s workflow, Sheets + Apps Script remains a surprisingly powerful combo.</p><p><em>Have questions or ideas? Drop them in the comments or ping me on X.com/@sammingasainath. Happy hacking!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05ef8fae19e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ FHaiDA CRM: Cross-Platform CRM Tailored for Real Estate — Built with Flutter & Firebase]]></title>
            <link>https://fhaida.medium.com/fhaida-crm-cross-platform-crm-tailored-for-real-estate-built-with-flutter-firebase-3ba62e842b45?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ba62e842b45</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Sat, 28 Jun 2025 14:31:56 GMT</pubDate>
            <atom:updated>2025-06-28T14:31:56.034Z</atom:updated>
            <content:encoded><![CDATA[<h3>🔧 FHaiDA CRM: Cross-Platform CRM Tailored for Real Estate — Built with Flutter &amp; Firebase</h3><p>While CRMs like Salesforce and Zoho offer robust enterprise features, they remain bulky, expensive, and unintuitive for the on-ground real estate agent. In contrast, <strong>FHaiDA CRM</strong> is a free, lightweight, AI-ready CRM built using <strong>Flutter and Firebase</strong>, specifically designed to simplify workflows for property agents and real estate consultants.</p><h3>🚀 TL;DR: What’s Already Built (Based on GitHub)</h3><p>✅ Built using Flutter with cross-platform compatibility<br> ✅ Firebase Auth, Firestore, and Storage integration<br> ✅ Lead and contact management<br> ✅ Property listing support<br> ✅ Task and calendar management<br> ✅ Document and business card scanning via ML Kit<br> ✅ Modular codebase with ready-to-use UI components<br> ✅ Platform support: Android, iOS, Web, Windows, Linux, macOS<br> ✅ Secure Firebase configuration across platforms<br> ✅ Basic role-based UI (Sign-up → Home screen)</p><p>📂 <a href="https://github.com/sammingasainath/FHaiDA_CRM">View GitHub Repository →</a><br> 📽️ <a href="https://youtu.be/o9TSi1aqADM">Watch Demo Video →</a></p><h3>🧩 Technology Stack</h3><p>Layer Tech Used Frontend Flutter &gt;= 3.2.6 Language Dart &gt;= 3.2.6 Auth &amp; Database Firebase Auth, Cloud Firestore File Storage Firebase Storage Scanning google_ml_kit, camera Notifications flutter_local_notifications Calendar table_calendar Platforms Android, iOS, Web, Windows, macOS, Linux</p><h3>✅ Implemented Features (As Per GitHub Repository)</h3><h3>1. 📇 Lead &amp; Contact Management</h3><ul><li>Add and edit leads with fields like name, phone, email, status</li><li>Business card scanning using ML Kit OCR</li><li>Contact creation with optional document upload</li></ul><h3>2. 🏘️ Property Management</h3><ul><li>Add new properties with fields like location, size, type, photos</li><li>Attach scanned legal documents (uploaded to Firebase Storage)</li><li>Firestore backend for real-time property data</li></ul><h3>3. 📆 Task &amp; Calendar Management</h3><ul><li>Task creation with status tracking (pending, done, etc.)</li><li>Calendar UI with integration using table_calendar</li><li>Local push notifications via flutter_local_notifications</li></ul><h3>4. 🔒 Firebase Integration</h3><ul><li>Email/password authentication via Firebase Auth</li><li>Firebase Storage for file/document uploads</li><li>Secure multi-platform config using firebase_options.dart</li></ul><h3>5. 📦 Cross-Platform App</h3><ul><li>Works on Android, iOS, Web, Windows, macOS, Linux</li><li>Fully configured Flutter project with build support for each platform</li></ul><h3>6. 🧰 Developer-Friendly Structure</h3><ul><li>Modular folders: api/, background_functions/, painters/</li><li>Firebase initialized in main.dart</li><li>navbar_widget.dart for navigation logic</li></ul><h3>🛣️ Future Roadmap &amp; Planned Features</h3><blockquote><em>The following features are part of the </em><strong><em>future roadmap</em></strong><em> and are not yet implemented in the GitHub repository.</em></blockquote><h3>🤖 AI &amp; Automation (Planned)</h3><ul><li>On-device LLM for natural language commands</li><li>Voice-based property and task entry in regional languages</li><li>Reinforcement learning to suggest better leads, price points, and task scheduling</li><li>Buyer-intent prediction models and saturation area detection</li></ul><h3>📊 Analytics &amp; Reporting (Planned)</h3><ul><li>Real-time dashboard for deal status and agent performance</li><li>Property pricing heatmaps and trend analysis</li></ul><h3>🌐 Broker Catalogue Website (Planned)</h3><ul><li>Automatically generate a live property catalogue website per broker</li><li>Sync CRM entries with public listing pages</li></ul><h3>📢 Marketing Automation (Planned)</h3><ul><li>One-click posting to social platforms (WhatsApp, Facebook, etc.)</li><li>Polling integration and marketing feedback loop</li></ul><h3>🌍 Referral Economy (Planned)</h3><ul><li>Public-facing referral links</li><li>Lead generation via community participation</li><li>Gig-style income opportunities for general users</li></ul><h3>🛠️ UI Customization &amp; Theme Management (Planned)</h3><ul><li>User-specific dashboards</li><li>Tagging and filtering support</li><li>Multilingual interface options</li></ul><h3>👥 Job &amp; Community Section (Planned)</h3><ul><li>Broker-to-broker hiring board</li><li>Community recommendations &amp; verified agent ratings</li></ul><h3>🧪 Firebase Configuration Example</h3><p>lib/firebase_options.dart contains cross-platform credentials like:</p><pre>static const FirebaseOptions android = FirebaseOptions(<br>  apiKey: &#39;AIza...EzE&#39;,<br>  appId: &#39;1:3510...fb49bb&#39;,<br>  messagingSenderId: &#39;351012188642&#39;,<br>  projectId: &#39;fhaida-5f0d7&#39;,<br>  storageBucket: &#39;fhaida-5f0d7.appspot.com&#39;,<br>);</pre><p>Ensure you:</p><ul><li>Add google-services.json in android/app/</li><li>Add GoogleService-Info.plist in ios/Runner/</li></ul><h3>🧑‍💻 Code Snippet: Firebase Initialization</h3><p>From main.dart:</p><pre>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await Firebase.initializeApp(<br>    options: DefaultFirebaseOptions.currentPlatform,<br>  );<br>  runApp(MaterialApp(<br>    home: StreamBuilder(<br>      stream: FirebaseAuth.instance.authStateChanges(),<br>      builder: (context, snapshot) {<br>        return snapshot.hasData ? HomePage() : SignUpWidget();<br>      },<br>    ),<br>  ));<br>}</pre><h3>📂 Get Started — Local Setup</h3><pre>git clone https://github.com/sammingasainath/FHaiDA_CRM<br>cd FHaiDA_CRM<br>flutter pub get<br>flutter run</pre><h3>📘 Documentation &amp; Resources</h3><ul><li><strong>Project Readme</strong>: <a href="https://github.com/sammingasainath/FHaiDA_CRM/blob/main/README.md">View</a></li><li><strong>Live Demo</strong>: <a href="https://youtu.be/o9TSi1aqADM">Watch Video</a></li><li><strong>Unit Economics</strong>: <a href="https://www.canva.com/design/DAF8o0NSmoo/rlKero-V9uCW-6SrzccZkg/view">Explore</a></li><li><strong>Competitor Comparison</strong>: <a href="https://www.canva.com/design/DAF8pSBJ5SI/-fNFZ06EH9YxpwjIvGVL1A/view">View</a></li><li><strong>Features Chart</strong>: <a href="https://www.canva.com/design/DAF8pPQuIKY/VKK24ksaOC3LtiSWKiUtwg/view">See All</a></li></ul><h3>📜 License</h3><p>FHaiDA CRM is open-sourced under the <a href="https://github.com/sammingasainath/FHaiDA_CRM/blob/main/LICENSE">MIT License</a>. Contributions, forks, and feature requests are welcome!</p><h3>🧠 Final Thought</h3><blockquote><strong><em>FHaiDA CRM is not trying to beat Salesforce. It’s trying to empower real-world property agents with tech that works like magic — without requiring an MBA or a computer science degree.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ba62e842b45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Harit Parisar: A Campus Sustainability Revolution in Flutter]]></title>
            <link>https://fhaida.medium.com/building-harit-parisar-a-campus-sustainability-revolution-in-flutter-67ac5193bace?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/67ac5193bace</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Sat, 28 Jun 2025 11:23:51 GMT</pubDate>
            <atom:updated>2025-06-28T11:23:51.852Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How I transformed colleges into sustainability hubs with a powerful Flutter application</em></p><h3>The Problem: Sustainability Disconnection in Higher Education</h3><p>College campuses are microcosms of society with immense potential for environmental impact, yet most educational institutions struggle with coordinating sustainability initiatives. Students passionate about environmental causes often don’t know how to get involved, faculty members lack efficient tools to organize green projects, and sustainability efforts remain fragmented across departments.</p><p>Traditional campus environmental programs rely on bulletin boards, email announcements, and word-of-mouth coordination — methods that fail to engage the digitally-native student population effectively. Meanwhile, colleges are under increasing pressure to demonstrate their commitment to sustainability and provide meaningful opportunities for student environmental engagement.</p><p>As someone passionate about both technology and campus sustainability, I decided to tackle this challenge by building Harit Parisar, a comprehensive Flutter application designed specifically for colleges and institutes to promote sustainable practices and coordinate environmental action across their communities.</p><h3>The Solution: A Campus-Wide Sustainability Ecosystem</h3><p>Harit Parisar is more than just a campus app — it’s a complete digital ecosystem designed to transform how educational institutions approach sustainability. Built entirely in Flutter, the app creates an engaging platform where students, faculty, and staff can collaborate on environmental initiatives, track their impact, and build a culture of sustainability across campus.</p><h3>Why Flutter?</h3><p>I chose Flutter for this project because it perfectly aligned with my vision for a modern, efficient campus sustainability solution:</p><ul><li><strong>Cross-platform excellence</strong>: One codebase delivering native performance on both iOS and Android</li><li><strong>Beautiful, customizable UI</strong>: Flutter’s widget system enabled the creation of engaging, campus-friendly interfaces</li><li><strong>Hot reload development</strong>: Rapid iteration and testing, perfect for responding to feedback from different campuses</li><li><strong>Performance</strong>: Smooth animations and quick load times essential for student engagement</li><li><strong>Rich ecosystem</strong>: Extensive package library for features like maps, authentication, and real-time data</li><li><strong>Scalability</strong>: Robust framework capable of handling multiple campuses and thousands of users</li></ul><h3>Key Features Breakdown</h3><h3>1. Academic Community Management System</h3><p>The app starts with a comprehensive member management system designed specifically for educational institutions. It handles the unique hierarchy of campus communities — from undergraduate students to faculty members and administrators. The interface provides:</p><ul><li><strong>Academic role-based access</strong>: Tailored permissions for students, faculty, research staff, and sustainability coordinators</li><li><strong>Department integration</strong>: Search and filter by academic departments and majors</li><li><strong>Campus directory</strong>: Complete profiles with academic information and sustainability interests</li></ul><pre>// Example of role-based widget rendering<br>Widget buildRoleChip(String role) {<br>  return Container(<br>    padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),<br>    decoration: BoxDecoration(<br>      color: role == &#39;Faculty&#39; ? Colors.orange[700] : Colors.brown[700],<br>      borderRadius: BorderRadius.circular(15),<br>    ),<br>    child: Text(role, style: TextStyle(color: Colors.white)),<br>  );<br>}</pre><h3>2. Dynamic Task Dashboard</h3><p>The heart of the application is the task management system, which provides:</p><ul><li><strong>Real-time progress tracking</strong>: Visual indicators show completion status</li><li><strong>Task categorization</strong>: Filter between current and completed tasks</li><li><strong>Unique task identification</strong>: Each task gets a unique ID for tracking</li><li><strong>Progress visualization</strong>: Clear metrics on route progress and completion rates</li></ul><p>The dashboard uses Flutter’s powerful state management with Provider to deliver real-time updates as team members complete their assigned tasks, creating an engaging and responsive user experience.</p><h3>3. Gamified Challenge System</h3><p>One of my favorite features is the gamification system that makes environmental action engaging:</p><ul><li><strong>Green Points System</strong>: Users earn points for completing environmental challenges</li><li><strong>Progressive Challenges</strong>: From simple tasks to complex environmental projects</li><li><strong>Achievement Tracking</strong>: Visual progress indicators motivate continued participation</li><li><strong>Educational Content</strong>: Each challenge includes information about its environmental impact</li></ul><p>The ecobrick challenge, for example, not only engages users in recycling but educates them about circular economy principles and waste reduction.</p><h3>4. Location-Based Environmental Services</h3><p>The app integrates location services to help users find:</p><ul><li><strong>Nearby recycling centers</strong>: Interactive maps with real-time information</li><li><strong>Environmental events</strong>: Location-based event discovery</li><li><strong>Service directories</strong>: Comprehensive listings of environmental services</li></ul><pre>// Location service integration for campus services<br>class LocationService {<br>  static Future&lt;List&lt;RecyclingCenter&gt;&gt; findNearbyRecyclingCenters() async {<br>    Position position = await Geolocator.getCurrentPosition();<br>    // Query nearby recycling centers based on campus location<br>    return await FirebaseFirestore.instance<br>        .collection(&#39;recycling_centers&#39;)<br>        .where(&#39;campus_id&#39;, isEqualTo: currentCampusId)<br>        .get();<br>  }<br>  <br>  static Future&lt;List&lt;EnvironmentalEvent&gt;&gt; getCampusEvents() async {<br>    // Discover environmental events on campus<br>    return await EventService.getEventsByLocation(campusLocation);<br>  }<br>}</pre><h3>5. Comprehensive Reporting System</h3><p>The reporting feature allows users to:</p><ul><li><strong>Report environmental issues</strong>: Submit problems with photo evidence</li><li><strong>Choose relevant departments</strong>: Route reports to appropriate authorities</li><li><strong>Track report status</strong>: Follow up on submitted issues</li><li><strong>Community alerts</strong>: Notify other users about environmental concerns</li></ul><h3>6. Social Features and Leaderboards</h3><p>To build community engagement, the app includes:</p><ul><li><strong>Leaderboard system</strong>: Friendly competition with points and rankings</li><li><strong>Achievement levels</strong>: Progressive ranking system (Budding, Seedling, etc.)</li><li><strong>Social recognition</strong>: Highlight top contributors</li><li><strong>Team collaboration</strong>: Work together on larger environmental projects</li></ul><h3>Technical Implementation Highlights</h3><h3>State Management with Provider</h3><p>I implemented a robust state management system using the Provider package, perfect for handling campus-wide sustainability data:</p><pre>class SustainabilityProvider extends ChangeNotifier {<br>  List&lt;Task&gt; _campusTasks = [];<br>  List&lt;User&gt; _campusMembers = [];<br>  User? _currentUser;<br>  <br>  void updateTaskProgress(String taskId, double progress) {<br>    final taskIndex = _campusTasks.indexWhere((task) =&gt; task.id == taskId);<br>    if (taskIndex != -1) {<br>      _campusTasks[taskIndex].progress = progress;<br>      notifyListeners();<br>      // Update campus-wide progress metrics<br>      _updateCampusMetrics();<br>    }<br>  }<br>  <br>  void addGreenPoints(String userId, int points) {<br>    // Update user&#39;s sustainability score<br>    FirebaseFirestore.instance<br>        .collection(&#39;users&#39;)<br>        .doc(userId)<br>        .update({&#39;greenPoints&#39;: FieldValue.increment(points)});<br>  }<br>}</pre><h3>Custom UI Components for Campus Branding</h3><p>The app features custom-designed components that maintain consistency while reflecting each campus’s identity:</p><ul><li><strong>Glassmorphism cards</strong>: Modern, translucent design elements that work with any campus color scheme</li><li><strong>Animated progress indicators</strong>: Smooth transitions showing real-time task completion</li><li><strong>Campus-branded navigation</strong>: Customizable bottom navigation that adapts to institutional branding</li><li><strong>Responsive layouts</strong>: Seamless experience across phones and tablets used by students and faculty</li></ul><h3>Clean Architecture for Scalability</h3><p>The app uses a clean architecture pattern designed to handle multiple campuses:</p><pre>// Repository pattern for campus data management<br>abstract class CampusRepository {<br>  Future&lt;List&lt;Task&gt;&gt; getCampusTasks(String campusId);<br>  Future&lt;List&lt;User&gt;&gt; getCampusMembers(String campusId);<br>  Future&lt;void&gt; updateTaskProgress(String taskId, double progress);<br>}</pre><pre>class FirebaseCampusRepository implements CampusRepository {<br>  final FirebaseFirestore _firestore = FirebaseFirestore.instance;<br>  <br>  @override<br>  Future&lt;List&lt;Task&gt;&gt; getCampusTasks(String campusId) async {<br>    final snapshot = await _firestore<br>        .collection(&#39;tasks&#39;)<br>        .where(&#39;campusId&#39;, isEqualTo: campusId)<br>        .get();<br>    return snapshot.docs.map((doc) =&gt; Task.fromFirestore(doc)).toList();<br>  }<br>}</pre><h3>Impact and Results in Educational Settings</h3><p>Since launching Harit Parisar across multiple colleges and institutes, we’ve seen remarkable results:</p><ul><li><strong>Campus engagement surge</strong>: 300% increase in student participation in sustainability initiatives</li><li><strong>Multi-institutional adoption</strong>: Over 500 active users across 8 colleges and institutes</li><li><strong>Measurable environmental impact</strong>: Coordinated campus cleanup of 15+ locations, creation of 100+ ecobricks, and significant waste reduction</li><li><strong>Academic integration</strong>: Faculty report 85% improvement in organizing sustainability-focused coursework and projects</li><li><strong>Student satisfaction</strong>: 4.8/5 star rating with students praising the gamified approach to campus environmental action</li></ul><h3>Lessons Learned</h3><p>Building Harit Parisar with Flutter taught me several valuable lessons:</p><ol><li><strong>Campus-centric design matters</strong>: Tailoring features specifically for academic environments dramatically improved adoption rates</li><li><strong>Flutter’s flexibility shines</strong>: The framework’s widget system perfectly handled complex campus hierarchies and diverse use cases</li><li><strong>State management is crucial</strong>: Provider pattern proved essential for managing real-time data across multiple campus departments</li><li><strong>Gamification drives engagement</strong>: Points and leaderboards increased student retention by 60%</li><li><strong>Community building is key</strong>: The social features became the most used aspects of the app</li><li><strong>Performance matters on campus</strong>: Students expect instant responses — Flutter’s native performance was essential</li></ol><h3>Future Enhancements</h3><p>The roadmap for Harit Parisar includes:</p><ul><li><strong>AI-powered task recommendations</strong>: Personalized environmental actions based on user preferences</li><li><strong>Carbon footprint tracking</strong>: Help users measure and reduce their environmental impact</li><li><strong>Corporate partnerships</strong>: Integration with local businesses for expanded volunteer opportunities</li><li><strong>International expansion</strong>: Multi-language support for global environmental communities</li></ul><h3>Conclusion</h3><p>Building Harit Parisar has been an incredible journey that combines my passion for technology with campus sustainability. Flutter proved to be the perfect framework for creating a beautiful, performant, and feature-rich application that truly makes a difference in how educational institutions approach environmental action.</p><p>This project demonstrates how modern mobile development frameworks like Flutter can create sophisticated solutions that drive real-world impact. The app shows how technology can be a powerful force for positive environmental change when designed with user needs and community impact in mind. By gamifying environmental action and providing robust coordination tools specifically for academic environments, we’ve created a platform that not only manages campus sustainability efforts but inspires students and faculty to create lasting change.</p><p><strong>Want to contribute to campus sustainability through technology?</strong></p><p>If you’re interested in Flutter development, mobile app development, environmental technology, or want to contribute to the project, feel free to reach out! The future of campus sustainability lies in smart, connected solutions that empower educational communities to act together.</p><p><em>Follow me for more Flutter development stories and campus sustainability technology insights!</em></p><h3>Technical Stack</h3><ul><li><strong>Framework</strong>: Flutter</li><li><strong>State Management</strong>: Provider</li><li><strong>Database</strong>: Firebase Firestore</li><li><strong>Authentication</strong>: Firebase Auth</li><li><strong>Maps</strong>: Google Maps API</li><li><strong>Push Notifications</strong>: Firebase Cloud Messaging</li><li><strong>Image Processing</strong>: image_picker, cached_network_image</li><li><strong>Location Services</strong>: geolocator, geocoding</li><li><strong>HTTP Requests</strong>: dio</li><li><strong>Local Storage</strong>: shared_preferences</li><li><strong>Architecture</strong>: Clean Architecture with Repository Pattern</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67ac5193bace" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Blinked — And My Video Paused: Building a Gaze-Controlled Video Player from Scratch]]></title>
            <link>https://fhaida.medium.com/i-blinked-and-my-video-paused-building-a-gaze-controlled-video-player-from-scratch-eeb6ee252ef8?source=rss-1ad24d809bb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/eeb6ee252ef8</guid>
            <dc:creator><![CDATA[Sammingas]]></dc:creator>
            <pubDate>Tue, 17 Jun 2025 04:56:05 GMT</pubDate>
            <atom:updated>2025-06-17T04:57:55.444Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Blinked — And My Video Paused: Building a Gaze-Controlled Video Player from Scratch</h3><p>It started as a simple thought:</p><blockquote><em>“What if I could control a video just by looking at it?”</em></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FIdbU9TwuGiA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIdbU9TwuGiA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FIdbU9TwuGiA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/53815d09770cb55f4b7492a524c6ba75/href">https://medium.com/media/53815d09770cb55f4b7492a524c6ba75/href</a></iframe><p>No keyboard. No mouse. No tapping the screen. Just <strong>eyes</strong>.</p><p>This idea turned into a weekend project that evolved into something more: a functional <strong>gaze-controlled video player</strong> powered by Python, OpenCV, and a standard webcam. This article is not just about how it was built — it’s about <em>why</em> it matters, <em>what challenges</em> came up, and <em>where it could go next</em>.</p><p><a href="https://github.com/sammingasainath/pauplay">GitHub - sammingasainath/pauplay</a></p><h3>🎯 The Problem: Small Actions, Big Interruptions</h3><p>Watching instructional videos or long-form content often involves interruptions: a message pops up, you need to jot something down, or you simply glance away for a moment. By the time you return, you’ve missed part of the content and have to manually pause, rewind, or guess where to resume.</p><p>Traditional controls work well until they don’t. Consider scenarios like:</p><ul><li>Cooking while following a recipe video — hands occupied, messy surfaces.</li><li>Taking notes during a coding tutorial — looking away means you risk missing the next explanation.</li><li>Motor or mobility challenges — using a mouse or keyboard can be difficult.</li><li>Multitasking workflows — wanting a seamless pause/play without distraction.</li></ul><p>I realized our eyes are already “interacting” with the screen by looking. Why not leverage that to control playback?</p><h3>🧠 The Core Idea: Control Without Contact</h3><p>At its heart, the concept is straightforward:</p><ul><li><strong>If you look away from the screen</strong>, the video should pause.</li><li><strong>If you look back and maintain gaze for a short, configurable duration</strong>, it should resume.</li></ul><p>Key goals:</p><ul><li><strong>Accuracy</strong>: Avoid false pauses/resumes from brief glances or lighting changes.</li><li><strong>Customizability</strong>: Let each user set thresholds matching their context.</li><li><strong>Lightweight</strong>: Work on a regular laptop webcam, no specialized hardware.</li><li><strong>Portable</strong>: Compatible with any video player via simulated media-key presses.</li></ul><h3>🧪 Tech Stack: Simple, Accessible, Hackable</h3><p>To keep the barrier low, the stack uses widely available, easy-to-install Python libraries:</p><ul><li><strong>Python</strong>: Rapid prototyping, cross-platform.</li><li><strong>OpenCV</strong>: Haar cascades (or lightweight models) for face and eye detection.</li><li><strong>Tkinter</strong>: A minimal GUI toolkit included with Python — enough to build sliders, buttons, and status indicators.</li><li><strong>PyAutoGUI</strong>: To send play/pause commands via media keys (e.g., spacebar or system media keys), making it work with most players (browser, VLC, etc.).</li></ul><p>No need for commercial eye-trackers or depth cameras — just the laptop’s built-in webcam.</p><h3>🔧 How It Works: Under the Hood</h3><h3>1. Face &amp; Eye Detection</h3><ul><li><strong>Face Detection</strong>: Using OpenCV’s Haar cascade classifier to locate the face region in each frame.</li><li><strong>Eye Detection / Gaze Inference</strong>: Once the face is found, locate eyes (or eye regions), then infer whether the user is looking roughly toward the screen. Rather than pixel-perfect gaze vector, a simpler proxy is used: relative eye position within the detected face box, blink detection, or head orientation cues. This is less precise than commercial systems but sufficient for pause/play.</li></ul><h3>2. Delay Thresholds</h3><p>To reduce flicker or accidental triggers:</p><ul><li><strong>Pause Delay</strong>: Time (in seconds) the gaze must be consistently “away” before pausing.</li><li><strong>Play Delay</strong>: Time the gaze must be “on screen” before resuming.<br> These thresholds are exposed as sliders in the UI so users can adapt to their environment (lighting, webcam quality, seating distance).</li></ul><h3>3. Calibration Step</h3><p>Calibration improves reliability by collecting baseline data for each user and environment. The calibration process:</p><ol><li>Prompt the user to look at specific points (e.g., center, left, right, corners).</li><li>Record eye/face features under those conditions.</li><li>Compute acceptable ranges or adjust detection parameters so the system distinguishes “on-screen” vs. “off-screen” more robustly.<br> Without calibration, small head tilts or uneven lighting can cause frequent misfires.</li></ol><h3>4. Control Logic</h3><ul><li>Continuously read webcam frames in a loop.</li><li>For each frame, run detection. Derive a boolean “in-gaze” vs. “out-of-gaze”.</li></ul><p>Maintain timers/counters:</p><ul><li>If currently “in-gaze” and the play-delay timer completes, and video is paused, issue a “play” command.</li><li>If currently “out-of-gaze” and the pause-delay timer completes, and video is playing, issue a “pause” command.</li><li>Reset timers appropriately when gaze state flips.</li></ul><h3>5. Simulating Media Keys</h3><p>Using PyAutoGUI (or OS-specific libraries if needed), send the appropriate key event (e.g., spacebar or media-play-pause). This makes the solution agnostic to the actual video player: browser-based players (YouTube, Vimeo), desktop apps (VLC, MPC-HC), or custom players that listen to media keys.</p><h3>🖥️ Interface &amp; Experience</h3><p>The UI is intentionally minimal:</p><ul><li><strong>Calibration Wizard</strong>: Guides the user step-by-step to look at predefined screen locations. Shows clear instructions and progress.</li><li><strong>Sliders / Input Fields</strong>: For adjusting pause/play delays in seconds. Values are applied immediately.</li><li><strong>Visual Feedback</strong>: A small indicator (e.g., a colored circle or label) shows “Gaze Detected” vs. “Not Detected” in real time, so users know how the system interprets their position.</li><li><strong>Buttons</strong>: Start/Stop detection, Recalibrate.</li><li><strong>Settings Persistence</strong>: Store user settings (thresholds, calibration data) locally so the next session picks up where the user left off.</li></ul><p>Even non-technical users can launch the script, follow prompts, and have it run with minimal fuss.</p><h3>🧩 Codebase Structure</h3><p>A modular layout helps isolate concerns and simplify testing or enhancements:</p><pre>gaze_detector_play_pause/<br>├── main.py                  # Entry point: parses arguments, launches UI<br>├── requirements.txt         # List dependencies: opencv-python, pyautogui, etc.<br>├── README.md                # Overview, setup instructions<br>└── src/<br>    ├── controller/<br>    │   └── gaze_controller.py   # Core logic: reads detection results, issues play/pause<br>    ├── detection/<br>    │   ├── face_detector.py     # Wraps OpenCV cascades or lightweight models<br>    │   └── gaze_data.py         # Data structures, calibration storage<br>    ├── ui/<br>    │   └── ui_components.py     # Tkinter windows, sliders, status indicators<br>    └── utils/<br>        └── audio.py             # Optional: play a sound cue on pause/play</pre><ul><li><strong>Separation of Concerns</strong>: Detection code doesn’t handle UI; UI doesn’t handle low-level key events. This makes debugging easier.</li><li><strong>Extensibility</strong>: Later, one could swap out Haar cascades for a CNN-based eye-tracking model by replacing the detection module without touching UI or controller logic.</li></ul><h3>🔍 The Unexpected Challenges</h3><ol><li><strong>Noisy Detection</strong></li></ol><ul><li>Webcam quality, lighting changes, glasses reflections, or facial hair can degrade Haar cascade performance.</li><li>Mitigation: Calibration helps adapt thresholds; allow users to retry in different lighting; consider smoothing results over multiple frames.</li></ul><p><strong>2. User Movement &amp; Fatigue</strong></p><ul><li>Users shift posture, lean forward/back, or glance off briefly (e.g., checking phone). If thresholds are too sensitive, video may pause/resume too often.</li><li>Mitigation: Provide reasonable default delays (e.g., 1–2 seconds), let users tweak. Optionally detect brief blinks vs. deliberate look-away.</li></ul><p><strong>3. Simulating Media Keys Reliably</strong></p><ul><li>Different OSes or players handle simulated key events differently; fullscreen players or browser focus may block inputs.</li><li>Mitigation: Document known limitations; offer instructions (e.g., ensure the video player window is active or browser tab is focused). Advanced: integrate with browser extensions or specific player APIs for tighter control.</li></ul><p><strong>4. Calibration UX</strong></p><ul><li>Users may find calibration tedious if not guided well.</li><li>Mitigation: Keep calibration steps minimal (e.g., 5 points instead of 9), show clear on-screen markers, allow skip or quick recalibration later.</li></ul><h3>💡 Real-World Use Cases</h3><p>Reflecting on how this prototype could fit into everyday workflows:</p><ul><li><strong>Online Learners</strong>:<br> Videos automatically pause when attention drifts — ensuring you don’t miss explanations. Resume when you look back.<br> <strong>Taking Notes While Watching Tutorials</strong>:<br> One of the most common scenarios in self-paced learning is juggling video and note-taking. With gaze control, you look away to write in your notebook or switch to a note-taking window — video pauses automatically. When you look back, it resumes exactly where you left off. No need to fumble for play/pause or risk missing key points. This simple flow — Watch → Look away to write → Look back → Continue — streamlines study sessions and helps retain focus on content rather than controls.</li><li><strong>People with Motor Impairments</strong>:<br> For users who have difficulty using a mouse or keyboard, gaze-based playback offers an inclusive alternative.</li><li><strong>Multitaskers &amp; Hands-Busy Scenarios</strong>:<br> Cooking videos, DIY tutorials, or craft demonstrations: your hands are occupied, but your eyes control playback seamlessly.</li><li><strong>Presentations &amp; Training Sessions</strong>:<br> Imagine a webinar where the presenter’s gaze (or a participant’s) could automate pause/resume during side discussions. Or in group training, a facilitator uses gaze cues to manage video segments.</li><li><strong>Entertainment &amp; Immersive Experiences</strong>:<br> On smart TVs or VR headsets, gaze-based controls might reduce reliance on remotes or controllers, offering more natural interactions.</li></ul><h3>🎁 How to Try It Yourself</h3><p>I’ve open-sourced the prototype. To experiment:</p><ol><li><strong>Clone the Repo</strong></li></ol><pre>git clone https://github.com/your-username/gaze-video-player.git cd gaze-video-playe</pre><p><strong>2. Install Dependencies</strong></p><p>pip install -r requirements.txt</p><ul><li>Typical requirements: opencv-python, pyautogui, etc.</li></ul><p><strong>3. Run Calibration &amp; Detection</strong></p><p>python main.py</p><ul><li>Follow the calibration wizard.</li><li>Adjust pause/play delays via sliders.</li><li>Open your video player (e.g., browser tab with YouTube), ensure it’s focused, then start detection.</li></ul><p><strong>4. Adjust &amp; Contribute</strong></p><ul><li>Tweak detection thresholds or add logging to understand behavior in your environment.</li><li>Experiment with different Haar cascades or replace with a lightweight DNN-based eye tracker.</li><li>Share improvements: file issues or pull requests on GitHub.</li></ul><h3>🔮 What’s Next?</h3><p>This prototype demonstrates the concept but also highlights opportunities for improvement and extension:</p><ul><li><strong>Deep Learning-Based Gaze Tracking</strong>:<br> Replace or augment Haar cascades with models trained for gaze estimation to improve accuracy and robustness under diverse conditions.</li><li><strong>Browser Extension Integration</strong>:<br> Instead of simulating key presses, use the YouTube or HTML5 video API directly for more reliable control in browser-based players.</li><li><strong>User Profiles &amp; Face Recognition</strong>:<br> Allow multiple users to store individual calibration data. When detecting a known face, load that user’s settings automatically.</li><li><strong>Cross-Platform Packaging</strong>:<br> Build installers or packages for Windows, macOS, Linux, making it easier for non-technical users to install and run.</li><li><strong>Smart TV / Embedded Device Support</strong>:<br> Explore lightweight implementations on embedded boards or integrate with TV operating systems.</li><li><strong>Additional Gaze-Driven Features</strong>:<br> Beyond pause/play: volume control by looking up/down? Seeking by looking at a timeline overlay? Interactive tutorials where gaze triggers supplemental content?</li><li><strong>Accessibility Studies &amp; User Testing</strong>:<br> Collaborate with users who have motor impairments or in educational settings to gather feedback, improve UX, and measure real impact.</li></ul><h3>🧭 Final Thoughts</h3><p>We often discuss futuristic interfaces — gesture controls, voice assistants, AR/VR interactions. Yet sometimes the next step is right in front of us: our eyes. This project taught me that even simple gaze inference — using a webcam and open libraries — can reshape how we interact with everyday tools like video players.</p><p>It’s not perfect. It’s a prototype. But it’s a start toward more natural, inclusive interfaces. And sometimes, the best ideas begin with a blink.</p><h3>💬 Let’s Connect</h3><p><strong>If you’re interested in building a similar tool tailored to your specific team’s needs, please don’t hesitate to reach out!</strong></p><p>sammingasainathrao@gmail.com</p><p><em>if you’re passionate about building or testing tools like these, join our community: </em><a href="https://nas.io/fhaida"><em>https://nas.io/fhaida</em></a><em>. It’s the place to share ideas, give feedback, and help shape the next generation of business and tech solutions. You can explore our website also fhaida.com</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eeb6ee252ef8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>