Metadata-Version: 2.3
Name: health-code
Version: 0.1.2
Summary: print_unique and a simple annual mortality disclosure script.
Requires-Dist: polars>=1.36.1,<1.42
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# health-code

A `print_unique` helper and one editable Python script for the national weighted mortality release.

```bash
uv pip install --upgrade health-code
health-example prepare_mortality_disclosure.py
```

Edit the paths, date, placeholder column names, and annual filename pattern at the top of the copied script. Run it with `uv run python prepare_mortality_disclosure.py`.

The script appends 2001–2024, adds `survivors = n - deaths`, and writes two CSVs:

```text
20261026/
  support/national_mortality_20261026_support_CUI_SP-CENS_T13T26.csv
  for_release/national_mortality_20261026_T13T26.csv
```

Support preserves exact input values and adds survivors. The release keeps rows and:

- Displays unweighted counts below 15 as the string `<15`.
- Rounds larger counts to the nearest 10, 50, 100, 500, or 1,000 according to their size; counts of a million or more use four significant digits.
- Rounds the existing **weighted** mortality rate and weighted population to four significant digits.
- Puts `D` in mortality when observations, deaths, or survivors are below 15, including zero; puts `D` in weighted population when observations are below 15.
- Omits survivors from the release.

It expects complete aggregate inputs, including actual unweighted deaths. It does not reconstruct deaths from a weighted rate. Rerunning replaces the two output files.

Rounding follows the [Census Methods Handbook, pp. 27–29](https://www2.census.gov/adrm/FSRDC/Resources/FSRDC-Disclosure-Avoidance-Methods-Handbook.pdf). Count ties below a million round half to even; four-significant-digit rounding uses Polars. The zero-count rate screen is this product's conservative choice. Prior-release/complementary suppression review and Census clearance still apply.

```python
from health import print_unique
print_unique(df, "year")
```

Version 0.1.2 removes the earlier disclosure helper API, XLSX output, optional inventory, and validation framework. The disclosure code is entirely in the example script; `health-example` simply copies it for editing.
