| Title: | Readmission Risk Pool Platform |
|---|---|
| Description: | The Readmission Risk Pool Platform (RRP) facilitates hospital readmissions prediction and management. |
| Authors: | Alex Zajichek [aut, cre], CentralStatz Statistical & Data Sciences LLC [cph] |
| Maintainer: | Alex Zajichek <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 0.0.1.9000 |
| Built: | 2026-11-01 19:05:26 UTC |
| Source: | https://github.com/centralstatz/readmit |
Read retained assessment rows and their run context without sourcing or invoking project-authored analytical functions. Both optional filters use exact identifier matching and may be combined.
rrp_inspect_history(path, run_id = NULL, episode_id = NULL)rrp_inspect_history(path, run_id = NULL, episode_id = NULL)
path |
Path to an existing RRP project with initialized state. |
run_id |
Optional single nonblank run ID to select. |
episode_id |
Optional single nonblank episode ID to select. |
Initialize state with rrp_state_init() before inspecting history.
Rows are ordered by run creation time, run ID, and episode ID. Reads use a
read-only connection and never create state or modify history. A completed
run with zero episodes contributes no assessment row.
An ordinary data frame containing stored assessment identity,
times, disposition, probability, failure detail, selected terminal-event
context, and associated run metadata. Empty results retain the same
columns and types, including UTC POSIXct timestamps.
project <- tempfile("rrp-inspect-") rrp_project_init(project, "example-rrp") rrp_state_init(project) rrp_inspect_history(project) unlink(project, recursive = TRUE)project <- tempfile("rrp-inspect-") rrp_project_init(project, "example-rrp") rrp_state_init(project) rrp_inspect_history(project) unlink(project, recursive = TRUE)
Copy the installed project template into a new, user-owned directory. The project contains editable configuration, branding, source-mapping and risk-provider scripts, and a Shiny application. Initialization does not create analytical state or products. The project owner must implement the two analytical scripts before running assessments.
rrp_project_init(path, project_id)rrp_project_init(path, project_id)
path |
Destination for the new project. Its parent directory must exist, and the destination itself must not exist, even as an empty directory. |
project_id |
A nonempty project identifier beginning with a letter or
digit and containing only letters, digits, |
The project-owned application runs separately with ordinary Shiny
tooling, for example shiny::runApp("path/to/project/app"), after its
dependencies are installed as described in the project's README.md.
The normalized project path, invisibly.
project <- file.path(tempdir(), "example-rrp-project") if (!file.exists(project)) { rrp_project_init(project, "example-rrp-project") }project <- file.path(tempdir(), "example-rrp-project") if (!file.exists(project)) { rrp_project_init(project, "example-rrp-project") }
Read project identity and completed-run status without sourcing the project's analytical scripts, executing an assessment, or changing state. This also works before analytical state has been initialized.
rrp_project_status(path)rrp_project_status(path)
path |
Path to an existing RRP project directory. |
The latest run is the most recently recorded completed run by
created_at, not the largest analytical as_of_time. Ties in recorded
creation time are broken by run_id. Reads use a read-only connection and
do not initialize state.
An ordinary named list containing character project_id, logical
state_initialized, integer run_count, character latest_run_id, and
UTC POSIXct latest_as_of_time. The latest fields are typed missing
values when there are no runs.
project <- tempfile("rrp-status-") rrp_project_init(project, "example-rrp") rrp_project_status(project) unlink(project, recursive = TRUE)project <- tempfile("rrp-status-") rrp_project_init(project, "example-rrp") rrp_project_status(project) unlink(project, recursive = TRUE)
Check that an existing project has readable rrp-project.dcf and
rrp-authoring.dcf files and that their configured scripts define
rrp_produce_canonical(project_root, as_of_time) and
rrp_calculate_risk(project_root, request). A newly initialized project's
deliberate function stubs pass this check.
rrp_project_validate(path)rrp_project_validate(path)
path |
Path to an existing RRP project directory. |
The project-authored scripts are sourced, so their top-level R code can run. Neither authoring function is called. This is a structural check; it does not test source data, model behavior, analytical readiness, or the project's Shiny application.
TRUE, invisibly, when the essential configuration and authoring
functions load successfully. Missing or unusable resources raise an error.
project <- tempfile("rrp-validation-") rrp_project_init(project, "example-rrp") rrp_project_validate(project) unlink(project, recursive = TRUE)project <- tempfile("rrp-validation-") rrp_project_init(project, "example-rrp") rrp_project_validate(project) unlink(project, recursive = TRUE)
Derive the current clinically eligible risk pool, observed accepted-risk
trajectories, and operational scope from retained assessment history. The
selected completed run has the greatest analytical as_of_time; execution
created_at and then run_id break ties. A later-executed historical
backfill does not replace a newer analytical snapshot.
rrp_refresh_products(path)rrp_refresh_products(path)
path |
Path to an existing RRP project with initialized analytical state and at least one completed assessment run. |
Files are written under state/products/ as
current-remaining-risk.csv, remaining-risk-trajectory.csv, and
operational-scope-summary.csv. The current-risk file includes clinically
eligible provider-failure episodes with a missing probability, never zero
or an earlier estimate. Refresh reads history only: it does not run the
source mapper or provider, add a run, change retained history, or edit the
project-owned app. All files are staged and checked before replacement.
Replacement of the three files is not fully atomic if a filesystem error
occurs during the final replacement sequence.
Invisibly, a list with selected_run_id, UTC as_of_time, and named
character files containing the three generated CSV paths.
Run the configured project source mapper at one analytical time, determine which discharge episodes remain eligible for first readmission in the remaining 30-day follow-up window, and call the project risk provider once per eligible episode. Accepted estimates, provider failures, and ineligible outcomes are retained together as one completed run.
rrp_run(path, as_of_time)rrp_run(path, as_of_time)
path |
Path to an existing RRP project with initialized analytical state. |
as_of_time |
One finite UTC |
Call rrp_state_init() before the first run. The project owner must
implement the configured rrp_produce_canonical() and
rrp_calculate_risk() functions. A provider failure affects its episode,
while a source or persistence failure stops the run without a partial
completed record. Analytical products are generated separately.
An ordinary list with run_id, as_of_time, episodes_processed,
accepted, provider_failures, and ineligible. Counts are integers;
the run ID belongs to a successfully committed run.
## Not run: assessment_time <- as.POSIXct("2026-01-10 12:00:00", tz = "UTC") rrp_run("my-rrp-project", assessment_time) ## End(Not run)## Not run: assessment_time <- as.POSIXct("2026-01-10 12:00:00", tz = "UTC") rrp_run("my-rrp-project", assessment_time) ## End(Not run)
Create state/history.duckdb and its empty runs and assessments tables
for an existing project. This is separate from project creation and does not
execute assessments or generate analytical products.
rrp_state_init(path)rrp_state_init(path)
path |
Path to an existing RRP project that passes structural validation. |
Initialization refuses to overwrite any existing state/ directory.
Project-authored scripts are loaded during structural validation, but their
source-mapping and risk-provider functions are not called.
The normalized project path, invisibly.
project <- tempfile("rrp-state-") rrp_project_init(project, "example-rrp") rrp_state_init(project) unlink(project, recursive = TRUE)project <- tempfile("rrp-state-") rrp_project_init(project, "example-rrp") rrp_state_init(project) unlink(project, recursive = TRUE)