Improve Sampling Accuracy with Weighted Random Selections


Every data collector eventually runs into this issue at some point — you know the makeup of your population as a whole, but you only have access to a small group that isn’t representative. For example, you know that as a whole, the population pizza topping preference for plain cheese:pepperonni is 1:1. However, you only have access to a population heavy in vegetarians and you need opinions that reflect everyone.

In this article, we’ll build a survey function that randomly selects people to survey in a weighted manner. The weighting adjustment is a common statistical correction technique that compensates for the presence of bias. It gives underrepresented people or elements in your sample a larger weight than those over-represented. In the pizza example, you know you’ll need to weight the non-vegetarian open-to-eating-pepperoni people more in order to avoid interviewing too many vegetarians.

 Continue reading Improve Sampling Accuracy with Weighted Random Selections...

Ona This Month April 2017 Newsletter



What’s new?

Tableau connector for data visualization

We are excited to announce the Tableau App for Ona. Tableau is a data visualization tool that can create visually appealing reports, charts, graphs, and dashboards using your data from Ona. Here is an example:


 Continue reading Ona This Month April 2017 Newsletter...

Redirecting HTTP traffic while using AWS Target Groups


A few months ago we received a support query from a user who was unable to log in. We couldn’t replicate the issue and they weren’t able to work with us to get it fixed. We concluded that they were doing something unique and had ended up fixing it from their end somehow.

Fast forward to March 5th, when we sent email invitations for a Nairobi Linux Users Group meet-up with an HTTP—not HTTPS—link to the login page,, and got a complaint that the site did not redirect to HTTPS on the /login or /join routes. This was a serious problem because we only perform sign-ups, log-ins or any other form of data exchange over HTTPS, including setting cookies.

When we find the user’s authentication cookies are not set, or are expired, we reload the page so that they can get a new authentication cookie. We implemented this as shown below, by checking for a 401 status from the OnaData API. More of that code is here.

(defn http-request
  "Wraps cljs-http.client/request and redirects if status is 401"
  [request-fn & args]
  (let [response-channel (chan)]
      (let [original-response-channel (apply request-fn args)
            {:keys [status] :as response} (<! original-response-channel)]
        (if (= status 401)
          (set! js/window.location (.href js/window.location))
          (put! response-channel response))))

As a consequence of this setup, when a user connects over HTTP and is not redirected to HTTPS they can end up in an endless loop of reloads when they try to sign-up, log-in or submit data in any other way. When we tried it ourselves, HTTP redirected to HTTPS just fine. However, we noticed that it didn’t redirect on a fresh Firefox install, assuming this fresh install didn’t have add-ons like HTTPS Everywhere.

 Continue reading Redirecting HTTP traffic while using AWS Target Groups...

3,725 Health Posts Mapped in Jakarta in a Massive Grassroots Empowerment Effort


Health posts in Jakarta mapped by PKK.

We caught up with Renold Lim, a volunteer at Jakarta-based grassroots organization Pemberdayaan Kesejahteraan Keluarga (PKK), which aims to improve health services to the urban poor by sharing data about the realities of street-level health services. It is a colossal effort. Given that the city of 10 million has 400,000 poor residents, it requires coordinating and training over 1,200 volunteer data collectors to map data from 3,725 health facilities. They’ve managed to do this successfully — so far their efforts have resulted in more funding, new equipment, and government buy-in. In this short interview, Renold shares some tips for making the process go smoothly and what works at scale.

ONA: Please tell us about your organization and what you’re trying to do

RENOLD LIM: PKK is a non-governmental, non-profit organization based in Jakarta. Our mission is empowerment for family welfare and we have existed for over 45 years. Our activities include organizing pre-school education for the poor, running vocational classes for women, and advocating for public spaces in low-income areas. An ex-government official runs it. I got involved in March 2016. I was a volunteer at the Office of the [Jakarta] Governor and was introduced to the governor’s wife, who is involved with PKK.

 Continue reading 3,725 Health Posts Mapped in Jakarta in a Massive Grassroots Empowerment Effort...

How to Increase Security by Encrypting Form Data


Encrypting form data incorporates an added level of security by making your data private, unreadable, and tamper-proof. This security mechanism can help you meet strict data privacy requirements sometimes set by ethical review boards for research studies. For example, you should encrypt data if you have surveys on highly sensitive topics like domestic violence and want to take all precautions so data isn’t available to unintended people. This article will show you how to encrypt form data and how to decrypt the data for analysis.

 Continue reading How to Increase Security by Encrypting Form Data...