Protobi is not just a pretty face for the data, it also provides a full-featured language for data cleaning and reshaping prior to analysis.

No matter how carefully you design a survey there are almost always changes you need to make to the data once it comes back:

  • combine multiple waves of an ATU
  • merge in translations for text open-ends in other languages
  • stack patient cases
  • calculate time intervals
  • define segmentations
  • remove outliers
  • zero-fill skipped values

You can now do all of the above (and more) within Protobi.

Previously you might have used SPSS, R, or external vendors to do this externally. You can still do that, and upload the results to Protobi as you wish.

But now you can also keep all your processing code in one place, integrated with your analysis, and documented.

Strapped for time? We’re happy to set up your data cleaning and reshaping for you, and show your analysts how to edit or author it.

A simple example

Let’s say our survey asked respondents two questions:

  • Q1: Do you have any pets? [Yes/No]
  • Q2: How many pets do you have? [1-999] [Ask only if Q1=Yes]

At analysis time we’d like to report the average number of pets in Q2. But the challenge is Q2 has blank values for people who don’t have pets, throwing off the average. So we’d like to recode those missing values to zero.

Under the Admin pages for the study, there’s a tab “Pre-calculate”. In the code area, enter the following:

  rows.forEach(function(row) {
      if (row.Q1==2) row.Q2 = 0; // set pet count to zero if no pets 
  })
  return rows;

Protobi loads your data into an variable rows. This is an array of objects, where each object represents a row of your data.

The code above iterates over each row of your data. Within the function, you can access columns by name. So row.Q1 is the response to Question 1 for that row.

A more advanced example

Let’s say you surveyed boat owners and asked:

  • Q1: On what date did you purchase your most recent boat?
  • Q2: On what date did you sell your boat? [leave blank if not sold]

But for analysis, maybe you don’t want the dates but the duration in months that they owned the boat. And if the boat isn’t sold, use the survey field date from the dataset.


 rows.forEach(function(row) {
     row.Q2_dur = moment(row.Q2 || row.field_date ).diff(row.Q1, 'months')
 })
 return rows;

Voila, your dataset now has a new column Q2_dur with the months of ownership.

Javascript syntax

Protobi runs in your browser, which gives you access to a full programming language called Javascript that gives you tremendous capability. For instance, above we used the library moment.js which can do advanced date calculations. But there are many other web libraries you can use too.

SPSS syntax

Are you already proficient in SPSS? Protobi can execute SPSS core syntax! Here’s the same example in SPSS…

   if (Q1 = 2) Q2 = 3.

R integration

Are you proficient in R? You can keep running R as you always have. Your R code can get data from Protobi and post the processed data back.

data <- protobi.download(projectId=<ID>, apiKey=<KEY>) 
 # ...your code here...
protobi.upload(data, key="main", projectId=<ID>, apiKey=<KEY>)

Here <ID> is an identifier you can get from the project URL, and <KEY> is a secret key that you can generate on your account page.

Advanced recoding

There’s a lot more that’s possible. We have great docs and examples. But for your project, let us show you what’s possible for your data.