TrackPack: A Mobile App (and more!) for Grocery Data Collection and Analysis
2024-10-01
TL;DR
TrackPack is a mobile application I created as part of my undergraduate research with the Food, Policy, and Health Group
at the University of Calgary. This app is designed to help collect and analyze data on grocery products, with
the goal of extending and replacing Health Canada’s dated, paper-based product coding system. To date, TrackPack has
been used to
analyze more than 10,000 product images in retail locations in several Canadian provinces, including Alberta,
Ontario, Quebec, and Nova Scotia.
For more information about the project’s background and context, continue reading below. If you’re more interested in the technical aspects, you can skip directly to that section by clicking here.
Gallery







Some Background
Motivation
Children are exposed to an average of 5,000 food advertisements annually, most of which promote unhealthy products. Aware of the potential negative impact, Canadian policymakers are drafting legislation to limit this exposure. However, error-prone, paper-based data collection methods have delayed policymakers and researchers in obtaining the data they need.
Our team, led by Dr. Charlene Elliott, former Canada Research Chair in Food Marketing, Policy, and Children’s Health, aims to solve this issue by developing digital tools that will transform the way food policy researchers track grocery store offerings and analyze how they are marketed to consumers.
What is TrackPack?
Food policy research is vital for shaping regulations and guidelines within the food industry, making efficient and accurate data collection essential for informed decision-making. TrackPack is a cross-platform mobile application that simplifies and streamlines the collection of a wide range of grocery product data.
The core innovation of TrackPack lies in its ability to empower researchers to efficiently collect data on over 40 product features, ranging from health claims and seasonality to packaging design and marketing strategies. This comprehensive data collection facilitates in-depth studies on various aspects of food products and their marketing, helping to answer questions such as, “Does the prevalence of certain packaging features correlate with unhealthy nutrient profiles or additives?” By providing timely, accurate, and comprehensive data, TrackPack equips food policy researchers with the tools necessary for informed decisions and recommendations, ultimately contributing to better food policy and improved health outcomes for all Canadians.
A key feature to this end is the applications use of OCR technology with custom algorithms to automatically extract and structure data from product packaging images, allowing researchers to capture a wealth of information — such as nutritional facts, ingredient lists, and food additives — with improved speed and accuracy.
By standardizing the data collection process across multiple researchers and locations, TrackPack reduces inconsistencies that could skew research findings, providing a reliable foundation for policy analysis and development.
My Role
I joined the TrackPack team in September 2022 as the sole developer, following a recommendation from my professor, Dr. Reardon. I was brought on after an external software vendor failed to deliver any meaningful end product, leading the team to pursue in-house development. My task was to take a set of loosely defined requirements and transform them into a fully functional application within eight months. Throughout this process, I assumed multiple roles, from engaging stakeholders to refine requirements, to designing the UX/UI and handling all aspects of development. Thankfully, with the guidance of Dr. Elliott and Dr. Truman, as well as collaboration with other peers in the research group, we were able to deliver a tool that not only met the initial requirements but was also unexpectedly found to be quite fun by those who used it!
The project didn’t end with the app’s initial launch. After deployment, I transitioned to working with research assistants to ensure the app’s smooth operation while continuing to refine TrackPack. This ongoing work has allowed me to enhance the app further, making it an increasingly valuable tool for food policy research at our university.
Under the hood
Tech Stack
TrackPack is a cross-platform mobile Flutter application with Firebase and Google Cloud Platform utilized as the backend.
Flutter
was chosen because the application needed to be cross-platform, and it was also the framework used in the
research group’s existing applications.
Several key requirements led to the selection of Firebase and Google Cloud Platform
for the backend. In TrackPack,
the intention was to have multiple researchers collaborate on a shared, centralized database; this made having real-time
database synchronization across devices essential. To add to the complexity, the research devices were typically tablets
without LTE
connectivity. As a result, the application also needed to be designed with offline use in mind. This would require the
app to efficiently sync locally stored data with the backend once connectivity was restored, while ensuring data
integrity and resolving conflicts from changes made by other researchers during offline periods. The Firebase SDK
addressed both requirements by providing built-in functionality for real-time Firestore database synchronization, along
with caching database updates while offline and syncing the database upon reconnection.
TrackPack also leverages Google MLKit
for the initial processing phase when extracting nutritional information and
ingredient details from food product labels.
Getting Offline Syncing Down
In TrackPack, each product entry consists of two key elements: text data stored in Firestore and image data stored in Google Cloud. While the Firestore SDK mostly handles offline caching and syncing for text data automatically, the Google Cloud SDK does not offer this functionality. As a result, images required a manual implementation of caching, retry mechanisms, and synchronization processes.
To manage this, I implemented a system with two main components. First, a local database stores metadata for pending uploads, such as the local file path of the cached image, the reference to the associated Firestore document, and the upload status. Second, a background service periodically checks for network connectivity and initiates uploads when a connection is available. Once an image is successfully uploaded, the system updates the Firestore document with the image’s Google Cloud URL, ensuring that the images are correctly referenced, removes the entry from the local database, and deletes the cached image from local storage.
Robust conflict resolution was not necessary in our context for a few reasons. While there may be active edits to the text-based metadata, in the overwhelming majority of cases, the original product images that were uploaded were not modified. In the unlikely scenario that two researchers are trying to change the image of a product at the same time, the most recent update would be used, which was an acceptable outcome.
Final thoughts
Developing TrackPack has been a rewarding experience, allowing me to apply my technical skills to a project with real-world impact. From tackling the challenges of offline data synchronization to integrating cutting-edge OCR technology, this project has significantly contributed to my growth as a developer while providing a valuable tool for food policy research.