TheaAI
THE STORY BEHIND THE CODE: A DEEP DIVE
- Summary with focus on technical aspects
- App description
- Relevant links
- Technical details
- Diagrams
- Technology and services used
SHOWCASING THE APP
Summary with focus on technical aspects
Developed TheaAI iOS app, a personalized health & wellness application utilizing HealthKit and EventKit for tailored experiences, having OpenAI LLM models empower the avatar generated insights and conversations. Employed SwiftUI and SwiftData for App Store marketing advantages stemming from the alignment with Apple's latest technologies. Overcame user experience challenges present in the domain of health apps industry by introducing WidgetKit for presenting health insights. Focused on architectural design to manage code complexity and leveraged Swift's versatility for achieving high extensibility in data processing modules and standardized communication among the code modules.
App description
TheaAI is a fun and personalized health & wellness iOS mobile app with engaging avatar-led chats and journeys for a tailored wellness experience. It uses HealthKit to access user's health data and personalize the app experience and uses EventKit to personalize the actionable recommendations in terms of scheduling while respecting the users calendar.
The essence of the app is the chatbot with different avatar coaching styles (fierce, cheerleading or educational) which are chosen based on the user’s preference. Additionally, the app offers a widget that glanceably presents health insights generated based on data collected by HealthKit and EventKit.
Relevant links
iOS app is live here.
Technical details
The decision to use the latest Apple technologies, SwiftUI and SwiftData, was driven by the marketing-related benefits associated with this choice. Specifically, the App Store tends to favor apps that leverage the latest technologies over those developed using older ones.
Interesting challenges arose from the realization that notifications in health domain apps were not an effective means of reminding users. To address this issue, Apple's WidgetKit was employed to create an iOS widget. During the widget's development, numerous optimization challenges emerged in relation to the utilization of OpenAI models and the need to adhere to the hardware resource limitations of both iPhone and iPad.
The architectural design of the system played a crucial role in the app's development, with a keen focus on keeping code complexity consistently monitored. This was particularly important as the entirety of the app's code is essentially within the realm of the "frontend mobile app code".
Swift's versatile capabilities enable developers to write code in both functional and object-oriented paradigms. In the implementation of data processing-related software modules, a functional paradigm was employed, while the object-oriented paradigm was used in other parts of the system for data, interface, and communication standardization, aiming for high extensibility. The necessity for high extensibility in TheaAI system stemmed from the constant need for prompt tweaks and tests, relying on data retrieved from HealthKit and EventKit.
Various cost optimization strategies for OpenAI were brainstormed, including the use of more economical models where the decrease in response quality is minimal. Additionally, considerations were made for storing certain Large Language Model (LLM) responses, particularly when their reuse wouldn't cause significant unwanted determinism in the app. For instance, health knowledge facts, answerable deterministically, could be retrieved from the database using semantic search methods.
Diagrams
Technology and services used
- Swift
- SwiftUI
- SwiftData
- HealthKit
- EventKit
- WidgetKit
- OpenAI and OpenAI SDK
- Sentry
- Figma
- Trello