AWS Builder Center
Beyond the Queue: Building JalPriority AI for Fair Water Allocation

Beyond the Queue: Building JalPriority AI for Fair Water Allocation

How Team Avengers combined machine learning, constrained optimization, and AWS to explore fairer water distribution, account for historically underserved neighbourhoods, and improve allocation decisions when resources are limited.

Beyond the Queue: Building JalPriority AI for Fair Water Allocation

How Team Avengers combined machine learning, constrained optimization, and AWS to explore fairer water distribution when resources are limited.
Team: Team Avengers Team Code: SYM2MQ Track: Heat and Water Event: Environmental Hacks, Bharat Builds Tour Team Members: Anjali Sirohi and Harsh Giri

The Problem: When There Is Not Enough Water for Everyone

Water scarcity is not always caused by a heatwave. It can result from limited supply, rising demand, unequal distribution, or decisions that repeatedly leave some communities underserved.
When available water cannot meet the needs of every neighbourhood, someone has to decide who receives water first, how much each area gets, and how limited tanker capacity should be used.
Common approaches have their own limitations. First-come, first-served may favour those who request water earlier, while nearest-first dispatch may favour neighbourhoods closer to a depot. Neither approach necessarily accounts for the needs of communities that have repeatedly received less water than they require.
Heatwaves can make these challenges more severe by increasing demand and putting additional pressure on available supplies. But the underlying allocation problem exists even without extreme heat: when resources are limited, how do we distribute them efficiently without repeatedly neglecting the same communities?
That question became the foundation of JalPriority AI, our decision-support prototype for the Heat and Water track of Environmental Hacks, part of the Bharat Builds Tour powered by AWS Builder Center and WeMakeDevs.
Our goal was to explore how machine learning, constrained optimization, and historical fairness tracking could help decision-makers distribute limited water more transparently. Heat-related conditions are one factor the system can consider, not the only situation in which fair allocation matters.

How JalPriority AI Works

JalPriority AI brings together three key ideas: predicting shortages, generating feasible allocation plans, and accounting for historical deprivation.

1. Predicting shortages with XGBoost

The first step is estimating where the need may be greatest.
We use an XGBoost regression model to estimate neighbourhood-level water shortages. The model uses synthetic scenarios with features such as heat severity, population, demand history, and previous deliveries.
Heat severity is one of the factors considered by the model. The broader purpose of the prediction stage is to estimate shortages and provide useful inputs to the allocation process.
However, predicting a shortage does not determine how available water should be distributed. Even a good prediction must be translated into a feasible plan that respects the available supply and tanker capacities.
Our reported synthetic-data evaluation showed a mean absolute error of 884 litres for XGBoost, compared with 1,162 litres for a last-observed baseline. These figures describe the evaluated simulation, not proven accuracy on real municipal data.

2. Turning predictions into feasible plans

We use Google OR-Tools to support constrained water allocation and tanker routing.
The optimization stage works within operational limits, including available water supply and tanker capacity. Rather than simply ranking neighbourhoods, the system generates a plan that accounts for competing needs and practical delivery constraints.
We compare the proposed approach against two baseline strategies:
  • First-Come, First-Served: prioritizes the order in which requests arrive.
  • Nearest-First: prioritizes locations based on proximity.
The comparison considers seven metrics, including total unmet demand, priority-weighted unmet demand, remaining deprivation debt, minimum neighbourhood coverage, travel distance, constraint violations, and replanning time.
These metrics help reveal trade-offs. A plan may reduce travel distance while leaving some neighbourhoods underserved. Another may improve coverage but require more travel. Looking at multiple measures helps us examine allocation decisions beyond operational efficiency alone.

3. Making repeated deprivation visible

One of the defining ideas behind JalPriority AI is its deprivation-debt ledger.
When a neighbourhood's demand remains unmet, that shortfall is recorded and carried into future allocation decisions. This allows the system to account for historical deprivation rather than treating every delivery window as an isolated event.
The purpose is to reduce the risk of repeatedly overlooking the same communities. A neighbourhood should not disappear from consideration simply because it is distant from the depot or has been unable to receive sufficient water in previous rounds.
The mechanism does not guarantee fairness on its own. Its effectiveness depends on how priorities and weights are defined, how outcomes are evaluated, and whether the allocation rules reflect the needs of the communities affected.

Human Decisions Remain Central

JalPriority AI is designed as a decision-support tool, not an autonomous authority over an essential resource.
A dispatcher can review a proposed plan, inspect allocation explanations, and approve, edit, or reject the recommendation. The system also records audit information so decisions can be examined later.
It supports replanning when circumstances change, such as when a tanker becomes unavailable or the available supply is reduced. Instead of treating the original plan as fixed, the system can help generate a revised plan under the updated constraints.
These capabilities matter whenever allocation decisions have to balance competing needs. A recommendation should be understandable, its constraints should be visible, and responsibility for the final decision should remain with the appropriate human authority.

