Healthcare App Development with Connected Devices

02 Apr 2023 Aleksander Sokol

This project is about an advanced smart inhaler and its app, offering precise medication tracking and seamless data integration with healthcare providers’ systems. Focused on innovative medication packaging that communicates usage to patients and doctors, our client, a pharmaceutical industry leader, aimed to diversify into B2B custom-packaged medications. To achieve this, our client acquired a startup that we had been technically supporting from its inception. Acknowledging our technical expertise, the company proposed that we continue our work on the existing solution of the startup, now aligning with their vision for the product. This journey illustrates the evolution of the startup’s initial asthma treatment solution, originally designed for children, into an advanced, age-inclusive solution. Following this enhancement, we further developed it into a versatile, customizable low-code platform that embraces a white-labeling model, effectively meeting the diverse needs of patients and healthcare providers. Stay tuned to discover the details of how we made this transformation a reality.

Healthcare Solution for Connected Medical Devices

As previously mentioned, the application discussed here marks the first and immediately successful implementation of our customer’s vision. It’s designed for patients suffering from asthma and is compatible with a range of smart inhaler models. These smart inhalers are primarily designed to track medication intake. However, one model, which we will detail later, goes a step further by incorporating an additional set of sensors. These sensors enable a more comprehensive evaluation, assessing not just the intake of medication but also the correctness of the inhaler’s usage. This evaluation is based on multiple criteria, ensuring that patients administer their medication effectively and correctly.
Moreover, the app’s functionality includes tracking and maintaining a history of medication intake, covering various forms such as pills, creams, injections, oral drops, nasal sprays, and more.

The solution comprises:

  • A range of supported smart devices (inhalers, spirometers, dispensers, autoinjectors, etc.);
  • Native mobile applications for patients on Android and iOS;
  • A web application for doctors, admins, and caregivers;
  • A server-side component where internal business logic, data storage, and data exchange between mobile and web applications are implemented. You can learn more about this in a dedicated blog post that explores the technical details of building the backend with AWS services.

Next, we will explore this solution in action, following a user’s journey through the mobile app and demonstrating how, in conjunction with the other system components, it actualizes our customer’s holistic vision.

Mobile App for Asthma Management

The journey with the application begins with a personal consultation with the doctor. During this meeting, the doctor assesses the patient’s specific needs and decides which functionalities of the app will be most beneficial. This could include modules for tracking symptoms, monitoring medication intake, or other personalized features. The doctor configures these settings through their web application, tailoring the app to suit the individual patient’s treatment plan. Doctors can modify the app settings as the patient’s condition evolves, with the flexibility to add or remove features as needed.

Post-registration, the user enters the medical module, where they are prompted to pair their smart devices with the app via Bluetooth. This could include multiple devices, such as a daily-use inhaler, a rescue inhaler for sudden asthma attacks, and spirometers—diagnostic devices that measure exhaled air volume. Patients might also be prescribed medications that don’t involve smart devices, like pills, nebulizer treatments, or injections. These are selected by the patient upon first logging into the app and can be added or modified later. The patient set up a medication schedule and this completes the initial app setup.

The user then lands on the dashboard—the app’s main information screen displaying key current data. This includes weekly or monthly statistics of medication intake and recorded symptoms. Additionally, it shows climate information and air quality data for the user’s current location, as these factors can influence the health of asthma patients. For example, atmospheric pressure and pollen levels are provided through an API from AccuWeather. The dashboard also displays data from diagnostic measurements taken with smart spirometers.
Users receive push notifications from the app when it’s time to take their medication, according to the set schedule. Medication intake via smart devices is automatically recorded in the app and displayed in the medication history screen. This screen also includes manually entered records of medication intake that didn’t involve smart devices. All data are categorized by medication types and devices, so it’s clear when a patient took planned doses from one inhaler, rescue doses from another, pills, and so on. This information is also aggregated on the dashboard for weekly or monthly periods, depending on user settings. Both the user and the doctor can view the medication history, setting a specific time range for display, going back to the very first medication intake since the app’s inception.

