Skip to main content

readdbc

PyPI version CI Python Versions License: MIT

Leitor puro-Python para arquivos .dbc do DATASUS — formato dBASE III com compressão PKWARE blast. Sem dependências C, sem compilador necessário.


Instalação

pip install climasus_readdbc_py

Requisitos: Python ≥ 3.10, pandas ≥ 2.0


Uso rápido

import readdbc

# Ler arquivo .dbc diretamente como DataFrame pandas
df = readdbc.read_dbc("DOSP2023.dbc")

# Ler arquivo .dbf comum
df = readdbc.read_dbf("dados.dbf")

# Descomprimir bytes brutos de um .dbc para .dbf
with open("DOSP2023.dbc", "rb") as f:
    compressed = f.read()

raw_dbf_bytes = readdbc.blast_decompress(compressed)

O formato DBC

Os arquivos .dbc são distribuídos pelo DATASUS para transferência eficiente dos microdados do SUS (Sistema Único de Saúde). Internamente, são arquivos dBASE III (.dbf) cujo bloco de registros foi comprimido com o algoritmo PKWARE DCL Implode (também chamado de blast).

Layout interno:

[0 .. H)       Cabeçalho DBF não comprimido (H = uint16 LE nos bytes 8-9)
[H .. H+4)     4 bytes de CRC / padding (ignorados)
[H+4 .. EOF)   Dados comprimidos com PKWare blast

A descompressão produz: cabeçalho_dbf + registros_descomprimidos = DBF completo.


API de referência

Função / Classe Descrição
read_dbc(path) Lê um .dbc e retorna pd.DataFrame
read_dbf(path) Lê um .dbf e retorna pd.DataFrame
blast_decompress(b) Descomprime bytes brutos do formato blast
dbc_to_dbf(b) Converte bytes .dbc para bytes .dbf
BlastError Exceção para erros de descompressão
DBFError Exceção para erros de leitura DBF
DBCError Exceção para erros de leitura DBC

Projeto ClimaSUS

Este pacote faz parte do ecossistema ClimaSUS — plataforma de análise de dados climáticos e de saúde pública do SUS.

Metadata

Release files for climasus-readdbc-py 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for climasus-readdbc-py 0.2.0
File Size Uploaded Provenance Actions
climasus_readdbc_py-0.2.0.tar.gz 15.9 kB With provenance Details for climasus_readdbc_py-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for climasus-readdbc-py 0.2.0
File Interpreter ABI Platform Actions
climasus_readdbc_py-0.2.0-py3-none-any.whl Python 3 none any Details for climasus_readdbc_py-0.2.0-py3-none-any.whl

Total release size: 28.6 kB

Release files / climasus_readdbc_py-0.2.0.tar.gz

Download URL climasus_readdbc_py-0.2.0.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
750f77731eeeab544e95e3c677d7df8a666c4be78562ba7e6f13842fd3938b13
BLAKE2b-256 checksum
How to use checksums
5f2f2c0c53fb59511abf1619060010a46542147e6de3583109a072da4fb32a83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Release files / climasus_readdbc_py-0.2.0-py3-none-any.whl

Download URL climasus_readdbc_py-0.2.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
223c68d6b005b2e7b19b325de1bf29dadf3998537e3618f00f16bad3406ba484
BLAKE2b-256 checksum
How to use checksums
edb368e3f16d04bfdf70a626983cc69459acfd6d3f3faa918167b12accfb78bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Security for climasus-readdbc-py 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for climasus_readdbc_py-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page