Repository navigation
Releases
Releases · MSaadAsif/easyNIS
easyNIS 0.2.0
Highlights
- Replaced the archived API with lazy annual Parquet opening, ICD-10 prefix
flags, a domain survey design, HCUP labels, CPI-adjusted charges and costs,
cell suppression, and an invented six-year example fixture. - Added a Getting started guide, a guide to porting existing NIS studies, and
an analyst workflow note.
New features
nis_open()supports 2012 onward.nis_flag_dx()andnis_flag_pr()match
literal prefixes separately in each code slot; supplied prefixes ignore
case, periods, and spaces, while stored codes are compared byte for byte
without text normalization, so malformed UTF-8 cannot raise a matching
error.- Added experimental ICD-9 prefix flags with an explicit
system = "icd9"
option, metadata guards, and invented historical and split-2015 fixtures.
ICD-10 remains the default. nis_comorbidity()adds AHRQ Elixhauser Refined condition flags and
mortality/readmission index scores through the suggestedmedicalcoder
package. It accepts a collected data frame or annis_design()result.nis_ccsr_codes()reads a user-supplied HCUP DXCCSR or PRCCSR reference
file (Excel viareadxlor comma-separated) and returns ICD-10 codes in
selected CCSR categories, optionally restricted to the default inpatient
assignment. The codes can be passed tonis_flag_dx()ornis_flag_pr().
Survey design and weighting
nis_design()reports aggregate exclusions for invalid design fields and
affected years, stores the counts in thenis_excludeddesign attribute,
and documents why rows with invalidYEAR,HOSP_NIS,NIS_STRATUM, or
DISCWTcannot be represented in the supplied survey design. Exclusions
happen before cohort filtering and do not imply zero population weight or
unbiased estimates.nis_design()warns when charges are entirely missing for a year or when
that year has hospitals but no cohort discharges.annualizedivides by
the number of distinctYEARvalues, so a partial year counts as one.- Added experimental
nis_reweight()to multiply cohort survey weights while
retaining placeholder rows. It preserves column labels when rebuilding
designs, including after comorbidity scoring. Weights are matched by
position; call the function once. Weighted totals after reweighting are not
national counts, and its placeholder variance field does not provide survey
variance estimation. An optional commented WeightIt/cobalt example is in
the study template.
Disclosure control
nis_suppress()also masks the overall (add_overall()) cell in any row
where a by-group cell is masked. It marks that secondary maskMasked,
unless the overall cell is itself at or below the threshold.- For
continuous2statistic rows, suppression uses the displayed output
column's non-missing count and errors when that count is missing, ambiguous,
or non-finite. Other derivable cells, such as column totals across levels,
are not masked; review tables before sharing.
Study template
- Quarto study reports handle empty cohorts, one-level exposures, constant
outcomes, and unusable model matrices with explicit status messages. Models
use complete-case preflight; single-year reports omit the year adjustment,
and DOCX trend tables display years without thousands separators. - Report caches include study definitions, external data-root identity,
report inputs, output format, and rendering dependencies. - The template includes an optional, commented propensity-weighting example;
both WeightIt and cobalt must be installed to use it.
Documentation
- Added a Getting started guide covering file opening, flags, survey design,
weighted tables, models, primary-cell suppression, and study scaffolding;
runnable examples for exported helpers use invented fixtures, with the
slower optional comorbidity example markeddonttest. - Added a vignette on porting existing NIS study code, a short tidyverse
pipeline README, grouped pkgdown reference pages, and package citation
metadata. - Added issue templates, a privacy-aware pull request checklist, Contributor
Covenant, security reporting guidance, and contributor instructions. - Added CI workflows for linting, test coverage, and study-template rendering.
The pkgdown site is published at https://msaadasif.github.io/easyNIS/ on
pushes tomain.
Experimental and unverified
- The placeholder-row survey method is experimental and must agree with the
full-data design on estimates, standard errors, and degrees of freedom. - ICD-9 support is experimental. Historical layout facts beyond the
documented 2015 Q1–Q3/Q4 split are assumptions and have not been verified
against official HCUP documentation or licensed data. - NIS 2023 layout support is experimental and UNVERIFIED against official
HCUP 2023 documentation and real 2023 data. It assumesTOTCHG_2023, the
removal ofHOSP_REGIONandHOSP_DIVISION, and sequentialNIS_STRATUM
based on secondary notes.nis_open()accepts files without the geography
columns and keepsTOTCHG_2023separate fromTOTCHG; queries containing
it receive a once-per-session warning because HCUP's national-estimate
adjustment makes it incomparable with earlier-year charges.nis_design()
andnis_cost()acceptcharges = "TOTCHG_2023"to opt in; pooling requires
an explicitmutate(). Hospital and stratum IDs remain qualified by year. nis_comorbidity()is ICD-10 only, does not use present-on-admission
values, and treatsI10_DX1as the principal diagnosis. Its output is not
expected to match the Stata-derivedynel*andelixsumcolumns. Rows
without a usableI10_DX*code, including ICD-9-era discharges, receive
NAand a warning rather than zeros.- HCUP CCSR file layouts are UNVERIFIED; no CCSR content is bundled.
Malformed single-quoted CSV rows and non-ICD-10 codes are rejected.
Install: pak::pak("MSaadAsif/easyNIS@v0.2.0") · Docs: https://msaadasif.github.io/easyNIS/