The goal of OncoLink is to support precision medicine by helping oncologists predict a patient’s response to a treatment plan and make more informed clinical decisions. OncoLink can predict, with probability/confidence, whether a patient will respond to treatment, show the top k most similar historical patients from the METABRIC dataset, allow physicians to enter outcomes for patients so we can improve the model, and let them see insights into how the model makes predictions.
- Anjali Bhimanadham — apb2192
- Mahsa Mohajeri — mm6859
- Daniyah Taimur — drt2145
OncoLink_v4/
├── README.md
├── requirements.txt
├── run_project.sh
├── app.py
├── login_page.py
├── auth.py
├── evaluate_patient.py
├── patient_list.py
├── processing.py
├── model.py
├── similarity_engine.py
├── agent.py
├── outcome_store.py
├── incremental_learner.py
├── frontend_components/
│ ├── sidebar.py
│ ├── analysis_tabs.py
│ ├── evaluate_patient.py
│ └── submit_outcome.py
├── frontend_utils/
│ ├── data_loader.py
│ ├── agent_bridge.py
│ └── new_patient_store.py
├── data/
│ └── METABRIC_RNA_Mutation.csv
├── test data/
│ ├── README.txt
│ ├── manifest.csv
│ └── uploaded patient-file examples
└── outputs_metabric/
├── processed feature CSVs, scalers, PCA objects, charts, and similarity index
├── oncolink.db
├── new_patient_evaluations.csv
├── new_patient_feature_store.csv
├── outcome_feedback.csv
├── retrain_checkpoint.txt
└── model_results/
├── best_model.pkl
├── best_model_info.txt
├── incremental_model.pkl
├── incremental_update_log.json
├── model_comparison.csv
├── shap_values.npy
├── shap_feature_names.json
└── ROC/confusion/SHAP chart images
Create a Groq API key here:
https://console.groq.com/keys
Groq is used for generated explanation text. The app can still run without a key, but explanation panels will use static fallback text.
Open a terminal in the project folder and copy the example environment file:
cp .env.example .envOpen the .env file that was just created and replace the placeholder value:
GROQ_API_KEY=your_groq_key_herewith your actual Groq API key. The other values in .env.example can stay as they are.
Run the project from the terminal:
./run_project.shThis script handles the full setup and launch:
- creates or reuses
.venv - installs
requirements.txt - runs
processing.py - runs
model.py - creates/updates local output files and database files under
outputs_metabric/ - launches Streamlit at
http://localhost:8501
Once Streamlit starts, it should open the application in your browser. If it does not open automatically, go to:
http://localhost:8501
To reset the local physician/session/patient database before launch:
./run_project.sh --reset-db.venv/bin/python processing.py
.venv/bin/python model.py
.venv/bin/python -m streamlit run app.py- Start the app with
./run_project.sh - Open
http://localhost:8501. - Create a physician account from the Create Account tab.
- Sign in with the account you created.
- Go to Evaluate New Patient.
- Choose Manual Entry and enter de-identified clinical values, or choose Attach Patient File and upload one of the sample files from
test data/. - Click Evaluate New Patient.
- Review the prediction, explanation, and similar historical patients.
- Save or revisit the evaluation from My Patients.
- In My Patients, use Update Outcome when a confirmed outcome is available.
- Go to Model Insights to inspect SHAP/feature importance, gene expression, and model comparison results.
Example uploaded-file workflow:
test data/330_68_GSM615650.txt
Upload the file on Evaluate New Patient, select a patient record from the parsed records, adjust any prefilled clinical fields, and submit the evaluation.
To reproduce the main generated artifacts from the raw METABRIC CSV:
.venv/bin/python processing.py
.venv/bin/python model.pyprocessing.py should regenerate files such as:
outputs_metabric/X_all_genes.csvoutputs_metabric/X_clinical.csvoutputs_metabric/X_pca_20.csvoutputs_metabric/X_pca_50.csvoutputs_metabric/X_pca_95_var.csvoutputs_metabric/y_labels.csvoutputs_metabric/dataset_summary.txtoutputs_metabric/class_distribution.pngoutputs_metabric/pca_explained_variance.png
model.py should regenerate files such as:
outputs_metabric/model_results/best_model.pkloutputs_metabric/model_results/best_model_info.txtoutputs_metabric/model_results/model_comparison.csvoutputs_metabric/model_results/incremental_model.pkl- ROC and confusion matrix images
outputs_metabric/model_results/shap_values.npyoutputs_metabric/model_results/shap_feature_names.jsonoutputs_metabric/model_results/shap_summary.png
Then run the app:
.venv/bin/python -m streamlit run app.pydata/METABRIC_RNA_Mutation.csv
|
v
processing.py
- cleans METABRIC columns
- builds clinical, all-gene, top-gene, PCA-20, PCA-50, and PCA-95 feature files
- saves scalers, PCA objects, charts, feature metadata, and dataset summary
|
v
model.py
- trains Logistic Regression, Random Forest, optional XGBoost, and an SGD incremental baseline
- writes model comparison, ROC/confusion plots, best_model.pkl, incremental_model.pkl, and SHAP/fallback artifacts
|
v
app.py
- Streamlit entry point and authenticated navigation
|
+-- login_page.py -> sign in / create account
+-- auth.py -> SQLite physicians, sessions, saved patients
+-- evaluate_patient.py -> new-patient intake, prediction, explanation, similarity comparison
+-- patient_list.py -> saved patients, edit/delete, confirmed outcomes
+-- similarity_engine.py -> FAISS/sklearn patient similarity index
+-- outcome_store.py -> outcome CSV and retrain threshold logic
+-- incremental_learner.py -> SGDClassifier partial_fit and optional model promotion
+-- agent.py -> Groq/OpenAI-compatible explanation helper
+-- frontend_components/sidebar.py -> sidebar navigation and system status
+-- frontend_components/analysis_tabs.py -> SHAP, gene-expression, and model-comparison views
+-- frontend_utils/data_loader.py -> artifact loading, prediction helpers, upload parsing
+-- frontend_utils/new_patient_store.py -> new-patient evaluation and feature persistence