sahie-database / README.md
Nason's picture
Publish reviewed dataset guide, preserving later R examples
0739d8a verified
|
Raw History Blame Contribute Delete
8.26 kB
---
pretty_name: Census Small Area Health Insurance Estimates (SAHIE), 2024
license: other
license_name: us-public-domain-census-bureau-work
license_link: https://www2.census.gov/foia/ds_policies/ds027.pdf
tags:
- health-insurance
- census
- sahie
- duckdb
- datapond
size_categories:
- 100K<n<1M
---
# County and State Health Insurance Estimates
Census estimates of health-insurance coverage for U.S. states, DC and counties in 2024. The August 2026 Small Area Health Insurance Estimates (SAHIE) release provides counts, percentages and 90% margins of error for demographic and income groups. Start with `county_uninsured` for one row per county for people under 65, all races, both sexes and all incomes. These are modeled aggregate estimates; categories overlap and are not individual records.
## Start querying
Inspect New York county uninsured estimates and their 90% margins of error. Estimates describe the Census-defined population used for poverty estimates, not the entire resident population; missing values are not zeros.
`fips` is the geographic identifier, `county_name` is its label, `pctui` is percent uninsured, and `pctui_moe` is the 90% margin of error in percentage points.
Expected first counties are Albany, Allegany and Bronx, with uninsured percentages
4.8, 5.4 and 8.1 and 90% margins of error 0.5, 0.7 and 0.6 percentage points.
Python returns DECIMAL percentages as `Decimal`; R returns numeric values. FIPS
identifiers remain strings. These are source estimates, not individual records.
Choose R or Python. Install datapond once: use `install.packages("datapond")` in R, or run `python -m pip install datapond` in a terminal.
### R
```r
library(datapond)
con <- dp_connect("sahie")
tryCatch({
DBI::dbExecute(con, "SET threads=1")
DBI::dbExecute(con, "SET memory_limit='128MiB'")
DBI::dbExecute(con, "SET max_temp_directory_size='0B'")
print(DBI::dbGetQuery(con, "SELECT fips,county_name,pctui,pctui_moe FROM county_uninsured WHERE statefips='36' ORDER BY fips LIMIT 3"))
}, finally = dp_disconnect(con))
```
### Python
```python
import datapond
con = datapond.connect('sahie')
try:
con.execute("SET threads=1")
con.execute("SET memory_limit='128MiB'")
con.execute("SET max_temp_directory_size='0B'")
print(con.execute("""SELECT fips,county_name,pctui,pctui_moe FROM county_uninsured WHERE statefips='36' ORDER BY fips LIMIT 3""").fetchall())
finally:
con.close()
```
Queries run on your computer and read the byte ranges they need. A small result can still require a large scan. These examples limit DuckDB to one thread and a 128 MiB buffer pool with disk spill disabled; that is not a limit on the entire R or Python process. Larger analyses may need more memory or a local download with enough disk space.
<a id="coverage-fields-and-sources"></a>
<a id="additional-dataset-notes"></a>
## Tables, fields and joins
See the [data dictionary](https://huggingface.co/datasets/Nason/sahie-database/resolve/89ff1d4e9c1515a7d777a3deaf8a8c816a271918/DICTIONARY.md) for column definitions.
| Table | Description | Rows | Columns |
|---|---|---:|---:|
| `estimates` | Demographic/income estimates, overlapping groups | 402,786 | 27 |
| `geographies` | State and county FIPS/names | 3,195 | 6 |
| `category_codes` | Official category definitions | 26 | 3 |
`county_uninsured` selects under-65, all-race, both-sex, all-income estimates for
3,144 counties. Source missing values remain SQL NULL.
Join category fields (`agecat`, `racecat`, `sexcat`, `iprcat`) to `category_codes` using the category name and code. `fips` is two characters for state rows and five for county rows; filter the geography level before joining, and keep leading zeros.
## Interpretation
The groups overlap, so table rows must not be added as population counts. Race
detail is state-only. Match geographic vintages before FIPS joins. Kalawao County
is unavailable. Zero margins of error reflect source rounding. These aggregate
modeled data do not identify causal effects. See the [field guide](https://huggingface.co/datasets/Nason/sahie-database/blob/main/FIELD-GUIDE.md),
[data dictionary](https://huggingface.co/datasets/Nason/sahie-database/blob/main/DICTIONARY.md) and the
[official layout](https://www2.census.gov/programs-surveys/sahie/technical-documentation/file-layouts/sahie-file-layout-2008-2024.pdf).
The population denominator is the Census poverty universe. `pctui` uses the selected income group; `pctelig` uses the same demographic group at all incomes. Published 90% uncertainty reflects model and sampling error, subject to model assumptions, and excludes nonsampling error. Missing estimates remain NULL. The field guide defines all measures, overlapping categories, zero-denominator missingness, Kalawao omissions, rounding and geographic-vintage caveats.
<a id="advanced-access-query-the-hosted-database-with-python-or-r"></a>
## Other ways to connect
### Direct DuckDB SQL
```sql
-- In DuckDB with HTTPFS available:
ATTACH 'https://huggingface.co/datasets/Nason/sahie-database/resolve/main/sahie.duckdb' AS sahie (READ_ONLY);
USE sahie;
SELECT fips, county_name, pctui, pctui_moe
FROM county_uninsured WHERE statefips='36' ORDER BY fips LIMIT 3;
```
### Direct hosted access with Python or R
These direct DuckDB examples access the same hosted snapshot as the live catalog.
Install Python `duckdb` or R `duckdb` and `DBI`; `INSTALL httpfs` below installs
DuckDB's HTTP extension if it is not already present.
```python
import duckdb
con = duckdb.connect(config={"memory_limit": "128MiB", "threads": "1",
"max_temp_directory_size": "0B"})
try:
con.execute("INSTALL httpfs; LOAD httpfs")
con.execute("ATTACH 'https://huggingface.co/datasets/Nason/sahie-database/resolve/main/sahie.duckdb' AS sahie (READ_ONLY)")
print(con.execute("""
SELECT fips, county_name, pctui, pctui_moe
FROM sahie.county_uninsured
WHERE statefips = '36' ORDER BY fips LIMIT 3
""").fetchall())
finally:
con.close()
```
```r
library(DBI)
con <- dbConnect(duckdb::duckdb())
tryCatch({
dbExecute(con, "SET memory_limit='128MiB'")
dbExecute(con, "SET threads=1")
dbExecute(con, "SET max_temp_directory_size='0B'")
dbExecute(con, "INSTALL httpfs; LOAD httpfs")
dbExecute(con, "ATTACH 'https://huggingface.co/datasets/Nason/sahie-database/resolve/main/sahie.duckdb' AS sahie (READ_ONLY)")
print(dbGetQuery(con, "
SELECT fips, county_name, pctui, pctui_moe
FROM sahie.county_uninsured
WHERE statefips='36' ORDER BY fips LIMIT 3"))
}, finally = dbDisconnect(con, shutdown=TRUE))
```
The `sahie` dataset is available in the live Datapond catalog.
Queries run on your machine. The 14.17 MB file size is storage, not required RAM;
DuckDB's 128 MiB limit covers its buffer pool, not the entire Python/R process.
Selected columns reduce transfer, but a final `LIMIT` does not guarantee a small
scan. These examples use one thread and disable disk spill.
## Sources and maintenance
### Sources and license
Source: [U.S. Census Bureau SAHIE](https://www.census.gov/data/datasets/time-series/demo/sahie/estimates-acs.html). License: U.S. public domain (Census Bureau work).
Source: [Census SAHIE, 2024](https://www.census.gov/data/datasets/time-series/demo/sahie/estimates-acs.html),
retrieved November 2, 2026. U.S. public domain as a Census Bureau work under the
[agency policy](https://www2.census.gov/foia/ds_policies/ds027.pdf); no worldwide CC0 claim.
### Artifact and client checks
The 14,168,064-byte database includes standard datapond metadata.
Source ZIP SHA-256: `5ec0a0cc5cb2e4e17cf046d9f68508decfdb4d9bbb982781d94bbf56ce50347a`.
Tested engine versions are Python DuckDB 1.5.6 and R DuckDB 1.5.5.
Python and R clients can query this file directly with DuckDB/DBI. The Python
datapond 0.1.5 and CRAN R datapond 0.1.0 clients passed HTTP range tests against
this exact artifact using a temporary registry (DuckDB 1.5.6 and 1.5.5 respectively).
The `sahie` identifier is now available in the live Datapond catalog; the first-use
examples above use that default catalog. See build-manifest.json for identity and validation, and
[the code repository](https://github.com/ian-nason/sahie-database) for client examples.