Request for Comments: Quirk, an Open Source Cognitive Behavioral Therapy App
Tags: showdev, opensource, react, ios
Published: 2018-12-10 03:08:12

---
title: Request for Comments: Quirk, an Open Source Cognitive Behavioral Therapy App
published: true
description: a pitch for a new, open source iOS/Android CBT app
tags: showdev, opensource, react, ios
cover_image: https://i.imgur.com/m5X3Nw8.png
---

_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](https://econn.tech/how-i-got-to-now).

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.](https://dev.to/flaque/request-for-comments-quirk-an-open-source-cognitive-behavioral-therapy-app-12il#showdev-quirk-an-open-source-cbt-app)**

![screen hint](https://i.imgur.com/HTglKHf.png)

# Welcome to my private life

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

![graph of attacks](https://i.imgur.com/StVbtVt.png)

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:

```sh
$ freak 8
```

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](https://i.imgur.com/PoG9NOL.png)

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](https://ebmh.bmj.com/content/13/4/125). 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.](https://www.amazon.com/dp/B009UW5X4C/ref=dp-kindle-redirect?_encoding=UTF8&btkr=1) 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](https://pro.psychcentral.com/psychoeducation/wp-content/uploads/sites/9/2017/07/1-2-1024x254.jpg)

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](https://i.imgur.com/HT3a7Ut.png)

MoodNotes is 5 dollars but much better looking.

![MoodNotes](https://i.imgur.com/DepVkJO.png)

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](https://i.imgur.com/n8B5xne.png)

## 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](https://i.imgur.com/sl5GGAF.jpg)

# 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.](https://goo.gl/forms/2grxxc50WF9oGW3s2)

# 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.