Home / Projects

Building “The ECG of Mood Disorders”

A no-code journey with AI: how a psychiatry resident built a digital Life Chart.

In the world of psychiatry, Bipolar Disorder is uniquely challenging because it is defined by time—the oscillating rhythm of mood over months and years. To treat it effectively, we need to see this rhythm. We need to visualize history.

The NIMH/Robert Post Life Chart Method is the gold standard for this. It maps episodes, medications, and life events onto a single longitudinal timeline. But practically? It’s a complex, manual paper process.

I wanted to fix this. I wanted a digital tool that was accessible, clinically precise, and beautiful.
The problem? I’m a doctor, not a coder.

Enter Antigravity

This project is the result of a collaboration between myself and Antigravity, an advanced AI agent by Google DeepMind. This wasn't just "generating code snippets"—it was true pair programming. I provided the clinical vision and the "What", and Antigravity handled the "How".

Here is the story of how we built Life Chart: The ECG of Mood Disorders.

1. The Vision: From Paper to Pixel

The goal was clear: replicate the intricate design of the paper Life Chart but make it dynamic.
We started from scratch. I explained the logic:

  • Mania goes up, Depression goes down.
  • Medications need specific line styles (Mood stabilizers as solid bars, Antidepressants as dots).
  • Everything must be aligned by year.

Antigravity built a custom SVG rendering engine using nothing but Vanilla JavaScript. No heavy frameworks, just pure logic translating clinical data into visual vectors.

2. The Hurdle: "The Mess"

It wasn't smooth sailing. The biggest challenge was Data Entry.
We initially tried using standard browser "Date Pickers". It was a disaster.
I tried to enter a date, and it asked for the day. Who remembers the exact day of a manic episode from 2010?
The chart stopped generating. Columns went empty. The "NaN" (Not a Number) errors piled up.

I told the AI: "Everything is messed up. I just want a simple Month and Year dropdown."

This was the turning point. Instead of giving up or offering a complex workaround, Antigravity pivoted. It completely refactored the interface, building a custom "Month Select + Year Input" system that matched exactly how a clinician thinks. It fixed the plumbing underneath to translate "Jan 2010" into the data format the engine needed. The chart roared back to life.

3. The Refinement: Clinical Precision

Once it worked, we had to make it professional.

  • The PDF Export: We spent hours perfecting the "Scale to Fit" logic so clinicians could print A4 charts for medical records without cropping.
  • The Aesthetics: I wanted it to feel like a medical instrument. We added a "Dark Mode" aesthetic and a custom ECG Heartbeat Animation on the splash screen—symbolizing that this chart effectively tracks the "heartbeat" of a patient's mood history.
  • Detail: We added dynamic age markers (e.g., "Age: 35") automatically calculated above every episode, a crucial detail for retrospective diagnosis.

Why This Matters

This isn't just a coding project. It's a demonstration of how AI can empower domain experts—doctors, engineers, artists—to build tools that solve real problems in their fields.

The result is a fully functional, privacy-focused (client-side only), professional-grade Life Chart generator.

Launch the Tool →