traumar
Functions to help with data analytics in the injury epidemiology field.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (20.0%) to scientific vocabulary
Keywords
ems
mortality
pi
probability
quality
r
survival
trauma
triss
Last synced: 6 months ago
·
JSON representation
Repository
Functions to help with data analytics in the injury epidemiology field.
Basic Info
- Host: GitHub
- Owner: bemts-hhs
- License: other
- Language: R
- Default Branch: main
- Homepage: https://bemts-hhs.github.io/traumar/
- Size: 9.58 MB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 5
- Releases: 4
Topics
ems
mortality
pi
probability
quality
r
survival
trauma
triss
Created about 1 year ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
Support
README.Rmd
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(traumar)
```
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://github.com/bemts-hhs/traumar/actions/workflows/R-CMD-check.yaml)
[](https://CRAN.R-project.org/package=traumar)



[](https://app.codecov.io/gh/bemts-hhs/traumar)
# traumar
Continuous Quality Improvement (CQI) and Process Improvement (PI) are essential
pillars of healthcare, particularly in the care of injured patients. However,
hospitals, trauma systems, and their trauma program managers (TPMs) often lack
access to standardized quality measures derived from academic literature. The
{traumar} package addresses this gap by providing tools to calculate quality
measures from trauma center or trauma system effectiveness and efficiency, to
relative mortality efficiently and accurately. By automating these calculations,
{traumar} empowers hospital systems, trauma networks, and TPMs to focus their
efforts on analyzing outcomes and driving meaningful improvements in patient
care. Whether you're seeking to enhance PI initiatives or streamline CQI
processes, {traumar} serves as a valuable resource for advancing trauma care
quality.
## Installation
You can install the development version of `traumar` from [GitHub](https://github.com/bemts-hhs/traumar) with:
``` r
# install.packages("remotes")
remotes::install_github("bemts-hhs/traumar")
```
Additionally, you can install the CRAN version of `traumar` via:
```r
install.packages("traumar")
```
## Helper Functions
{traumar} has many functions to help you in your data analysis journey! In
particular, if you do not presently have access to probability of survival data,
{traumar} provides the `probability_of_survival()` function to do just that
using the TRISS method. Check out the additional package documentation at
https://bemts-hhs.github.io/traumar/ where you can find examples of each
function the package has to offer.
## Trauma System Evaluation and Quality Improvement
{traumar} includes functions to allow users to calculate the efficiency and
effectiveness of one or more trauma centers, or even a trauma system. The
`seqic_indicator_*` family of functions affords users the logic and formulas to
assess their center or system on topics of importance such as:
- Surgeon/physician/mid-level provider response times
- Data Quality
- Rate of autopsy among deceased trauma patients
- Blood alcohol measurements / drug testing
- Analysis of mortality among risk groups
- Time from patient arrival to a) physical discharge, b) decision, c) time from
decision to physical discharge
- Trauma team activations
- Under and over triage
- ...among many others. Please check the {traumar}
https://bemts-hhs.github.io/traumar/ documentation to explore all these
analytical opportunities
## Calculating the W-Score
The W-Score tells us how many survivals (or deaths) on average out of every 100
cases seen in a trauma center. Using R, we can do this with the {traumar}
package.
### First, we will create the data for these examples
```{r all_data}
# Generate example data
set.seed(123)
# Parameters
n_patients <- 5000 # Total number of patients
groups <- sample(x = LETTERS[1:2], size = n_patients, replace = TRUE) # Arbitrary group labels
trauma_type_values <- sample(x = c("Blunt", "Penetrating"), size = n_patients, replace = TRUE) # Trauma types
rts_values <- sample(x = seq(from = 0, to = 7.8408, by = 0.005), size = n_patients, replace = TRUE) # RTS values
ages <- sample(x = seq(from = 0, to = 100, by = 1), size = n_patients, replace = TRUE) # patient ages
iss_scores <- sample(x = seq(from = 0, to = 75, by = 1), size = n_patients, replace = TRUE) # ISS scores
# Generate survival probabilities (Ps)
Ps <- traumar::probability_of_survival(trauma_type = trauma_type_values, age = ages, rts = rts_values, iss = iss_scores)
# Simulate survival outcomes based on Ps
survival_outcomes <- rbinom(n_patients, size = 1, prob = Ps)
# Create data frame
data <- data.frame(Ps = Ps, survival = survival_outcomes, groups = groups) |>
dplyr::mutate(death = dplyr::if_else(survival == 1, 0, 1))
```
### The W-Score!
```{r w_score}
# Calculate trauma performance (W, M, Z scores)
trauma_performance(data, Ps_col = Ps, outcome_col = death)
```
## Comparing the Probability of Survival Distribution of your Patient Mix to the Major Trauma Outcomes Study
The M and Z scores are calculated using methods defined in the literature
(Champion et al., 1990, Flora, 1978) may not be meaningful if the distribution
of the probability of survival measure is not similar enough to the Major Trauma
Outcomes Study distribution. {traumar} provides a way to check this in your data
analysis script, or even from the console. The `trauma_performance()` function
does this under the hood for you, so you can get a read out of how much
confidence you can put into the Z score.
```{r trauma_case_mix}
# Compare the current case mix with the MTOS case mix
trauma_case_mix(data, Ps_col = Ps, outcome_col = death)
```
## The Relative Mortality Metric
Napoli et al.(2017) published methods for calculating a measure of trauma center
(or system) performance while overcoming a problem with the W-Score and the
TRISS methodology. Given that the majority of patients seen at trauma centers
will have a probability of survival over 90%, estimating performance based on
the W-Score may only indicate how well a center performed with lower acuity
patients. Using Napoli et al. (2017), it is possible to calculate a score that
is similar to the W-Score in its interpretability, but deals with the negatively
skewed probability of survival problem by creating non-linear bins of score
ranges, and then weighting a score based on the nature of those bins. The
Relative Mortality Metric (RMM) has a scale from -1 to 1.
* An RMM of 0 indicates that the observed mortality aligns with the expected
national benchmark across all acuity levels.
* An RMM greater than 0 indicates better-than-expected performance, where
the center is outperforming the national benchmark.
* An RMM less than 0 indicates under-performance, where the center’s observed
mortality is higher than the expected benchmark.
## Non-Linear Binning Algorithm
An important part of the approach Napoli et al. (2017) took was to modify the
M-Score approach of looking at linear bins of the probability of survival
distribution, and make it non-linear. The {traumar} package does this for you
using Dr. Napoli's method:
``` {r non_linear}
# Apply the nonlinear_bins function
results <- nonlinear_bins(data = data,
Ps_col = Ps,
outcome_col = survival,
divisor1 = 4,
divisor2 = 4,
threshold_1 = 0.9,
threshold_2 = 0.99)
# View intervals created by the algorithm
results$intervals
# View the bin statistics
results$bin_stats
```
## The RMM function
The RMM is sensitive to higher acuity patients, meaning that if a trauma center
struggles with these patients, it will be reflected in the RMM. In contrast, the
W-Score may mask declines in performance due to the influence of lower acuity
patients via the MTOS Distribution. The {traumar} package automates RMM
calculation as a single score using the nonlinear binning method from Napoli et
al. (2017). The `rmm()` and `rm_bin_summary()` functions internally call
`nonlinear_bins()` to generate the non-linear binning process. The function uses
bootstrap sampling with `n_samples` to simulate an RMM distribution and estimate
95% confidence intervals. The RMM, along with corresponding confidence
intervals, are provided for the population in `data`, as well.
```{r rmm}
# Example usage of the `rmm()` function
rmm(data = data,
Ps_col = Ps,
outcome_col = survival,
n_samples = 250,
Divisor1 = 4,
Divisor2 = 4
)
# Pivoting can be helpful at times
rmm(
data = data,
Ps_col = Ps,
outcome_col = survival,
n_samples = 250,
Divisor1 = 4,
Divisor2 = 4,
pivot = TRUE
)
# RMM calculated by non-linear bin range
# `rm_bin_summary()` function
rm_bin_summary(data = data,
Ps_col = Ps,
outcome_col = survival,
Divisor1 = 4,
Divisor2 = 4,
n_samples = 250
)
```
## Code of Conduct
Please note that the traumar project is released with a [Contributor Code of Conduct](https://bemts-hhs.github.io/traumar/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Owner
- Name: Bureau of Emergency Medical and Trauma Services
- Login: bemts-hhs
- Kind: user
- Location: Des Moines, Iowa
- Company: Bureau of Emergency Medical and Trauma Services > Division of Public Health > Iowa HHS
- Website: https://hhs.iowa.gov/public-health/emergency-medical-services-trauma
- Repositories: 1
- Profile: https://github.com/bemts-hhs
Injury and EMS epidemiology
GitHub Events
Total
- Create event: 9
- Release event: 3
- Issues event: 11
- Watch event: 5
- Delete event: 5
- Issue comment event: 1
- Public event: 1
- Push event: 204
- Pull request event: 5
Last Year
- Create event: 9
- Release event: 3
- Issues event: 11
- Watch event: 5
- Delete event: 5
- Issue comment event: 1
- Public event: 1
- Push event: 204
- Pull request event: 5
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 7
- Total pull requests: 7
- Average time to close issues: 25 days
- Average time to close pull requests: 11 minutes
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 7
- Pull requests: 7
- Average time to close issues: 25 days
- Average time to close pull requests: 11 minutes
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- bemts-hhs (7)
Pull Request Authors
- bemts-hhs (7)
Top Labels
Issue Labels
documentation (1)
upkeep (1)
Pull Request Labels
bug (2)
upkeep (2)
Packages
- Total packages: 1
-
Total downloads:
- cran 206 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
cran.r-project.org: traumar
Calculate Metrics for Trauma System Performance
- Homepage: https://bemts-hhs.github.io/traumar/
- Documentation: http://cran.r-project.org/web/packages/traumar/traumar.pdf
- License: MIT + file LICENSE
-
Latest release: 1.2.2
published 6 months ago
Rankings
Dependent packages count: 27.2%
Dependent repos count: 33.5%
Average: 49.2%
Downloads: 87.0%
Maintainers (1)
Last synced:
6 months ago
Dependencies
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v4 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- cli >= 3.6.3 imports
- dplyr >= 1.1.4 imports
- ggplot2 >= 3.5.1 imports
- lubridate >= 1.9.4 imports
- rlang >= 1.1.5 imports
- stats * imports
- tibble >= 3.2.1 imports
- tidyr >= 1.3.1 imports
- tidyselect >= 1.2.1 imports
- utils * imports
- broom * suggests
- testthat >= 3.0.0 suggests