Building the Backend and Integrating AWS

A useful allocation model needs more than a prediction function and an optimizer. The surrounding application must connect the components, manage data, expose workflows, and preserve decisions.
We built the backend in Python using FastAPI. The application brings together the prediction and optimization logic with allocation plans, approval workflows, audit records, and the dashboard.
We also designed the storage layer to support local development and cloud deployment.
SQLite supports local development, while Amazon DynamoDB provides persistent cloud storage for the deployed application. Keeping data access behind a storage layer allows the application logic to work with different storage configurations without requiring the entire system to be rewritten.
During development, we used Moto to test DynamoDB interactions locally without making every test dependent on a live AWS database. We also implemented a table-creation script to make database setup more repeatable.
The application is now running on Amazon EC2, with Amazon DynamoDB used for live database storage. This brings the application and its cloud database together, although a live deployment alone does not establish production readiness or prove that the allocation approach works in real municipal conditions.
You can explore the project here:

Our Experience at DTU

Environmental Hacks ran online from October 8 to 11, 2026. On October 10, the Bharat Builds Tour brought participants together for an optional in-person build day at Dr. B.R. Ambedkar Auditorium, Delhi Technological University (DTU), Delhi.
One of the most memorable parts of the experience for me was getting to interact personally with Arkodyuti Saha, Jessica Gilmore, Lindsey Erlick, and Chanpreet Singh. They were all helpful and approachable, and the event organizers were supportive throughout the experience.
These interactions made the day valuable beyond the work we were doing on the project. Building during a hackathon means working through technical decisions under time constraints, but it also gives you an opportunity to connect with people from the wider technology community.
Our work on JalPriority AI brought together machine learning, optimization, backend engineering, and cloud deployment. Getting those pieces to work together required us to think about the complete workflow rather than treating each feature as an independent task.
The DTU experience reminded me that hackathons are not only about the final application. The people you meet and the community you become part of are meaningful parts of the experience too.

The Environmental Goals Behind the Project

JalPriority AI's intended use connects to several United Nations Sustainable Development Goals:
  • SDG 6: Clean Water and Sanitation. The system explores how allocation decisions can make distributed quantities and unmet demand more transparent.
  • SDG 11: Sustainable Cities and Communities. Its planning, comparison, and replanning capabilities could support municipal decision-making when water resources are constrained.
  • SDG 13: Climate Action. By incorporating heat severity into shortage prediction, the prototype explores decision support for heatwave-related water stress.
  • SDG 10: Reduced Inequalities. The deprivation-debt mechanism is designed to make repeated shortfalls visible rather than allowing historical neglect to disappear between allocation windows.
These are intended contributions, not measured real-world outcomes. Our current evaluation uses synthetic scenarios. We have not established improved water access for actual residents or demonstrated that the system produces fairer outcomes in a real municipal deployment.
Before a field pilot, the model would need evaluation on appropriate historical data, the fairness rules would need review with affected stakeholders, and recommendations would need to be compared with existing dispatch practices.

What We Learned

Building JalPriority AI reinforced three important lessons for us.
First, prediction is not the same as decision-making. A model can estimate a shortage, but an optimizer is needed to turn that estimate into a feasible plan under real constraints.
Second, fairness needs to be made visible. Tracking historical shortfalls and comparing multiple allocation strategies helps expose trade-offs that a distance-only or request-order strategy can hide. The resulting decisions still need human scrutiny.
Third, cloud integration is part of the engineering. Separating storage from application logic and testing DynamoDB interactions locally helped us establish a clearer path from local development to a running application.
We also learned to distinguish successful technical implementation from evidence of real-world impact. A working model, passing tests, and a live application are meaningful milestones, but they do not replace validation with real data and the people who would be affected by the system.

Looking Ahead

JalPriority AI explores how limited water can be allocated more transparently, efficiently, and fairly when demand exceeds available supply. Heatwaves are one important use case, but the underlying challenge is broader: allocation decisions should account for need, operational constraints, and the history of who has gone without.
The next step is to validate the approach against real operational data, review the fairness assumptions with communities and municipal experts, and measure how its recommendations compare with existing practices.
For Team Avengers, Environmental Hacks gave us an opportunity to bring machine learning, optimization, backend engineering, and AWS deployment together around a concrete environmental challenge.
The question that started the project remains the one we want to keep investigating: when resources are limited, how can we make the decisions that distribute them more transparent, practical, and accountable?
Team Avengers Anjali Sirohi and Harsh Giri
#EnvironmentalHacks #AWSBuilderCenter #BharatBuildsTour #JalPriorityAI #MachineLearning #AWS #Sustainability
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article