The app features a section where the patient periodically completes surveys, reporting their condition and symptom severity on a scale, for instance, the presence and intensity of cough or runny nose. The survey also allows patients to note recent exposure to potential triggers, like certain foods or contact with specific animals and plants. All these details are recorded in the patient’s history. These inputs are augmented with daily weather data and air quality metrics from external services, creating a timeline that displays daily symptoms and external factors possibly causing them. This comprehensive view, accessible to the treating doctor through the web application, helps identify patterns unique to the patient, informing treatment strategies. Both mobile and web applications allow interactive customization of how symptoms and factors are visually represented on the timeline, making it easier to filter relevant information and discern patterns.
To enhance the interaction between doctors and patients, our mobile and web applications offer text and video chat capabilities, integrated with the SendBird platform. This enables physicians to conduct remote examinations and consultations, ensuring continuous and high-quality medical care anytime, anywhere. Additionally, the app includes educational sections. One tab contains informative articles about asthma, while another features videos hosted on YouTube, playable within the app. All this content is managed through an admin panel.

Smart Inhaler App Integration

As previously mentioned, the application is compatible with various types of smart inhalers. Let’s examine the most sophisticated model: the metered-dose inhaler (MDI). This inhaler employs an aerosol canister, opening its valve for a precise duration to consistently deliver the same medication dose. The dosage per actuation is known, enabling doctors to tailor an individualized treatment plan for each patient – determining the number of doses per day and actuations per dose.
The inhaler includes a calibrated pressure sensor acting as a trigger. If the force exerted on the medication canister’s valve exceeds the threshold to open it, the sensor activates, signaling an actuation. We also monitor the duration of the sensor’s activation to accurately determine the release of medication. If the duration of the sensor signal aligns with the expected time it takes for the valve to open and deliver a dose, it confirms that the medication has been dispensed.

This model also features an accelerometer and a differential air pressure sensor, assessing the patient’s correct usage of the inhaler during medication intake. Unlike simpler models that only track actuation, this inhaler gathers extensive data, providing a comprehensive usage evaluation based on five criteria, which we will explore in detail, showing how each criterion’s adherence is technically assessed during medication intake.

The first criterion is the device’s Bluetooth synchronization with the app. The inhaler records the time of each dose taken. If it’s not paired with the app at the moment of intake, the data is later retrieved from the inhaler’s microcontroller memory when Bluetooth connection is re-established. The app then compares the medication intake time with the data reception time to determine if the intake was real-time or a recorded event during a disconnection.

Next is the medication’s state within the canister. To prepare the medication for intake, the canister must be shaken a specific number of times with certain acceleration, detected by the accelerometer. The microcontroller firmware recognizes shaking patterns from the accelerometer data, counting the shakes and their intensity. Once correctly and sufficiently done, a LED on the inhaler signals the user. If over two minutes pass post-shaking without medication intake, the LED turns off, indicating the need for re-shaking, as the medication returns to its less optimal resting state.

The third criterion is the angle at which the inhaler is held during medication intake. Ideally, the inhaler should be perpendicular to the ground, similar to any aerosol canister, to ensure sufficient medication capture from the bottom. The acceptable deviation is up to 15 degrees. Exceeding this angle results in the app considering the intake as non-compliant regarding optimal canister orientation. This measurement relies on accelerometer data at the actuation moment.

The fourth criterion involves the strength and duration of the patient’s inhalation during medication intake, utilizing the built-in differential air pressure sensor. This sensor records the airflow velocity in the inhaler’s tube, generated by the patient’s inhalation. We analyze this data to chart inhalation intensity over time, capturing the inhalation’s start, end, peak, and average flow velocity, equivalent to inhalation strength. Additionally, this sensor helps identify false actuations, such as when the inhaler is pressed inside a bag or pocket without actual inhalation. No inhalation at actuation time means the event won’t be recorded as medication intake.

The final criterion is the timing of medication spray during the inhalation cycle. It’s incorrect to start the spray at full exhalation and the beginning of inhalation, as the lung alveoli are compressed with minimal airflow, hindering effective medication distribution. The ideal moment is after the first third of inhalation, when the alveoli are open, and inhalation strength and duration are sufficient for even aerosol distribution. We utilize the previously mentioned data from the differential air pressure sensor, which provides a graph showing the intensity of the patient’s inhalation at each specific moment in time. We then correlate this graph with the timing of the sensor’s actuation on the canister valve, thereby determining at which stage of inhalation the medication was injected.
This correlation of data from both sensors and the determination of its correctness are performed at the mobile application level. The device’s role is to record the data of all these events, time-stamped with an accuracy up to 10 milliseconds, and transmit them to the application. The app then processes these data, considering their time stamps, to determine whether the moment of medication injection was completely correct, partially correct, or completely incorrect. In cases of ‘completely incorrect’ injections, that dose is not counted in the medication intake statistics.

