Mary Pegington, a research dietician at the School of Medical Sciences and Wythenshawe Hospital, is leading research around mechanisms for breast cancer prevention in young women. She is specifically looking at tackling this through dietary changes and the monitoring of weight and activity.
There is little support for women under the age of 35 who have a family history of breast cancer, despite there being substantial support for women older than this. These younger women tend to be vulnerable to weight gain which increases their risk of cancer. However this tends not to be monitored, even after visits to the family history clinic and does not trigger preventative strategies.
Mary is developing a lifestyle intervention project to highlight and address issues of weight gain in this group of women. Some early consultation with young women suggests that an app-based intervention solution was of interest to them. The purpose of this project was therefore to develop an app for the purposes of gathering preliminary data on its effectiveness as part of a feasibility study. The data gathered is then to be used to improve the app to increase its effectiveness.
The Prevent App is a tool for setting goals and completing logs related to lifestyle and health. These logs are tracked and used to judge a user’s progress against achieving their set goals. At the same time, the app sends anonymised logs to Research IT’s StorageConnect system (which allows for secure research data collection and download) as well as a series of customised analytics events to Google Firebase for researchers to monitor app usage habits and engagement. The app offers the following features:
- Logging of weight, eating habits, smoking, alcohol intake and physical exercise.
- Seamless support of metric and imperial units throughout.
- Automatic BMI calculation and BMI-driven weight targets per user.
- Graphical illustrations of the trends in these data within the app.
- Goal setting around these logging areas and highlighting users’ achievements.
- Local log history to browse past logs on the device.
- Local notifications to remind users of log due dates based on user-chosen frequency.
- Push notifications to allow researchers to perform non-targeted communications with all users to encourage engagement.
- Embedded analytics for event capturing for researchers to measure usage and engagement.
- Linking within the app to signpost to other resources such as researcher-led Facebook groups.
Tech Spotlight: Multi-Unit Height / Weight Entry
Prevent was developed for iOS and Android using Microsoft’s Xamarin Forms 5 framework. Out of the box, Xamarin Forms provides a cross-platform Entry that is rendered as a Material Design Text Field. For inputting weight and height values in kilograms or centimetres, this single Entry works just fine. However, what happens when we want to switch seamlessly between metric and imperial units?
The quick solution, like most things in software development, is also the least flexible, least reusable and the hardest to maintain. The MDS use a Model-View-ViewModel (MVVM) pattern to build our apps. This means that the View (the Entry) that is rendered to the screen does not manage its own properties, such as the text is displays or whether it is visible or not. Instead, it uses “Data Binding” to get/set values in a ViewModel object in the code:
To show two Entries for imperial and one Entry for metric this involves duplication. It gets worse when we include height and weight on the same page:
If we then add in validation rules, unit conversions and all the rest of the features required to implement the feature we end up with a lot of very similar code. Considering we reuse these inputs in both the onboarding and the weight log parts of the app, it made sense to consider a reusable, more maintainable solution. Xamarin Forms provides a type of container view called a ContentView. We packaged up the complicated logic into a ContentView and a matching ViewModel instead. By doing so, we eliminated the need for six different flags by replacing them with two enumerated types indicating whether the view was metric/imperial and weight/height. The properties of the entries were then set from these flags using ValueConverters. We could then trim down the entries to only three (one metric and two imperial) and used a single backing value, which was always in metric, converted on the fly to the appropriate units, giving us a neat, reusable, flexible solution:
The app is currently being used by a pilot group of around a dozen women for an extended period. Data gathered by the analytics integration, as well as feedback gathered from regular focus groups with the participants, is steadily providing researchers and the Research Software Engineering team with feature requests and improvements which will scope out the next iteration of this app, subject to funding, later in 2022.
If you are thinking about developing a mobile app yourself, or would like the MDS to develop one for you, do get in contact with use either via the team email.