DEV Community

Cover image for Request for Comments: Quirk, an Open Source Cognitive Behavioral Therapy App
Evan
Evan

Posted on

Request for Comments: Quirk, an Open Source Cognitive Behavioral Therapy App

Disclaimer: I am not a doctor nor medical researcher. I'm not giving advice nor diagnosing anything and my only experience is myself.

About two months ago, I built a little tool to measure my panic attacks. Before you get concerned this is a coming-out-to-dev type story; this isn’t a secret. I tell most people in my dev circles about panic because panic is the reason I started programming.

I'm not here to shame you against stigma, tell you it's illegal to say "crazy" or make a case for better working hours. I'm here to show you something I'm working on.

screen hint

Welcome to my private life

Here’s a graph of the attacks I’ve had over a roughly 2 month period.

graph of attacks

This graph comes from that tool I built, affectionately called freak. It's a simple command line tool that records a timestamp and an intensity:

$ freak 8
Enter fullscreen mode Exit fullscreen mode

Episodic disorders like panic are easy to forget about. When it's bad, it's easy to forget that it could ever be good, and when it's good, you forget how bad it ever got.

It's easy to "forget" which treatments are effective and which are hogwash.

freak is simple way for me to record hard data about when they occur and when they stop. That way no armchair psychologist can claim that my attacks are just "caused by the moon's orbits" or whatnot.

I can point to any treatment and definitively say "yeah that seems to work for me."

Wait, slow down, what actually is a panic attack?

Lots of people describe this differently, so I'm not able to give you a one-size-fits-all description. I can tell you what my attacks are.

For me, panic is not stress, it's fear.

A panic attack is an intense physiological experience of fear in response to something that isn't dangerous. It's that shot of adrenaline you get in your belly when you're almost in a car wreck. It's knowing there's a murderer in your basement after having watched a scary movie. It's the "flight" in fight or flight; it's running from the tiger but without the tiger.

Panic is your body putting the foot to the floor, pedal to the metal, balls to the wall in your driver's ed parking lot.

It lasts about an hour or two and can sometimes happen in "clusters." It's not generalized anxiety because generally, you're happy and healthy.

Cognitive Behavioral Therapy and Your Brain

I've had these attacks for as long as I can remember and for as long as I can remember people have suggested dumb, back-of-the-internet, armchair treatments to me. After trying a lot of them, it's really easy to become skeptical.

After a particularly bad episode when I was in high school, I started seeing a doctor who recommended CBT.

I passed on the offer.

At the time, I had no idea what therapy might mean. When everyone around you suggests treatments, you tend to associate them in to hard treatments and soft treatments.

Since many lay people have an unfortunate moral objection to medication, they tend to provide soft treatments. And since they generally don't know what they're talking about, their "treatments" don't work.

You become biased against soft treatments, even when a doctor suggests them.

For several years, I ignored the concept of any form of therapy. It wasn't until this past year that I explored Cognitive Behavioral Therapy (CBT), the gold-standard of "soft" treatment options.

It has been by far, the most effective

Not only has it reduced the overall amount of attacks, but reapplication during clusters dramatically reduces their intensity and duration.

recent cluster

In my most recent cluster, captured by freak, it halted the attacks.

And I'm not the only one to suggest that CBT is effective, plenty of studies have shown it to be at least as good as treatment with SSRIs. It's been around since the 80s and is often the first treatment attempted when you see a psychologist.

So wait, what is CBT?

There are a lot of formats of CBT since it's popularization in the 1980s. CBT encompasses many different exercises; my explanation will focus on the "simplified" versions of the treatment.

Automatic thoughts

CBT asks you to recognize that your thoughts cause feelings, not the other way around. While it's certainly true that your existing moods can make some thoughts easier, generally destructive and unhealthy moods are caused by illogical and "distorted" thoughts. It also suggests that many of these thoughts are "automatic" and self-fulfilling prophecies.

For example, often my attacks will start because I think they're going to start. Something small and brief will frighten me, I'll pick up on it, and I'll automatically think:

I felt a bit of panic, therefore I'm about to have a panic attack.

The image of past attacks flashes in my head and I start to think about how bad it would be if I actually did have an attack. Maybe I'm at work and about to give a super important demo. What if I got hit on a performance review? What if I had to run out in the middle of the demo?

Cognitive Distortions

CBT would ask me to notice the cognitive distortions (effectively the psychological words for logical fallacies) in the original thought.

In this example, I'm catastrophizing. Would really anyone care if I screwed up a demo? Most people know that I have these attacks. I would just explain what was going on. Plus any of my teammates could have taken that demo; they're all fantastically smart.

