Research IT

The Pain of a Data Collection Mobile App

For those with long term, constant and often debilitating pain, taking part in a study requiring multiple questionnaires on levels of pain to be completed would be difficult, if not impossible. Research Software Engineers have developed an app for mobile devices to make this a much easier prospect.

Since the creation of the Human Pain Research Group within the University’s Faculty of Biology, Medicine and Health (in the Division of Neurosciences and Experimental Psychology), much work has been undertaken on a range of funded projects looking at chronic pain. The latest of these is the development of a Pain Diary mobile application for the electronic completion of questionnaire forms by study participants.

The group is a multidisciplinary team of clinical and non-clinical researchers, based in the Salford Royal NHS foundation Trust, and the project, led by Dr Alex Casson (Department of Electrical & Electronic Engineering) was developed by the Research IT Mobile Development Service (MDS). It offers a practical interface for users to manage a schedule of questionnaires throughout the study.

A version of the app was originally developed by an external company (in accordance with Information Governance requirements), who then owned the collected data, storing it on their own information systems. Although access to the data by University researchers was initially free, the external company have since introduced access and retention charges. An alternative solution was required, and researchers approached the (newly formed at the time) MDS. The result is P.I.C.A (Pain Information Collection Application) due to go live on the Google Play store in November 2020.


The application has the single, and relatively simple-sounding goal of allowing study participants to record their pain levels using a series of mobile device based questionnaire forms, and then store that data for researchers to access and utilise. In reality, the complexity of the solution was greater due to the following additional requirements that had to be implemented:

  1. A study should present a specific subset of all questionnaire types available in the app to the user
  2. Participants can only be registered on a single study although multiple studies should be offered by the app
  3. The schedule for each questionnaire (daily / weekly / start-and-end of study period etc.) varies according to which study it is part of
  4. The user should only be allowed to access each questionnaire on a specific date (calculated with reference to when they install the app and start the study) or the day immediately following that date
  5. Questionnaires not completed within this time period must be flagged as having been missed, and not appear to the user again, and a record stored to show this fact (a null entry)
  6. Data should be buffered if there is no internet connection, and sent to backend servers when internet becomes available

Suffice to say that the combination of offering custom questionnaires on a varying schedule, while making the user interface easy for the user to navigate, and also taking into account the demands of Information Governance… makes the data collection itself a pain!

The App

The application was developed for Android devices only, as these were being provided to the study participants. However, the project team wanted the door to be left open for an iOS version in the future. The standard MDS technical stack was used (Microsoft’s Xamarin.Forms framework) which allows for maximum code reuse, should the iOS option be pursued.

An initial, and one-time-only, screen is presented to capture the user’s participant Id (allocated by the Project Team) along with the requirement to select the study they are taking part in.

This data is stored on the phone, and then a full schedule of the questionnaires to be presented is created based on the user’s selections.

From here, and whenever the app is then run, a dashboard screen showing the next 7 days of questionnaires to be completed (along with any that were due the previous day) is displayed. Colour coding is used to highlight questionnaires that can now be completed, in University purple.

When this screen is loaded, in the background, the app sends any data buffered on the phone; for example, if there was no mobile signal at the time the questionnaire was completed, and also updates the database with details of any questionnaires that have been missed.

The user then selects an appropriate questionnaire to complete.

MDS_Pain_Setup_Screen v2.jpg

Question Control Abstraction

The questionnaires within the app are each built at run time from a set of “Content Views” – essentially customisable abstract representations of primitive question types. These views are designed to gather information from the user in a number of ways:

  1. Absolute numbers – done via slider controls
  2. Picking a relevant textual response from a list – utilising checkboxes or radio buttons
  3. Free text entries
  4. Specific time data – done using clock controls

MDS_ Pain_Slider v2.jpg

These content views are constructed by a questionnaire builder implementation, setting appropriate properties and bindings on the controls to customise the wording and other parameters. The use of a factory pattern in this way significantly reduces the size of the code base and makes the entire application much easier to maintain.

The app also uses a bespoke, MDS-created “body map” control which allows taps on the displayed body parts to be recorded as selected options, along with the option of double tapping to represent the user’s “worst” area of pain.

The library of controls which can be utilised in apps is always increasing allowing MDS to reuse them on subsequent project. However, the MDS team are very willing to create solutions tailored to specific data collection requirements, should the project require it.

Once the questionnaire is complete, the values of the properties bound to the content views are serialised into data packets and sent securely to Research IT’s StorageConnect data storage system for researchers to download.


Academic lead, Alex Casson, on working with the Research Software engineers, remarked “It’s been great working with MDS. Coming from Electrical and Electronic Engineering, we have the technical skills to fundamentally make an app ourselves – but that’s not what this project was about. For this project we needed a professionally engineered approach for maximum re-usability and future proofing (if/when future questionnaires need to be added) and we were very aware of information governance requirements, ensuring that user responses are collected, stored and transmitted anonymously. MDS already had frameworks for doing this which we could build upon and really accelerate the work…”.

Work with us

If you have the need for a flexible, mobile device based, data collection tool; then we’d love to hear from you to see if we can work together to develop what you need. To get help with putting together projected costs for development work, please contact the MDS Lead Adrian Harwood, send a message to the MDS email address, or contact us via the Support Portal.