Featured image of post Incident App (Part 1)

Incident App (Part 1)

Most of you won’t know this, but to keep me busy (as if work, blogging, presenting & community isn’t enough) I am the chair of my local platform diving club, Star Diving. Give them a look at http://stardiving.org/ if you or your son or daughter want to learn a great sport that pushes you to control your body & keep fit.

My youngest son is part of the Skills squad (very proud parent) and he loves it. To support him and mainly because I was the last to step back, I became the chair of the club last April.

Star is a registered charity, whose purpose is to promote diving across Surrey and beyond and have 200 members or all ages. As a registered charity, Microsoft generously gives Star 25 licenses for using Office 365, we host our email and use teams and other things.

The requirement

Diving is a dangerous sport to the untrained and accidents happen. Logging accidents and informing parents, in this day and age of GPDR has become a concern. Gone are the days that we can keep an accident book at the pool side and have a chat with a parent. Our duty of care needs to ensure any incidents are logged centrally to ensure repeat incidents.

On discussing with our coaches and welfare officer a list of requirements where created. Wasn’t a formal list, just from conversations etc, but like any good BA, I created a list

  • Centralised, secure list of incidents
  • Ability to add divers to list for trials or competitions
  • Data entry must be easy and not time-consuming
  • Weekly notification of all incidents to the welfare officer
  • Email to parent or guardian of the diver when an incident is raised
  • Escalation to welfare officer and others in the organisation for serious incidents
  • Not cost anything

Of all these requirements, the last one drove me in a direction which is not my normal. I am so used to firing up a CDS environment, creating an entity structure and starting the process from data.

I decided to delve into the unknown (I know the principles, like any Solution Architect, but doing is different) and create a SharePoint list or two to store the data and build a Power App on top to handle data entry. Power Automate will be used to link the app together and provide the notifications.

Introducing Pike

Pike’s front screen has a series of buttons that I will hopefully expand on as I add functionality. I have used the default black and yellow scheme, as Star’s colours are the same.

Data Entry

If you click on Create New Incident, you are taken to the first data entry screen.

This is my first learning point. I knew what the * next to the fields means, but my users didn’t. Don’t assume that just because you know how something works that others will.

This is a simple form based on the SharePoint list. The fields are formatted for the screen, and I didn’t want a lot of scrolling, so split the data entry over 2 screens. The first screen uses a second list for all our divers and displays a drop-down of them.

Further, if the diver is not on the list, for trials or competitions, you can add them using the + next to the diver

The Reporter field is a Person or Group field in SharePoint, which allows linking to a user on our environment. Location is a choice field, with diving specific terms.

Once all the fields that require data are filled in, a big Next button appears at the bottom

This is done by a simple formula on the Visible property of the button, namely, only display if the form is valid

Selecting the button passed to a second New form, to finish entering the data.

The Contacted? field is a multi-choice field and it kicks off a flow for serious incidents (if a hospital visit or ambulance is called, it is serious by default)

Again, the visibility of the submit button is controlled by the validity of the form.

The submit form doesn’t conduct a straight submit but combines the data on the two forms. Additionally, notify the user if there is a positive or negative outcome to the submission

Patch( Incidents, Defaults(Incidents), ‘frmIncidentNew-First’.Updates, ‘frmIncidentNew-Second’.Updates, {‘Welfare History’: “Created by " & User().FullName} ); If( IsEmpty(Errors(Incidents)), Notify( “Your incident has been recorded”, NotificationType.Success ); Navigate( Home, ScreenTransition.CoverRight ), Notify( “There was a problem submitting your incident. Please contact incidents@stardiving.org manually”, NotificationType.Error ) )

This returns the user to the home screen, where they can view incidents they logged by clicking My Logged Incidents.

Viewing Incidents

As you can see, I got bored in testing & documented a lot of gruesome accidents, which thankfully doesn’t happen.

Clicking on the arrow shows the detail.

For a normal coach, a reporter, this is the end of the functionality. But for our welfare officer and administrator, there are a couple of additional features.

Securing Special features

On startup of the application, I run a Flow.

This flow is checking to see if the logged in user is the owner of the team that owns the Incidents list.

Firstly, initialise some variables, then call the SharePoint API to check the current users rights in the given SharePoint site.

The variable in the Uri is passed in from the Power App, which is the users email address.

If this call returns a value, it means that the user is in the owner team, and this result is passed back to the Power App.

The isAdmin boolean is set after the call as shown previously.

This global variable is used on the List of Incidents screen to hide or show an icon at the top

The visibility of this is controlled by the isAdmin value.

This button toggles whether the user sees all the incidents or just their own. This allows an admin to view all incidents.

On the incident detail screen, there is a edit button as well, which allows an admin or welfare officer to add some commentary to the incident, such as when the parent is contacted or details about any investigations.

The SharePoint List

In SharePoint, you can see the recorded incident in the SharePoint list

This is a simple use of the list, and is secure. Next article, I will walk-through the other flows that are being triggered to notify the parents and welfare officers to complete the requirements.

Conclusions

It is a simple app, but it really hits the mark for being cheap (free), secure, easy & portable. SharePoint may not be the database of choice for everyone, but you can not knock it for being cheap. Power Apps just adds that extra polish to the data storage mechanism that takes it from a plain list to an intuitive application.

If there are any clubs out there that want to work with me on implementing this app at your organisation, particularly charities, give me a shout. I would be happy to help & share the application and spend time installing with you.

comments powered by Disqus
My views, nothing to do with anyone else
Built with Hugo
Theme Stack designed by Jimmy