Skip to content

Julia Package for reading DBC (.dbc) files from DATASUS into data frame tables

License

Notifications You must be signed in to change notification settings

lego-yaw/DBCDatasus.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DBCDatasus

Stable Dev Build Status Coverage

DBCDatasus.jl

  • A simple package for converting .dbc (compressed DBC) files from Datasus into .dbf (DBF) and data frames tables.

  • DATASUS plays a critical role in ensuring the efficient operation of Brazil's public health system. DATASUS is the name of the Departement of informatics of Brazil's health system (Sistema Unico de Saúde-SUS). They are responsible for maintaining and publishing Brazilian public health data. Aside this, the Brazilian National Agency for supplementary Health data (ANS), also use the same file format for storing public health data.

  • Please note that, this package only handles .dbc format used by DATASUS and is not in any way related to handling Microsoft Foxpro or CANdb DBC files.

Installation

  • Package can be installed like any other julia package
>>> ]
>>> add DBCDatasus

or

>>> using Pkg
>>> Pkg.add("DBCDatasus")

Usage

  • DBCDatasus is simple to use
# converting dbc to dbf format
>>> using DBCDatasus
>>> dbctodbc("path/to/file.dbc, path/to/file.dbf) # input file is .dbc file and output file is .dbf

# converting dbc into dataframe Table
>>> using DBCDatasus
>>> df = dbcTable("path/to/file.dbc)" # input file is .dbc file and output file is in table format
>>> head(df) 

# Example
>>> using Downloads, using DBCDatasus
>>> Downloads.download("ftp://ftp.datasus.gov.br/dissemin/publicos/SIASUS/200801_/Dados/ABOAC1909.dbc", "ABOAC1909.dbc") # this link downlaods the ABOAC1909.dbc file from Datasus database.

# run fucntion
>>> df = dbcTable("ABOAC1909.dbc") ## read into dataframe Table, this will also greate a dbf file for you
>>> display(df)

#Note
# This will create dbf files in your directory, to remove them just run
>>>dir_path = "Path to directory"
>>>files = readdir(dir_path)
>>> for file in files
       if endswith(file, ".dbf")
        rm(joinpath(dir_path, file))
        end
    end


### If you want to convert from dbc to dbf only, use this 
>>> using DBCDatasus
>>> dbctodbc("ABOAC1909.dbc", "ABOAC1909.dbf") # conversion into DBF format

Format description references

Contact information

Citation

About

Julia Package for reading DBC (.dbc) files from DATASUS into data frame tables

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages