AgensGraph: A Graph DB Helping to Solve World Hunger

DZone 's Guide to

AgensGraph: A Graph DB Helping to Solve World Hunger

Learn more about a graph database that is helping to solve world hunger.

· Database Zone ·
Free Resource

Image title

How can we help solve world hunger?

First published in DZone's 2019  Guide to Databases: Evolving Solutions and Toolsets.

In this article, we describe how data scientists in one of the world’s largest humanitarian organizations are using a graph database, AgensGraph, to analyze rich datasets and determine food security within vulnerable regions.

You may also like:  Using a Graph DB to Customize Online Learning


In the most extreme situations, such as war, flood, hurricane, earthquake, or fire, there are many vulnerable people left in need of critical nutrition to prevent serious health problems or even death. As part of the United Nations, the World Food Programme (WFP) assists such people around the world. Every day, too many men, women, and children lack a daily nutritious meal according to the WFP, which estimates that 821 million people still go to bed on an empty stomach each night and that one in three of the global population suffers from some form of malnutrition. 

The World Food Programme [CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0)]

Assisting 91.4 million people in around 83 countries each year, the WFP has, on any given day, 5,000 trucks, 20 ships and 92 planes on the move. The logistics alone are significant, and it is essential that the WFP is prepared to deliver the most effective response to every crisis. The Vulnerability Analysis and Mapping (VAM) unit within the WFP consists of 200 food security analysts based in over 70 countries such as Somalia, South Sudan and Yemen with a mission to provide help as it is needed in a timely and cost-effective way possible. There are many factors behind food poverty, and the team needs to understand the level of food insecurity in a particular region, and why that insecurity occurs.

To determine regional food security, the VAM unit gathers various data including economic analysis, thematic analysis, and geospatial analysis. However, another strand of their work is to determine the characteristics of an area by carrying out surveys through face-to-face or over the phone interviews. A single survey may have over 400 questions, and hundreds of thousands of local households and food suppliers are interviewed each year. 

The surveys are carefully designed and highly structured, but the amount of data is large, diverse, and extremely complex because: 

  • It is impossible to create one single universal standard that encompasses all possible health, livelihood, and socioeconomic variables for the many different regions at risk. 

  • A multitude of relationships exists among the variables themselves. As Gaurav Singhal, the lead data scientist of UN WFP puts it, “Food is not just something you eat. In rural areas, food is something you grow, food is something you transport and something you sell”.

Diverse Data Demystified

Let’s take a specific example of how the VAM unit works with the data they collect to infer new information and determine the most at-risk areas and people. This example is taken, with kind permission, from Gaurav Singhal’s presentation given at the Postgres Conference Silicon Valley in 2018. 

The VAM unit needed to consolidate their data about food consumption and expenditure, data which was collected by surveying different regions about diverse food groups, different units of measurement, varying currencies, and multiple food sources (such as whether food is purchased from a market, home-grown, or whether it comes via government distribution). How to collate this vital data into a single, useful repository?

The team found a solution by using a graph database to record the relationships between the variables, infer facts and organize the data. Working with AgensGraph from Bitnine Global, the VAM data scientists took the complex dataset and made sense of the information it contained. Singhal says in the presentation that, “...through the use of inferred facts, we were able to easily aggregate and coalesce highly disaggregated raw data, along multiple dimensions”. 

In the era of big data, many organizations are finding that traditional RDBMS cannot keep pace with the variety of data formats and their rapidly-changing nature. As just one example of the NoSQL database revolution, graph databases are increasingly proving themselves as a powerful technology in the data management community today. Gartner predicted that at least 70% of leading companies will have piloted a graph database project by the end of 2018.

AgensGraph is a multi-model graph database based on PostgreSQL to allow developers to integrate the relational and graph data model into one database. SQL and Cypher can be used in the same query, which allows developers to build upon the power of a graph database alongside a legacy SQL environment for data management. PostgreSQL users can easily migrate relational data into the graph with support from PostgreSQL extensions. AgensGraph also supports features such as ACID transactions, MVCC, triggers, and JSON and provides a browser to visualize the graph contents, forming an intuitive model of the real world.

One of the examples given in the presentation is a study of the dietary habits of a population receiving WFP cash handouts to buy food. The graph database can be queried to establish the families that are buying and consuming non-essential sugary food 7 days per week, but only consuming essential Vitamin A-containing food once per week. By establishing the regions and characteristics of families lacking education about the importance of Vitamin A, the WFP can focus their efforts to improve information. They may reduce cash handouts and instead introduce vouchers to be exchanged for those foodstuffs that contain Vitamin A, for example, in certain areas.

The following graphic illustrates the concept modeling behind this example: 

  • a household, which consumes a food group (in this case meat). 

  • a food group (meat), and the nutrition it contains

  • a household, which expends money upon such a food group.            

Defined Edge Types and Properties

Example Data

Even in this simple example, it is clear that the graph database queries and inference allowed the UN WFP to find a way to:

  • Identify the households with the most pressing malnutrition issues

  • Prioritize distribution of items that aligned with food consumption pattern analysis 

  • Plan appropriate nutrition education programs for long-term sustainability

AgensGraph is one of their key tools.  Here is a video that illustrates how they work with the database in more detail. 

For Further Information

The priority of the WFP is ‘Zero Hunger’, which is a pledge to end hunger, achieve food security, improve nutrition, and promote sustainable agriculture by 2030. Despite the progress so far, there is still a long way to go. To achieve this goal, governments, citizens, civilian organizations and the private sector must collaborate to invest, innovate and create lasting solutions. To accelerate the achievement, they work with various technology, of which Bitnine’s AgensGraph is one. AgensGraph Community Edition is licensed under AGPL 3.0, while the Enterprise Edition is licensed under a commercial license. 

Further Reading

Understanding Graph Databases

Building a Graph Database Wannabe (Part 1)

database, graph database management, multi-model databases, postgresql, rdbms, solve world hunger, world food programme, world hunger

Published at DZone with permission of Jo Stichbury , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}