Tools for Analyzing PiLR Data

Tools for Analyzing PiLR Data

Analyzing Your Data

The PiLR MBaaS platform provides a fast easy way to build and deploy a mobile application.  The data, metadata, and derived data help you gain a complete understanding of how your users are responding to your program, and what they are doing when they are interacting with the system.  PiLR provides broad support for users of R, an open software tool for data analysis and reporting.  We did this because R is reasonably priced and has a strong support community.  PiLR supports 3 primary mechanisms for R code to be used for data analysis:

  1. Download a file in csv format and load those files into your R development environment.
  2. Connect an R development tool like R Studio to PiLR via the PiLR-API we created so that R procedures can access PiLR datasets via a secure interface.  PiLR provides tools for issuing and managing security tokens.  Once the security setup is complete, an analyst can treat PiLR datasets as an external data source and use commands that are familiar to them to get some or all of the data in 1 or all datasets.  The geo-location demonstration applet uses this approach so that it could produce the map visualization and the plots.
  3. R code can be transformed to a package.  If this is done, the R code can be run on PiLR itself.  This offers 2 advantages:
  4. You are using our servers to run the R procedure
  5. This code can be used as part of a fully automated multi-step real-time process.


Geo-Location Demo Project Closer Look

In a previous post we talked about an applet that had real-time access to the PiLR platform.  The demonstration project was created in R using the following packages:

library(shiny)
library(leaflet)
library(rgdal)
library(maps)
library(geosphere)
library(ggplot2)
library(reshape2)
library(dplyr)
library(xtable)
library(jsonlite)
library(devtools)
library(httr)
library(pilr.api.r)

This is an example of the power of the R environment.  Plotting interactive data on a scalable map could be a daunting process if you were trying to write everything from scratch.  The effort to do this in R is greatly reduced because a community of dedicated developers has solved many of the problems for you.  In this case, most of the heavy lifting for the maps and map calculations were handled by pre-built packages(leaflet, rgdal, maps, geosphere).  We embedded this work in a Shiny application.  This creates a web application that enables real-time interaction.  At the bottom you can see our package(pilr.api.r).

We accessed 2 datasets to perform all of the work that was done in the demo application.  They are the Survey dataset and the Venues dataset.  To refresh your memory -- the demo project implements a location trigger.  The mobile app runs in background until it detects “entry” at a user defined Venue.  When this happens a notification is created on the phone.  If the user presses the notification they will bring the app to the foreground and be presented with a survey that asks them several questions.  The user’s responses to those questions are in the Survey dataset, and the Venues they created are in the Venue dataset.

The following code was used to access these datasets in my R server code.

 survey_data <- read_pilr(data_set = "pilrhealth:mobile:survey_data", schema = "1", 
                           query_params = list(group = "enrolled"))
  venue_data <- read_pilr(data_set = "pilrhealth:mobile:personal_venue", schema = "1",
                          query_params = list(group = "enrolled"))

 
  

The read operations were assigned to dataframes in my environment.  After the work to prepare the data,   the results were rendered using the following code and the leaflet package:

##render the leaflet map
output$mymap <- renderLeaflet({
  mymap <- leaflet(leaf_data1()) %>% setView(lng = lng_mean(), lat = lat_mean(), zoom=18) %>%
  clearMarkers() %>%
  clearShapes() %>%
  fitBounds(~min(lng_min()), ~min(lat_min()), ~max(lng_max()), ~max(lat_max())) %>%
  addTiles() %>%  # Add default OpenStreetMap map tiles
  addMarkers(~lng, ~lat, popup = ~as.character(name)) %>%
  addCircles(radius = ~count * 10, fillColor = "red")
})  # Print the map

This code was embedded in a shiny applet which is what creates the interactive experience as seen in the following video.

Summary

The total time required to get to the video output was about 20 hours.  5 hours to create and deploy the mobile app, and 15 hours of time to create an R application that processed the data.  Of course it took several weeks to collect enough data points to make the graphs and maps look reasonable :-).

We are not limited to R.  It is the default environment we support because of it’s broad support.  We are happy to build interfaces to meet your needs.  Interested in learning more contact us at info@pilrhealthcom.



Run analytics against real time data and help offload your local workstation. Once an algorithm is confirmed it can be uploaded for others to use.

Like
Reply

To view or add a comment, sign in

More articles by John Shade

  • Performance Management as a Game

    Many of my previous posts have been pretty dry – they are focused on technical aspects of collecting and analyzing…

  • Calculate Department Utilization

    In my last post I talked about a way to collect information to analyze production data. The process is easy because we…

  • Getting Performance Data

    Rate x Time = Production was the topic of my last post. The application of several data analysis techniques makes it…

  • Production = Rate x Time

    In my last post we talked about Pareto and his discovery that opportunity is unevenly distributed. By focusing our…

  • Your Missing Easy Opportunity

    Almost everyone I meet can attribute the phrase 80/20 to Pareto. Vilfredo Pareto was an Italian economist that noticed…

  • A Safety Reporting Prototype

    We just posted a prototype safety reporting project summary on our QuickStartrm site. Using PiLR we built a first…

  • Device Prototype Project

    We just posted a prototype sensor project summary on our QuickStartrm site. Using PiLR we built a first generation…

  • New Prototype Project

    We just posted a prototype project summary on our QuickStartrm site. Using PiLR we built a first generation prototype…

  • Value Add Your Customers Experience

    We live in an increasingly "on the go" world. I used to go to an office for any work that I had to get done even if it…

  • Leadership

    At some point in every business cycle you discover problems that need to be resolved. There is not an option of calling…

Others also viewed

Explore content categories