Skip to content

EYoung21/Predictacare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PredictaCare — Machine Learning for Healthcare Optimization

PredictaCare is a Philly Codefest project (Drexel’s 11th annual “Leveraging AI for the Common Good”) that predicts healthcare appointment durations to help clinics optimize scheduling and reduce patient wait time.

April 2024 – June 2024 • Team: Jeff Torr, Eli Young, Tony Stanell

What it does

  • Analyzes a short free‑text appointment description plus demographics (age, gender, prior visit) and predicts the estimated visit length (in minutes).
  • Supports a simple web UI and an HTTP endpoint for programmatic use.

Tech stack

  • Python (scikit‑learn, NLTK, NumPy, SciPy, pandas)
  • Node.js + Express for the web/API server
  • Static HTML/CSS/JS frontend
  • Dockerized runtime for reproducible setup
  • License: GPL‑3.0 (see LICENSE)

Repository structure

  • nodejs-docker-web-app/: Main app (Node.js server, frontend, Dockerfile, Python model code and CSV dataset)
  • BackEndTerminalTests/: Historic/experimental terminal scripts and models used during exploration

Getting started

You can run PredictaCare either with Docker (recommended) or locally.

Option A: Docker

  1. Open a terminal and navigate to the app folder:
cd nodejs-docker-web-app
  1. Build the image:
docker build -f dockerfile -t predictacare:latest .
  1. Run the container:
docker run --rm -p 8080:8080 predictacare:latest
  1. Open the UI at http://localhost:8080

Option B: Local (Node.js + Python)

Prerequisites: Node 18+, Python 3.9+.

  1. Install Node dependencies:
cd nodejs-docker-web-app
npm install
  1. Install Python dependencies:
pip install -r requirements.txt
  1. On Windows, ensure the app uses the right Python command (set once per shell):
set PYTHON_EXECUTABLE=python

On macOS/Linux (optional; defaults to python3):

export PYTHON_EXECUTABLE=python3
  1. Start the server:
npm start
  1. Open http://localhost:8080

API

POST /run-python

  • Request body (JSON):
{
  "descriptionField": "sore throat and fever",
  "ageField": 37,
  "genderField": "male",   // "male" | "female"
  "familiarityField": "yes" // "yes" | "no"
}
  • Response (JSON):
{ "output": "23.418273" }

Example with curl:

curl -X POST http://localhost:8080/run-python \
  -H "Content-Type: application/json" \
  -d '{
    "descriptionField": "sore throat and fever",
    "ageField": 37,
    "genderField": "male",
    "familiarityField": "yes"
  }'

Notes:

  • output is the predicted appointment length in minutes (stringified).
  • The Node server shells out to a Python script which loads/trains a model and returns a prediction.

Model and data

  • Dataset: EstimateHealthcareAppointmentLengthGivenX-Sheet2.csv
  • Features:
    • Text: appointment description → TF‑IDF (1–2 grams)
    • Numeric: age, gender (0/1), familiarity (0/1)
  • Model: scikit‑learn Linear Regression trained on TF‑IDF + numeric features (concatenated via SciPy sparse hstack)
  • Preprocessing: tokenization, lowercasing, lemmatization, English stopword removal (NLTK)

Training/prediction entry point: nodejs-docker-web-app/SkLearnLinearRegression.py


Development notes

  • The Docker image installs NLTK data at build time to avoid first‑run downloads.
  • On Windows, set PYTHON_EXECUTABLE=python before npm start if python3 is not available.
  • This repository includes earlier terminal‑only experiments in BackEndTerminalTests/ for reference.

Safety and limitations

PredictaCare is a research/demo project. It is not a medical device and must not be used for diagnosis or treatment decisions.


Acknowledgments

Built and showcased at Drexel’s 11th annual Philly Codefest: “Leveraging AI for the Common Good.”

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •