Learn Courses My Dashboard

My First App Journal - Pain Score Calculator

Hey everyone,

I’m new to coding and development of any kind, but I’m jumping in with both feet in learning how to make and publish my first app. Hopefully this concept is easy enough.

I used to support veterinary hospitals that used a worksheet to quickly gauge an animals level of pain. They’ve tried all sorts of solutions: laminating a sheet, using an electronic PDFs, or building the logic into a spreadsheet, but none of those solutions could keep a record of evaluations or potentially integrate with their PIMS software.

The overall concept is simple: the user can choose between a dog or cat, then answer a few quick questions that will provide a number value that contributes to an overall score:

For the initial release, I’m looking to have the app just calculate values. For further updates, I’m hoping to implement other features:

  • Give the option for a patient profile: Patient Name, Patient ID Number, Owner Name, and Picture.
  • Ability to save and track scores over time.
  • Ability to export results to a PDF and share them.
  • Ability to integrate with APIs from other applications like SmartFlow and CornerStone
1 Like

It took a few days, but I finally figured out how to create a single “Question View Model” and iterate over a single JSON source for both the question text and the answers:

The issue I was having was trying to access the elements of an array that was nested in an array of a data type that I was using already. Most of the examples I found were people trying to create lists of data from a nested array, but I needed a menu that I could then turn each menu item into a button. I solved it with this:

I have some cleaning up to do, but for each question I wanted the Question Model’s table to be replaced with the question’s text with a menu underneath. Within each menu, I wanted to get the count of answers in the array, then create a button instance with content of the data within the array at the title.

Now onto programming to button logic…

Ok, now I’m stuck.

I can get the menu text and buttons to populate properly, but any code I assign to any button applies to each instance in the ForEach loop. That makes sense - I keep nesting ForEach loops in order to pull the values from the JSON file that holds them, but I’m not sure how to make a unique button for each iteration.