Anatomy of a Medical App Part 2: MobileSleepDoc V2.0–Can a Mobile App Deliver Personalized Medicine?

No one expects an app to take the place of an actual doctor’s visit, but could we design one that asked some of the same questions a doctor would, and then guide a user down a diagnostic and treatment path? There are already many websites that provide similar services to the casual web surfer, so a mobile app that interacts with a user not just to give kudos and badges, but to lead to potential diagnoses, provide current educational information, and suggest possible treatments would not seem far-fetched. MobileSleepDoc V1.0 was problem-centric, as is the case with most medical apps my colleagues and I use on a daily basis. MobileSleepDoc V2.0, on the other hand, is user-centric, whereby the user’s personal sleep profile and sleep reports are presented to the user when they log into the app.

Working on the MobileSleepDoc mobile app for the past 2 years, I have become acquainted with a brand new jargon. Words and phrases like “pivot” and “user friction” are old concepts with a fresh twist. I especially like the concept of pivoting, which amounts to making rapid changes in response to and/or anticipation of a change in business model. After releasing version 1.0 of the app, we had no idea how many pivots we would be making between versions 1.0 and 2.0. The changes were all precipitated by key events. I share these so that others may benefit from what we’ve learned in a whirlwind year.

Shortly after releasing version 1.0, I spoke in-depth with an app marketing company, and was advised to run a focus group–and this would be Event #1–Run a Focus Group. The 12-person group was assembled, and the users played with the app for a few weeks and answered many questions. The end result, 2 months later, was an extremely useful, comprehensive report that would change the course of the app and our business for good. The key question at the end of the group, “Would you recommend this app to a friend?” gave us some “maybe’s” that we would have to learn how to turn into “yes’s.”

Event #2—Create a Business Model. Some people advise creating a business plan before starting a business, but I’m not sure I knew I was creating a business when we developed MobileSleepDoc V1.0. My goal simply was to help as many people with sleep problems as possible for the lowest possible cost, but after that, things were fuzzy. After advice from a few friends, I hired a consultant, an MBA-type, to come pick my brain and point out to me things I didn’t know I knew. After several meetings, the result was a comprehensive report describing our business model and projected financials. These documents serve as a dynamic, working framework of the app and where it may lead.

Event #3—Hire a New Development Team. After 12 months and many late nights working together, the original app developers and I established a productive working relationship. I became very fond of them as individuals and co-collaborators. But what I learned from our focus group was that we needed a strong DESIGN team that understood how to optimize the user’s experience. We then realized we needed to let the old development team go and replace it with a new one whose main strength was in the areas where the previous team fell short. This was an expensive and difficult decision, and it meant losing momentum to teach a brand new team the logic of the app. In the end, we successfully revamped MobileSleepDoc Pro in version 2.0, and launched it in the Apple app store in October 2014.
MobileSleepDoc V2.0 Logo

The major changes include:
1. The new app is User-centric instead of Problem-centric, and centers around the user’s “My Sleep Profile” page.
2. A brand new logo and modern graphics throughout, including extensive sleep reports.
3. A Rewards Program to game-i-fy the most important (and HARDEST) aspect to getting a good night’s sleep—changing the user’s behavior.
4. Animal Dream Totems to place on the user’s Virtual Night Stand. The totems borrow from the Native American tradition of animal spirits carrying potential messages to the user.
5. Brand new soundscapes recorded exclusively for MobileSleepDoc.
6. The User may log sleep manually or sync with their Fitbit!

Sleep LogSleep Log ViewSleep efficiencyTotems

Commentary: A Doctor’s View of Wearable Tech
Actiwatch photo
(ActiwatchTM by Phillips Respironics, 2004, $2000)
Fitbit photo
(Fitbit FlexTM , 2014, $99)

For many years, doctors have been recommending collecting data from patients at home, whether for monitoring blood sugars, blood pressure, peak flows (rate of respiratory volume exhaled), or heart rhythms. In sleep medicine, we often ask patients to keep sleep logs, which is a simple and informative way to graph sleep/wake behavior. Sleep logs are especially useful in patients with insomnia and sleep schedule irregularity (e.g. circadian rhythm disorders). Sleep log data are further supported (or disputed) by the passive monitoring of user behavior through the use of wrist actigraphy, a tiny computer worn on the wrist over several days (photo above, top). Wrist actigraphy is a well-established research tool but not commonly done in the office setting, perhaps because it is not reimbursed by most insurance companies. It is a test I have found to be universally useful in my practice. After wearing the wrist actigraph for 5-7 days, the patient brings it back to the office and we download the data, which shows quite sensitively, their pattern of activity versus stillness, the latter correlating with time asleep. From the data we can tell whether or not they go to bed around the same time each night, keep a regular wake-up time, how long they slept, and how many (and how long) awakenings (active periods at night) they experienced each night.

With the advent of fitness and sleep trackers like the FitbitTM (photo above, bottom), I now find myself analyzing the same data and reports on a patient’s smartphone through associated apps. In fact, I often recommend the use of fitness trackers to my patients to encourage regular physical activity AND to monitor their sleep routines, since both of these “interventions” improve sleep quality. These ubiquitous, electronic “flies on the wall” of a patient’s real life are not prescribed as medical devices, but rather are lifestyle-biofeedback-awareness tools at an affordable price. But can they provide clinical benefit to a person? Absolutely. The biggest challenge, however, may be helping the user make sense of the data they are collecting. That’s where working with a provider may be truly enlightening and beneficial to someone’s health. One additional benefit? I am no longer in charge of keeping the patient/user data, but the individual is, and that is one of the biggest advantages of getting tracking devices into the hands of more people. Getting people involved in their health makes them healthier.

Melissa S. Lim, MD
Pulmonary, Critical Care, Sleep specialist
Redwood City, CA

ANATOMY OF A MEDICAL APP: Part 1. MobileSleepDoc from Concept to V1.0

Let me begin by saying that as a doctor, I do not know programming code from a “code blue.” But after seeing hundreds of patients over the past 20 years with sleep problems, I decided to create a mobile medical app to help as many people as possible who have trouble sleeping. This was partly for selfish reasons, of course, since the number of people suffering from sleep problems is overwhelming– compared to the number of practicing sleep specialists, the ratio may be as high as 20,000 to 1. As more and more of my colleagues opt out of seeing patients, the present and looming doctor shortage becomes a very real threat and challenge for all of us. People, therefore, are not seeking or getting the help they need to get the best quality sleep—the most effective performance enhancing drug we can prescribe. Creating MobileSleepDoc and using current technology to educate, diagnose, and guide people to proper treatments seems to me just a practical necessity.

Our model of medical education is initially system-based, and then problem-based. For example, we spend the first part of medical school learning the normal functions of different organ systems—lungs, heart, kidneys, brain, etc.—and then the latter part learning about the diseases that affect each organ system—asthma, emphysema, coronary artery disease, kidney failure, stroke, etc. Traditional medical education introduces patient care in the latter part of medical school (note that this model of medical education has been altered more recently). After graduating from medical school, our real education begins. Patients and published research help us create—sometimes deliberately and sometimes not—treatment frameworks, or protocols, for the diseases we’ve studied. We ask ourselves, “Does this person fit into the expected pattern of signs and symptoms of the problem I am treating? If not, what other diagnoses should I consider? Are they responding as expected to treatment? If not, why?” And so on. Sleep Medicine is a newer member of the medical sub-specialties, and although there may be many “official” sleep diagnoses in the coding manuals, the vast majority of sleep patients present with one or both of the two most common diagnoses—insomnia and obstructive sleep apnea. Thus, when designing MobileSleepDoc, I decided to focus on these 2 disorders.

What is MobileSleepDoc?

The concept for MobileSleep Doc was years in the making, but the first build, or version, of the app began in the late spring of 2012. The path to V1.0 can be outlined as follows:

IDEA–>Budget–>Pitch to Developers–>Choose a Development Team–>BUILD

…with the last component of building the app feeding back to the original idea and budget, in an ongoing manner.

Interestingly, the acronym “IDEA” itself describes the key components of MobileSleepDoc:

1) It is an INTERACTIVE tool that helps identify 2 of the most common sleep disorders, insomnia and obstructive sleep apnea;

2) It is DESIGNED by a board certified sleep specialist, based on proven methods and >20 years’ experience taking care of sleep patients;

3) It EMPOWERS users to take charge of their sleep problems;

4) It ACTIVELY engages users in their own health, which will ultimately make them healthier.

How does MobileSleepDoc work?

The app asks users a series of questions about their sleep and, based on their answers, guides them to their possible diagnoses; specifically, the app lets them know whether they have signs and symptoms of insomnia or obstructive sleep apnea

In the case of insomnia, the app will lead the user to 2 common behavioral therapies prescribed in real-life office situations, such as Stimulus Control Therapy (SCT) and a mild version of Sleep Restriction Therapy (SRT), which I call “SRT-light.” SRT initially causes sleep deprivation, which aids the user by increasing the pressure to sleep at the desired time.


