TrialTwin AI — Project Story


Inspiration

Clinical trials are expensive, slow, and high-risk. While much focus is placed on biological outcomes, many trials fail for operational reasons—participants drift, disengage, or show warning signs too late.

We started with a simple question:

What if trial teams could see where a participant is heading before it’s too late?

Instead of building a complex biological simulator, we focused on clinical trial operations—specifically, how participant behavior affects outcomes. This led to TrialTwin AI: a digital twin system that shows two possible futures for the same participant.


What We Learned

This project reinforced several key insights:

  • Explainability matters more than complexity
    In healthcare contexts, understanding why a participant is at risk is more valuable than using a black-box model.

  • Visualization drives understanding
    The split-screen “two futures” design communicates the concept instantly—often before any explanation is needed.

  • Small signals compound over time
    Minor changes in adherence or symptoms can lead to dramatically different outcomes when projected forward.

  • Narrative is critical in demos
    Structuring the product as a story (one participant → two futures → intervention) made it significantly more compelling.


How We Built It

TrialTwin AI is a lightweight system that simulates, analyzes, and visualizes participant behavior.

1. Synthetic Data Generation

We generated realistic longitudinal participant data to safely simulate trial behavior. Each participant includes baseline attributes and daily observations such as:

  • Heart rate
  • Blood pressure
  • Glucose proxy
  • Symptom score
  • Medication adherence

This forms a time series:

X_t = {x_1, x_2, ..., x_t}


2. Feature Engineering

We transform raw time-series data into interpretable features:

  • Rolling averages
  • Short-term slopes
  • Recent event flags

Example (7-day slope):

slope = (x_t - x_{t-7}) / 7

These features capture trends rather than single data points.


3. Risk Modeling

We use simple, interpretable models to estimate:

  • Safety risk
  • Dropout risk
  • Adherence risk

Each model outputs a probability:

P(risk) = σ(w^T x + b)

We chose this approach for speed, transparency, and explainability.


4. Twin Simulation Engine

The core idea is the digital twin:

  • Take the participant’s current state
  • Split into two scenarios:
    • Adherent
    • Non-adherent
  • Simulate forward using rule-based projections

Future_adherent ≠ Future_non-adherent

The divergence between these paths is the key insight.


5. Frontend Experience

We built a React-based interface focused on storytelling:

  • Split-screen twin comparison
  • Diverging outcome visualization
  • Risk scoring dashboard
  • Actionable recommendations

The UI is designed so the concept is understood before the metrics are read.


Tech Stack

  • Frontend: React + Vite
  • Backend: FastAPI
  • Modeling: pandas, scikit-learn
  • Database: SQLite
  • Visualization: Recharts + custom SVG

Challenges We Faced

1. Balancing realism vs simplicity

We needed data that felt believable, but simple enough to explain and debug.

2. Avoiding black-box AI

We intentionally avoided complex models in favor of interpretability, which required careful feature design.

3. Making the demo intuitive

Early versions required too much explanation. The breakthrough came from the split-screen twin concept, which made the idea immediately clear.

4. Time constraints (hackathon reality)

We had to:

  • Build backend + models
  • Create a polished frontend
  • Ensure everything worked live

This forced us to prioritize clarity over completeness.


Final Takeaway

TrialTwin AI is not about perfectly predicting the future.

It is about making the future visible, understandable, and actionable.

By turning one participant into two futures, we help trial teams answer a critical question:

What happens next—and what can we do about it?


Tagline

Two sides. Two futures.

Share this project:

Updates