Skip to main content

Where are new secondary schools most needed? Part III: socioeconomic variables

Spatial data science with the 2018 Continuous Household Survey: a census segment score built in Pentaho and the final school locations with PostGIS and Python.

The third and final part of the search for where to place 136 new secondary schools in Uruguay. Since distance to the nearest school wasn’t enough, the author adds variables from the 2018 Continuous Household Survey, builds a score per census segment with Pentaho Data Integration and places the schools one by one with PostGIS and Python. It closes with other uses of spatial data science.

Series «Where are new secondary schools most needed?», part 3 of 3. Part 1 · Part 2 · Part 3

Where should 136 new secondary schools go in Uruguay? In the second part of this series, distance to the nearest school wasn’t enough to answer that. This third and final part adds socioeconomic variables from the 2018 Continuous Household Survey by census segment, builds a score with Pentaho, places the schools with PostGIS and Python, and closes with other business problems spatial data science can solve.

Socioeconomic variables by census segment

Although I changed the approach in the second part, I didn’t get good results. Using only the distance to the nearest school, the algorithm didn’t predict good places for the next ones: it needed variables representing the educational and socioeconomic level of each area.

So I downloaded the person-level data from the 2018 Continuous Household Survey (Encuesta Continua de Hogares), which records the census segment where each person lives. Uruguay’s National Statistics Institute (INE) also provides a shapefile with the census segments.

Out of the more than 400 variables in the survey, we had to pick the ones relevant to this case. With help from contributors at Universidad ORT and in the banking sector, we selected and weighted the variables to use:

Selected variables and assigned weights (the red ones subtract instead of adding).

A score per census segment with Pentaho and PostGIS

Then I built a process in Pentaho Data Integration (Kettle/Spoon) to:

  • summarize the data (compute averages) at the census segment level instead of the person level;
  • filter to keep only people under 30 who haven’t finished secondary school;
  • pivot the variable values;
  • normalize the values so each variable always ranges from 0 to 1.

At the end of the process the table is loaded: for each defined variable it holds the actual value and the normalized value.

To get the score of each census segment as defined, I created a view:

With all that in place, the query that returns the weight of each candidate point is:

Placing the new schools with Python

The first point is inserted into the centros_anep table with a flag marking it as invented, and the query runs again, because the distance to the nearest school has to be recalculated including the new one. The version I actually used was this one, which returns the geom ready to insert:

In the Python code:

And here is the result:

New schools are shown in red

Business problems spatial data science can solve

There are several interesting tools to sink your teeth into: geopandas, fiona, shapely, pyproj, geopyspark and arcpy.

Spatial data science is gaining ground fast. Many business problems can be solved with these techniques, from problems very similar to this one (where to place a clinic, an ATM or a new supermarket branch) to more complex questions such as:

  • which regions are good for buying land as an investment;
  • whether a spatial pattern drives the prevalence of a disease and, if so, which regional factors contribute to higher or lower prevalence;
  • the optimal design of a camera surveillance network, whether for defense, traffic control or theft prevention;
  • route optimization.

Héctor Cotelo
Business Analytics & Information Management consultant

¿Listo para dar
el próximo paso?

Inicia tu camino
Otras publicaciones

Before asking how to use AI in a utility, it is worth asking whether the data is ready to support better decisions.

Six connected stages take a public power finance function from assessment to adoption, so AI can support better, faster and more traceable decisions.

Affordability, capital investment and resilience are now moving together. Utilities need scenarios to make decisions before the future becomes clear.

Quanam, a digital transformation, data and AI consultancy headquartered in Montevideo, Uruguay, is Certified in the Claude Partner Network. Its team holds Claude certifications, part of a path guided by one conviction: AI delivers more when people work alongside it.

Leave a Reply