Inspiration

PRANA AI Triage is an edge-oriented clinical triage prototype that fuses ECG and chest X-ray signals into a single severity verdict per patient. A PyTorch 1D-CNN trained on the MIT-BIH Arrhythmia dataset (train_mitbih_cnn.py) classifies 187-sample heartbeat windows into 5 rhythm classes and is served through cnn_inference.py. Patient data flows through a NATS pub/sub pipeline (nats_pipeline.py) that simulates sensors publishing ECG + X-ray messages, a subscriber that pairs them by patient_id, runs the CNN, computes an overall severity (NORMAL / MODERATE / HIGH / CRITICAL) via compute_overall_severity, and persists each verdict to SQLite plus a human-readable reports/ text file through prana_database.py; if no NATS server is present the pipeline falls back to offline simulation. A Streamlit + Plotly dashboard (dashboard.py) auto-refreshes over prana_records.db to show system-wide summaries, severity distribution, confidence histograms, critical-case tables, and a searchable full-report view — mirroring the "Raspberry Pi → NATS → Hailo AI → SQLite → Dashboard" architecture described in architecture.txt and designed so only the sensor-read layer changes when moving from laptop simulation to real hardware.

What it does

PRĀNA is an AI-based real-time patient triage system that analyzes ECG and X-ray data to identify abnormalities and determine the patient’s overall severity level. The ECG component uses a CNN trained on the MIT-BIH heartbeat dataset and currently achieves 97.06% test accuracy, while the X-ray module identifies conditions such as pneumonia, lung opacity, effusion, and atelectasis. The results from both modalities are combined to classify patients as NORMAL, MODERATE, HIGH, or CRITICAL, with an appropriate recommended action. The system uses NATS for real-time communication, SQLite for storing patient reports, and a Streamlit dashboard for monitoring and visualization. The current software pipeline has been successfully tested using simulated ECG/X-ray data, and the next stage is integrating the system with the Raspberry Pi 5, AI HAT+, and real ECG sensor hardware for real-time edge-AI operation.

How we built it

We built PRĀNA in stages. First, we created the software pipeline for ECG and X-ray analysis and connected the components using Python. For ECG, we moved to the MIT-BIH heartbeat dataset, which contains 187 ECG signal samples per heartbeat and five labeled heartbeat classes. We trained a 1D CNN in PyTorch using the training dataset and evaluated it on the separate test dataset, achieving 97.06% test accuracy, with a classification report and confusion matrix to evaluate individual classes. The trained model was then integrated into the ECG inference module, where the five classes are mapped into normal or anomalous results for the PRĀNA triage system. We built an X-ray analysis module, combined the ECG and X-ray results through a severity engine, and classified cases as NORMAL, MODERATE, HIGH, or CRITICAL. We then added NATS for real-time message communication, SQLite for storing triage results, automatic text-report generation, and a Streamlit dashboard for viewing patient statistics and reports. Finally, we tested the complete pipeline with simulated patients and configured the project for the next stage: connecting the software to the Raspberry Pi 5, AI HAT+, and real ECG sensor hardware.

Challenges we ran into

We faced several challenges while developing PRĀNA, including finding and structuring a suitable ECG dataset, handling the highly imbalanced MIT-BIH heartbeat classes, and making sure the CNN architecture used during training matched the inference pipeline. We also had to replace the earlier 500-sample ECG pipeline with the 187-sample MIT-BIH format and resolve model compatibility issues between the old and newly trained models. Another challenge was integrating the AI modules with NATS real-time communication, database storage, report generation, and the dashboard while keeping all components synchronized. Finally, we tested the system in offline simulation mode because the NATS server was not always running, and the next challenge is integrating the software with the Raspberry Pi 5, AI HAT+, and real ECG sensor for actual hardware-based operation.

Accomplishments that we're proud of

We successfully built a working end-to-end AI triage software prototype that combines ECG and X-ray analysis into a single patient severity assessment. We trained a CNN on the MIT-BIH ECG dataset and achieved 97.06% test accuracy, with detailed classification metrics and a confusion matrix. We also integrated real-time NATS communication, SQLite database storage, automatic patient reports, system-performance monitoring, and a Streamlit dashboard. The pipeline has been tested with 50 simulated patients, generating and storing complete triage reports successfully. We also prepared the project for the next stage of deployment on the Raspberry Pi 5 with the AI HAT+ and real ECG sensor hardware.

What we learned

Through this project, we learned how to build an end-to-end AI and IoT healthcare system, from dataset preparation and CNN model training to real-time deployment. We learned the importance of using the correct train/test datasets, handling class imbalance, and evaluating an ML model using accuracy, precision, recall, F1-score, and a confusion matrix instead of relying only on accuracy. We also learned how to integrate different software components using NATS messaging, SQLite databases, automated reports, and Streamlit dashboards. Most importantly, we learned that successful AI deployment requires more than a trained model—it requires matching the data format between training and inference, reliable communication between components, system monitoring, and hardware integration.

What's next for Prana_AI Triage

The next phase is to expand PRĀNA from a two-modality system into a multi-parameter AI health monitoring platform. We plan to integrate additional physiological sensors such as SpO₂ (blood oxygen saturation), EEG (brain activity), heart rate and other vital-sign sensors, alongside the existing ECG and X-ray modules. These sensor streams will be connected to the Raspberry Pi 5 and processed in real time through the PRĀNA pipeline. We also plan to integrate the Raspberry Pi AI HAT+ for accelerated edge-AI inference, improve multimodal AI fusion so that information from ECG, X-ray, SpO₂, EEG and other sensors can contribute to a more comprehensive triage assessment, and eventually develop a unified dashboard showing the patient's real-time physiological status and alerts. The long-term goal is to make PRĀNA a portable, real-time, edge-AI health monitoring and triage system rather than only an ECG/X-ray classifier.

Built With

Share this project:

Updates

Submission history