Work on a focused branch. From the repository root, install development dependencies with pak::pak(".", dependencies = TRUE) in R. Install devtools, callr, and cyclocomp for checks, and put Air 0.13.0 and Jarl 0.7.1 on your PATH.
Data types
Keep HCUP category codes numeric in DuckDB and derived binary indicators as BOOLEAN. Keep indicators logical in R, including after collection and in survey designs. Apply factor labels to multi-level codes at the R boundary with nis_label().
Verify a change
- Before writing code, list what could fail. Prefer end-to-end tests of the public workflow with invented fixtures. Keep the inputs, exact command, platform, transcript, and observed results for each run. Follow AGENTS.md when a test needs isolation.
- Run relevant tests with
devtools::test(). Keep tests fast and safe to run in parallel. Put slow tests behindEASYNIS_FULL_TESTSand keep CI on each push under 10 minutes. SetTESTTHAT_CPUSto use more test workers on a larger machine. Small fixtures use one DuckDB thread per connection. Workload tests set their own thread limits. - If roxygen comments change, run
devtools::document()and commit the generated changes. Use the roxygen2 version inDESCRIPTION. - Put changelog bullets in one unique
news/<topic-slug>.mdfragment. LeaveNEWS.mdfor collection. An optional first##heading must match a development section inNEWS.md. - Before committing, run
Rscript --vanilla tools/check-package.R --lintfor CodeMeta freshness, Air formatting, Jarl lint, and installed-package cyclomatic complexity of 15 or less. Refresh CodeMeta withRscript --vanilla tools/probe/update-codemeta.Rafter editing package metadata. - Before opening the PR, run
Rscript --vanilla tools/check-package.R --full. It runsdevtools::check()on the exact commit withEASYNIS_FULL_TESTSenabled, isolated from the working tree and ignored data. For routine checks, omit--full. The source build still renders the vignettes. The check validates the shipped outputs and leaves the second vignette execution to full qualification.
Describe what changed, how you verified it, and any remaining limitations in the PR template. See the improvement loop for orchestrated work and review.
Where changes belong
Package code lives in R/, with related tests in tests/testthat/.
| To change | Start here |
|---|---|
| Opening annual or Hive data |
R/open.R for the entry point and query dependencies, R/cohort-source.R for saved-cohort markers, R/open-discovery.R for part ownership, R/open-parquet.R for scans, R/open-release.R for release checks, and R/duckdb.R for connections and spill storage |
| Adding columns with native SQL |
R/query-expressions.R for result tables and preservation of source ownership, grouping, and window context |
| Diagnosis or procedure selection |
R/code-layout.R for slots and code systems, R/code-flags.R for matching, R/procedure-days.R for PRDAY decoding, and R/pr-timing.R for the shared timing rules and slot layout |
| Saved cohorts and conversion |
R/cohort-source.R for persisted cohort membership, R/write-cohort.R for exports, R/convert.R for conversion, and R/staged-directory.R for publication and cleanup |
| Survey design or weights |
R/design-sample.R for sample eligibility and roster checks, R/lazy-survey.R for the DuckDB domain roster, R/design.R for analyst field selection, R/cohort-design.R for survey objects, R/survey-variance.R for PSU identities and variance, and R/reweight.R for reweighting |
| Disclosure |
R/disclosure-policy.R for policy, R/cell-counts.R for summaries, and R/suppress-survey.R or R/suppress-data-frame.R for masking |
| Generated studies |
inst/templates/nis-study/analysis.qmd for study definitions and presentation, R/study-disclosure.R for publication decisions, R/study-model.R for fit diagnostics, and R/study-cache.R for caching |
| Improvement probes |
tools/probe/quality-checks.R for checks, tools/probe/quality-receipts.R for evidence, and tools/probe/readiness-criteria.R for readiness |
For scan planning or DuckDB workload changes, run the bounded scan check and spill benchmark.
Update CCSR mappings
Update the AHRQ CCSR mappings with Rscript --vanilla tools/update-ccsr.R <dx|pr> <version> <YYYY-MM-DD> <HCUP-URL> [local-file] [expected-codes] [expected-categories] [expected-pairs] for each release. The input can be the download URL, a local HCUP ZIP or workbook, or its mapping CSV. Use - for the local-file argument when downloading and checking published totals. Review the release index, verify the mapping diff and coverage, update the attribution, and open a pull request.
Privacy and licensing
Keep licensed HCUP inputs, real records, private paths, and local validation receipts out of the repository and public material. Never publish output from real-data runs, including estimates, counts, or any record-derived values, in issues, PRs, commits, or docs. Keep those outputs in Git-ignored local/loop/. Review tables for primary and complementary disclosure risks. Follow the HCUP Data Use Agreement and institutional requirements, and contribute independently authored code compatible with AGPL-3.0-only.
Before posting an issue or PR body, save the text locally and run Rscript --vanilla tools/check-public-text.R path/to/body.md. Check the text yourself for private material even when the scanner passes.