1) Go to bed when sleepy, not when you think you should go to bed

2) Get out of bed if not able to fall asleep in 15-20 minutes

3) No naps

4) Bed/bedroom for sleep only

5) Keep a regular wake up/get up time, no matter when you fall asleep


1) Pick desired wake-up time and stick to it

2) Get into bed 7 hours before this desired wake-up time

3) Follow SCT rules 2-5

4) Once user’s sleep efficiency improves and holds steady, the user can add time to their total sleep period by going to bed progressively earlier.

5) SRT is “completed” once the user attains a sleep efficiency >85% most nights, and feels generally refreshed during the day.

MobileSleepDoc monitors user data and gives feedback to encourage the user to continue keeping their sleep logs.

For BOTH SCT and SRT, keeping daily sleep logs is very helpful and a great way to chart the user’s progress. MobileSleepDoc provides an extensive library of reports that the user can email to themselves or their doctor, for review and guidance.

In terms of obstructive sleep apnea, MobileSleepDoc uses well-established questions to help screen for signs and symptoms of this disorder. If sleep apnea is suspected based on the user’s responses, then the user is given links to further resources, and a map of the closest sleep centers.

How much did it cost to create a MobileSleepDoc?

I do not recommend developing an app of any sort with the primary intent of making money. I created MobileSleepDoc because the idea was stubbornly implanted in my brain. My primary intent was to create a beautiful and useful tool that had the potential to help many people with a real world problem. Building an app costs a lot of time and money—probably your time and money, and more of both than you think. A different person in a different situation might be able to get someone else to pay for their bright idea, but as a female person of color over the age of 50 with no background in programming or technology, investing in myself seemed like the most pragmatic option.

The other core decisions to consider were:

  1. How much could I afford to spend on this idea? Or as my father would say, “Never gamble more than you can afford to lose.” I had some rough idea of my target investment but later found out that the more complicated the app, the more expensive it was to create. Also, I learned that the complexity was not always clear to the developers or even myself, especially in the beginning. I presented my ideas and budget to 2 different development teams, filled out detailed questionnaires about the project, and interviewed both companies. Luckily, I found out that my initial budget was in the right ballpark for both companies, and picked the team whose approach I liked best.
  2. Expect to go over budget and have a buffer of 50%. See above.
  3. How much time did I have to be the real project manager? The main objective of the developers is to help you realize your vision, so having a vision is advised. Although I worked with talented project managers throughout this process, I discovered I was the actual project manager. I needed to be an integral part of the process from day 0. MobileSleepDoc V1.0 took 9 months to launch and 460 hours of my time. I educated myself as quickly as possible to be able to ask questions and make decisions (a LOT of them—from the logo, font, and colors to the logic, wording, and price). I was the ultimate authority over all decisions, so I quickly learned not to be afraid to make them.

It was in my best interest to fail as fast and often as possible in order to avoid wasting precious time and resources.

We launched MobileSleepDoc V1.0 in December 2012. We made several important upgrades and added an Android version to iOS, ultimately launching V1.4 of both in March 2013.


MSD splash screen logo

 MobileSleepDoc Version 1.0 Logo

Coming next—Anatomy of a Medical App: Part 2. MobileSleepDoc V1.0 to V2.0, A Doctor’s View of Wearable Tech

Melissa Lim, MD

Pulmonary, Critical Care, Sleep Specialist

Redwood City, CA


I don’t remember the name of the book, but I remember the inscription my sister Marie wrote on the inside cover. She loved giving me books and this one was about a new female doctor navigating the treacherous path of her internship, circa 1972. I was 10 years old at the time, and my sister wrote to me, in her then perfect handwriting, “Never give up on you aspirations, you are going to be a great doctor someday.” These days my sister can no longer write her own signature, let alone inscriptions in books. She was diagnosed with early onset Alzheimer’s disease a few years ago, when her forgetfulness seemed to leap into not being able to buy vegetables at the grocery store. She had always been the artist with her “head in the clouds, “ but things suddenly became very different.

Alzheimer’s disease, still mysterious in its cause, and devastating with its terrible prognosis, causes a sort of death in life. It seems strange to say “my sister was a great artist,” when she is very much alive living a simple, but happy life with her husband. Instead of the disease causing her to become irritable and aggressive, as it does for many, she has become childlike with a pureness of heart, always smiling and ready to share her big, generous laugh. But I miss my sister, the other one who loved to read Winnie the Pooh to me when I was small, who became an accomplished and well-known local artist for her intricate Plexiglas and linoleum prints inspired by African folklore, the one would wanted to explore her creativity in the most elemental ways. She went from knitting, to working a loom, to spinning and dyeing her own yarn. I did not expect her to stop before raising her own sheep. That sister is gone. It seems strange to me not to have said goodbye before she was kidnapped by her disease, but it all happened so fast.