By analyzing correct usage data, we gain insights for improvements, such as refining instructional videos or sending targeted UI notifications to patients, encouraging adherence to these criteria. The app’s dashboard also motivates patients by displaying how well their recent device usage aligns with these five criteria.

In cases of device malfunction or battery depletion, patients can manually log medication intake in the app. If the inhaler isn’t paired with the phone during intake, it stores sensor data for each intake, transferring it to the app once Bluetooth connection is restored.

Our engineers developed the firmware for the Nordic Semiconductor nRF52810 microcontroller used in this inhaler from scratch. The process began with writing drivers for device sensor interaction, followed by developing middleware as an intermediary layer between hardware (drivers, sensors) and software applications. This middleware offers an accessible API for high-level applications, simplifying access to sensor data and hardware control. The API allows applications to efficiently extract necessary information and control device functions without direct low-level component interaction. Finally, the top-level business logic was developed, defining the inhaler’s primary functions and behaviors per usage requirements.

During firmware development for this and other smart devices, our engineers utilized Segger Embedded Studio. This integrated development environment provides a broad range of functions, including advanced debugging and code analysis tools, enabling our team to effectively identify and resolve errors and optimize software performance. These capabilities allow our engineers to accurately and quickly implement both low-level and high-level firmware functionalities.

Smart Inhaler Software Development Kit

To fulfill the integration requirements of our customer’s partners, who are eager to incorporate this intelligent device into their own systems, we developed a Software Development Kit (SDK) that implements all the low-level logic for Bluetooth interaction with this device. This SDK is a library that can be integrated into mobile application development projects, simplifying the development process by abstracting away the complexities of direct interaction with Bluetooth devices.

This enables developers to focus their efforts on other aspects of application development, rather than on the basic protocols of Bluetooth communication. We developed the SDK to be compatible with leading mobile platforms, using Kotlin for Android and Swift for iOS.

Continuous Improvement of Application

In collaboration with our customer’s team, our team continually works on enhancing the application. The customer regularly conducts medical studies with various focus groups of real patients, proposing specific usage scenarios of the app combined with smart devices. They then collect data on how effectively users utilize the devices and the app, their adherence to instructions, and gather feedback from these focus groups. Based on this feedback, we make improvements in the app from a UI/UX perspective or refine the educational content. For instance, we’ve already revised some user flows, added features to make tutorials and guidelines more user-friendly, and enhanced the content for these tutorials and guidelines. This process of improvement is ongoing.

Application Development Platform

Upon its market debut, this application proved to be highly successful. Our customer decided to commercialize this business model, thereby attracting new partners. They intended to offer not just the service of producing medications in their partners’ branded packaging, but also to propose integrating smart devices and the application with their medications. This integration would be customized for each partner, aligning with their functional requirements for the app and incorporating visual customization by implementing the app’s design in the style of the partner’s brand. To realize this concept, we developed a low-code platform based on this application for creating new apps for our customer’s partners. This platform enables the creation of new applications like a constructor, featuring more than 20 functional modules and options for visual customization.
The process of creating a new application is primarily carried out in the admin panel of this system, where some configurations are made through a UI interface, while the rest require some developer involvement. If the existing functional modules are insufficient to implement a specific scenario for a partner, we develop new functional modules or make improvements to existing ones. In doing so, we not only meet the individual functional needs of our customer’s partners but also expand the available functionality of the platform for creating new applications. Learn more about this low-code platform in this blog post.

In conclusion, our partnership journey culminated in a groundbreaking solution in asthma care that is not just a product but an ecosystem of smart medical devices and applications.

We Can Create the Same Solution for You

Are you searching for a team of healthcare development professionals?

We offer a suite of services that can transform your vision into reality. From crafting secure healthcare applications to setting up reliable server-side solutions and introducing new IoT devices, we’re equipped to support your healthcare project’s needs.

Contact us today! Let’s schedule a consultation to discuss your project.

Let's arrange a consultation