Chapter 2-Wordpress and Google Apps APIs Came to My Rescue

This is the second article in a series about my learning curve in building an online business simulation model in WordPress. Check here if you didn’t catch the first article. The setup was an assignment to bail out a distressed project for the Department of Defense (Air Force specifically). I got the project through a consultancy attached to The University of Tennessee in Knoxville.

They had been using the services of one of the business school faculty to code a new online simulation game to teach DoD personnel how to improve the process of managing asset acquisition projects (fighter jets specifically). The atmosphere was one of intense scrutiny by the taxpaying public and the Pentagon over a history of gruesome cost overruns, so there was considerable pressure for an effective training tool. The developer/professor had a brilliant reputation as an original developer of a very popular B-school management simulation game called “Marketplace”, used by several universities. He also had ninja level PHP coding skills. He was coding the entire process from scratch using MySQL and PHP, with no apparent use of a foundational CMS platform. The code base became a textbook case of “spaghetti code”. While the developer was quite skilled, the time pressures were simply too intense for him to do code documentation and commenting.

It became a classic instance of a “single point of failure”. Tragically, this valued professor/developer suddenly died at his desk one day. Now what??!! The project team panicked. I was offered an opportunity to take up the baton and continue the website development. Against my gut instincts, I said with a perfectly straight face, “OK, I can do that”. There was no way I nor any other mere mortal developer could figure out what the developer’s code base was doing; I tried but that was going nowhere. But I had an ace up my sleeve.

wp-logoRegarding the basic website structure of page content, site navigation, styling, and all the other built-in goodies in a CMS, I knew that WordPress would provide a quick way to do all the heavy lifting for at least that portion of the simulation. Secondly, I recognized that the fundamental process of the simulation model was one best suited for a spreadsheet environment. The idea was that team players would experiment with alternative management tactics and decisions in managing the contract for the aircraft acquisition process. Those decisions were captured in a series of input screens, and those decisions then rippled throughout a very complex, convoluted network of effects on other stages of the process.

The team players then evaluated the efficacy of their experimental decisions on the overall financial and operational success of the program. This was a classic spreadsheet situation if I ever saw one, but the original developer was coding all of those complex interactions via raw PHP code and MySQL calls.

My second ace-up-my-sleeve was that I knew I could capture the complex interactive simulation logic in a parallel online spreadsheet like Google Sheets. While Microsoft is moving slowly in this interactivity direction, Google had move further down the road in providing programmatic interactivity with its spreadsheet tool, so I followed that direction.  I was vaguely aware that Google had developer APIs to interact with their tools, but early on, I had no idea how tightly integrated I could make it within the context of a WordPress website.

An unsatisfying scenario would have been to have a typically polished WordPress website for the participants to read instructions and follow the assignment process, and then devolve to a parallel multi-sheet Google spreadsheet, open in a separate window to do inputs and evaluate results. That would in a rudimentary way, satisfy the basic requirements for the simulation, and at least get us out of the immediate problem. But needless to say, it would have been a very unprofessional and less than seamless interactive process.

Google ChartsSo I began an intensive exploration into two of Google’s core APIs: The Google spreadsheet API (check here for more details) and the Google data visualization API (check here for more details). Notice that their APIs are based on a Google-specific Javascript library;  very friendly and familiar turf for developers. So far; so good. I knew I needed the ability to input decision variables into a Google spreadsheet and then present various pieces of content from other parts of the spreadsheets in various pages throughout the WordPress site. I also needed to provide dashboard-style charts and graphs at various stages of the simulation, as these participants are accustomed to that type of feedback environment. The Google spreadsheet tool provides its own built-in forms capability to input changes into a spreadsheet. This could be opened in modal windows at various simulation stages. However, the built-in Google forms are heavily branded with the Google look. Who can blame them since they are providing this free functionality?  But that would not have been my preferred way of receiving input.

My best case scenario would be to have an embedded, non-branded input form or table inside the appropriate pages within the website, and a series of data visualizations, tables, icons, etc., in the simulation “results” pages. After a considerable research process, I found some effective ways to do precisely those things. Ideally, team participants wouldn’t even be able to recognize that they were interacting with a background spreadsheet at all. They would only see that their decisions impacted results in appropriate ways, and all of that would be seamlessly contained within the context of a polished, professional website.



One more key requirement of the simulation process… The team participants all fell into specialized roles in the simulation, comparable to their real-world job descriptions. This meant that some individuals could see and interact with certain decisions (pages) in the process and not others, depending on their roles. Others could see and interact with all of them. WordPress’ role & capability management features satisfied that need perfectly. I used Justin Tadlock’s well-established Members plugin to allow me to manage selective role-based page access throughout the site.

Stay Tuned…

In subsequent articles on this saga, I’ll drill down into the details of how I implemented specific site interaction with the background Google spreadsheets and how I utilized their charts & graphs tools.