Taylor had his first hip replacement when he was still in high school, after contracting a rare form of bone cancer. Although doctors managed to remove the tumor, he’s since had a further three hips replaced, all before the age of 30.

Incredibly, after all that trauma, Taylor says he’s feeling great. Using the power of mindfulness, he’s found a way through the pain. He even describes himself as “very lucky” despite all he’s been through.

Taylor is just one of thousands of people managing physical challenges with PeerWell, a Silicon Valley startup with whom we’ve built a highly intelligent app to guide patients through surgery.

The PeerWell app offers a series of PreHab and ReHab exercises, setting patients specific goals and tracking their progress. It includes range of motion detectors, allowing users to gauge the flexion of their joints, and a hazard detector to spot potential dangers around the home. This feature is so advanced that PeerWell has actually applied for a patent.

It’s a project we’re really proud to have worked on, and in this article we’re going to take you under the hood. Specifically, we’ll discuss:

  • How we came to work with PeerWell
  • How we built the app
  • What we built on top of the core design
  • How we made a trans-Atlantic partnership work

Origins

When PeerWell CEO Manish Shah reached out to our co-founder Stefan Klumpp in 2015, it was clear he had a really special idea.

PeerWell had started out as a community service, putting surgery patients in touch with one another – hence the ‘peer’ in the name. But now Manish wanted to build his own exercise platform, providing bespoke routines in tandem with healthcare providers who would direct patients to the app. 

They’d already raised $2 million, a sizeable amount for an early stage venture. What’s more, they had a track record. Manish had built data company LiveRamp, backed by Facebook investor Peter Thiel. Co-founder Evan Minamoto had played a key role in Palantir, a startup which had earned ‘unicorn’ status for its $1 billion valuation.

But the vision was still very embryonic. Manish, an engineer himself, had already started building the prototype but he needed someone to complete it. And it was clear that this would involve some serious planning.

Evolution

At first, Manish simply wanted an app which would retain PeerWell’s community function but also provide some essential exercises, as well as advice on diet and lifestyle. The app would consist of a timeline, a checklist of activities and a peer-related chat feature, allowing users to share their experiences. 

Over time, however, we started working on some more complex features during brainstorms with the PeerWell team. They’d suggest features and we’d tell them the best way of realizing them.

Here’s a brief rundown of the features we’ve provided:

The range of motion detector is designed for patients undergoing knee surgery. It measures the extension and flexion of the affected knee on a daily basis, then compares it with the healthy knee.

The step counter encourages patients to undertake 2-minute and 6-minute walks, a major part of the PeerWell program. The steps are monitored by the device’s pedometer.

The breathing coach provides a breathing exercises to relax patients, using an on-screen animation which grows and shrinks to guide the user in their breathing.

The hazard detection feature, built on machine learning, instructs users to record specific rooms of their house, then detects potential dangers in that space (such as wires, missing bath mats or even poor lighting). 

Now we’re working on Sit & Stand, another machine learning feature, which enables users to count the number of sit-and-stand repetitions they can perform. 

These features work together to create an intuitive coaching platform. The app calculates a patient’s range of movement, then uses this information to suggest a customized routine, ranging from basic mood exercises to advanced physical ones. A series of clear, colorful charts allow patients to gauge their improvement.

All exercises are suggested by PeerWell’s healthcare partners, who also use the app to monitor patients’ progress. In fact PeerWell’s partnership model is now so successful that the vast majority of users arrive via a doctor’s referral.

Building the App

In truth, a lot of the PeerWell innovation is based on technologies common to everyday smartphones. We’ve built the motion detector using the in-built device accelerometer and gyroscope; to measure steps, we’ve used the in-device pedometer as well as two standard activity trackers, GoogleFit for Android and HealthKit for iOS.

The biggest technical hurdle has been the machine learning function. The technologies that went into it – CoreML, a native framework from Apple, along with TensorFlow and TensorFlow Lite, the Google for Android equivalent – aren’t particularly revolutionary, but we also had to work out how to train the machine learning model. 

In the end we built an entirely separate app, which PeerWell’s machine learning team could use to manage the training program. The app has since been used to build both the Hazard detector and the sit-and-stand feature, with the ability to handle data from hundreds of different training repetitions (you can read more about how to train a machine learning model by checking out this blog from our sister company Bugfender).

Trans-Atlantic Partnership

Aside from the core technical brief, we’ve given PeerWell a huge amount of advice and consultancy. Effectively we’ve become an extra part of the company; four years into the project, they still haven’t hired a specialist mobile team, preferring to keep working with us instead.

But this has required a huge commitment on our side. At the last count we were pouring 350 working hours a month into PeerWell, and we’ve faced some serious logistical challenges. PeerWell are based in San Francisco while the bulk of our team are in Barcelona, so there’s a nine-hour time difference to bridge.

This makes things tricky from a time perspective – as anyone who’s logged on at midnight to speak to a client can attest – but it also makes real-time collaboration practically impossible. So how do we overcome these challenges?

Well, we’ve relied on first-class agile working disciplines. We’ve divided the entire PeerWell collaboration into two-week sprints – a short, intense burst of activity used to complete a specific project – and we’ve used Asana to create our scrum board, the chart where all the tasks associated with that project are listed, planned and moved around.

Each time PeerWell sends us a request, it gets added to the scrum board and moved into the correct section. It means we can maintain the project asynchronously, responding rapidly to each request without needing a call or meeting.

The agile methodology works so well that we can keep the project running smoothly with only two weekly calls, one to review the week’s tasks and the other to follow-up on any snags that have cropped up since the first chat. It’s a remarkably efficient system and we plan to continue using it.

From Strength to Strength

PeerWell’s CTO Jeff Greenberg visiting us in Barcelona

Over the past four years our collaboration with PeerWell has grown and grown. We’re no longer just a service provider; we’re a full-time part of the team.

As well as our core design and engineering services, we offer PeerWell a specialist quality assurance and testing facility, as well as advice on agile working practices and consultancy for their mobile UX. 

Although we’ve hardly even met the PeerWell team, we feel the same excitement about their company as our own. The project allows us to experiment with fascinating technologies and, more importantly, has an enormous social impact. Helping people like Taylor makes all those hundreds of hours worthwhile – and then some.

Joan Martin

Starting with a mathematics degree, continuing with a computer science master's degree, and working on mobile and backend development during the past 10 years, Joan is a proficient software engineer. Motivated by great projects and an awesome team, Joan is currently leading the Mobile Jazz team and enjoying the MJ philosophy at its best.