The load_vaccines() function provides access to the
National Immunization Program Information System
(SI-PNI). This dataset contains records of vaccine doses
applied across Brazil, allowing for the analysis of immunization
coverage and public health strategies.
The load_vaccines function offers the following
parameters:
1994 to present."SP", "RJ", "AC").
"Rotina" – Routine vaccination schedule."Especial" – Special immunobiologicals."Bloqueio" – Blocking vaccination in outbreak
areas."Intensificação" – Intensification campaigns."Serviço Privado" – Data from private clinics.NULL, a selection menu will
appear."BCG - BCG",
"Febre amarela - FA", "Hepatite B - HB").
NULL, a selection menu will
appear."D1", c("D1", "2"),
"Única", etc.)..xls or
.xlsx file downloaded manually.
load_vaccines() will skip web
scraping and only perform data cleaning and harmonization."eng" (default) for English or
"pt" for Portuguese.The function supports two distinct data ingestion modes, depending on the availability and stability of the official SI-PNI portals:
Both modes produce a fully harmonized output, consistent with the historical SI-PNI data structure.
For historical data (1994–2022),
load_vaccines() can automatically retrieve consolidated
vaccination data directly from the legacy SI-PNI Web portal using web
scraping techniques.
This mode:
chromote
package.No manual intervention is required from the user.
From 1994 to 2022, vaccination data are available
through the legacy SI-PNI Web system. Although
load_vaccines() can retrieve these data automatically via
web scraping, users may also choose to manually download the
data and provide the file to the function for
harmonization.
In this case, load_vaccines() will perform only the
cleaning, harmonization, and standardization steps, ensuring that the
resulting dataset follows the same structure as the automatically
collected data.
This approach can be useful when:
Access the DATASUS vaccination dashboard:
https://sipni.datasus.gov.br/si-pni-web/faces/relatorio/consolidado/dosesAplicadasMensal.jsf
In the filter panel, fill only the following fields:
(Do not apply any additional filters)
Select the option “Totalizar por Município”.
Click “Pesquisar” and wait for the table to be generated.
Below the table, locate the section “Exportar Para o
Formato” and click on the first icon (.xls) to
download the data.
Provide the downloaded file to load_vaccines() using
the data argument.
From 2023 onwards, vaccination data are published exclusively through the new DATASUS interactive dashboard. Due to technical and legal constraints, automated scraping is not supported for this platform.
In this case, load_vaccines() will perform only the
cleaning, harmonization, and standardization steps.
Access the DATASUS vaccination dashboard:
https://infoms.saude.gov.br/extensions/SEIDIGI_DEMAS_VACINACAO_CALENDARIO_NACIONAL_OCORRENCIA/SEIDIGI_DEMAS_VACINACAO_CALENDARIO_NACIONAL_OCORRENCIA.html
In the filter panel, fill only the following fields:
(Do not apply any additional filters)
Switch to the “Tabelas” tab.
In the table configuration:
Click “Baixar Dados” and save the file in
.xlsx format.
Provide the downloaded file to load_vaccines() using
the data argument.
Interactive Mode:
If you are unsure of the exact strings for strategy or
product, you can run the function providing only the
year and state. The function will provide an
interactive menu in the R console for you to choose from valid
combinations. (The interactive mode is only valid for data between
1994 and 2022)
Examples:
library(datazoom.saude)
# Download data for Yellow Fever via web scraping (Routine strategy) - State of Acre, 2020
data_fa_acre <- load_vaccines(
year = 2020,
state = "AC",
strategy = "Rotina",
product = "Febre amarela - FA",
language = "eng"
)
# Download data for BCG via web scraping (Private Service strategy) - State of São Paulo, 2018
data_bcg_sp <- load_vaccines(
year = 2018,
state = "SP",
strategy = "Serviço Privado",
product = "BCG - BCG",
language = "pt"
)
# Download data for Trivalent Influenza using a manually downloaded file (Blockade strategy) - State of Acre, 2018
data_fa_acre <- load_vaccines(
year = 2018,
state = "AC",
strategy = "Bloqueio",
product = "Influenza Trivalente - FLU3V",
doses = c("D1", "DU", "REV", "DI"), # required for data up to 2022
data = "C:/path/to/downloaded_file.xls", #.xls
language = "eng"
)
# Download data for Trivalent Influenza using a manually downloaded file (Blockade strategy) - State of Minas Gerais, 2024
data_fa_acre <- load_vaccines(
year = 2024,
state = "MG",
strategy = "Bloqueio",
product = "Influenza Trivalente - FLU3V",
doses = NULL, # not required for data 2023 onwards
data = "C:/path/to/downloaded_file.xls", #.xls
language = "pt"
)
# Example of calling the function to trigger interactive selection - State of Minas Gerais, 2010
data_interactive <- load_vaccines(
year = 2010,
state = "MG",
language = "pt")Technical Note:
load_vaccines()
always returns a harmonized dataset with consistent variable names, dose
categories, and structure.Important: For the web scraping mode, please be aware that the SI-PNI website (https://sipni.datasus.gov.br/si-pni-web/faces/relatorio/consolidado/dosesAplicadasMensal.jsf) often experiences significant instability. This may result in connection timeouts, slow response times, or unexpected errors during the scraping process. If the function fails, it is recommended to wait a few minutes and try again. If the error persists, please check the SI-PNI portal status or report the issue on our GitHub repository.