Would it really be a big deal if I had to run out in the middle of the demo? Surely that's happened before. Plenty of folks have gotten sick before a big event.

Challenge the thought

CBT would then ask me to record these logical arguments. Writing them down helps solidify the concepts so they come more naturally before your brain has jumped from one terrifying thought to the next.

Find an alternative

Finally, CBT would ask you to find a logical way to interpret the situation. For example:

I felt a bit of panic, but that doesn't mean it'll lead to more panic nor an attack.

That's it.

You record your thought, you challenge it, and you find an alternative thought. And you do it for every illogical, unreasonable, and terrifying thought you might have.

In the 80s when treatment was formalized, they suggested patients do this in three columns:

three-columns

But anyone who's ever done this in the modern world has likely noticed that it's much easier with a device. Software gives you two major advantages:

  • discrete recording
  • cumulative metrics

Having it on your phone means you'll always have a way to record.

Current apps are fugly, costly, and clunky

There's a few apps that currently exist, namely "Thought Diary" and "MoodNotes." ThoughtDiary is free but it's quite fugly.

ThoughtDiary Screenshots

MoodNotes is 5 dollars but much better looking.

MoodNotes

Both suffer from an intense focus on mood. They assume that the user is using CBT for depression and therefore strongly couple "mood" therapy to cognitive change.

In both apps you can't record if you're happy

The very first thing you have to do when you record something is tell the app how you're doing. If you're happy, it will not let you record and challenge a thought.

Which means if you're having a fine day, but notice yourself thinking something illogical that could bring you down, you have to either wait for that thought to spiral out of control or lie to the app and tell it that you're unhappy.

That's a pretty bad flaw in an app that's trying to help you disassociate your illogical thoughts from catastrophic moods.

Each app takes forever to enter anything

Because they're so focused on mood therapy, they add plenty of diverging steps which mean more taps and more fields to fill out.

If it takes you 30 seconds to fill something out, you can easily sneak that in, even if you're in a meeting. If it takes you 2 minutes, it's much harder.

We could do a lot better

More importantly, we could do a lot less. Many of these apps suffer from feature creep. They're trying to make a very specific solution with all the bells and whistles but marketing it to everyone.

Instead, we could trim down the features and make something more focused.


ShowDev: Quirk, an open source CBT app.

For the past few weeks, I've been prototyping a CBT app. It's still in really early stages, but here's the general gist of what it could/will be:

  • Licensed under aGPL with a repo on Github
  • Stores data on device for privacy
  • Non commercial

Note that non commercial and open source does not mean "free," just that the purpose of this endeavor is not to make money. There's no business being created; this is just a project I'm doing on my weekends. That said, it's not cheap to put or keep an app on the various stores.

All the mockups below are done really quickly and are in a very malleable state. They're not final and may not even be remotely close to the finished state.

From a code perspective, this app is really small and I already have a solid but ugly prototype of it working. So this write-up is much more about how we can make a great product.

Cross Platform, but iOS as a focus

The code's written in React Native, so I plan to publish it on both the Google Play store and the Apple App Store.

That said, I currently don't own an Android device and haven't worked on Android for awhile. Your Mileage May Vary.

Two Screens

To limit the scope as much as possible, there's only really two main screens. One for recording and one for later viewing. The transitions between these screens will be swipes, so you can think of the recording screen as "on the left" and the listing screen as "on the right."

To help highlight that, we'll put the transition buttons on opposite sides and even change the place of the period in quirk. to really sell the effect.

Mockup

Onboarding

When the user hops on, we'll give them a crash course on CBT. This has to be really minimal otherwise they won't remember it, so we'll add some illustrations to make it more memorable.

Onboarding

If this is something you're interested in

Then let me know. I'm building this first and foremost for myself. But I'm planning on releasing it because I doubt I'm the only one who needs it.

So if you're interested in either helping build this or using it let me know! And if you could, fill out this 4 question survey.

Project status

There's about three iterations of this project so far, all of them prototypes. It's currently not released nor on Github. It will be in the future once I can properly clean it up and have reasonable entry points.

Critique Welcome

I'd love critique on this app. I can't guarantee that I can do everything; the scope of this app is very small for a reason. But there's certainly ways to improve this product.

Top comments (20)

Collapse
 
scottishross profile image
Ross Henderson

Evan, this is a brilliant idea and I'm going to keep an eye on this. I went through CBT to help with PTSD and the linked Disassociative Disorder I gained with it and I literally cannot recommend CBT enough.

Please let us know when it's released on Android :)

Collapse
 
lssweatherhead profile image
Laura Weatherhead

