Skip to main content

Mental Health Prediction Using Machine Learning: Building an Explainable AI Web Application

Machine learning is increasingly being explored for applications in healthcare and wellbeing. However, building an ML model for a sensitive domain such as mental health requires more than simply achieving a high accuracy score. I developed a Mental Health Prediction & Assessment System that combines machine learning, PHQ-9 screening, Explainable AI and a Flask-based web application. The project is available on GitHub: https://github.com/starJeet000/Mental-Health-Prediction-Using-Machine-Learning What Is the Project? The application is designed as an educational and preliminary screening system that evaluates mental-health-related information and produces a risk prediction. It combines an ML-based prediction system with a standardized PHQ-9 questionnaire. The purpose is not to replace mental-health professionals but to demonstrate how machine learning can be incorporated into a complete software application. Machine Learning Model Several classification algorithms were tr...

Build a serverless Node.js AI news bot with Gemini, GitHub Actions, Telegram, RSS scraping, NLP, Discord and Vercel

What if you could wake up every morning and have a bot deliver a concise briefing about what's happening across the technology world—without running a server 24/7?

That's the idea behind my Chaos Routine Bot, an automated Telegram news agent built with Node.js, Gemini 2.5 Flash, GitHub Actions and Vercel.

The project is available on GitHub:

https://github.com/starJeet000/Telegram-News-Scraper-Bot

What Does It Do?

The bot automatically collects technology news from multiple sources, removes irrelevant stories, extracts useful facts, sends the cleaned information to Gemini, and delivers an AI-generated briefing.

The interesting part isn't simply calling an AI API.

The project creates a pipeline around the AI.

The flow looks roughly like this:

News Sources → Filtering → Article Extraction → Offline NLP → Gemini → Telegram/Discord → Web Dashboard/RSS

Infographics for this post

1. Automated Daily Execution

The project uses GitHub Actions as its scheduler.

A workflow runs every morning at 08:00 IST. An Ubuntu runner starts the Node.js application, executes the scraping pipeline, generates the briefing and deploys the generated public files.

This means there is no traditional server that needs to remain running.

The workflow can also be triggered manually through GitHub Actions.

2. Randomized Tech-News Sources

Instead of depending on a single news website, the scraper contains a pool of sources covering areas such as:

  • Hacker News

  • Reddit technology communities

  • Dev.to

  • Lobste.rs

  • InfoQ

  • BleepingComputer

  • Krebs on Security

  • TechCrunch AI

  • MIT Technology Review AI

  • Phoronix

  • ServeTheHome

  • TechXplore

  • Ars Technica

For every execution, the bot randomly selects two sources.

That creates a slightly different information mix each day.

3. Filtering Before AI Processing

One of the things I wanted to avoid was sending everything directly to an LLM.

The scraper applies a technology-focused filter before the article reaches the AI stage.

It uses:

  • A negative keyword blocklist

  • A technical keyword whitelist

  • Source-specific extraction logic

This helps reduce irrelevant stories before spending AI processing on them.

4. Cleaning Articles Before Summarization

Once a story is selected, the application fetches its HTML.

Instead of passing the entire webpage to Gemini, the project uses Mozilla Readability + JSDOM to extract the actual article content and remove things such as navigation and webpage clutter.

This is followed by offline NLP processing using Compromise.

The current implementation extracts up to three sentences from the cleaned article.

So the pipeline effectively becomes:

Web Page
   ↓
HTML
   ↓
Mozilla Readability
   ↓
Clean Article Text
   ↓
Compromise NLP
   ↓
Core Facts
   ↓
Gemini

5. Gemini Generates the Briefing

The extracted facts are then passed to Gemini 2.5 Flash.

Instead of asking for a generic summary, the project uses a specific persona: an exhausted senior software engineer who has already had four cups of coffee.

The result is designed to be a short, sarcastic briefing about the latest technology stories.

That gives the output a personality rather than making it feel like another generic RSS digest.

6. There Is an Offline Fallback

This is one of the more important engineering details.

If the Gemini API key isn't available, or if the Gemini request fails, the application doesn't simply stop.

It falls back to the previously extracted offline NLP facts.

That means the pipeline can still produce useful output without the AI generation step.

Gemini available?
      │
   ┌──┴──┐
  YES    NO
   │      │
 Gemini   Offline NLP
   │      │
   └──┬───┘
      ↓
   Briefing

7. More Than Just Telegram

Although Telegram is the primary delivery channel, the project also supports Discord through a webhook.

The application additionally generates:

  • index.html

  • briefing.json

  • rss.xml

The JSON file acts as a static API containing the briefing and evidence behind it.

The RSS feed makes the generated briefings accessible through RSS-compatible readers.

8. Vercel Deployment

The GitHub Actions workflow also handles deployment.

After generating the public files, the workflow installs the Vercel CLI and deploys the production output.

So the complete automation looks like:

GitHub Actions
      ↓
Node.js scraper
      ↓
