Skip to content

Latest commit

 

History

History
81 lines (59 loc) · 3.3 KB

README.md

File metadata and controls

81 lines (59 loc) · 3.3 KB

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