I love this, and the design/wireframes encapsulate the focus of the app perfectly! I have submitted a survey response and would be more than happy to pitch in if you needed a spare pair of coding hands (depending on where/when you needed them! :) )

Collapse
 
annarankin profile image
Anna Rankin

Love this. I agree that the mood tracking apps out there right now are really clunky in general - it's really hard to find the right level of granularity when it comes to tracking thoughts and feelings. The mockups look beautiful! I look forward to seeing where you take it next 🙂

Collapse
 
ben profile image
Ben Halpern

Submitted the survey. Am I missing something or do I not see a link to the GitHub?

Collapse
 
flaque profile image
Evan • Edited

Whoops should probably be more explicit. This hasn't actually been released yet on Github; cleaning up code before I release it. And thanks Ben! ❤️

Collapse
 
ben profile image
Ben Halpern

Ah, cool. Well this project seems totally worth it to me! We need more mental-health-positive apps and I’m not surprised the current market is weak.

Collapse
 
luc45 profile image
Random Dev • Edited

Hi Evan,

My mother, brother and sister have bipolar disorders and psychotic episodes, and, being it mostly genetic, I have the propension to have it too.

I didn't know what CBT was, but I used a similar technique over the time to control myself in times of extreme anxiety. I started looking at these episodes as mental cancer. Cancer is when a cell multiplies itself without control.

If I don't control my thoughts - they branch into possibilities and, as you try to keep up with the branching, it generates more possibilities, and you end up lost in thoughts and anxious.

What happens to you seems to be a process of auto-suggestion so strong that you believe in one branch as if it were reality, right? You don't get lost in the branches. You focus on one of them 'till the end, being it truth or false, and generally, that branch is the feeded by fear?

CBT seems like a great way to deal with that, because, if we are humble enough to admit it, our modern society doesn't know for a fact the true nature of the mind and consciousness. We use chemicals to treat the mind, while is the mind that generates the chemicals in normal circumstances. When you act on the mind, you heal permanently, when you act on the chemical level, you are drying water without fixing the leak.

I would like to give Quirk a go when it's released, to identify low self-esteem thoughts and how to stop them, this kind of thing - in the branching of thoughts, CBT is like a compass.

Collapse
 
flaque profile image
Evan

Hey Lucas,

In the meantime, you should should read the New Mood Therapy. It looks really cheesy, but it's a good overview.

Collapse
 
michael_hiltz profile image
Michael Hiltz • Edited

Evan,

Im not a developer. I am an outpatient psychiatric nurse practitioner. You really hit it SPOT ON with Quirk. I use Android and can give you feedback from clinician and user perspective.

Any interest in building an electronic medical record system for outpatient psychiatry? I have a ton of experience, but no code/dev skills.

Oh? Is it called Freak?

Best,
Mike

Collapse
 
flaque profile image
Evan • Edited

Freak is sort of an early prototype, I figured “quirk” was a lot nicer name. I called it freak originally because the term “panic” was a keyword in the programming language I built it in and it go too confusing. When I was a kid, I called my panic attacks “freak outs” since I wasn’t sure what they were. But the term “freak” has a pretty negative conotation when used as a noun, so i renamed the whole thing to “quirk.”

I’d definitely be interested in your thoughts/opinions however. I’m not a doc, and I’m most definitely gonna miss something. Send me a DM on twitter: @flaqueeau

As for EMR systems, as much as I would love to try and tackle that problem, I generally maintain a “two-project” rule. Right now, building the developer platform for Segment is my #1 project and Quirk is my weekend/opensource project.

Collapse
 
antonrich profile image
Anton

Is there a way to couple it with HRV (heart rate variability) and get the data together?

Collapse
 
flaque profile image
Evan • Edited

Actually this was the original reason I started working on freak. I wanted to be able to combine health tracking data with these to see if I could write something to predict or at least identify panic attacks.

I'd love to offer CSV exports and full data access from this app!

Collapse
 
lynnewritescode profile image
Lynne Finnigan

I love the concept and design, and would most likely use it! Great idea, so many mental health resources are so ugly and not well made.

Collapse
 
jess profile image
Jess Lee

This is awesome. My biggest issue with existing apps is one of the reasons you mention: feature creep. Makes the overhead so much bigger, and then I give up. Looking forward to seeing what's next!

Collapse
 
flaque profile image
Evan

Holy crap yeah. It’s very very easy to bite off more than you can chew and I do it all the time. Focus, focus, focus. Understand that on average, a programmer writes about 25 lines of bug-free, working code in a full work day.

Collapse
 
juliatorrejon profile image
Julia Torrejón

Brilliant idea, Evan! I love the design and concept behind the app!🙂