TITLE: Protocol for Epidemiological Analysis and Data Visualization in Health
AUTHORS: Ronaldo Rodrigues de Oliveira Junior, Leandro do Prado Assunção, Lindomar José Pena, Valéria Christina de Rezende Feres

[DESCRIPTION]
In recent years, information contained in large health databases (big data) has been used in various scientific fields. These databases have been generated from original data that has expanded to encompass not only mortality and survival data but also other dimensions such as healthcare and infection control, becoming a valuable source for conducting epidemiological studies, effectiveness analyses of treatments, and monitoring population health, among other applications. For this purpose, the programming languages R and Python are most commonly used for data processing, statistical analysis, and the creation of graphs and tables. In this context, a protocol was developed using the database of the Sistema de Informação de Agravos de Notificação (SINAN) through the R programming language to create graphs showing the frequencies of comorbidities, symptoms, and a map of the distribution of deaths in the state of Goiás, Brazil, from 2015 to 2022. This script can be used to process and generate figures from other databases.

[BEFORE_START]
The RStudio program must be installed on the computer. If not, the link below provides the tutorial for download.
https://posit.co/download/rstudio-desktop/

[STEPS]
SECTION: Installing the packages
1. Install the packages that will be used throughout the analyses using the install.packages('package name') function. Then, press Ctrl + Enter. The code is as follows:

 

SECTION: Loading the packages
2. Load the packages.

Note: Every time you open the software, you should load the packages as indicated below.
 

SECTION: Importing the database
3. Import the database into the R environment using the following function:
 

i. The 'read.dbf' function is used to read data from a DBF (DataBase File) file.
ii. The argument 'file = 'Banco_Sinan.dbf'' indicates the name of the DBF file to be imported.
iii. The argument 'as.is = TRUE' is used to keep strings (character sets) as they are in the database.
SECTION: Selecting the variables for the study
4. 
Filter the variables of interest using the 'select' function. Name the database as 'sinan' only.
 

SECTION: Cleaning and standardizing the variables
5. Adjust the database so that all records contained in it are written in the same way, ensuring that analyses are not compromised by typing differences.
 

SECTION: Selecting the records
6. 
Select records that meet all of the following criteria:

i. Epidemiological or laboratory diagnostic criterion (1 or 2)
ii. The final classification was chikungunya (13)
iii. Evolved to death (2)

Note: Information within parentheses defines how the variables were filled.
 

SECTION: Renaming the variables
7. Rename the variables using the 'rename' function from the dplyr package.
 

SECTION: Handling the &#x27;age&#x27; variable
8. The filling of the variable 'age' is different from the others. This process follows the following rule applied to the first digit:

1. Hour
2. Day
3. Month
4. Year

For example: 4056 --> 56 years old; 3009 --> 9 months old; 2024 --> 24 days old
 

SECTION: Creating new variables
9. Create some variables as per the code below:
 

SECTION: Renaming the variable names
10. Rename and standardize the writing of variables.
 

SECTION: Changing the label of the variable
11. Change the labels of the variables and convert them to 'factor'.
 

SECTION: Removing variables that will no longer be used
12. Remove the variables that were used only to create others.

For example: the variable 'nu_idade,' which represents the age of patients but is encoded, will no longer be necessary since it has been decoded to create another variable for this purpose.
 

SECTION: Changing the format of variables representing dates
13. Standardize the date format. The code is as follows:
 

SECTION: Exporting the processed database
14. Export the database (optional)
 

SECTION: Creating the relative frequency bar chart of comorbidities
15. The use of charts is one of the most commonly employed visual methods for data visualization. Therefore, bar charts will be created to demonstrate the frequencies of comorbidities in relation to deaths.
SECTION: Creating the relative frequency bar chart of comorbidities
15.1. i. Conversion of variables to numeric
 

SECTION: Creating the relative frequency bar chart of comorbidities
15.2. ii. Calculate the percentage of patients for each comorbidity
 

SECTION: Creating the relative frequency bar chart of comorbidities
15.3. iii. Transform the dataset from wide to long format
 

SECTION: Creating the relative frequency bar chart of comorbidities
15.4. iv. Create the chart
 

SECTION: Creating the relative frequency chart of symptoms in relation to deaths
16. Create the symptom chart in the same manner as mentioned earlier. The script is provided below:
SECTION: Creating the relative frequency chart of symptoms in relation to deaths
16.1. i. Convert categorical data into numerical data
 

SECTION: Creating the relative frequency chart of symptoms in relation to deaths
16.2. ii. Calculating the percentage of patients for each symptom
 
 
SECTION: Creating the relative frequency chart of symptoms in relation to deaths
16.3. iii. Transform the data from wide to long format
 

SECTION: Creating the relative frequency chart of symptoms in relation to deaths
16.4. iv. Create the chart
 

SECTION: Creating the map of municipalities in Goiás
17. "Now we will create the map. The region used as an example is the state of Goiás, Brazil, showing the frequency of deaths by municipalities. The code is provided below:"
SECTION: Creating the map of municipalities in Goiás
17.1. i. Import the database from IBGE for the state of Goiás
 

SECTION: Creating the map of municipalities in Goiás
17.2. ii. Processing the IBGE database
 

SECTION: Creating the map of municipalities in Goiás
17.3. iii. Perform a join of the IBGE database with the death frequency table
 

SECTION: Creating the map of municipalities in Goiás
17.4. iv. Generating the map