Welcome to PySUS documentation!
PySUS is a Python package for accessing and analyzing Brazil’s public health data (DATASUS). It provides tools to download, process, and work with health datasets including SINAN (disease notifications), SIM (mortality), SINASC (births), SIH (hospitalizations), SIA (ambulatory), CIHA, CNES, PNI, and more.
A local web server (pysus web) is included for interactive browsing and downloading of datasets through a graphical Streamlit interface.
This documentation covers PySUS 2.0+.
Contents
- Installation
- Quickstart
- Guides
- Data Sources
- Working with DATASUS data
- 1. The systems at a glance
- 2. The DBC format
- 3. Encoding: always latin-1
- 4. File naming and the FTP layout
- 5. The DATASUS FTP server
- 6. Large files and memory (SIA-PA)
- 7. Column layouts drift across years
- 8. Do not trust third-party data dictionaries
- 9. Same concept, different column names
- 10. Sex encoding: three different maps
- 11. Age encoding: three different schemes
- 12. CID-10 codes: validity, multicausal fields, prefix matching
- 13. Municipality codes: 6 vs 7 digits
- 14. Missing-data sentinels
- 15. Data types: codes, money, plausibility
- 16. Disappearing fields: AP_TIPPRE
- 17. Boolean encodings: S/N vs 0/1
- 18. Auxiliary reference tables (.CNV, CBO, equipment)
- 19. Deduplication and natural keys
- 20. System notes: CNES and SIH-SP
- 21. Population denominators (IBGE)
- 22. Researcher checklist
- Tutorials
- API Reference
- Architecture Overview
- Quick Start
- FileBag
- Main Client
- Types
- Utilities
- File Format Handlers
- Abstract Base Models
- High-Level Data Functions
- Column Metadata
- Errors & Warnings
- Cache Management
- Input Validation
- Data Quality
- Data Transformation
- Export
- Data Diff
- Metadata Models
- OpenDataSUS Client
- DuckLake Client
- FTP Client
- DadosGov Client
- Package Root
- DuckLake Internals
- Legacy Data Readers
- CLI
- Migration
- Async-first clients
- Central orchestrator
- OpenDataSUS (Saude) client
- Migrating from the flat fetchers to the origin namespaces
- Unified metadata layer
- First-run experience
- Cache and state
- TOML configuration
- CLI commands
- Friendly errors
- Progress bars
- Export
- Data quality
- Column metadata
- Parallel downloads
- Contributing