Lets get to the tech

The tech behind MyWell: A water tracking app for Farmers in rural India

Lewis Daly
vessels
6 min readMar 29, 2017

--

My first few posts have been a bit of housekeeping, but one of my goals here is to get software developers like myself interested in solving ICT4Dev problems. So, lets talk about some technical stuff. That will get them interested… right?

The Problem

In many semi-arid parts of India, groundwater (water in aquifers, pumped from wells) is the main — or even sole — source of water. Farmers in these parts rely upon groundwater for their crops, and these communities need this water for day to day things like drinking, bathing, washing etc.

The amount of water available to the farmers and villagers is heavily dependent on the amount of rainfall in the wet season. During the wet season, water falls and seeps through the ground to replenish the aquifers, a process also known as ‘Aquifer Recharge’. This water needs to be shared between farmers within a village, across multiple villages, and sometimes even across state boundaries.

The scarcity of water, combined with the fact that water is relatively cheap to obtain through diesel or electric pumps leads to a classic economics problem known as the “Tragedy of the commons”.

Sidebar: The Tragedy of the Commons is an economic problem where every individual tries to maximise their benefit from a shared resource. The combined actions of each individual results in depleting the resource, and nobody ends up benefitting.

Enter Project MARVI

MARVI stands for Managed Aquifer Recharge for Village level Intervention. The aim of Marvi is to improve the water security and enhance the livelihood for rural communities in India (MARVI, 2016). Three primary areas of approach for the project are:

  • Better Education: Improve the community understanding of agriculture and water conservation.
  • Improved Data & Information: More detailed well, rainfall and aquifer data, and better understanding of this information at a village level.
  • Building Communities: Bringing communities together across villages to work to better understand water conservation, agriculture and ultimately to better share groundwater.

So… you promised some Technology?

MyWell is the technology component of Marvi. MyWell is an app for tracking well readings across the wells all monitored in Marvi. It works on Android, iOS, Web, and even over SMS. It crowdsources well readings and rainfall information, removing the need for paper based recordings, spreadsheets and copious amounts of email. Additionally, it will allow the Marvi project to scale up from 10 villages to hopefully hundreds or even thousands (eep!).

How it works

Every village has a number of volunteers trained to take well readings across the 50 or so wells in each village. These volunteers are called Bhujal Jankaars (BJ), a Hindi word meaning “Groundwater informed volunteer”.

BJs travel to the wells, and take readings of the depth of the current water level from a defined spot marked on the well. Instead of recording it on paper, the BJ can upload the reading using the MyWell smartphone app, or SMS the reading straight to the MyWell system.

This reading is then saved to MyWell’s database, where it can be accessed at a later date for statistics and data analysis.

Aditionally, MyWell allows BJ’s and administrators to:

  • Track rainfall levels
  • Register new wells, rain gauges and checkdams
  • Take and attach pictures to a well

Anyone can query MyWell’s data to get a clear picture of what is going on in a given well or village, and compare it to what has been happening over the last 2 years.

A graph showing the difference in well level over 3 years.

The Technology

We developed MyWell using a Microservices approach on Docker.

The MyWell Stack — each represents a container inside a docker-compose file

Front End

The front end uses Ionic, a framework for developing web-based applications and packaging them to run on iOS and Android. This allowed us to develop for Android, iOS and Web simultaneously.

Sidebar: Universal Mobile Frameworks

We started working on MyWell almost 2 years ago. Since then, a newer (shinier) universal mobile framework has come out — React Native. I have pondered many times about switching over to React Native, but since this would require just about an entire rewrite of the front end, I’ve decided to keep going with Ionic for now. I’m also quite skeptical about these kinds of frameworks — in the future, it may be best for us to focus just on Android, as none of the end users of MyWell even have iOS devices, as they are too expensive.

Backend

The backend is written in Javascript, using Node.js. More specifically, it uses Loopback — a framework built on top of Express.js for rapidly building APIs. It was helpful in order to get everything up and running, but has some seriously fatal flaws that make it a little bit of a pain sometimes, especially when dealing with complex-ish SQL queries.

Database

We are using a MariaDB docker image for our database. There’s nothing all that special or unique going on here.

MyWell — the entire system!

SMS Gateway

Keen readers will notice that I’ve left something pretty important out; a way to communicate to MyWell over SMS. We do this using an SMS Gateway. The SMS gateway provides us with an Indian virtual mobile number, which farmers and BJ’s can message to interact with MyWell over SMS. We are using Way2Mint, an Indian provider whose website seems to dissapear every now and then. Luckily, unlike their website, the messages are quite reliable.

When a message is sent to the virtual mobile number, Way2Mint converts it into a HTTP request, which is then forwarded on to our backend.

Hosting

The entire service is hosted on a single $5/month DigitalOcean droplet. It suits our needs just perfectly, and since it is all built using Docker, we can pick it up and move it to another cloud provider any time we want.

Next Steps

MyWell started out as a university project, but it’s grown into something much more. My goal is to use MyWell as a starting point for this company, Vessels. At Vessels, we are passionate about using IT to help needy people, and this MyWell is just one such example.

For Marvi and MyWell specifically, we are currently hoping to get funding for the next round of the project, in order to expand from 10 villages to initially 100, and then several orders of magnitude larger! From a technology perspective, this will involve scaling the system, and improvements such as better data analytics and general bug fixes.

And for myself, I hope that I can use this as a starting point for a Phd. There is plenty of work to be done here, and certainly some unique contributions to the field of ICT for development.

Well, that is a basic rundown of MyWell, the motivations and some of the technology behind it. I may write in more detail about the technology stack, if you would like, but for now I hope this gives you a good overview.

You can check out the web version of MyWell here. It’s also available on the Google Play store here.

As always, thanks for reading, and feel free to visit us at vesselstech.com, or send me an email at lewisdaly@me.com .

--

--