DEV Community

Leman Caliskan
Leman Caliskan

Posted on • Originally published at Medium

Restoring the Rhythm of Rest: Introducing SleepMetrics

SleepMetrics Logo

Honestly, I never planned to build something like SleepMetrics. Not at first.

I developed CardioMetrics-Core what is an AI-powered desktop application that analyzes clinical data to evaluate cardiovascular risk levels and provide real-time health insights using machine learning models.

And I enjoyed developing the CardioMetrics project. And I thought, could I create a similar application related to health? And that’s how Sleepmetrics was created.


✨ My Approach

I wanted SleepMetrics to be more than just a spreadsheet of numbers. The tool needed to be simple, functional, and professional.

CustomTkinter ended up being a surprisingly good fit once again. I maintained the light/dark modes to ensure the interface felt comfortable to use especially important for an app you might check at night.

  • Real-time Visualization: I integrated live gauges that react to your data. When you adjust stress levels or physical activity, the app provides immediate visual feedback.

  • Personalized Sleep Insights: The app doesn't just show numbers; it provides specific guidance based on sleep duration, activity levels, and stress to help you optimize your rest.

SleepMetrics Desktop app in Turkish UI

SleepMetrics Desktop app in English UI


🩺 Smart Health Recommendations

Based on the lifestyle and clinical data entered, SleepMetrics generates a dynamic dashboard of personalized suggestions. These aren't generic tips; they are reactive nudges triggered by your specific metrics:

🧠 Disorder & Quality Alerts

SleepMetrics transforms your data into three different health statuses based on the machine learning model’s findings:

  • Sleep Apnea Risk Detected 🚨: If the model identifies patterns consistent with Apnea, the app triggers a high-priority alert (Red) recommending a consultation with an ENT specialist.

  • Insomnia Symptoms Detected ⚠️: When insomnia markers appear, the app provides practical tips, such as cutting out blue light sources 2 hours before bed to help your brain naturally produce melatonin.

  • Healthy / Asymptomatic βœ…: If no risks are detected, the app encourages you to keep up the good work, confirming your data aligns with a healthy sleep profile.

πŸ” Parameter Specific Health Recommendations

  • Stress Management 🧘: If stress levels exceed 7/10, the app suggests pre-sleep breathing exercises to lower cortisol levels.

  • Sleep Duration ⏰: Logging less than 6 hours triggers a warning about the lack of physical repair and encourages a 7+ hour target.

  • Activity & Movement πŸ‘£: Low step counts (< 5,000) or low activity trigger a reminder that reaching 7,500 steps can shorten the time it takes to fall asleep by 15%.

  • Heart Rate & BP ❀️: High readings prompt advice to reduce caffeine intake and monitor vitals more closely.

Note: They’re not the a substitute for professional medical advice, diagnosis, or treatment. It just a simple advices and friendly nudges to support your heart health.


πŸ›  The Tech Stack & Model

For the backend, I used these datasets Sleep Health and Lifestyle and Sleep Cycle and Productivity from Kaggle.

I built a dual-engine system:

Backend Engine

  • Quality Prediction: A RandomForestRegressor (150 estimators) handles the sleep quality score with a 99.08% $R^2$ accuracy.

  • Diagnosis: A GradientBoostingClassifier predicts potential sleep disorders with 88% accuracy.

The model provides a signal: "maybe check this out."


🌍 Why Two Languages? (EN/TR)

As I’m Turkish, I developed the app in Turkish first. But health is universal. I restructured the project to have clean v_EN and v_TR folders so language would never be a barrier to access.


πŸ–₯️ Choose Your Experience: (Web, Desktop, or Code)

People have different preferences. Some want instant access, some prefer a standalone desktop app, some just want the code.
So I made three options:

  • Streamlit Web App: quick access β†’ SleepMetrics Streamlit App
  • Desktop App: A pre-built .exe file (no Python environment required). Just download and run.
  • Source Code: Cleanly structured folders with clear EN/TR separation for the curious.

SleepMetrics Web-app (Streamlit Version)


πŸš€ Explore the Project

GitHub logo lemancaliskan / SleepMetrics

Sleep Health & Lifestyle Analysis Tool: An AI-powered desktop application that analyzes biometric data to predict sleep quality and detect potential sleep disorders using machine learning models.

πŸŒ™ SleepMetrics - Sleep Health & Lifestyle Analysis Tool

SleepMetrics is a modern desktop application designed to analyze sleep quality and predict potential sleep disorders using advanced machine learning algorithms. By processing lifestyle and clinical data through a sleek, high-DPI interface, it provides users with data-driven insights into their sleep health.

Streamlit


πŸ“Ί Demo

🎨 Visual Experience

The application features a dedicated toggle for seamless switching between light and dark modes.
Features integrated real-time gauges for the live visualization of sleep quality scores.

πŸ” Desktop Application (EN/TR)

Optimized for a 980x666 centered window layout, this standalone application delivers a precision-focused, localized experience through a theme-aware CustomTkinter UI designed for both global and local users.

TURKISH UI:
image

ENGLISH UI:
image

🌐 Web Application (Streamlit):

A responsive and lightweight web version for instant access from any device. image


✨ Features

  • Dual Language Support: Optimized interfaces for both English (EN) and Turkish (TR).

  • Modern GUI: A…

  • Streamlit Web App: Try it here
  • Desktop App: Pre-built .exe available in GitHub Releases.

🀝 Contributing

If you have ideas on how to improve the ML model or want to suggest new features for the UI, feel free to open an issue or a Pull Request on GitHub. Let’s build better health tools together!


Medical Disclaimer: This software is for informational purposes only. The results provided do not constitute a formal medical diagnosis. Always consult with a professional healthcare provider before making any medical decisions.

Top comments (0)