Metadata-Version: 2.4
Name: climasus4py
Version: 0.2.0a1
Summary: Fast SUS and climate data workflows for Brazil - Python edition
Project-URL: Homepage, https://github.com/climasus/climasus4py
Project-URL: Repository, https://github.com/climasus/climasus4py
Project-URL: Bug Tracker, https://github.com/climasus/climasus4py/issues
Author-email: Marlon Resende Faria <marlon.faria@usp.br>, Thauã Menezes <thaua.menezes@unesp.br>, "Dr. Max Anjos" <max.anjos@campus.ul.pt>, Andrey Araújo <andreyke.araujo@gmail.com>
Maintainer-email: "Dr. Max Anjos" <max.anjos@campus.ul.pt>
License-Expression: MIT
License-File: LICENSE
Keywords: brazil,climate,datasus,epidemiology,health,sus
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.10
Requires-Dist: climasus-data>=0.2.0
Requires-Dist: climasus-readdbc-py>=0.2.1
Requires-Dist: duckdb>=1.0
Requires-Dist: pandas>=2.0
Requires-Dist: pyarrow>=12.0
Requires-Dist: rich>=13.0
Provides-Extra: all
Requires-Dist: geopandas>=0.14; extra == 'all'
Requires-Dist: joblib>=1.3; extra == 'all'
Requires-Dist: openpyxl>=3.1; extra == 'all'
Requires-Dist: plotnine>=0.12; extra == 'all'
Requires-Dist: polars>=0.20; extra == 'all'
Requires-Dist: pysus>=1.0; extra == 'all'
Requires-Dist: scikit-learn>=1.3; extra == 'all'
Requires-Dist: xgboost>=2.0; extra == 'all'
Provides-Extra: datasus
Requires-Dist: pysus>=1.0; extra == 'datasus'
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Provides-Extra: excel
Requires-Dist: openpyxl>=3.1; extra == 'excel'
Provides-Extra: metadata
Provides-Extra: ml
Requires-Dist: xgboost>=2.0; extra == 'ml'
Provides-Extra: plot
Requires-Dist: plotnine>=0.12; extra == 'plot'
Provides-Extra: polars
Requires-Dist: polars>=0.20; extra == 'polars'
Provides-Extra: spatial
Requires-Dist: geopandas>=0.14; extra == 'spatial'
Provides-Extra: xgboost
Requires-Dist: joblib>=1.3; extra == 'xgboost'
Requires-Dist: scikit-learn>=1.3; extra == 'xgboost'
Requires-Dist: xgboost>=2.0; extra == 'xgboost'
Description-Content-Type: text/markdown

# climasus4py

[![PyPI](https://img.shields.io/pypi/v/climasus4py.svg)](https://pypi.org/project/climasus4py/)
[![Python Versions](https://img.shields.io/pypi/pyversions/climasus4py.svg)](https://pypi.org/project/climasus4py/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)

Fast SUS and climate data workflows for Brazil - Python edition.

Documentation: https://climasus.github.io/climasus4py

## Installation

Install from PyPI:

```bash
pip install climasus4py
```

Install with optional extras:

```bash
pip install "climasus4py[all]"
```

Install latest from GitHub:

```bash
pip install git+https://github.com/climasus/climasus4py.git
```

## Quick Example

```python
import climasus4py as cs

result = cs.sus_pipeline(
    system="SIM-DO",
    uf="SP",
    year=[2021, 2022, 2023],
    lang="en",
    groups=["dengue"],
    time="month",
    geo="state",
)

print(result.df().head())
```

## Step-by-step Example

```python
import climasus4py as cs

# 1. Import and cache
x = cs.sus_data_import("SIM-DO", "SP", [2021, 2022])

# 2. Clean
x = cs.sus_data_clean_encoding(x)

# 3. Standardize
x = cs.sus_data_standardize(x, lang="en")

# 4. Filter
x = cs.sus_filter(x, groups=["dengue"], age_min=0, age_max=80)

# 5. Create variables
x = cs.sus_data_create_variables(x, age_group="who", epi_week=True)

# 6. Aggregate
x = cs.sus_data_aggregate(x, time="month", geo="state")

# 7. Export
cs.sus_export(x, "output/dengue_sp.parquet")
```

To preserve the original DATASUS `.dbc` files for audit or reuse, enable the raw
cache explicitly:

```python
x = cs.sus_data_import(
    "SINAN-DENGUE",
    "SP",
    2024,
    store_raw=True,
    raw_cache_dir="dados/cache/raw",
)
```

## Shared Metadata

climasus4py consumes metadata from `climasus-data` (disease groups, dictionaries,
UFs, regions, DATASUS FTP sources and SINAN disease codes). This dependency is
installed automatically.

You can force update local metadata when needed:

```python
from climasus4py import update_climasus_data
update_climasus_data()
```

## Contributing

- Pull requests and issues are welcome.
- Run tests locally before opening PRs.
- Include a minimal reproducible example for bug reports.

## License

MIT
