Abstract
Objective:
to present version 0.0.3 of the csapAIH package, developed to automate the classification and description of Ambulatory Care Sensitive Conditions (ACSC) according to the Brazilian ACSC List.
Methods:
the csapAIH function was modified and novel functions were added to enable listing, tabulating and plotting of groups of causes.
Results:
csapAIH now reads compressed (.dbc) files generated by Brazilian public hospitalization databases; the nomesgruposCSAP function lists groups of causes; descreveCSAP provides a table with the absolute frequency of groups of causes, as well as relative frequency of the overall number of hospitalizations and total ACSC; desenhaCSAP draws a horizontal barplot of groups of causes.
Conclusion:
the csapAIH package now reads .dbc files and has functions for plotting tables and graphs of groups of causes, making it easier to analyze and present results of investigation, as well as to prepare periodical ACSC monitoring reports in accordance with the Brazilian ACSC List.
Keywords:
Hospitalization; Primary Health Care; Health Services Research; Health Information Systems; Automatic Data Processing
Introduction
The evolution of information technology and the philosophy of 'open source' - i.e. programs for free use, distribution and modification - offer powerful tools at very low cost for management and statistical analysis of data. In Brazil, it is also possible to access different health information system databases of the Brazilian National Health System (SUS), in addition to tabulation tools created by its Information Technology Department (DATASUS) especially for management of those systems, such as TABNET and TabWin.11. Ministério da Saúde [BR]. Departamento de Informática do SUS - Datasus. Tab para Windows - TabWin [Internet]. Brasília: Ministério da Saúde; 2010 [citado 2019 maio 7]. Disponível em: Disponível em: http://datasus.saude.gov.br/apresentacao
http://datasus.saude.gov.br/apresentacao... This set of databases and tools facilitates Municipal and State Health Department calculation and monitoring of indicators, as well as facilitating research by undergraduate and postgraduate students.
R22. R Core Team. R: a language and environment for statistical computing [Internet]. Vienna, Austria: R Foundation for Statistical Computing; 2018 [cites 2019 May 7]. Disponível em: Disponível em: https://www.R-project.org/
https://www.R-project.org/... is an open source program for management and statistical analysis of data and has various 'packages', i.e. a set of functions for executing commands. R enables databases to be read and reports and articles to be produced from the analysis of the data in various publication formats (presentations in PDF, HTML and other formats; or documents in PDF, HTML, DOCX and other formats). R is a gradual learning program, owing to the characteristics of its language which works with command lines, and also due to its basic interface which is user unfriendly and has limited resources. Despite this, through interfaces such as RStudio33. RStudio Team. RStudio: integrated development environment for R [Internet]. Boston, MA: RStudio; 2015 [citado 2019 May 7]. Disponível em: Disponível em: http://www.rstudio.com/
http://www.rstudio.com/... and R Commander,44. Fox J. The R commander: a basic statistics graphical user interface to R. J Stat Softw [Internet]. 2005 Sep [citado 2019 May 7];14(i09):1-42. Disponível em: Disponível em: https://www.jstatsoft.org/article/view/v014i09 . doi: 10.18637/jss.v014.i09
https://www.jstatsoft.org/article/view/v... ,55. Moriña D, Utzet M, Nedel FB, Martín M, Navarro A. Introducción a la estadística con R-Commander para las ciencias de la salud. Cerdanyola del Vallès: Universitat Autònoma de Barcelona; 2016. among other programs, it is quite easy to generate automatic reports using R and a pre-prepared command file.
Creating tools that facilitate this process can be useful both for health research and also for Brazil’s Municipal and State Health Departments to monitor indicators.66. Rocha TAH, Silva NC, Amaral PVM, Barbosa ACQ, Vissoci JRN, Thomaz EBAF, et al. Geolocalização de internações cadastradas no Sistema de Informações Hospitalares do Sistema Único de Saúde: uma solução baseada no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2018 [citado 2019 maio 7];27(4):e2017444. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v27n4/2237-9622-ress-27-04-e2017444.pdf . doi: 10.5123/s1679-49742018000400016
http://www.scielo.br/pdf/ress/v27n4/2237... There are some specific R packages for this purpose, such as read.dbc77. Petruzalek D. Read.dbc: read data stored in dbc (compressed dbf) files [Internet]. 2016 [citado 2019 May 7]. Disponível em: Disponível em: https://CRAN.R-project.org/package=read.dbc
https://CRAN.R-project.org/package=read.... ,88. Petruzalek D. READ. DBC: um pacote para importação de dados do datasus na linguagem R. In: Anais do XV Congresso Brasileiro de Informática em Saúde [Internet]; 2016 nov 27-30; Goiânia, Brasil. Goiânia: J Health Inform; 2016 [citado 2019 maio 7] Disponível em: Disponível em: http://www.sbis.org.br/biblioteca_virtual/cbis/Anais_CBIS_2016_Artigos_Completos.pdf
http://www.sbis.org.br/biblioteca_virtua... for reading databases compressed by DATASUS in .dbc format: the homonyms datasus99. Petruzalek D. Datasus: an interface for the Brazilian public healthcare datasets (Datasus) [Internet]. 2016 [citado 2019 May 7]. Disponível em: Disponível em: https://rdrr.io/github/danicat/datasus/
https://rdrr.io/github/danicat/datasus/... ,1010. Prado Siqueira R. Datasus: an interface to datasus system [Internet]. 2017 [citado 2019 May 7]. Disponível em: Disponível em: https://CRAN.R-project.org/package=datasus
https://CRAN.R-project.org/package=datas... and microdatasus1111. Freitas Saldanha R. Microdatasus: download and preprocess datasus files [Internet]. 2019 [citado 2019 May 7]. Disponível em: Disponível em: https://github.com/rfsaldanha/microdatasus
https://github.com/rfsaldanha/microdatas... for downloading files containing databases of some Brazilian information systems; and csapAIH,1212. Nedel FB. CsapAIH: classificar condições sensíveis à atenção primária [Internet]. 2016 [citado 2019 maio 7]. Disponível em: Disponível em: https://sourceforge.net/projects/csapAIH/files/v0.0.1/csapAIH-manual.pdf
https://sourceforge.net/projects/csapAIH... for classifying Ambulatory Care Sensitive Conditions (ACSC) in accordance with the Brazilian ACSC List.1313. Brasil. Ministério da Saúde. Portaria MS/GM nº 221, de 17 de abril de 2008. Publica, na forma do anexo desta portaria, a lista brasileira de internações por condições sensíveis à atenção primária [Internet]. Diário Oficial da União, Brasília (DF), 2008 abr 18 [citado 2019 maio 7]; Seção 1:70. Disponível em: Disponível em: http://bvsms.saude.gov.br/bvs/saudelegis/sas/2008/prt0221_17_04_2008.html
http://bvsms.saude.gov.br/bvs/saudelegis...
ACSCs are an indirect indicator of the effectiveness of Primary Health Care (PHC), as measured by hospitalizations for health conditions that would not develop to the point of requiring hospitalization if PHC worked flawlessly.1414. Caminal Homar J, Casanova Matutano C. La evaluación de la atención primaria y las hospitalizaciones por ambulatory care sensitive conditions. Marco conceptual. Aten Prim [Internet]. 2003 jan [citado 2019 maio 7];31(1):61-5. Disponível em: Disponível em: https://www.elsevier.es/es-revista-atencion-primaria-27-articulo-la-evaluacion-atencion-primaria-las-13042583
https://www.elsevier.es/es-revista-atenc...
15. Ansari Z. The concept and usefulness of ambulatory care sensitive conditions as indicators of quality and access to primary health care. Aust J Prim Health [Internet]. 2007 Dec [citado 2019 May 7];13(3):91-110. Disponível em: Disponível em: https://www.publish.csiro.au/PY/PY07043 . doi: 10.1071/PY07043
https://www.publish.csiro.au/PY/PY07043... -1616. Nedel FB, Facchini LA, Bastos JL, Martín-Mateo M. Conceptual and methodological aspects in the study of hospitalizations for ambulatory care sensitive conditions. Ciênc Saúde Coletiva [Internet]. 2011 [citado 2019 May 7];16(Suppl 1):1145-54. Disponível em: Disponível em: http://www.scielo.br/pdf/csc/v16s1/a46v16s1.pdf . doi: 10.1590/S1413-81232011000700046
http://www.scielo.br/pdf/csc/v16s1/a46v1... The Brazilian List of Ambulatory Care Sensitive Conditions cannot be tabulated by TABNET, barring a few exceptions such as the version of TABNET used by the Santa Catarina State Health Department (SES/SC), and even then only for Hospital Admission Authorization (AIH) files in that state. On the other hand, TabWin, has ACSC among its pre-set tabulation options. Having a single function with the same name. Apart from tabulating cases occurring in a given region, its purpose was to classify each hospitalization according to the ACSC groups so that this information could be handled as a variable in the hospitalization database.1212. Nedel FB. CsapAIH: classificar condições sensíveis à atenção primária [Internet]. 2016 [citado 2019 maio 7]. Disponível em: Disponível em: https://sourceforge.net/projects/csapAIH/files/v0.0.1/csapAIH-manual.pdf
https://sourceforge.net/projects/csapAIH... ,1717. Nedel FB. csapAIH: uma função para a classificação das condições sensíveis à atenção primária no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2017 jan-mar [citado 2019 maio 7];26(1):199-209. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v26n1/2237-9622-ress-26-01-00199.pdf . doi: 10.5123/s1679-49742017000100021
http://www.scielo.br/pdf/ress/v26n1/2237... Since then changes have been made to optimize working with AIH files and to allow tables and graphs showing ACSC group distribution to be generated, thus facilitating the publication of results and reports of research on this indicator.
The objective of this article was to present version 0.0.3 of the csapAIH package, how it is installed and used, and examples of new features.
Methods
The AIH records used in this article are those of admissions occurred in hospitals in Rio Grande do Sul state and invoiced (reference month) in January 2018. The records were stored on the file named RDRS1801.dbc, which contains 60,529 records and 113 variables. The file can be downloaded from the DATASUS website and read by R using the following commands:
# install.packages("read.dbc") # installs the package read.dbc
download.file(url="ftp://ftp.datasus.gov.br/dissemin/publicos/SIHSUS/200801_/Dados/RDRS1801.dbc", destfile = "RDRS1801.dbc")
aih <- read.dbc::read.dbc("RDRS1801.dbc")
The principles underlying the development of the csapAIH package are:1717. Nedel FB. csapAIH: uma função para a classificação das condições sensíveis à atenção primária no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2017 jan-mar [citado 2019 maio 7];26(1):199-209. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v26n1/2237-9622-ress-26-01-00199.pdf . doi: 10.5123/s1679-49742017000100021
http://www.scielo.br/pdf/ress/v26n1/2237...
a) its main focus is the management of abridged AIH files (RD??????.dbc); therefore, the default behavior of its functions assumes that the user will work with these databases; however, the user may be interested in analyzing other databases or, simply, be interested in tabulating a series of diagnoses; as such, the package allows the classification of any list of codes of the 10th Revision International Statistical Classification of Diseases and Related Health Problems (ICD-10);
b) by default, the package excludes obstetric hospitalizations attributed to events such as childbirth and miscarriage and long-stay AIH - although it does permit the contrary;
c) the database resulting from the classification of hospitalizations should contain a not overly extensive selection of variables about the patient and their hospitalization, since it is always possible to use the csapAIH function to add a variable to the database having the ACSC hospitalization classification.
Below we present the current situation of the package, with changes made with effect from version 0.0.1.1717. Nedel FB. csapAIH: uma função para a classificação das condições sensíveis à atenção primária no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2017 jan-mar [citado 2019 maio 7];26(1):199-209. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v26n1/2237-9622-ress-26-01-00199.pdf . doi: 10.5123/s1679-49742017000100021
http://www.scielo.br/pdf/ress/v26n1/2237... Version 0.0.2 was released in February 2018 and has not been published in the scientific literature. This article is focused on the use of the package, especially for working with AIH files. Details about the functions and modifications to the code can be consulted in the package manual,1818. Nedel FB. CsapAIH: classificar condições sensíveis à atenção primária [Internet]. 2019 [citado 2019 May 7]. Disponível em: Disponível em: https://sourceforge.net/projects/csapAIH/files/csapAIH_0.0.3.pdf/download
https://sourceforge.net/projects/csapAIH... in addition to examining the function scripts.
Modifications made
csapAIH function:
this function now identifies and reads AIH files in compressed format (RD??????.dbc), using the read.dbc package;77. Petruzalek D. Read.dbc: read data stored in dbc (compressed dbf) files [Internet]. 2016 [citado 2019 May 7]. Disponível em: Disponível em: https://CRAN.R-project.org/package=read.dbc
https://CRAN.R-project.org/package=read.... .88. Petruzalek D. READ. DBC: um pacote para importação de dados do datasus na linguagem R. In: Anais do XV Congresso Brasileiro de Informática em Saúde [Internet]; 2016 nov 27-30; Goiânia, Brasil. Goiânia: J Health Inform; 2016 [citado 2019 maio 7] Disponível em: Disponível em: http://www.sbis.org.br/biblioteca_virtual/cbis/Anais_CBIS_2016_Artigos_Completos.pdf
http://www.sbis.org.br/biblioteca_virtua...the logical argument parto.rm was created (having “TRUE” as its default) to remove records having childbirth as primary diagnosis (ICD-10: codes O80 to O84), regardless of the procedure performed; this argument was added because there was a small number of cases (in the database used as an example, they accounted for 0.02% of hospitalizations excluding obstetric procedures) having childbirth as primary diagnosis of hospitalization but with a procedure record different to the records selected for deletion using procobst.rm = TRUE, hence why these cases remained in the database even when obstetric procedures were excluded;
information on the number of records in the database of origin and the number of long-stay or obstetric procedure hospitalizations excluded is now stored as an attribute of the resulting database; this allows this information to be recovered in automated reports as well as the sum of the values resulting from more than one abridged AIH file being read (RD file, which contains monthly AIH records); and
other modifications to the code which are of less interest to the end user and were therefore not within the scope of this article.
New functions of the csapAIH package are presented below:
descreveCSAP
This function tabulates a vector of the "factor" or "character" class, present as an object in the work space or as a variable in a database containing the ACSC groups; it generates a table with the absolute frequency of hospitalizations for groups of causes and their percentages in relation to the total number of hospitalizations and total number of ACSCs. The ACSC groups are shown with abbreviated names; while numbers are shown with a dot ( . ) as the thousands separator and a comma ( , ) as the decimal separator, in accordance with Latin standards. The function has two arguments. The first argument (grupos) is mandatory and serves to indicate the variable as per the groups of the Brazilian ACSC List, labeled in the same way as the groups resulting from the csapAIH function: g01, g02, … , g19. If in a database, this vector is a variable called 'grupos', the user can indicate either the variable or the database. The second argument (digits) is used to set the number of decimal places in the percentages presented (default = 2 decimal places).
desenhaCSAP
This function generates a graph of the absolute or relative frequency of hospitalizations by ACSC group. Its first argument, dados, is mandatory and can be (i) a database generated by the csapAIH function, (ii) a variable with the groups of causes sorted according to the Brazilian ACSC List, or (iii) a table with the frequency of the groups of causes. If ggplot2 is installed on the system, it will be used by default; if it is not installed, or if the argument tipo.graf is defined as = "base", a graph of the absolute number of cases will be generated (regardless of the contagem [count] argument) with the basic functions of R. The argument titulo facilitates the definition of a title: it can be text typed by the user or "auto" (automatic). Selecting “auto” makes the argument onde [where] mandatory and generates a title from the combination of (i) a pre-defined text ('Hospitalization for Care Sensitive Conditions'), (ii) the text shown in the 'onde' [where] and (iii) the AIH reference month as identified by the filename. This last part of the automatic title may be modified by the argument quando [when]. The other arguments define the layout of the graph; some apply only to graphs generated by tipo.graf = ggplot; limsup defines the width of the x-axis, which can be useful for viewing the percentages presented on the bars of bar graphs, or for including additional text on the graphs.
idadeSUS
This function calculates patient age on admission to hospital, from the AIH IDADE and COD_IDADE fields. It is the same script used in csapAIH in version 0.0.1 of the package,1717. Nedel FB. csapAIH: uma função para a classificação das condições sensíveis à atenção primária no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2017 jan-mar [citado 2019 maio 7];26(1):199-209. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v26n1/2237-9622-ress-26-01-00199.pdf . doi: 10.5123/s1679-49742017000100021
http://www.scielo.br/pdf/ress/v26n1/2237... now retrieved to an isolated function, as previously explained. It is useful when intending to analyze age in AIH files, without the need to classify ACSC. The only argument of this function (x) expects the name of the database (an object of the "data.frame" class in the R work space) containing the IDADE and COD_IDADE variables, in the same way as in the AIH files, i.e. : IDADE containing how long the individual has been alive for, expressed in the unit of time defined by COD_IDADE.
nomesgruposCSAP
This function has no arguments and generates a vector with the names of the ACSC groups. It is useful for labeling tables and graphs created by the user, as well as those generated by the aforementioned functions.
Further information about the functions can be found in the package manual.1818. Nedel FB. CsapAIH: classificar condições sensíveis à atenção primária [Internet]. 2019 [citado 2019 May 7]. Disponível em: Disponível em: https://sourceforge.net/projects/csapAIH/files/csapAIH_0.0.3.pdf/download
https://sourceforge.net/projects/csapAIH...
Package installation
Although it undergoes an error check (devtools::check)) to have no errors, warnings or notes, the csapAIH package does not undergo all tests for submission to CRAN, which is the official repository of R. However, the package can be found and installed from its repositories on GitHub https://github.com/fulvionedel/csapAIH) and SourceForge (https://sourceforge.net/p/csapaih/).
The latest version of the package can be installed in two different ways:
a) from local files using the R package installation menu (or RStudio, etc.), after downloading the installation file (csapAIH_0.0.3.tar.gz for Linux and Macintosh operating systems; csapAIH_0.0.3.zip for Windows) from the address Https://sourceforge.net/projects/csapaih/files/; or
b) by using the R console, from repositories on the internet:
install.packages("https://sourceforge.net/projects/csapaih/files/csapAIH-v.0.0.3.tar.gz/down load", type = "source", repos = NULL) # for Linux and Mac
# ou
install.packages("https://sourceforge.net/projects/csapaih/files/csapAIH-v.0.0.3.zip/downlo ad", type = "source", repos = NULL) # for Windows
The development version can be installed from its repository on GitHub, by using the devtools package:
install.packages("devtools") # intalls the package devtools
devtools::install_github("fulvionedel/csapAIH") # intalls the package csapAIH
The abridged AIH files (RD*.dbc) do not allow patient identification and are made available to the public at the DATASUS portal, in 'Transferência de Arquivos >> SIHSUS',1919. Ministério da Saúde (BR). Departamento de Informática do SUS - Datasus. Transferência de arquivos [Internet]. Brasília: Ministério da Saúde; 2018 [citado 2019 maio 7]. Disponível em: Disponível em: http://www2.datasus.gov.br/DATASUS/index.php?area=0901&item=1&acao=25
http://www2.datasus.gov.br/DATASUS/index... or in their ftp repository, as we saw earlier regarding R commands. In the sample database that comes with the package, the AIH number was replaced by the record order number on the sample database.
The package is distributed under the GPLv3 license agreement (General Public License, version 3/GNU project), which allows its use, distribution and modification provided that the source is kept open. Its repository on GitHub (https://github.com/fulvionedel/csapAIH) is public. Contributions are welcome.
Results
The file used as an example contains 60,529 SUS admissions to hospitals in the state of Rio Grande do Sul which were billed in January 2018. Of these, 10,864 were due to ACSC, representing 21% of hospitalizations, excluding child deliveries and obstetric procedures. Taking total hospitalizations, frequency of females is 28% higher than that of males, while this ratio is inverted for ACSC hospitalizations: women appear 3% less than men. The mean age of patients hospitalized due to ACSC (53.8 years) is seven years higher than hospitalizations for other causes (46.7 years), excluding obstetric admissions. Four of the five leading causes of hospitalization due to ACSC are chronic. ACSC distribution by groups of causes can be seen in tables and graphs in Figures 1 to 5.
- Ambulatory Care Sensitive Conditions, “raw” table, as displayed on the console, Rio Grande do Sul, reference month 01/2018
- Ambulatory Care Sensitive Conditions, application of the kable function to the “raw” table (shown in Figure 1), in a report generated in HTML format, Rio Grande do Sul, reference month 01/2018
- Ambulatory Care Sensitive Conditions, table in a .docx file after "copy and paste" of a document in HTML format (see Figure 2), Rio Grande do Sul, reference month 01/2018
- Graph generated by the desenhaCSAP function, as per the option (ggplot function; on "base") using tipo.graf argument
- Example of the result of applying the facet_grid function for graphic presentation of ACSC stratified according to another factor in the database
The csapAIH function now recognizes and reads DATASUS .dbc files; the step previously performed to read the AIH file (aih <- read.dbc:read.dbc ("RDRS1801.dbc"), can now be shortened by reading the data file and classifying ACSC with a single command, csap <- csapAIH ("RDRS1801.dbc"), in the same way as if the data file were in the working directory:
csap <- csapAIH(“RDRS1801.dbc”)
Importados 60.529 registros.
Excluídos 8.240 (13,6%) registros de procedimentos obstétricos.
Excluídos 366 (0,6%) registros de AIH de longa permanência.
Exportados 51.923 (85,8%) registros.
The number of records handled in each step of data importing is displayed on the screen during the data reading process, and can be retrieved by using the 'resumo' attribute:
attributes(csap)$resumo
acao freq perc objeto
1 Importados 60529 100 registros.
2 Excluídos 8240 13.6 registros de procedimentos obstétricos.
3 Excluídos 366 0.6 registros de AIH de longa permanência.
4 Exportados 51923 85.8 registros.
class(attributes(csap)$resumo)
[1] “data.frame”
csaptudo <- csapAIH(“RDRS1801.dbc”, procobst.rm = FALSE, parto.rm = FALSE, longa.rm = FALSE)
Importados 60.529 registros.
Exportados 60.529 (100%) registros.
attr(csaptudo, which = “resumo”) # another way to read the attributes
acao freq perc objeto
1 Importados 60529 100 registros.
2 Exportados 60529 100 registros.
In the data read return message, the numbers are formatted with the thousands separator as a dot ( . ) and the decimal separator as a comma ( , ), although in the attributes they are stored in numeric format, with a decimal point instead of a comma, thus allowing mathematical operations.
The descreveCSAP function provides a table with the absolute and relative frequencies of hospitalizations by cause group. The command for raw presentation of results is simple and, through functions such as xtable, kable or pander, tables can be prepared for publication. The following paragraph presents the commands for generating the raw table table and also a more elaborate table, which can be presented in an HTML document or exported to a Word document. Figures 1 and 2 show the graphical differences between these results, while Figure 3 shows how we see the result of "copying and pasting" a table from an HTML document to a .docx document (in this case, LibreOffice software).
descreveCSAP(csap) # generates the "raw" table
knitr::kable(descreveCSAP(csap), align = 'r', caption = “Internações por Condições Sensíveis à Atenção Primária. Rio Grande do Sul, mês de competência 01/2018.”) # draw the table for printing
The desenhaCSAP function plots, by default, a horizontal bar chart with the percentage of cases per group of causes, in decreasing order. If the ggplot2 package is installed, it will be used to create the chart; if not, or if the argument tipo.graf is defined as "base", a case count graph is plotted using the basic functions (Figure 4).
library(ggplot2)
library(grid)
desenhaCSAP(csap, titulo = “auto”, onde = “RS”, colorir = “cinza”,
y.size = 10, limsup = .14)
desenhaCSAP(csap, titulo = “auto”, onde = “RS”, colorir = “cinza”,
tipo.graf = “base”, cex.main=.8, cex.names=.8, xlab = “Casos”,
font.lab = 2, adj = 1)
When ggplot2 is installed, the graph can be stratified according to other database variables. For example, the desenhaCSAP(csap) + facet_grid(~sex) command generates a figure without a title, with a graph for each sex, which can be saved in vector format (required for some publications) using the RStudio menus. If the ordenar [sort] = TRUE argument is kept, the bars of the graphs for each stratum are sorted by global frequency. The output argument shows, moreover, a side effect of the limsup argument (message of overlapping scales on the graph axis):
desenhaCSAP(csap, titulo = “auto”, onde = “RS”, y.size = 10, limsup = .2, colorir = “cinza”) +
facet_wrap(~ munres == “431490”, labeller = as_labeller(c("FALSE" = "Interior", "TRUE" = “Capital”))) +
labs(caption = “Distribuição percentual segundo a residência no interior ou capital do estado.”)
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
The idadeSUS function does not need to be used by the user when working with ACSC, because it is retrieved by the csapAIH function to create the age variables on the resulting database; however, it is useful when working with AIH files when ACSC tabulation is not required. For example, in order to quickly find out that the mean age of hospitalizations in Rio Grande do Sul billed in January 2018 was 45.2 years (and not 45.3), the following command can be given:
mean(idadeSUS(read.dbc::read.dbc("RDRS1801.dbc"))[,1])
[1] 45.1962
Just reading the IDADE field, without considering COD_IDADE, would provide the following information:
mean(read.dbc::read.dbc(“RDRS1801.dbc”)$IDADE)
[1] 45.3023
If there is interest in detailed analyses, it is better to join together age and age ranges as variables in the database:
banco <- read.dbc::read.dbc("RDRS1801.dbc")
113 variables in the data set:
UF_ZI, ..., TPDISEC9
banco <- cbind(banco, idadeSUS(banco))
116 variables in the data set:
UF_ZI, ..., TPDISEC9, idade, fxetar.det, fxetar5
The nomesgruposCSAP function is also less important on its own; however, it may be useful for labeling tables and graphs that have not been created by the descreveCSAP or desenhaCSAP functions:
# the function csapAIH over a vector with five ICD-10 codes
csap <- csapAIH(as.factor(c("A01", "B19", "C10", "D42", "E11")))
table(droplevels(csap$grupo))
g02 g13 não-CSAP
1 1 3
# changes the levels of the variable "grupo" with the function nomesgruposCSAP()
levels(csap$grupo)[1:19] <- nomesgruposCSAP()
table(droplevels(csap$grupo))
2.Gastroenterite 13.Diabetes mellitus não-CSAP
1 1 3
Discussion
The incorporation of the read.dbc88. Petruzalek D. READ. DBC: um pacote para importação de dados do datasus na linguagem R. In: Anais do XV Congresso Brasileiro de Informática em Saúde [Internet]; 2016 nov 27-30; Goiânia, Brasil. Goiânia: J Health Inform; 2016 [citado 2019 maio 7] Disponível em: Disponível em: http://www.sbis.org.br/biblioteca_virtual/cbis/Anais_CBIS_2016_Artigos_Completos.pdf
http://www.sbis.org.br/biblioteca_virtua... function lets csapAIH read the compressed DATASUS files (.dbc format), which was one of the main limitations found in the first version of the package.1717. Nedel FB. csapAIH: uma função para a classificação das condições sensíveis à atenção primária no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2017 jan-mar [citado 2019 maio 7];26(1):199-209. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v26n1/2237-9622-ress-26-01-00199.pdf . doi: 10.5123/s1679-49742017000100021
http://www.scielo.br/pdf/ress/v26n1/2237... The independence of other software for expanding .dbc extension files ensures that data reading, management and analysis can be done with a single command script - even though it may possibly be long, or divided into several files that can be retrieved with another script. In the case of R and with the facilities of RStudio33. RStudio Team. RStudio: integrated development environment for R [Internet]. Boston, MA: RStudio; 2015 [citado 2019 May 7]. Disponível em: Disponível em: http://www.rstudio.com/
http://www.rstudio.com/... (among others44. Fox J. The R commander: a basic statistics graphical user interface to R. J Stat Softw [Internet]. 2005 Sep [citado 2019 May 7];14(i09):1-42. Disponível em: Disponível em: https://www.jstatsoft.org/article/view/v014i09 . doi: 10.18637/jss.v014.i09
https://www.jstatsoft.org/article/view/v... ), the content and form of the results can also be reproduced. Reproducibility is desirable not only in the scientific realm; it also facilitates the organization of periodic monitoring reports for the State and Municipal Health Departments.
The new descreveCSAP and desenhaCSAP functions have been planned, above all, for Health Departments and Health Councils to monitor ACSC, in order to facilitate this work and thus promote the practice of ACSC monitoring by Primary Care management. In addition, these functions can be useful for informing academic debates and scientific publications. With regard to this latter objective, the colorir (color) argument has been created and, in particular, so has the option of grayscale coloring of graph bars. The other new functions are of less interest for most forms of analysis, since they are run internally by the main functions and not by the user; however, they can be useful for automatic presentation of results throughout texts, which is one of the benefits of writing research reports directly in R. This facilitates report writing and saves time spent on analyses and presentations. They can also be used by other functions, and this justifies their separation into independent functions.
The inclusion of the parto.rm argument in the csapAIH function now enables complete exclusion of childbirth irrespective of the procedure performed, while also facilitating in the event of just wanting to delete childbirth and retaining the other obstetric procedures. However, the proportion of hospital admissions with a primary diagnosis of childbirth and obstetric procedure different to those excluded by procobst.rm = TRUE is small. It may also be of interest for the purposes of analysis to retain, for example, cases of procedure '03.03.10.004-4 - Treatment of clinical complications during pregnancy' even with diagnosis of childbirth, considering that as they are 'clinical complications', they are not physiological events giving rise to childbirth.
Limitations of the package include the reduction in the number of data file formats it recognizes, which are now restricted to .dbc, .dbf and .csv. This limitation is mitigated, since data files in other formats can be read in advance, and then be subject to the csapAIH function. There is also an adverse effect, generated by using the limsup argument in the desenhaCSAP function, in that it produces a warning message that a new scale was superimposed on a previous one. It is not difficult to avoid this message appearing in reports, it being sufficient to include the option message=FALSE in the graph "chunk" command textbox in the report source file (this being precisely what was done to ensure that in the outputs above the message appeared in only one of the graphs). However, while trying to avoid this message from appearing, other problems with the result happened in the function itself, this being why the message continues to appear even though it is considered unnecessary.
csapAIH is a yet another tool for studying ACSCs in Brazil. In its current version, the package reads DATASUS .dbc files, generates publication quality graphs and tables through simple commands, provides a function for calculating age in AIH files and has another function for listing groups of causes, in accordance with the Brazilian List of Ambulatory Care Sensitive Conditions. Users with some knowledge of R can use these tools and create scripts for analysis of local interest and for monitoring the municipal health situation or the health situation of Health Service areas/administrative divisions within a municipality.66. Rocha TAH, Silva NC, Amaral PVM, Barbosa ACQ, Vissoci JRN, Thomaz EBAF, et al. Geolocalização de internações cadastradas no Sistema de Informações Hospitalares do Sistema Único de Saúde: uma solução baseada no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2018 [citado 2019 maio 7];27(4):e2017444. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v27n4/2237-9622-ress-27-04-e2017444.pdf . doi: 10.5123/s1679-49742018000400016
http://www.scielo.br/pdf/ress/v27n4/2237... These scripts can be used as "templates" and, with slight modifications, can be used in other locations. Users with no knowledge of the program may, in turn, follow instructions for reading these files and automatically generating reports. It is expected that the csapAIH package will contribute to teaching and research and also to the management of SUS Primary Care and its monitoring by society.
References
- 1Ministério da Saúde [BR]. Departamento de Informática do SUS - Datasus. Tab para Windows - TabWin [Internet]. Brasília: Ministério da Saúde; 2010 [citado 2019 maio 7]. Disponível em: Disponível em: http://datasus.saude.gov.br/apresentacao
» http://datasus.saude.gov.br/apresentacao - 2R Core Team. R: a language and environment for statistical computing [Internet]. Vienna, Austria: R Foundation for Statistical Computing; 2018 [cites 2019 May 7]. Disponível em: Disponível em: https://www.R-project.org/
» https://www.R-project.org/ - 3RStudio Team. RStudio: integrated development environment for R [Internet]. Boston, MA: RStudio; 2015 [citado 2019 May 7]. Disponível em: Disponível em: http://www.rstudio.com/
» http://www.rstudio.com/ - 4Fox J. The R commander: a basic statistics graphical user interface to R. J Stat Softw [Internet]. 2005 Sep [citado 2019 May 7];14(i09):1-42. Disponível em: Disponível em: https://www.jstatsoft.org/article/view/v014i09 doi: 10.18637/jss.v014.i09
» https://doi.org/10.18637/jss.v014.i09» https://www.jstatsoft.org/article/view/v014i09 - 5Moriña D, Utzet M, Nedel FB, Martín M, Navarro A. Introducción a la estadística con R-Commander para las ciencias de la salud. Cerdanyola del Vallès: Universitat Autònoma de Barcelona; 2016.
- 6Rocha TAH, Silva NC, Amaral PVM, Barbosa ACQ, Vissoci JRN, Thomaz EBAF, et al. Geolocalização de internações cadastradas no Sistema de Informações Hospitalares do Sistema Único de Saúde: uma solução baseada no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2018 [citado 2019 maio 7];27(4):e2017444. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v27n4/2237-9622-ress-27-04-e2017444.pdf doi: 10.5123/s1679-49742018000400016
» https://doi.org/10.5123/s1679-49742018000400016» http://www.scielo.br/pdf/ress/v27n4/2237-9622-ress-27-04-e2017444.pdf - 7Petruzalek D. Read.dbc: read data stored in dbc (compressed dbf) files [Internet]. 2016 [citado 2019 May 7]. Disponível em: Disponível em: https://CRAN.R-project.org/package=read.dbc
» https://CRAN.R-project.org/package=read.dbc - 8Petruzalek D. READ. DBC: um pacote para importação de dados do datasus na linguagem R. In: Anais do XV Congresso Brasileiro de Informática em Saúde [Internet]; 2016 nov 27-30; Goiânia, Brasil. Goiânia: J Health Inform; 2016 [citado 2019 maio 7] Disponível em: Disponível em: http://www.sbis.org.br/biblioteca_virtual/cbis/Anais_CBIS_2016_Artigos_Completos.pdf
» http://www.sbis.org.br/biblioteca_virtual/cbis/Anais_CBIS_2016_Artigos_Completos.pdf - 9Petruzalek D. Datasus: an interface for the Brazilian public healthcare datasets (Datasus) [Internet]. 2016 [citado 2019 May 7]. Disponível em: Disponível em: https://rdrr.io/github/danicat/datasus/
» https://rdrr.io/github/danicat/datasus/ - 10Prado Siqueira R. Datasus: an interface to datasus system [Internet]. 2017 [citado 2019 May 7]. Disponível em: Disponível em: https://CRAN.R-project.org/package=datasus
» https://CRAN.R-project.org/package=datasus - 11Freitas Saldanha R. Microdatasus: download and preprocess datasus files [Internet]. 2019 [citado 2019 May 7]. Disponível em: Disponível em: https://github.com/rfsaldanha/microdatasus
» https://github.com/rfsaldanha/microdatasus - 12Nedel FB. CsapAIH: classificar condições sensíveis à atenção primária [Internet]. 2016 [citado 2019 maio 7]. Disponível em: Disponível em: https://sourceforge.net/projects/csapAIH/files/v0.0.1/csapAIH-manual.pdf
» https://sourceforge.net/projects/csapAIH/files/v0.0.1/csapAIH-manual.pdf - 13Brasil. Ministério da Saúde. Portaria MS/GM nº 221, de 17 de abril de 2008. Publica, na forma do anexo desta portaria, a lista brasileira de internações por condições sensíveis à atenção primária [Internet]. Diário Oficial da União, Brasília (DF), 2008 abr 18 [citado 2019 maio 7]; Seção 1:70. Disponível em: Disponível em: http://bvsms.saude.gov.br/bvs/saudelegis/sas/2008/prt0221_17_04_2008.html
» http://bvsms.saude.gov.br/bvs/saudelegis/sas/2008/prt0221_17_04_2008.html - 14Caminal Homar J, Casanova Matutano C. La evaluación de la atención primaria y las hospitalizaciones por ambulatory care sensitive conditions. Marco conceptual. Aten Prim [Internet]. 2003 jan [citado 2019 maio 7];31(1):61-5. Disponível em: Disponível em: https://www.elsevier.es/es-revista-atencion-primaria-27-articulo-la-evaluacion-atencion-primaria-las-13042583
» https://www.elsevier.es/es-revista-atencion-primaria-27-articulo-la-evaluacion-atencion-primaria-las-13042583 - 15Ansari Z. The concept and usefulness of ambulatory care sensitive conditions as indicators of quality and access to primary health care. Aust J Prim Health [Internet]. 2007 Dec [citado 2019 May 7];13(3):91-110. Disponível em: Disponível em: https://www.publish.csiro.au/PY/PY07043 doi: 10.1071/PY07043
» https://doi.org/10.1071/PY07043» https://www.publish.csiro.au/PY/PY07043 - 16Nedel FB, Facchini LA, Bastos JL, Martín-Mateo M. Conceptual and methodological aspects in the study of hospitalizations for ambulatory care sensitive conditions. Ciênc Saúde Coletiva [Internet]. 2011 [citado 2019 May 7];16(Suppl 1):1145-54. Disponível em: Disponível em: http://www.scielo.br/pdf/csc/v16s1/a46v16s1.pdf doi: 10.1590/S1413-81232011000700046
» https://doi.org/10.1590/S1413-81232011000700046» http://www.scielo.br/pdf/csc/v16s1/a46v16s1.pdf - 17Nedel FB. csapAIH: uma função para a classificação das condições sensíveis à atenção primária no programa estatístico R. Epidemiol Serv Saúde [Internet]. 2017 jan-mar [citado 2019 maio 7];26(1):199-209. Disponível em: Disponível em: http://www.scielo.br/pdf/ress/v26n1/2237-9622-ress-26-01-00199.pdf doi: 10.5123/s1679-49742017000100021
» https://doi.org/10.5123/s1679-49742017000100021» http://www.scielo.br/pdf/ress/v26n1/2237-9622-ress-26-01-00199.pdf - 18Nedel FB. CsapAIH: classificar condições sensíveis à atenção primária [Internet]. 2019 [citado 2019 May 7]. Disponível em: Disponível em: https://sourceforge.net/projects/csapAIH/files/csapAIH_0.0.3.pdf/download
» https://sourceforge.net/projects/csapAIH/files/csapAIH_0.0.3.pdf/download - 19Ministério da Saúde (BR). Departamento de Informática do SUS - Datasus. Transferência de arquivos [Internet]. Brasília: Ministério da Saúde; 2018 [citado 2019 maio 7]. Disponível em: Disponível em: http://www2.datasus.gov.br/DATASUS/index.php?area=0901&item=1&acao=25
» http://www2.datasus.gov.br/DATASUS/index.php?area=0901&item=1&acao=25
Publication Dates
- Publication in this collection
22 Aug 2019 - Date of issue
2019
History
- Received
09 Mar 2019 - Accepted
10 Apr 2019