Skip to content

Repository files navigation

PowerNap: A Sleep and Socio-Economic Analysis Tool

PowerNap is a comprehensive data analysis project that explores the intricate relationship between sleep patterns, socio-economic factors, and overall well-being. The project leverages a combination of data analysis, machine learning, and an interactive web application to provide users with both macro-level insights into sleep disparities across different communities and micro-level analysis of их personal sleep data.

This project is driven by the understanding that sleep is a critical component of a healthy and productive life. By analyzing sleep data in conjunction with socio-economic data, we can identify and address disparities that may exist, contributing to a more equitable and inclusive society.

Key Features

  • Socio-Economic Mapping: Visualizes the correlation between sleep duration and socio-economic indicators across different geographical areas in the United States.
  • Personal Sleep Data Analysis: Allows users to upload their own sleep data (in .npy format) for in-depth analysis and visualization.
  • Sleep Stage Prediction: Utilizes a variety of machine learning models to predict sleep stages from raw EEG data.
  • Interactive Web Application: A user-friendly GUI built with Taipy that provides an interactive platform for data exploration and model interaction.

Technical Breakdown

Data Analysis and Mapping (R)

The data analysis and mapping component of this project is handled by an R script (DATATHON2024_DEI.R) that utilizes the following libraries:

  • tidycensus: To extract ACS data from the US Census.
  • dplyr and tidyr: For data manipulation and processing.
  • ggplot2 and sf: For creating insightful and visually appealing maps.

The script merges sleep survey response data from the CDC with socio-economic data from the US Census to create a comprehensive dataset for analysis.

Machine Learning Models (Python)

The machine learning pipeline is built in Python (ML.py) and leverages the following libraries:

  • numpy and pandas: For data manipulation and analysis.
  • mne: For processing and analyzing EEG data.
  • tensorflow and keras: For building and training Deep Neural Network (DNN) and Convolutional Neural Network (CNN) models.
  • xgboost: For implementing our XGBoost model for sleep stage classification.
  • scipy: For signal processing, including the Fast Fourier Transform (FFT).

The ML pipeline preprocesses raw EEG data by performing an FFT and extracting power in different spectral bands (Alpha, Beta, Delta, Theta, and Sigma waves). This frequency-domain data is then used to train our models to predict sleep stages. Our models achieve an accuracy of 85% on our test set.

Web Application (Taipy)

The interactive user interface is a web application built with the Taipy framework in Python (dashboard.py). The application allows users to:

  • Upload their own sleep data for analysis.
  • Visualize both raw and processed sleep data.
  • Select and run different machine learning models on their data.
  • View and download the results of their sleep stage analysis.

How to Use

To run the PowerNap web application, you will need to have Python and the required libraries installed. You will also need to manually upload the default data files, p00_n1_NEW_X.npy and p00_n1_NEW_y.npy, to the web-app/taipy/data directory.

Once the data is in place, you can launch the interactive GUI by running dashboard.py from the web-app/taipy directory.

Version Control

This project uses Git for version control. A git_cheat_sheet.pdf is included in the repository for easy reference to common Git commands.

About

The repository for Datathon 2024, by Thomas Pickell, Leo Marek, Matthew Karazincir, and Theodore Kim

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages