Patient Journey Sankey Diagram

This interactive diagram, built with D3.js, models the various paths patients take from diagnosis to treatment and follow-up, highlighting key decision points and outcomes.

A Data-Driven Approach to Gastrointestinal Disease: A Sankey Diagram and Other Methodologies

Summary

This project utilizes a comprehensive gastrointestinal disease dataset to construct interactive visualizations that narrate the patient journey. A dynamic Sankey diagram illustrates the flow from demographic factors and symptoms to final diagnoses, with flow volumes proportional to patient counts. The analysis also explores alternative visualization techniques like Chord Diagrams and Interactive Decision Trees to provide a holistic view of complex medical data relationships.

Introduction 🔬

This project leverages a 30,000-row gastrointestinal disease dataset to create intuitive and insightful visualizations. The primary focus is a Sankey diagram that illustrates the “patient journey” by connecting demographic factors and symptoms to disease diagnoses. Beyond this, alternative methodologies were explored to showcase the versatility of modern data analysis techniques in a medical context.


Methodology and Results: The Sankey Diagram 📊

The Sankey diagram was selected to depict the multi-stage flow of patients from initial characteristics to diagnoses, with flow line widths proportional to patient counts.

  • Data Preparation

  1. Creating Age Groupings: The numerical Age variable was categorized into discrete groups (e.g., 30-49, 50-64) to form meaningful nodes.
  2. Generating Flow Links: Data was aggregated to count patients flowing between categories, e.g., from the “30-49” age group to “Bloating” and then to Disease_Class.
  • Visualization

    The plotly library in Python was used to create an interactive HTML Sankey diagram with the key code go.Figure(data=[go.Sankey(...)]). Users can hover over nodes and links to view exact patient counts, adding a quantitative layer to the visual flow.

Key Findings

The diagram highlighted distinct pathways, showing significant patient flows from the 30-49 and 50-64 age groups to diagnoses, with many experiencing bloating as a key symptom.


Other Methodologies 🔬

Two additional visualization approaches were explored to provide alternative perspectives:

  1. Chord Diagram: This circular visualization arranges nodes around a circle, with chords (arcs) showing relationships, their thickness indicating strength. It could reveal correlations between factors like Disease_Class and Smoking_Status using a relationship matrix: matrix.loc[row['Disease_Class'], row['Smoking_Status']] += 1. This offers a comprehensive view of complex dataset interconnections.

  2. Interactive Decision Tree: A machine learning-based Decision Tree acts as a diagnostic flowchart, identifying key questions (e.g., “Is Family_History positive?”) to predict Disease_Class. Trained with model.fit(X_train, y_train), the tree’s visual representation enables healthcare professionals to trace how symptoms and lifestyle factors lead to diagnoses, serving as an interpretable diagnostic and prognostic tool.


Conclusion ✨

This project showcases multiple interactive visualization methods for a gastrointestinal disease dataset. The Sankey diagram effectively narrates the patient journey, linking age, symptoms, and diagnoses. The Chord Diagram and Interactive Decision Tree provide complementary insights, revealing complex relationships and offering transparent, actionable tools for diagnosis and prognosis.


© Balaji Ramanathan