I visit my new sister from time to time, though the 3000 mile distance makes it difficult. She lives in the present, unable to form and hold onto memories, and rapidly losing even older ones. We accept these visits for what they are, a change in scenery for her and a respite for my devoted brother-in-law. I try my best to appreciate the elemental nature of her new self, much like she used to explore in her artwork. But mostly I am left with a renewed empathy—and a profound sympathy–for my patients and their families who are going through the same thing.

Melissa Lim, MD
Redwood City, CA

INFORMED CONSENT AND THE PROCEDURAL PAUSE: Three questions the midwife taught me

“We should break your water to move your labor along,” directed the labor and delivery nurse during the birth of my daughter. In my laborious stupor I recall her holding what appeared to me at the time was a 2-foot spear with a hook on the end, a sort of uber-crochet hook pointed at my–let’s put this politely—birth canal. Declining this unwanted intrusion, and after our friend escorted that nurse out of our hospital room in place of another, more “natural birth-oriented” one, we realized that part of the delay was due to improper positioning of our daughter. Instead of preparing to arrive face down, to exit the birth canal like a breast stroke swimmer coming up for air, our daughter decided that back stroke was her plan—not the ideal position for exiting the womb. The preferred face-down, or “occiput anterior” position (OA, where the back of the baby’s head—occiput—is facing the front—anterior—of mother) engages the baby’s head into the mother’s pelvis like a hat with a perfect fit. The “occiput posterior” position (OP, where the back of the baby’s head is facing the back of the mother) is an ill-fitting crown, prolonging labor and causing increased back pain for the mother. OP babies are a frequent cause of the all-too-common indication for cesarean section (C-section)—“failure to progress.” This was clearly in my future as we approached the 20th hour of labor. Then, as if the birthing instructor herself was in the room, we noticed while I was on my back that the shape of my belly was pointed, our daughter’s knees were pointing towards the ceiling—she was an OP baby. Having gone the way of natural childbirth, ignoring an old friend who summed up her advice for delivery in 3 words, “Get The Epidural,” I remembered the cat-cow stretches we practiced in our birthing class that could pop the baby out of the pelvis for repositioning. I jumped off the bed, got on all fours, and did several of these, as my partner turned our daughter’s knees in the right position, and lo and behold, our daughter turned upside down like a proper OA baby! Labor proceeded rapidly afterwards, and all was well, my only dismay being the lack of full disclosure from my long-postpartum friends–many of whom had memories dulled by anesthetics–that labor approximates the feeling of one’s rear end being engulfed in flames.

Childbirth was the most exhilarating experience of my life, the crescendo of this other-worldly pain disappearing in an instant. Much of what I cherish about childbirth stretched beyond the magic of that day, however, but also includes learning the importance of preparing for that day. In medical school, we rotate through different medical specialties, including obstetrics (“O.B.”).  ‘O.B’ among medical students and residents is described as “hours of boredom followed by seconds of terror,” meaning that there is always an element of the unknown when bringing a baby safely into this world—and one’s preparation for all that could go wrong makes the difference between a happy and a tragic outcome.

My birthing class was taught by a former labor and delivery nurse turned mid-wife. As my classmates and I approached our respective due dates, our instructor thoroughly informed us of the potential procedures that may be offered or recommended throughout the course of pregnancy and delivery. I have referred to her wise words many times over the past 16 years with my own patients, and encourage my patients to ask these 3 questions, whenever any medical provider, including myself, proposes an invasive test or procedure:

1) What happens if I do it?

2) What happens if I don’t do it? and

3) What happens if I wait?

In medicine we have many tests and procedures at our disposal, and when we advise our patients, we look to different sources to guide us—from published “standards of care” by professional organizations, to “expert opinion,” to one’s own experience guided to the best of our ability by research and common practice. Physicians frequently balance what they can do versus what they should do in the treatment of any individual patient, with the patient always being the vulnerable variable in the equation.

So whether it’s a crochet hook, an x-ray, or an operation, please ask your doctor to answer the 3 questions my midwife taught me. It’s a great way to inform—and protect–yourself.


Melissa Lim, MD

Pulmonary, Critical Care, Sleep specialist

Redwood City, CA