library(askpass)
library(brandr)
library(checkmate)
library(cli)
library(dplyr)
library(enderecobr)
library(fs)
library(geobr)
library(geocodebr)
library(ggplot2)
library(googlesheets4)
library(groomr) # github.com/danielvartan/groomr
library(here)
library(httr2)
library(labelled)
library(lobstr)
library(lockr) # github.com/danielvartan/lockr
library(lubridate)
library(magrittr)
library(nanoparquet)
library(numbersBR)
library(orbis) # github.com/danielvartan/orbis
library(osfr)
library(parallel)
library(purrr)
#library(pmtiles)
library(quarto)
library(readr)
library(scales)
library(sf)
library(stringr)
library(tidyr)
library(vroom)
library(xml2)
library(zip)Mapping Accessibility to Health Food in Brazilian Favelas and Urban Comunities
Overview
The present study aims to provide maps generated through the Kernel Density Function regarding access to healthy food in Brazilian favelas and urban communities by obtaining, processing, geocoding, and classifying CNPJs data from the Brazilian Federal Revenue Service (RFB), as well as acquiring, processing, geocoding, and classifying (OSM) establishment data via the Overpass API.
The classification of food healthfulness follows Locais-Nova study, using Group 0 (G0), which is not part of the original classification but rather a subgroup within G1 + G2. This subgroup is composed of establishments that exclusively sell healthy foods that should constitute part of the population’s diet.
For instructions on how to run this work, see the repository README.
Problem
The AcessoSAN project aims to develop new methods for measuring and analyzing inequalities in access to healthy food, particularly in Brazilian favelas and urban communities. To achieve these objectives, it is necessary to use reliable and up-to-date datasets regarding establishments that sell healthy food.
The Brazilian Federal Revenue Service RFB provides records of companies operating in Brazil, including food retailers. However, it does not provide geocoded information, which is necessary for spatial analysis. This study follows the piepelnes developed by Daniel Vartanian et al. (2026b) to georeference RFB CNPJs data and by Flávio Soares de Freitas et al. (2026) obtain accessibility metrics for Group G0.
Furthermore, in order to better understand the existing informational gaps regarding access to healthy food in favelas and urban communities, analyses will also be conducted using data available through the Overpass API as a means of comparison with the results obtained from the RFB. RFB.
Data Availability
Methods
Source of Data
The data used for this this work comes from:
- Brazilian Federal Revenue Service (RFB):
- Legal entities data from the National Register of Legal Entities (CNPJ) database, used for company identification (Brasil et al., n.d.).
- Codes of Brazilian agencies and municipalities (Tabela de Órgãos e Municípios, TOM) (Brasil & Sistema de Vigilância Alimentar e Nutricional, n.d.), used to identify municipalities in the CNPJ database.
- Brazilian Institute of Geography and Statistics (IBGE):
- Brazilian municipalities data via the
geobrR package (Pereira & Goncalves, n.d.), used for cross-referencing. - Codes and descriptions from the National Classification of Economic Activities (CNAE) (Instituto Brasileiro de Geografia e Estatística & Comissão Nacional de Classificação, n.d.), used to match establishments to the Locais-Nova groups.
- Open spatial datasets of Brazilian addresses from the National Address Register for Statistical Purposes (CNEFE) via the
geocodebrR package (Pereira & Herszenhut, n.d.), used for geocoding the establishments. - Tract boundary data from the Brazilian 2022 Census and municipal boundary data via the
geobrR package (Pereira & Goncalves, n.d.), used for spatial analysis and population density calculations. - Tract population data from the Brazilian 2022 Census via the
censobrR package (Pereira & Goncalves, n.d.), used to calculate population density.
- Brazilian municipalities data via the
- Center for Metropolitan Studies (CEM):
- Lookup table providing the classification linking the establishments CNAEs codes to the Locais-Nova groups (Fenandes & Giannotti, 2026), used to classify establishments into the Locais-Nova groups.
-
Mapzen Terrain Tile
- Terrain data (Mapzen, n.d.) via the
elevatrR package (Hollister et al., 2025), used to calculate travel times and accessibility metrics.
- Terrain data (Mapzen, n.d.) via the
- OpenStreetMap (OSM):
- Road and footpaths spatial data (OpenStreetMap Contributors, n.d.) via the Geofabrik project (Geofabrik GmbH, n.d.), used to calculate travel times and accessibility metrics.
-
PMTilesBR: Tiled Geospatial Data for Brazil
- Brazil municipality data in PMTiles format (Vartanian et al., 2026), used for plotting geographical information in interactive maps using MapLibre (MapLibre Contributors, 2022) with the
mapglR package (Walker, 2026).
- Brazil municipality data in PMTiles format (Vartanian et al., 2026), used for plotting geographical information in interactive maps using MapLibre (MapLibre Contributors, 2022) with the
-
Uber Technologies:
- Hexagonal grid data structured using the hexagonal hierarchical geospatial indexing system (H3) (Uber Technologies, n.d.), processed with the
h3jsr(O’Brien, 2023) R package, used to create hexagonal grids for spatial analysis and visualization.
- Hexagonal grid data structured using the hexagonal hierarchical geospatial indexing system (H3) (Uber Technologies, n.d.), processed with the
Data Munging
The data munging follows the data science workflow outlined by Wickham et al. (2023), as illustrated in Figure 1. All processes were made using the Quarto publishing system, along with the AWK (Aho et al., 2023) and R (R Core Team, n.d.) programming languages, supported by several R packages.
For data manipulation and workflow, priority was given to packages from the tidyverse, rOpenSci and r-spatial frameworks, as well as other packages adhering to the tidy tools manifesto (Wickham, 2023).
Source: Reproduced from Wickham et al. (2023).
Data Structure
Brazilian Federal Revenue Service (RFB)
Open Street Map (OSM)
Travel Matrix
The travel matrix is computed using the r5r R package (Pereira et al., 2021), which interfaces with the R5 routing engine. This tool enables detailed travel time calculations based on multimodal transportation networks, accounting for road types, traffic conditions, and elevation changes. Travel times are derived from OpenStreetMap (OSM) road and footpath data (OpenStreetMap Contributors, n.d.) and elevation data from the Mapzen Terrain Tile dataset (Mapzen, n.d.).
Code Style
The Tidyverse tidy tools manifesto (Wickham, 2023), code style guide (Wickham, n.d.-a) and design principles (Wickham, n.d.-b) were followed to ensure consistency and enhance readability.
Reproducibility
The pipeline is fully reproducible and can be run again at any time. To ensure consistent results, the renv package (Ushey & Wickham, 2025) was used to manage and restore the R environment. See the README file in the code repository to learn how to run it.
Load Packages
Import, Process, Geocoded and Classify CNPJs from Bazilian Federal Revenue (RFB)
This pipeline was adapted from the pipeline made by Daniel Vartanian et al. (2026b) to geocode only the G0 groups.
Set the Environment
Set Keys
Veja a seção Disponibilidade dos Dados para mais informações.
osf_auth(Sys.getenv("OSF_PAT")) # askpass())public_key <- here(".ssh", "id_rsa.pub")private_key <- here(".ssh", "id_rsa")password <- Sys.getenv("ACESSOSAN_PASSWORD") # askpass()Set Data Directories
for (i in c(raw_data_dir, input_data_dir, data_dir)) {
if (!dir_exists(i)) {
dir_create(i, recurse = TRUE)
}
}Check Parameters
The pipeline main parameters are defined in the YAML header of its Quarto document.
The year and month variables represent the year and month of the consolidated RFB CNPJ dataset.
The municipality_codes variable identifies the IBGE codes of the municipalities included in the analysis. Click here to see a list of all Brazilian municipalities and their codes.
params |> lobstr::tree()
#> <list>
#> ├─year: 2026
#> ├─month: 1
#> ├─municipality_codes<int [5]>: 2507507, 3106200, 3550308, 4314902, 1501402
#> └─h3_resolution: 9assert_int(params$year, lower = 1980, upper = 2050)
assert_int(params$month, lower = 1, upper = 12)
assert_integerish(params$municipality_codes, lower = 1100015, upper = 5300108)Download and Import Locais-Nova CNAEs Lookup Table
See the Source of Data section for more information.
Although restaurants are part of the Locais-Nova classification, they were excluded from this analysis due to conflicting evidence on how to reliably identify them using company registry data.
Download Data
locais_nova_lookup_file <-
input_data_dir |>
file.path("locais-nova-lookup-data.rds")if (!file_exists(locais_nova_lookup_file)) {
locais_nova_lookup_data <-
"1ipCw2FM3aUOdRd4w55J5SUEgXDCogxWZF-NZi0A-o_4" |>
read_sheet(sheet = "Dataset")
locais_nova_lookup_data |> write_rds(locais_nova_lookup_file)
}Import Data
locais_nova_lookup_data <- locais_nova_lookup_file |> read_rds()locais_nova_lookup_data |> glimpse()
#> Rows: 540
#> Columns: 7
#> $ cnae <chr> "4711302", "5611201", "4722902", "4721102", "4721101",…
#> $ description <chr> "Supermarket 1", "Restaurant", "Fish Market", "Bakery …
#> $ federal_unit <chr> "AC", "AC", "AC", "AC", "AC", "AC", "AC", "AC", "AC", …
#> $ g0 <lgl> FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,…
#> $ g1_g2 <lgl> TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, F…
#> $ g3 <lgl> FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, F…
#> $ g4 <lgl> TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE…Download, Import, and Process Municipality Data
See the Source of Data section for more information.
Download and Save Data
read_municipality_file <-
input_data_dir |>
file.path(
paste0(
paste(
"read_municipality",
"code",
"all",
"year",
params$year |> closest_geobr_year(type = "municipality"),
"simplified",
FALSE,
sep = "-"
),
".rds"
)
)
#> ! The closest map year to 2026 is 2024. Using year 2024 instead.if (!file_exists(read_municipality_file)) {
municipalities_data <-
read_municipality(
year = params$year |> closest_geobr_year(type = "municipality"),
simplified = FALSE,
showProgress = FALSE
)
municipalities_data |> write_rds(read_municipality_file)
}Import Data
municipalities_data <- read_municipality_file |> read_rds()municipalities_data |> glimpse()
#> Rows: 5,571
#> Columns: 8
#> $ code_muni <dbl> 1100015, 1100023, 1100031, 1100049, 1100056, 1100064, …
#> $ name_muni <chr> "Alta Floresta D'oeste", "Ariquemes", "Cabixi", "Cacoa…
#> $ code_state <dbl> 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11…
#> $ abbrev_state <chr> "RO", "RO", "RO", "RO", "RO", "RO", "RO", "RO", "RO", …
#> $ name_state <chr> "Rondônia", "Rondônia", "Rondônia", "Rondônia", "Rondô…
#> $ code_region <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
#> $ name_region <chr> "Norte", "Norte", "Norte", "Norte", "Norte", "Norte", …
#> $ geom <MULTIPOLYGON [°]> MULTIPOLYGON (((-61.9300418..., MULTIPOLY…Filter Data
municipalities_data |> glimpse()
#> Rows: 5
#> Columns: 8
#> $ code_muni <dbl> 1501402, 2507507, 3106200, 3550308, 4314902
#> $ name_muni <chr> "Belém", "João Pessoa", "Belo Horizonte", "São Paulo",…
#> $ code_state <dbl> 15, 25, 31, 35, 43
#> $ abbrev_state <chr> "PA", "PB", "MG", "SP", "RS"
#> $ name_state <chr> "Pará", "Paraíba", "Minas Gerais", "São Paulo", "Rio G…
#> $ code_region <dbl> 1, 2, 3, 3, 4
#> $ name_region <chr> "Norte", "Nordeste", "Sudeste", "Sudeste", "Sul"
#> $ geom <MULTIPOLYGON [°]> MULTIPOLYGON (((-48.5257946..., MULTIPOLYGON (((-34.88…Transform Data
municipalities_data <-
municipalities_data |>
st_transform(st_crs(4326)) |>
select(
municipality = name_muni,
municipality_code = code_muni,
state = name_state,
state_code = code_state,
federal_unit = abbrev_state,
region = name_region,
region_code = code_region,
geometry = geom
)municipalities_data |> glimpse()
#> Rows: 5
#> Columns: 8
#> $ municipality <chr> "Belém", "João Pessoa", "Belo Horizonte", "São Pa…
#> $ municipality_code <dbl> 1501402, 2507507, 3106200, 3550308, 4314902
#> $ state <chr> "Pará", "Paraíba", "Minas Gerais", "São Paulo", "…
#> $ state_code <dbl> 15, 25, 31, 35, 43
#> $ federal_unit <chr> "PA", "PB", "MG", "SP", "RS"
#> $ region <chr> "Norte", "Nordeste", "Sudeste", "Sudeste", "Sul"
#> $ region_code <dbl> 1, 2, 3, 3, 4
#> $ geometry <MULTIPOLYGON [°]> MULTIPOLYGON (((-48.5257946..., MULTIPOLYGON (((-…Download, Import, and Transform Agencies and Municipalities (TOM) Data
See the Source of Data section for more information.
Download Data
municipalities_tom_data_file <-
input_data_dir |>
file.path("municipalities_tom_data.csv")if (!file_exists(municipalities_tom_data_file)) {
request("https://www.gov.br") |>
req_url_path_append("receitafederal") |>
req_url_path_append("dados") |>
req_url_path_append("municipios.csv") |>
req_user_agent("https://cem-usp.github.io/kernel-accessibility") |>
req_options(connecttimeout = 10) |>
req_retry(
max_tries = 3,
retry_on_failure = TRUE,
backoff = \(attempt) 5^attempt
) |>
req_progress() |>
req_perform(path = municipalities_tom_data_file)
}Import Data
municipalities_tom_data <-
municipalities_tom_data_file |>
read_delim(
delim = ";",
col_names = FALSE,
col_types = cols(.default = "c"),
progress = FALSE
) |>
slice(-1)municipalities_tom_data |> glimpse()
#> Rows: 5,571
#> Columns: 5
#> $ X1 <chr> "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "…
#> $ X2 <chr> "1100106", "1100379", "1100205", "1100452", "1100122", "1100924"…
#> $ X3 <chr> "GUAJAR\xc1-MIRIM", "ALTO ALEGRE DOS PARECIS", "PORTO VELHO", "B…
#> $ X4 <chr> "Guajar\xe1-Mirim", "Alto Alegre dos Parecis", "Porto Velho", "B…
#> $ X5 <chr> "RO", "RO", "RO", "RO", "RO", "RO", "RO", "RO", "RO", "RO", "RO"…Transform Data
municipalities_tom_data <-
municipalities_tom_data |>
mutate(
across(
.cols = everything(),
.fns = \(x) iconv(x, from = "Windows-1252", to = "UTF-8") # iconvlist()
)
) |>
set_names(
c(
"municipality_code_tom",
"municipality_code_ibge",
"municipality_tom",
"municipality_ibge",
"federal_unit"
)
) |>
mutate(
across(
.cols = starts_with("municipality_code"),
.fns = as.integer
)
) |>
relocate(
municipality_tom,
municipality_code_tom,
municipality_ibge,
municipality_code_ibge,
federal_unit
)municipalities_tom_data |> glimpse()
#> Rows: 5,571
#> Columns: 5
#> $ municipality_tom <chr> "GUAJARÁ-MIRIM", "ALTO ALEGRE DOS PARECIS", …
#> $ municipality_code_tom <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1…
#> $ municipality_ibge <chr> "Guajará-Mirim", "Alto Alegre dos Parecis", …
#> $ municipality_code_ibge <int> 1100106, 1100379, 1100205, 1100452, 1100122,…
#> $ federal_unit <chr> "RO", "RO", "RO", "RO", "RO", "RO", "RO", "R…Map IBGE Municipality Codes to TOM Codes
params$municipality_codes
#> [1] 2507507 3106200 3550308 4314902 1501402municipality_tom_codes
#> [1] "0427" "2051" "4123" "7107" "8801"Download RFB Data
See the Source of Data section for more information.
List Files
public_token <- "YggdBLfdninEJX9"request <-
request("https://arquivos.receitafederal.gov.br") |>
req_auth_basic(public_token, "")response <-
request |>
req_url_path_append("public.php") |>
req_url_path_append("webdav") |>
req_method("PROPFIND") |>
req_url_path_append(
paste0(params$year, "-", str_pad(params$month, 2, pad = 0))
) |>
req_headers("Depth" = "1") |>
req_body_raw(
'<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:">
<d:prop>
<d:displayname/>
<d:getcontentlength/>
<d:getcontenttype/>
<d:getlastmodified/>
</d:prop>
</d:propfind>',
type = "application/xml"
) |>
req_user_agent("https://cem-usp.github.io/kernel-accessibility") |>
req_options(connecttimeout = 10) |>
req_retry(
max_tries = 3,
retry_on_failure = TRUE,
backoff = \(attempt) 5^attempt
) |>
req_perform() |>
resp_body_xml() %>%
xml_find_all(
.,
".//d:response",
xml_ns(.)
)list_files <- function(node, response) {
xpaths <- list(
name = ".//d:displayname",
url = ".//d:href",
size = ".//d:getcontentlength",
type = ".//d:getcontenttype",
modified = ".//d:getlastmodified"
)
xpaths |>
map(
function(xpath) {
node |>
xml_find_first(xpath, xml_ns(response)) |>
xml_text()
}
) |>
as_tibble()
}files <-
response |>
map(list_files, response = response) |>
list_rbind() |>
filter(type == "application/zip") |>
mutate(size = size |> as_fs_bytes())files |> glimpse()
#> Rows: 37
#> Columns: 5
#> $ name <chr> "Cnaes.zip", "Empresas0.zip", "Empresas1.zip", "Empresas2.…
#> $ url <chr> "/public.php/webdav/2026-01/Cnaes.zip", "/public.php/webda…
#> $ size <fs::bytes> 21.56K, 465.72M, 74.25M, 75.43M, 81.18M, 86.12M, 92.…
#> $ type <chr> "application/zip", "application/zip", "application/zip", "…
#> $ modified <chr> "Sun, 11 Jan 2026 17:51:31 GMT", "Sun, 11 Jan 2026 17:52:0…Download Data
if (
raw_data_dir |>
dir_ls() |>
str_detect(rfb_file_pattern) |>
all() |>
not()
) {
cli_progress_bar(
"Downloading RFB files",
total = nrow(files),
clear = FALSE
)
for (i in seq_len(nrow(files))) {
request |>
req_url_path_append(files$url[i]) |>
req_perform(
path = here(raw_data_dir, files$name[i])
)
cli_progress_update()
}
cli_progress_done()
}Unzip Files
zip_files <-
raw_data_dir |>
dir_ls(type = "file", regexp = "\\.zip$")if (length(zip_files) > 0) {
zip_files |> file_delete()
}Import and Filter Data
Import and Filter Active and Regular Establishments by Municipalities
The AWK programming language and the vroom R package are used to read and filter the data efficiently, without loading it entirely into memory.
Only establishments with an Active registration status ($6 == "02") and no special status ($29 == "") are included, and the resulting records are further filtered by municipality ($21 == municipality_tom_codes).
Click here to access the data dictionary.
data <-
raw_data_dir |>
dir_ls(
type = "file",
regexp = "\\.ESTABELE$"
) |>
map(
function(x) {
vroom(
file = pipe(
paste0(
"awk ",
"-F ",
"';' ",
"'{ ",
"if (",
'($6 == "',
'\\"02\\"',
'")',
" && (",
paste0(
'$21 == "\\"',
municipality_tom_codes,
'\\""',
collapse = " || "
),
") && ",
'($29 == "',
'\\"\\"',
'")',
") ",
"print",
" }' ",
str_escape(x)
)
),
delim = ";",
col_names = c(
"cnpj_basic",
"cnpj_order",
"cnpj_dv",
"branch_identifier",
"trade_name",
"registration_status",
"registration_status_date",
"registration_status_reason",
"foreign_city_name",
"country",
"opening_date",
"primary_cnae",
"secondary_cnae",
"street_type",
"street_name",
"number",
"complement",
"neighborhood",
"postal_code",
"federal_unit",
"municipality_code_tom",
"phone_area_code_1",
"phone_number_1",
"phone_area_code_2",
"phone_number_2",
"fax_area_code",
"fax_number",
"email",
"special_status",
"special_status_date"
),
col_types = cols(.default = "c"),
col_select = c(
"cnpj_basic",
"cnpj_order",
"cnpj_dv",
"trade_name",
"opening_date",
"primary_cnae",
"secondary_cnae",
"street_type",
"street_name",
"number",
"complement",
"neighborhood",
"postal_code",
"municipality_code_tom",
"federal_unit",
"registration_status_date"
),
guess_max = 100,
num_threads = detectCores() |>
multiply_by(0.75) |>
ceiling(),
progress = TRUE,
show_col_types = FALSE
)
},
.progress = TRUE
) |>
list_rbind()data |> glimpse()
#> Rows: 0
#> Columns: 16
#> $ cnpj_basic <chr>
#> $ cnpj_order <chr>
#> $ cnpj_dv <chr>
#> $ trade_name <chr>
#> $ opening_date <chr>
#> $ primary_cnae <chr>
#> $ secondary_cnae <chr>
#> $ street_type <chr>
#> $ street_name <chr>
#> $ number <chr>
#> $ complement <chr>
#> $ neighborhood <chr>
#> $ postal_code <chr>
#> $ municipality_code_tom <chr>
#> $ federal_unit <chr>
#> $ registration_status_date <chr>Filter Establishments by Locais-Nova G0 Group
data <-
data |>
mutate(primary_cnae = primary_cnae |> str_pad(7, pad = "0")) |>
inner_join(
y = locais_nova_lookup_data,
by = join_by(primary_cnae == cnae, federal_unit)
) |>
rename(
locais_nova_g0 = g0,
locais_nova_g1_g2 = g1_g2,
locais_nova_g3 = g3,
locais_nova_g4 = g4
) data |> glimpse()
#> Rows: 0
#> Columns: 21
#> $ cnpj_basic <chr>
#> $ cnpj_order <chr>
#> $ cnpj_dv <chr>
#> $ trade_name <chr>
#> $ opening_date <chr>
#> $ primary_cnae <chr>
#> $ secondary_cnae <chr>
#> $ street_type <chr>
#> $ street_name <chr>
#> $ number <chr>
#> $ complement <chr>
#> $ neighborhood <chr>
#> $ postal_code <chr>
#> $ municipality_code_tom <chr>
#> $ federal_unit <chr>
#> $ registration_status_date <chr>
#> $ description <chr>
#> $ locais_nova_g0 <lgl>
#> $ locais_nova_g1_g2 <lgl>
#> $ locais_nova_g3 <lgl>
#> $ locais_nova_g4 <lgl>Import and Filter Additional Company Data by Establishment
Import and Filter Simples Nacional Data by Establishment
Visualize Registration Status Dates
These dates indicate when establishments were registered as Active.
Tidy Data
Some tidying operations are performed to ensure the data is in a suitable format for analysis. The data is not yet reshaped to a tidy format to avoid duplicated cases during geocoding.
Addresses were normalized using the enderecobr R package (Herszenhut et al., n.d.), which standardizes common street types and abbreviations in Brazilian addresses.
Remove Extra Columns
Standardize Character Encoding
Pad CNPJs and CNAEs
Remove CNPJ Duplicates
Remove Invalid CNPJs and CNAEs
Add Municipality Data
Standardize Data
Relocate Columns
Arrange Data
Geocode Data
Prepare Data
Geocode Data
Tidy Data
Visualize Geocoding Precision
Global Precision
Local Precision
Tidy Data
Remove Extra Columns
Pivot Data
Arrange Data
Create Data Dictionary
Prepare Metadata
Visualize Final Data
Save Data
The processed data are available in csv, rds and parquet formats through a dedicated repository on the Open Science Framework (OSF). See the Data Availability section for more information.
Clean Old Data Files
Write Data
Write Lookup Tables
Lock Data
Write Meetadata
Visualize Geocoding
The processed data can be visualized at RFB and OSM Georeferenced Data.
Open Street Map (OSM) Establishment Data Acquisition, Processing, Geocoding, and Classification
This pipeline was developed to establish a methodology for assessing informational gaps in data availability within Brazilian favelas and urban communities.
RFB and OSM Georeferenced Data
Visualize the RFB and OSM georeferenced data.
Calculating Accessibility to Food Establishments in Brazilian Favelas and Urban Comunities
This pipeline was adapted from the pipeline made by Flávio Soares de Freitas et al. (2026) to calculate the accessibility to food establishments classified as group G0 in favelas and urban comunities.
Furthermore, this pipeline uses the RFB and OSM data to obtain the metrics.
Mapping Acessibility to Food Establishments in Brazilian Favelas and Urban Comunities
This pipeline was adapted from the pipeline made by Daniel Vartanian et al. (2026a) to map the accessibility to food establishments classified as group G0 in favelas and urban comunities.
Furthermore, this pipeline uses the accessibility metrics obtained from the Calculating Accessibility to Food Establishments in Brazilian Favelas and Urban Comunities.
Mapping the Accessibility Denisty in Brazilian Favelas and Urban Comunities
This pipeline offers the accesibility density trough the Kernel Density Function.
As the Mapping Acessibility to Food Establishments in Brazilian Favelas and Urban Comunities, this pipeline also uses the metrics obtained from the Calculating Accessibility to Food Establishments in Brazilian Favelas and Urban Comunities.
Outcomes
Analisys of the Outcomes
Conclusion
Citation
When using this data, you must also cite the original data sources.
To cite this work, please use the following format:
Pizzonia, M. A. Jr. (2026). Mapping Accessibility to Health Food in Brazilian Favelas and Urban Comunities [Computer software]. Center for Metropolitan Studies, University of São Paulo. https://cem-usp.github.io/kernel-accessibility/
A BibTeX entry for LaTeX users is
@software{pizzonia2026,
title = {Mapping Healthy Food Accessibility in Brazilian Slums and Urban Communities},
author = {{Marcio Antonio Pizzonia Junior}},
year = {2026},
address = {São Paulo},
institution = {Center for Metropolitan Studies, University of São Paulo},
langid = {en},
url = {https://cem-usp.github.io/kernel-accessibility/}
}License
The original data sources may be subject to their own licensing terms and conditions.
The code in this repository is licensed under the GNU General Public License Version 3, while the report is available under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.
Copyright (C) 2026 Center for Metropolitan Studies
The code in this report is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
Reconhecimentos
This work is part of a research project by the Polytechnic School (Poli) of the University of São Paulo (USP), in partnership with the National Secretariat for Food and Nutrition Security (SESAN) of the Brazilian Ministry of Social Development and Assistance, Family and Fight Against Hunger (MDS), titled: AcessoSAN: Mapping Food Access to Support Public Policies on Food and Nutrition Security and Hunger Reduction in Brazilian Cities.
This study was financed, in part, by the São Paulo Research Foundation (FAPESP), Brazil. Process Number 2025/17879-2.
