excerpt: Topgolf and Microsoft worked jointly to prototype a new system based on Azure App Service to analyze the game play of Topgolf visitors and enable future customer-facing apps. This article describes the development process and the results.
In this joint development effort, held at the Microsoft Reactor in San Francisco during the Azure App Service Hackfest October 21-24, Microsoft teamed up with Topgolf to prototype a new method to analyze the game play of their guests. This new system is used in various capacities to improve customer visits, staffing coordination, and enable future customer-facing applications. In this article, we describe the development process and the outcomes.
Our solution resulted in creating an Azure Machine Learning model, multiple Azure Functions, and an Azure web app service that accepts game play data from a representative Topgolf venue and can provide calculations that will enhance the customer experience. The results will help Topgolf provide an enhanced guest experience in their future innovation work. Engineers at Topgolf are currently using this work to craft a solution that integrates with their systems. They are likely to deploy it into production once properly vetted by their internal teams.
## Customer profile
Topgolf is a global sports entertainment community. With 30 venues serving 12.2 million guests annually and the world's largest digital golf audience, Topgolf has become a go-to destination for fun both in-venue and online. The Topgolf games can be experienced by all ages and skill levels, and the microchipped golf balls score themselves, providing players with instant feedback on each shot's accuracy and distance.
Each venue features climate-controlled hitting bays for year-round play, a chef-driven food and beverage menu, music and hundreds of HDTVs. Topgolf also brings interactive experiences to the community through its Topgolf U lessons, leagues, The Topgolf Tour, KidZone parties, social and corporate events, and the World Golf Tour (WGT) app. Topgolf's lifestyle division, Topgolf Media, creates advanced media content and cultivates partnerships and sponsorships that enhance the Topgolf fan experience.
To learn more about Topgolf, follow [@Topgolf](http://twitter.com/topgolf) or visit [www.topgolf.com](http://www.topgolf.com).
Topgolf currently has 28 locations nationwide and each venue consists of 50,000+ square feet, is three stories tall, and has 90+ game bays. They attract and serve many different customer demographics with various skill levels. Currently Topgolf is using some manual processes to provide various systems that improve the customer experience, then they use this information in various capacities to improve the experience for both guests and staff. Topgolf would like to reduce the amount of manual effort needed to properly align to guest expectations, thereby providing the most optimal visit to the facility.
## Solutions, steps, and delivery
Topgolf was invited to Microsoft's Reactor in San Francisco, California, to participate in the Azure App Service Hackfest. This hackfest was designed for customers and partners to sit down with experts from Microsoft for a number of days and work toward a specific goal. Leading up to the hackfest, technical evangelists from Microsoft met with architects, developers, and senior leadership from Topgolf to discuss priorities and scope a solution that would both be attainable in the time allotted and beneficial to Topgolf and their guests.
**Day 1**
Technical evangelists (TEs) from Microsoft and the team from Topgolf spent half the day defining the data needed and creating a value stream map consisting of existing and proposed processes. They also spent time cleaning the data and creating experiments using Azure Machine Learning using various algorithms.
During the second half of the day other work streams started. Technical evangelist Livi Erickson started working with members of the Topgolf team on creating a dashboard that will display various key performance indicators (KPIs) by calling an Azure Function that reads data from DocumentDB. Technical evangelist Ian Philpot started working with other developers from Topgolf, creating Azure Functions that would accept and process game data directly from Topgolf's data sources and capture Azure Machine Learning predictions using DocumentDB as a persistent store.
The team focused on refining the data and running more experiments in Azure Machine Learning. In parallel, work on the dashboard and functions continued. The dashboard was built as an Angular 2 website deployed to Azure App Service. The Azure Functions were built using Node.js. Both the Functions and the App Service website used Azure App Service's built-in CI/CD system. The source for each project was stored in a repository on GitHub. When a commit was pushed, it would trigger a deployment. By the end of day two the team was happy with the output of Azure Machine Learning, data was written to DocumentDB, and the Dashboard was pulling this data via a separate Azure Function from DocumentDB and displaying the designed KPIs.
On the last day of the hackfest the team concentrated on putting the final touches on the project and creating their presentation. With the refined dataset that was created during the event, Azure Machine Learning was able to provide predictions within a good tolerance. The team, both members from Topgolf and Microsoft, were extremely happy with the outcome.
The customer experience optimization model built during the hackfest is currently being reviewed by Topgolf and refined for use in production at their venues across the country. The final solution consisted of the following workflow:
1. Topgolf sends reservation info to an Azure Function via HTTPS.
2. That Azure Function calls Azure Machine Learning to provide suggestions that can improve the customer experience from the minute they walk through the door.
3. When the response is received back, the Azure Function writes the complete data to DocumentDB.
4. The Azure website that hosts the dashboard calls another Azure Function to retrieve data.
5. This Azure Function retrieves data from DocumentDB.
6. The entire system is deployed using the Web Apps feature with built-in CI/CD using webhooks from GitHub.
We developed two Azure Functions, both using Node.js as the runtime and JavaScript as the language. The functions are triggered by an HTTPS request and utilize the DocumentDB npm package. The first function accepts the data from the on-premises system, requests predictions from the Machine Learning API, and persists to a DocumentDB database. The second function pulls data from the DocumentDB database when a request is made by the Dashboard and shapes the data for display.
The website dashboard is hosted as an Azure App Service. It is a Single Page Application (SPA) based on Angular 2 written in JavaScript. It’s used to display KPIs to enable IT support staff and customers to make better decisions about their playing experience.
Azure Machine Learning is used to make customer experience enhancements based on calculations of the data collected from proprietary systems, which are not shared in this example.
### Azure Functions CI/CD
This video covers the CI/CD setup for deploying Azure Functions from a GitHub repo.
[![CI CD setup](https://img.youtube.com/vi/CPc2QpxDY40/0.jpg)](https://www.youtube.com/watch?v=CPc2QpxDY40)
Serverless computing, in this case Azure Functions, was a great option for reducing operational costs and dead simple operational management and scalability. However, currently the development cycle, particularly the debugging experience, is not what it will be. During the hackathon, team members with a Windows machine were able to use the functions-cli npm package to successfully debug locally, but those with a Mac had to deploy to Azure to test. Other than this inconvenience, getting started and deploying Functions to Azure was simple.
Azure Machine Learning was also simple to get started with and to run experiments on. Most of the time was spent pruning and shaping the data used to train and evaluate the models created during experiments.