breathesimple: Building a React Native app to combat sleep disorders
Sleep apnea and snoring are widespread conditions affecting the quality of life for millions. We partnered with breathesimple to address this issue using breath training, React Native, and wearable technology. Moving beyond smartphone-based biometric monitoring, we integrated the Circul+ ring for superior accuracy and reliability. Our mobile application seamlessly analyses your sleep and guides you through daily breathing exercises to reprogram your brain to naturally improve your sleep quality.
The breathesimple approach
At its core, breathesimple is an innovative app that integrates with a wearable ring to enhance your sleep quality. The ring monitors your blood oxygen levels (Sp02) and heart rate accurately and continuously. The app operates in two main modes:
- Sleep Mode: In this mode, the ring tracks your blood oxygen levels throughout the night. It calculates the Oxygen Desaturation Index (ODI), which indicates how frequently your blood oxygen level drops. This measurement is crucial for identifying sleep apnea and other related breathing issues like snoring.
- Breath Training Mode: This mode focuses on improving your breathing quality through guided exercises. The ring’s precise heart rate monitoring, combined with advanced algorithms, assesses your breathing. The exercises use the phenomenon of neuroplasticity to rewire the brain’s automatic breathing control patterns. Better breathing means more energy, less stress, and better sleep.
So the app can not only monitor and track how well you sleep but also coaches you to breathe and sleep better.
Overcoming technical challenges
Our journey wasn’t without its hurdles. Here are some key challenges we faced:
- Integrating with the wearable: Since we lacked full access to the ring manufacturer’s binary files, we needed a way to bridge our React Native application with the device. The solution lay in creating a custom Native Module written in Swift. By implementing the RCTBridgeModule protocol, we defined methods that could be exposed to our JavaScript code. After registering this module with the React Native bridge, we could seamlessly communicate with the ring using the NativeModules API from within our JavaScript components. This highlights the ease with which React Native allows for the creation of tailored native components using Swift.
- Pairing Process: Limited access to the ring’s resources initially made Bluetooth pairing tricky. Once our custom code could interface with the ring, we gained fine-grained control over its state.
- Leveraging Legacy Algorithms: Repurposing pre-existing algorithms for the specific needs of breathesimple required careful adaptation and integration.
The development experience
Our primary goal was a functional, testable proof-of-concept (POC). That said, we didn’t want to sacrifice aesthetics entirely. React Native Elements proved invaluable, providing a library of pre-styled UI components to streamline our development process.
Why this matters
breathesimple showcases how software and hardware can converge in the medical field to produce solutions with tangible benefits. The sleep disorder market is vast, and our project offers a potential avenue for disruption through accessible, technology-driven interventions.
Lessons learnt
- React Native’s versatility: Building a health-focused app that interfaces with external hardware demonstrates the flexibility of the React Native framework.
- The power of custom modules: When off-the-shelf solutions aren’t available, extending React Native with native modules (like our Swift code) allows projects to overcome limitations.
- Data-Driven healthcare: The importance of robust algorithms for translating raw physiological data into meaningful health insights is highlighted in breathesimple’s sleep analysis capabilities.
What’s next?
Our sleep monitoring app vision is to enhance the user experience through algorithm refinements, improved sleep monitoring using AI-supported detection of breathing instabilities, advanced data analysis to determine apnea phenotypes, and partnerships with other device manufacturers. Our goal is to create a comprehensive solution that empowers individuals to manage their sleep and improve their well-being.
About the author
Sachin Jethwa is an Engineering Manager with a passion for building robust, scalable software solutions. With expertise in React, React Native, and agile development methodologies, he excels at driving technical excellence and fostering collaboration within engineering teams.