Skip to main content

Heartbeat analysis using Deep Learning, Signal Processing, and AI Agents.

Project description

🩺 AI Body Sound Analyzer

An end-to-end medical diagnostics platform using Deep Learning, Digital Signal Processing (DSP), and Agentic AI to analyze biological sounds (Heart, Lung, and Bowel).

Python Version License: MIT


🚀 Key Features

1. ❤️ Heart Sound Analysis

  • Deep Learning: Uses a trained LSTM (Long Short-Term Memory) model to classify heart sounds into Normal, Murmur, or Artifact.
  • Signal Processing: Extracts S1/S2 heartbeats using energy envelope detection and 20-500Hz bandpass filtering.
  • Heart Rate Variability (HRV): Detailed timing analysis of heart rate patterns.

2. 🫁 Lung Sound Analysis

  • Classification: Powered by a GRU (Gated Recurrent Unit) model to detect Normal, Wheeze, or Crackle sounds.
  • Breath Cycle Detection: Sophisticated prominence-based detection of inspiration and expiration phases.

3. 🩺 Bowel Sound Analysis

  • Event Detection: High-resolution detection of bowel sounds using CRNN (Convolutional Recurrent Neural Networks).
  • Metric Extraction: Analysis of event frequency and rhythmic patterns.

4. 💬 Specialized AI Agents

  • Integrated with LangGraph and Groq (Llama-3) for rapid medical insight.
  • Context-Aware: Agents receive patient information (age, gender, name) to provide personalized explanations.
  • RAG Powered: Uses semantic search over analysis reports to answer technical questions about detected anomalies.

📦 Installation

Install the package directly from PyPI or locally in editable mode:

From PyPI

pip install heart-murmur-analysis

Locally (for development)

pip install -e .

[!IMPORTANT] Ensure you have FFmpeg installed on your system for audio processing (required by librosa).


🏃 Usage

Programmatic Usage

You can use the package as a library in your own Python projects:

from heart_murmur_analysis import HeartbeatAnalyzer, load_model

# Run Signal Processing
analyzer = HeartbeatAnalyzer("heartbeat_sample.wav")
results = analyzer.analyze()
print(f"Detected Heart Rate: {results['heart_rate_bpm']} BPM")

⚙️ Configuration

The AI Agents require the following environment variables (or a .env file):

  • GROQ_API_KEY: For LLM generation.
  • HF_TOKEN: For downloading models from HuggingFace.

📂 Project Structure

├── heart_murmur_analysis/ 
│   ├── agent/             # LangGraph AI logic
│   ├── classification/    # Deep Learning (H5 Models)
│   ├── signal_processing/ # Audio DSP routines
│   ├── report_generator/  # PDF/JSON report logic
│   └── cli.py             # App entry point
├── main.py                # Main Streamlit dashboard
├── pyproject.toml         # Packaging metadata
└── README.md              # You are here!

📄 License

Distributed under the MIT License. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heart_murmur_analysis-0.4.4.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heart_murmur_analysis-0.4.4-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file heart_murmur_analysis-0.4.4.tar.gz.

File metadata

  • Download URL: heart_murmur_analysis-0.4.4.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for heart_murmur_analysis-0.4.4.tar.gz
Algorithm Hash digest
SHA256 ef4346beae7faa935f7d0120527cf98b1875d847455e79bff513e8844ff9728f
MD5 6950a91e8051ce4eaebdd1ff3e3a39e0
BLAKE2b-256 f06e0a90b2b6234e89c283d92e375830ef0fb804678b9c2f0f18e6d6e42e7e75

See more details on using hashes here.

File details

Details for the file heart_murmur_analysis-0.4.4-py3-none-any.whl.

File metadata

File hashes

Hashes for heart_murmur_analysis-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4305319061dd61b075fa73ffc66ee650439312b3719560ec2a5730b9a5e4d8a1
MD5 c22c8d97125813963b519dcb19fab1b5
BLAKE2b-256 c345fc7d058ea324cbf5a42351c17e4d2f0fd5c86d170a854e5dd150fae6f5e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page