Spaces:
Sleeping
Sleeping
Justin Zhang
commited on
Commit
·
8ad415a
0
Parent(s):
Initial commit: AI-powered oncology insights platform
Browse files- .gitignore +7 -0
- .huggingface.yaml +4 -0
- README.md +51 -0
- dashboard/app.py +42 -0
- data/synthetic_oncology_patients.csv +11 -0
- docs/requirements.txt +3 -0
- notebooks/01_data_exploration.ipynb +123 -0
.gitignore
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.venv/
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.pyc
|
| 4 |
+
.env
|
| 5 |
+
.env.*
|
| 6 |
+
.DS_Store
|
| 7 |
+
.ipynb_checkpoints/
|
.huggingface.yaml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sdk: streamlit
|
| 2 |
+
app_file: dashboard/app.py
|
| 3 |
+
python_version: 3.9
|
| 4 |
+
requirements_file: docs/requirements.txt
|
README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AI-Powered Oncology Insights Platform
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
This project demonstrates how AI and real-world data (RWD) can be leveraged to extract actionable insights in oncology. It simulates a workflow for clinical decision support, drug development, and patient outcome prediction using synthetic data and modern AI tools.
|
| 5 |
+
|
| 6 |
+
## Features
|
| 7 |
+
- **Synthetic Oncology Data**: Simulated EHR, genomics, and treatment datasets.
|
| 8 |
+
- **NLP Pipelines**: Extract cancer staging, treatments, and adverse events from unstructured clinical notes.
|
| 9 |
+
- **Predictive Modeling**: Forecast patient survival or treatment response using XGBoost/LightGBM.
|
| 10 |
+
- **Clustering**: Identify patient subgroups with similar biomarker or treatment profiles.
|
| 11 |
+
- **Interactive Dashboards**: Visualize trends and model outputs with Streamlit or Dash.
|
| 12 |
+
|
| 13 |
+
## Directory Structure
|
| 14 |
+
```
|
| 15 |
+
📦 oncology-ai-insights/
|
| 16 |
+
├── README.md # Project overview, goals, and demo instructions
|
| 17 |
+
├── data/ # Synthetic or anonymized RWD samples
|
| 18 |
+
├── notebooks/ # Jupyter notebooks for analysis and modeling
|
| 19 |
+
├── src/ # Python scripts for preprocessing, modeling, and visualization
|
| 20 |
+
├── models/ # Saved model files and evaluation metrics
|
| 21 |
+
├── dashboard/ # Streamlit or Dash app code
|
| 22 |
+
└── docs/ # Documentation and references
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## Getting Started
|
| 26 |
+
1. Clone the repository.
|
| 27 |
+
2. Install requirements (see `docs/requirements.txt` or notebook cells).
|
| 28 |
+
3. Explore the notebooks for data analysis and modeling.
|
| 29 |
+
4. Run the dashboard app for interactive visualizations.
|
| 30 |
+
|
| 31 |
+
## AI Tools & Techniques
|
| 32 |
+
| Tool/Technique | Purpose |
|
| 33 |
+
|----------------------|-------------------------------------------------------------------------|
|
| 34 |
+
| NLP | Extract clinical features from text |
|
| 35 |
+
| XGBoost/LightGBM | Predict outcomes |
|
| 36 |
+
| K-Means/DBSCAN | Patient subgroup discovery |
|
| 37 |
+
| Plotly/Streamlit | Data visualization and dashboards |
|
| 38 |
+
| Faker/Synthea | Synthetic data generation |
|
| 39 |
+
|
| 40 |
+
## Impact
|
| 41 |
+
This project illustrates how AI can:
|
| 42 |
+
- Support oncologists in making data-driven decisions
|
| 43 |
+
- Identify clinical trial candidates
|
| 44 |
+
- Uncover hidden patterns in oncology RWD
|
| 45 |
+
|
| 46 |
+
## Credits
|
| 47 |
+
Inspired by real-world oncology data science and Ontada-style data models.
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
*For demo purposes only. No real patient data is used.*
|
dashboard/app.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import plotly.express as px
|
| 4 |
+
|
| 5 |
+
st.set_page_config(page_title="Oncology AI Insights Dashboard", layout="wide")
|
| 6 |
+
st.title("Oncology AI Insights Dashboard")
|
| 7 |
+
|
| 8 |
+
st.markdown("""
|
| 9 |
+
This dashboard visualizes synthetic oncology patient data and demonstrates how AI can support clinical insights.
|
| 10 |
+
""")
|
| 11 |
+
|
| 12 |
+
@st.cache_data
|
| 13 |
+
def load_data():
|
| 14 |
+
return pd.read_csv("../data/synthetic_oncology_patients.csv")
|
| 15 |
+
|
| 16 |
+
df = load_data()
|
| 17 |
+
|
| 18 |
+
# Sidebar filters
|
| 19 |
+
cancer_types = df['cancer_type'].unique().tolist()
|
| 20 |
+
st.sidebar.header("Filter Data")
|
| 21 |
+
selected_cancer = st.sidebar.multiselect("Cancer Type", cancer_types, default=cancer_types)
|
| 22 |
+
|
| 23 |
+
filtered_df = df[df['cancer_type'].isin(selected_cancer)]
|
| 24 |
+
|
| 25 |
+
# Main dashboard
|
| 26 |
+
st.subheader("Patient Demographics")
|
| 27 |
+
st.dataframe(filtered_df[['patient_id', 'age', 'gender', 'cancer_type', 'stage']])
|
| 28 |
+
|
| 29 |
+
st.subheader("Cancer Type Distribution")
|
| 30 |
+
fig1 = px.histogram(filtered_df, x="cancer_type", color="gender", barmode="group", title="Cancer Type by Gender")
|
| 31 |
+
st.plotly_chart(fig1, use_container_width=True)
|
| 32 |
+
|
| 33 |
+
st.subheader("Biomarker Status vs. Treatment")
|
| 34 |
+
fig2 = px.histogram(filtered_df, x="biomarker_status", color="treatment", barmode="group", title="Biomarker Status by Treatment")
|
| 35 |
+
st.plotly_chart(fig2, use_container_width=True)
|
| 36 |
+
|
| 37 |
+
st.subheader("Survival Time Distribution")
|
| 38 |
+
fig3 = px.histogram(filtered_df, x="survival_months", nbins=8, title="Distribution of Survival Time")
|
| 39 |
+
st.plotly_chart(fig3, use_container_width=True)
|
| 40 |
+
|
| 41 |
+
st.markdown("---")
|
| 42 |
+
st.markdown("*Demo only. No real patient data is used.*")
|
data/synthetic_oncology_patients.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
patient_id,age,gender,cancer_type,stage,diagnosis_date,biomarker_status,treatment,adverse_event,survival_months
|
| 2 |
+
P001,67,F,Breast,II,2021-03-15,HER2+,Trastuzumab,None,28
|
| 3 |
+
P002,59,M,Lung,III,2020-11-02,EGFR+,Osimertinib,Rash,18
|
| 4 |
+
P003,72,F,Colorectal,IV,2019-07-21,BRAF-,FOLFOX,Neuropathy,12
|
| 5 |
+
P004,50,M,Prostate,II,2022-01-10,AR+,Abiraterone,None,30
|
| 6 |
+
P005,64,F,Ovarian,III,2021-06-18,BRCA1+,Carboplatin,Neutropenia,22
|
| 7 |
+
P006,55,M,Lung,II,2022-04-05,ALK+,Alectinib,None,16
|
| 8 |
+
P007,70,F,Breast,IV,2020-09-30,HER2-,Paclitaxel,Neuropathy,10
|
| 9 |
+
P008,62,M,Colorectal,III,2021-12-12,BRAF+,FOLFIRI,Diarrhea,20
|
| 10 |
+
P009,48,F,Ovarian,II,2022-05-25,BRCA2-,Paclitaxel,None,26
|
| 11 |
+
P010,75,M,Prostate,IV,2019-02-14,AR-,Docetaxel,Fatigue,8
|
docs/requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
plotly
|
notebooks/01_data_exploration.ipynb
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "9f06e834",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# Oncology RWD: Data Exploration\n",
|
| 9 |
+
"This notebook explores synthetic oncology patient data, simulating EHR and biomarker records."
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": null,
|
| 15 |
+
"id": "a51fb3f6",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"outputs": [],
|
| 18 |
+
"source": [
|
| 19 |
+
"# Import libraries\n",
|
| 20 |
+
"import pandas as pd\n",
|
| 21 |
+
"import matplotlib.pyplot as plt\n",
|
| 22 |
+
"import seaborn as sns"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"cell_type": "code",
|
| 27 |
+
"execution_count": null,
|
| 28 |
+
"id": "48479ace",
|
| 29 |
+
"metadata": {},
|
| 30 |
+
"outputs": [],
|
| 31 |
+
"source": [
|
| 32 |
+
"# Load synthetic data\n",
|
| 33 |
+
"df = pd.read_csv('../data/synthetic_oncology_patients.csv')\n",
|
| 34 |
+
"df.head()"
|
| 35 |
+
]
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"cell_type": "markdown",
|
| 39 |
+
"id": "ba0324c5",
|
| 40 |
+
"metadata": {},
|
| 41 |
+
"source": [
|
| 42 |
+
"## Patient Demographics"
|
| 43 |
+
]
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"cell_type": "code",
|
| 47 |
+
"execution_count": null,
|
| 48 |
+
"id": "525868d7",
|
| 49 |
+
"metadata": {},
|
| 50 |
+
"outputs": [],
|
| 51 |
+
"source": [
|
| 52 |
+
"# Demographic summary\n",
|
| 53 |
+
"df[['age', 'gender', 'cancer_type', 'stage']].describe(include='all')"
|
| 54 |
+
]
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"cell_type": "markdown",
|
| 58 |
+
"id": "f872f204",
|
| 59 |
+
"metadata": {},
|
| 60 |
+
"source": [
|
| 61 |
+
"## Cancer Type Distribution"
|
| 62 |
+
]
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"cell_type": "code",
|
| 66 |
+
"execution_count": null,
|
| 67 |
+
"id": "8b89480d",
|
| 68 |
+
"metadata": {},
|
| 69 |
+
"outputs": [],
|
| 70 |
+
"source": [
|
| 71 |
+
"sns.countplot(data=df, x='cancer_type', hue='gender')\n",
|
| 72 |
+
"plt.title('Cancer Type by Gender')\n",
|
| 73 |
+
"plt.show()"
|
| 74 |
+
]
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"cell_type": "markdown",
|
| 78 |
+
"id": "d158309e",
|
| 79 |
+
"metadata": {},
|
| 80 |
+
"source": [
|
| 81 |
+
"## Biomarker Status vs. Treatment"
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"cell_type": "code",
|
| 86 |
+
"execution_count": null,
|
| 87 |
+
"id": "a878a045",
|
| 88 |
+
"metadata": {},
|
| 89 |
+
"outputs": [],
|
| 90 |
+
"source": [
|
| 91 |
+
"pd.crosstab(df['biomarker_status'], df['treatment'])"
|
| 92 |
+
]
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"cell_type": "markdown",
|
| 96 |
+
"id": "50dd531c",
|
| 97 |
+
"metadata": {},
|
| 98 |
+
"source": [
|
| 99 |
+
"## Survival Analysis (Simple)"
|
| 100 |
+
]
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"cell_type": "code",
|
| 104 |
+
"execution_count": null,
|
| 105 |
+
"id": "8a9cf12f",
|
| 106 |
+
"metadata": {},
|
| 107 |
+
"outputs": [],
|
| 108 |
+
"source": [
|
| 109 |
+
"sns.histplot(df['survival_months'], bins=8, kde=True)\n",
|
| 110 |
+
"plt.xlabel('Survival (months)')\n",
|
| 111 |
+
"plt.title('Distribution of Survival Time')\n",
|
| 112 |
+
"plt.show()"
|
| 113 |
+
]
|
| 114 |
+
}
|
| 115 |
+
],
|
| 116 |
+
"metadata": {
|
| 117 |
+
"language_info": {
|
| 118 |
+
"name": "python"
|
| 119 |
+
}
|
| 120 |
+
},
|
| 121 |
+
"nbformat": 4,
|
| 122 |
+
"nbformat_minor": 5
|
| 123 |
+
}
|