News filtering
      ↓
Article extraction
      ↓
Offline NLP
      ↓
Gemini
      ↓
Telegram + Discord
      ↓
JSON + RSS + Dashboard
      ↓
Vercel

Tech Stack

The project currently uses:

  • Node.js

  • Google Gemini 2.5 Flash

  • Cheerio

  • JSDOM

  • Mozilla Readability

  • Compromise NLP

  • RSS Parser

  • Feed

  • Telegram Bot API

  • Discord Webhooks

  • GitHub Actions

  • Vercel

  • dotenv

The dependencies are defined in the project's package.json.

Why I Built It

The goal wasn't to build another RSS reader.

I wanted to experiment with a more complete automation pipeline:

collect → filter → extract → understand → generate → distribute → deploy

It also demonstrates how AI can be used as one component inside a larger software system rather than being the entire application.

What's Interesting About the Architecture?

The biggest lesson from this project is that the AI doesn't have to do everything.

Traditional approach:

News → LLM → Summary

This project takes a more structured approach:

News
 ↓
Filtering
 ↓
Content Extraction
 ↓
Offline NLP
 ↓
Small Context
 ↓
Gemini
 ↓
Distribution

That separation makes the system easier to reason about and gives the application a fallback when the AI service isn't available.

Try the Project

The complete source code is available on GitHub:

https://github.com/starJeet000/Telegram-News-Scraper-Bot

If you're interested in Node.js automation, web scraping, NLP, generative AI, GitHub Actions or serverless applications, this project is a useful example of how those pieces can fit together.

Comments

Popular posts from this blog

Cybersecurity & Ethical Hacking Terminology: 100+ Essential Terms Explained

Cybersecurity has its own vocabulary. When you begin studying cybersecurity, you will quickly encounter terms such as malware, phishing, vulnerability, exploit, authentication, authorization, firewall, zero-day, ransomware, social engineering, penetration testing, and threat actor . At first, these terms can seem confusing. Some are closely related, while others describe completely different concepts. This glossary provides a beginner-friendly explanation of the most important cybersecurity and ethical-hacking terminology. The goal is not to memorize every word. Instead, use this guide as a reference whenever you encounter an unfamiliar security term. A — Cybersecurity Terms Access Control Access control determines who or what is allowed to access a resource and what they are permitted to do with it . It is commonly implemented using permissions, roles, policies, and authentication mechanisms. Active Directory Active Directory is Microsoft's directory and identity-management techno...

Mandatory Skills Every Tech Professional Should Have on Their Resume

A technology resume is more than a collection of programming languages and frameworks. Recruiters want to understand what you can actually build, how you solve problems, and whether you can work with the tools used in modern software development. If you're preparing a resume for a software developer, web developer, DevOps engineer, data professional, or other technology role, these are the major skill categories you should consider including. 1. Programming Languages Start with the programming languages you actually know. Depending on your career path, these might include: JavaScript TypeScript Python Java C++ C# Go PHP Don't add every language you've ever watched a tutorial about. If an interviewer asks you to solve a problem using a language listed on your resume, you should be comfortable using it. 2. Frameworks and Libraries Framework knowledge is important because modern software development rarely involves building everything from scratch. Examples include: React Next...

The Complete AI + Cybersecurity + MERN Developer Roadmap for 2026

Artificial intelligence, cybersecurity, and web development are three of the most interesting areas of modern technology. Each field provides valuable career opportunities on its own. But combining them can create an especially powerful technical skill set. This roadmap is designed for developers and students who want to learn MERN + cybersecurity + AI and eventually build real-world applications that combine all three. Why Learn AI + Cybersecurity + MERN? Consider a modern security application. A user opens a React dashboard. The application sends information to a Node.js backend. The backend stores data in MongoDB. Security rules analyze the data. An AI service helps classify or summarize the results. That single system requires knowledge of: Frontend development Backend development Databases APIs Security AI Deployment This is the intersection we are targeting. Phase 1: Learn Web Fundamentals Start with: HTML CSS JavaScript HTTP REST APIs Git GitHub Do not rush into advanced AI bef...

Mental Health Prediction Using Machine Learning: Building an Explainable AI Web Application

Machine learning is increasingly being explored for applications in healthcare and wellbeing. However, building an ML model for a sensitive domain such as mental health requires more than simply achieving a high accuracy score. I developed a Mental Health Prediction & Assessment System that combines machine learning, PHQ-9 screening, Explainable AI and a Flask-based web application. The project is available on GitHub: https://github.com/starJeet000/Mental-Health-Prediction-Using-Machine-Learning What Is the Project? The application is designed as an educational and preliminary screening system that evaluates mental-health-related information and produces a risk prediction. It combines an ML-based prediction system with a standardized PHQ-9 questionnaire. The purpose is not to replace mental-health professionals but to demonstrate how machine learning can be incorporated into a complete software application. Machine Learning Model Several classification algorithms were tr...