diff --git a/.gitignore b/.gitignore index 09d5605..4e9f112 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ vignettes/*.pdf .DS_Store obstinit.Rproj +docs diff --git a/DESCRIPTION b/DESCRIPTION index 153862c..4539acc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,9 @@ Imports: tidyr, data.table, ggforce, - cli + cli, + lubridate, + tidyverse Suggests: testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/_pkgdown.yml b/_pkgdown.yml deleted file mode 100644 index f9e6632..0000000 --- a/_pkgdown.yml +++ /dev/null @@ -1,4 +0,0 @@ -url: https://obianalysts-umich.github.io/obstinit/ -template: - bootstrap: 5 - diff --git a/docs/404.html b/docs/404.html index 3b4256b..04e6f56 100644 --- a/docs/404.html +++ b/docs/404.html @@ -4,76 +4,89 @@ - + Page not found (404) • obstinit - - - + + + - + + - - Skip to contents + -
-
-
+ + + +
+
+ Content not found. Please use links in the navbar. -
+
+ + +
- + diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 784d439..0a10ed1 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,59 +1,69 @@ -License • obstinitLicense • obstinit - Skip to contents + -
-
-
+
+ + + - + diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 539cac6..f2113ce 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -1,38 +1,40 @@ -MIT License • obstinitMIT License • obstinit - Skip to contents + -
-
-
+
+ + + - + diff --git a/docs/authors.html b/docs/authors.html index aac0538..ea68214 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,41 +1,43 @@ -Authors and Citation • obstinitAuthors and Citation • obstinit - Skip to contents + -
-
-
+
+
+
+ -
-

Authors

  • Thea B. Author, maintainer. @@ -46,39 +48,45 @@

    Authors

+
+
+

Citation

+ +
+
-
-

Citation

-

-

B T, Chen X (2023). +

B T, Chen X (2023). obstinit: OBI Internal Tool Package. -R package version 0.0.0.9000, https://obianalysts-umich.github.io/obstinit/. +R package version 0.0.0.9000, https://obianalysts-umich.github.io/obstinit/.

-
@Manual{,
+    
@Manual{,
   title = {obstinit: OBI Internal Tool Package},
   author = {Thea B and Xilin Chen},
   year = {2023},
   note = {R package version 0.0.0.9000},
   url = {https://obianalysts-umich.github.io/obstinit/},
 }
-
-
+
- + diff --git a/docs/index.html b/docs/index.html index fb9c5a1..8e8e1dd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,53 +4,58 @@ - - + OBI Internal Tool Package • obstinit - - - + + + - + + - - Skip to contents + -
-
-
+ +
+ + + + +
+
+
+
-
+ diff --git a/docs/pkgdown.js b/docs/pkgdown.js index 5fccd9c..6f0eee4 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -2,30 +2,70 @@ (function($) { $(function() { - $('nav.navbar').headroom(); + $('.navbar-fixed-top').headroom(); - Toc.init({ - $nav: $("#toc"), - $scope: $("main h2, main h3, main h4, main h5, main h6") + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); }); - if ($('#toc').length) { - $('body').scrollspy({ - target: '#toc', - offset: $("nav.navbar").outerHeight() + 1 - }); + $('[data-toggle="tooltip"]').tooltip(); + + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + // Ignore external links + if (links[i].host !== location.host) + continue; + + var nav_path = paths(links[i].pathname); + + var length = prefix_length(nav_path, cur_path); + if (length > max_length) { + max_length = length; + pos = i; + } } - // Activate popovers - $('[data-bs-toggle="popover"]').popover({ - container: 'body', - html: true, - trigger: 'focus', - placement: "top", - sanitize: false, - }); + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); + menu_anchor.parent().addClass("active"); + menu_anchor.closest("li.dropdown").addClass("active"); + } + }); + + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + + // Returns -1 if not found + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(-1); - $('[data-bs-toggle="tooltip"]').tooltip(); + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 0 : -1); + } + + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } + + return(haystack.length); + } /* Clipboard --------------------------*/ @@ -38,7 +78,7 @@ if(ClipboardJS.isSupported()) { $(document).ready(function() { - var copyButton = ""; + var copyButton = ""; $("div.sourceCode").addClass("hasCopyButton"); @@ -49,108 +89,20 @@ $('.btn-copy-ex').tooltip({container: 'body'}); // Initialize clipboard: - var clipboard = new ClipboardJS('[data-clipboard-copy]', { + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { text: function(trigger) { return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); } }); - clipboard.on('success', function(e) { + clipboardBtnCopies.on('success', function(e) { changeTooltipMessage(e.trigger, 'Copied!'); e.clearSelection(); }); - clipboard.on('error', function() { + clipboardBtnCopies.on('error', function() { changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); }); - }); } - - /* Search marking --------------------------*/ - var url = new URL(window.location.href); - var toMark = url.searchParams.get("q"); - var mark = new Mark("main#main"); - if (toMark) { - mark.mark(toMark, { - accuracy: { - value: "complementary", - limiters: [",", ".", ":", "/"], - } - }); - } - - /* Search --------------------------*/ - /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ - // Initialise search index on focus - var fuse; - $("#search-input").focus(async function(e) { - if (fuse) { - return; - } - - $(e.target).addClass("loading"); - var response = await fetch($("#search-input").data("search-index")); - var data = await response.json(); - - var options = { - keys: ["what", "text", "code"], - ignoreLocation: true, - threshold: 0.1, - includeMatches: true, - includeScore: true, - }; - fuse = new Fuse(data, options); - - $(e.target).removeClass("loading"); - }); - - // Use algolia autocomplete - var options = { - autoselect: true, - debug: true, - hint: false, - minLength: 2, - }; - var q; -async function searchFuse(query, callback) { - await fuse; - - var items; - if (!fuse) { - items = []; - } else { - q = query; - var results = fuse.search(query, { limit: 20 }); - items = results - .filter((x) => x.score <= 0.75) - .map((x) => x.item); - if (items.length === 0) { - items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; - } - } - callback(items); -} - $("#search-input").autocomplete(options, [ - { - name: "content", - source: searchFuse, - templates: { - suggestion: (s) => { - if (s.title == s.what) { - return `${s.dir} >
    ${s.title}
    `; - } else if (s.previous_headings == "") { - return `${s.dir} >
    ${s.title}
    > ${s.what}`; - } else { - return `${s.dir} >
    ${s.title}
    > ${s.previous_headings} > ${s.what}`; - } - }, - }, - }, - ]).on('autocomplete:selected', function(event, s) { - window.location.href = s.path + "?q=" + q + "#" + s.id; - }); - }); })(window.jQuery || window.$) - - diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 28c7bc0..1a50990 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,8 +2,5 @@ pandoc: 3.1.1 pkgdown: 2.0.7 pkgdown_sha: ~ articles: {} -last_built: 2023-12-10T22:54Z -urls: - reference: https://obianalysts-umich.github.io/obstinit/reference - article: https://obianalysts-umich.github.io/obstinit/articles +last_built: 2023-12-11T00:05Z diff --git a/docs/reference/add_CI_values.html b/docs/reference/add_CI_values.html index 144be3d..ab498e2 100644 --- a/docs/reference/add_CI_values.html +++ b/docs/reference/add_CI_values.html @@ -1,58 +1,58 @@ -confidence interval for a rate — add_CI_values • obstinitconfidence interval for a rate — add_CI_values • obstinit - Skip to contents - - -
    -
    -
    -
    +

    This function create upper and lower CI for observed rate. Two new variables will be added LC and UC the formula is based on 95% CI: rate+/- 1.96 x sqrt((!!var x (1-!!var))/!!n_cases)

    -
    -

    Usage

    +
    add_CI_values(data, var, n_cases)
    -
    -

    Arguments

    +
    +

    Arguments

    var

    variable you want to sort

    @@ -62,33 +62,50 @@

    Arguments -

    Examples

    -
    tb = tibble::tibble(cs_rate = c(0.1, 0.3),
    +    
    +

    Examples

    +
    library(dplyr)
    +#> 
    +#> Attaching package: ‘dplyr’
    +#> The following objects are masked from ‘package:stats’:
    +#> 
    +#>     filter, lag
    +#> The following objects are masked from ‘package:base’:
    +#> 
    +#>     intersect, setdiff, setequal, union
    +tb = tibble::tibble(cs_rate = c(0.1, 0.3),
                         n_pt_cases = c(140, 234))
     tb %>% 
      add_CI_values(var = cs_rate,
                    n_cases = n_pt_cases)
    -#> Error in tb %>% add_CI_values(var = cs_rate, n_cases = n_pt_cases): could not find function "%>%"
    +#> # A tibble: 2 × 4
    +#>   cs_rate n_pt_cases     LC    UC
    +#>     <dbl>      <dbl>  <dbl> <dbl>
    +#> 1     0.1        140 0.0503 0.150
    +#> 2     0.3        234 0.241  0.359
                    
     
    -

    +
    + + -
    +
    + diff --git a/docs/reference/add_benchmark.html b/docs/reference/add_benchmark.html index 91b31bd..cc9c619 100644 --- a/docs/reference/add_benchmark.html +++ b/docs/reference/add_benchmark.html @@ -1,47 +1,49 @@ -Add benchmark to plot — add_benchmark • obstinitAdd benchmark to plot — add_benchmark • obstinit - Skip to contents + -
    -
    -
    -
    +

    this function adds a benchmark line (and optional label) to a ggplot object

    -
    -

    Usage

    +
    add_benchmark(
       plot,
       y_int,
    @@ -56,8 +58,8 @@ 

    Usage )

    -
    -

    Arguments

    +
    +

    Arguments

    plot

    ggplot object

    @@ -99,22 +101,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/calculate_IA_comp.html b/docs/reference/calculate_IA_comp.html index 2507854..6be0e6d 100644 --- a/docs/reference/calculate_IA_comp.html +++ b/docs/reference/calculate_IA_comp.html @@ -1,73 +1,79 @@ -Calculate IA compliance — calculate_IA_comp • obstinitCalculate IA compliance — calculate_IA_comp • obstinit - Skip to contents + -
    -
    -
    -
    +

    Calculate IA compliance

    -
    -

    Usage

    +
    calculate_IA_comp(df)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- ideally, run through obstinit::create_IA_cohort first

    -
    +
    + +
    -
    +
    + diff --git a/docs/reference/calculate_TB_comp.html b/docs/reference/calculate_TB_comp.html index 2b985ad..82a6e33 100644 --- a/docs/reference/calculate_TB_comp.html +++ b/docs/reference/calculate_TB_comp.html @@ -1,73 +1,79 @@ -Calculate TeamBirth compliance — calculate_TB_comp • obstinitCalculate TeamBirth compliance — calculate_TB_comp • obstinit - Skip to contents + -
    -
    -
    -
    +

    Calculate TeamBirth compliance

    -
    -

    Usage

    +
    calculate_TB_comp(df)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- usually this is the data frame read into R using data.table::fread

    -
    +
    + + -
    +
    + diff --git a/docs/reference/calculate_cat_II_comp.html b/docs/reference/calculate_cat_II_comp.html index 38ca568..0cd8592 100644 --- a/docs/reference/calculate_cat_II_comp.html +++ b/docs/reference/calculate_cat_II_comp.html @@ -1,73 +1,79 @@ -Calculate cat II compliance — calculate_cat_II_comp • obstinitCalculate cat II compliance — calculate_cat_II_comp • obstinit - Skip to contents + -
    -
    -
    -
    +

    Calculate cat II compliance

    -
    -

    Usage

    +
    calculate_cat_II_comp(df)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- ideally, run through obstinit::create_cat_II_cohort first

    -
    +
    + + -
    +
    + diff --git a/docs/reference/calculate_dys_comp.html b/docs/reference/calculate_dys_comp.html index 8dc61d8..6a1ac3a 100644 --- a/docs/reference/calculate_dys_comp.html +++ b/docs/reference/calculate_dys_comp.html @@ -1,52 +1,54 @@ -Calculate dystocia compliance — calculate_dys_comp • obstinitCalculate dystocia compliance — calculate_dys_comp • obstinit - Skip to contents + -
    -
    -
    -
    +

    To calculate dystocia compliance, overall and by type

    -
    -

    Usage

    +
    calculate_dys_comp(df, include_types = F)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    A data frame, preferably one that has already been run through obstint::create_obi_cohort()

    @@ -56,22 +58,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/create_90_day_lock_dt.html b/docs/reference/create_90_day_lock_dt.html index 9f11be0..1e0c6a8 100644 --- a/docs/reference/create_90_day_lock_dt.html +++ b/docs/reference/create_90_day_lock_dt.html @@ -1,73 +1,79 @@ -Create OBI case lock dates — create_90_day_lock_dt • obstinitCreate OBI case lock dates — create_90_day_lock_dt • obstinit - Skip to contents + -
    -
    -
    -
    +

    Create OBI case lock dates

    -
    -

    Usage

    +
    create_90_day_lock_dt()
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- usually this is the data frame read into R using data.table::fread

    -
    +
    + +
    -
    +
    + diff --git a/docs/reference/create_IA_cohort.html b/docs/reference/create_IA_cohort.html index 8462780..b0f3ae0 100644 --- a/docs/reference/create_IA_cohort.html +++ b/docs/reference/create_IA_cohort.html @@ -1,52 +1,54 @@ -Create IA cohort — create_IA_cohort • obstinitCreate IA cohort — create_IA_cohort • obstinit - Skip to contents + -
    -
    -
    -
    +

    Create IA cohort

    -
    -

    Usage

    +
    create_IA_cohort(df, limit_to_IA_sites = F)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- usually this is the data frame read into R using data.table::fread

    @@ -56,22 +58,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/create_cat_II_cohort.html b/docs/reference/create_cat_II_cohort.html index 25d9aad..af5f059 100644 --- a/docs/reference/create_cat_II_cohort.html +++ b/docs/reference/create_cat_II_cohort.html @@ -1,52 +1,54 @@ -Create cat II cohort — create_cat_II_cohort • obstinitCreate cat II cohort — create_cat_II_cohort • obstinit - Skip to contents + -
    -
    -
    -
    +

    Create cat II cohort

    -
    -

    Usage

    +
    create_cat_II_cohort(df, limit_to_catII_sites = F)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- usually this is the data frame read into R using data.table::fread

    @@ -56,22 +58,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/create_caterpillar_df.html b/docs/reference/create_caterpillar_df.html index 6e3716c..52e8c36 100644 --- a/docs/reference/create_caterpillar_df.html +++ b/docs/reference/create_caterpillar_df.html @@ -1,52 +1,54 @@ -Create a data frame for caterpillar plots — create_caterpillar_df • obstinitCreate a data frame for caterpillar plots — create_caterpillar_df • obstinit - Skip to contents + -
    -
    -
    -
    +

    this function creates a data frame to be used for caterpillar plots where each row is a site name. The df includes a numerator, denominator, and rate for the variable of interest, as well as a 95% CI (bounded by 0 and 1) for the rate.

    -
    -

    Usage

    +
    create_caterpillar_df(df, num_var, denom_var, group_var = site_name)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- usually this is obi_cohort

    @@ -64,22 +66,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/create_ctrl_df.html b/docs/reference/create_ctrl_df.html index e341cd2..52ff0f3 100644 --- a/docs/reference/create_ctrl_df.html +++ b/docs/reference/create_ctrl_df.html @@ -1,53 +1,53 @@ -Structure OBI data for plotting control charts — create_ctrl_df • obstinitStructure OBI data for plotting control charts — create_ctrl_df • obstinit - Skip to contents - - -
    -
    -
    -
    +

    This function takes in a data frame row per observation like OBI data. It then summarize the numerator and denominator of a rate of interest. This function also use control chart principles to calculate CIs and flag alerts.

    -
    -

    Usage

    +
    create_ctrl_df(
       df,
       date_var,
    @@ -61,8 +61,8 @@ 

    Usage )

    -
    -

    Arguments

    +
    +

    Arguments

    df

    A data frame, for example OBI export data

    @@ -100,33 +100,33 @@

    Arguments -

    Value

    +
    +

    Value

    An tibble with the aggridated numerator and denominator by input date variable

    -
    -

    Examples

    - -
    -

    +
    + +
    -
    +
    + diff --git a/docs/reference/create_dystocia_cohort.html b/docs/reference/create_dystocia_cohort.html index 674c98f..d4a5895 100644 --- a/docs/reference/create_dystocia_cohort.html +++ b/docs/reference/create_dystocia_cohort.html @@ -1,73 +1,79 @@ -Create dystocia cohort — create_dystocia_cohort • obstinitCreate dystocia cohort — create_dystocia_cohort • obstinit - Skip to contents + -
    -
    -
    -
    +

    To create dystocia compliance cohort

    -
    -

    Usage

    +
    create_dystocia_cohort(df)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    A data frame, preferably one that has already been run through obstint::create_obi_cohort()

    -
    +
    + +
    -
    +
    + diff --git a/docs/reference/create_obi_cohort.html b/docs/reference/create_obi_cohort.html index b834f0a..2d4cb7c 100644 --- a/docs/reference/create_obi_cohort.html +++ b/docs/reference/create_obi_cohort.html @@ -1,12 +1,5 @@ -Create OBI cohort of locked, complete cases for most analyses — create_obi_cohort • obstinitCreate OBI cohort of locked, complete cases for most analyses — create_obi_cohort • obstinit - Skip to contents - - -
    -
    -
    -
    +

    this function does

    1. include case ≥2020-01-01 based on infant date of birth

    2. include case if case is complete using flg_complete

    3. create case_locked varaible using 90 days lock

    4. @@ -58,13 +54,12 @@
    5. create mdhhs_id character variable with leading 0's

    -
    -

    Usage

    +
    create_obi_cohort(df, limit_to_locked = T)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- usually this is the data frame read into R using data.table::fread

    @@ -74,22 +69,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/create_pv_response_dt.html b/docs/reference/create_pv_response_dt.html index bf57582..05dc968 100644 --- a/docs/reference/create_pv_response_dt.html +++ b/docs/reference/create_pv_response_dt.html @@ -1,12 +1,5 @@ -create patient voice response data — create_pv_response_dt • obstinitcreate patient voice response data — create_pv_response_dt • obstinit - Skip to contents - - -
    -
    -
    -
    +

    combine patient contact log with survey response data

    • cohort: pts who received pro survey emails

    • added var:

      • pro_response: pts who completed pro survey (opt out pts also consider complete)

      • pts choose to opt out: survey_informed_consent_b_0 ==0

    -
    -

    Usage

    +
    create_pv_response_dt(obi_dt, pro_survey_expired = FALSE)
    -
    -

    Arguments

    +
    +

    Arguments

    obi_dt

    OBI nightly export data

    @@ -72,44 +67,48 @@

    Arguments -

    Value

    +
    +

    Value

    a data frame with variables: patientid, site_name, infant_dob_dt, complete_pro_survey_flg, survey_informed_consent_b_0

    -
    -

    Details

    +
    +

    Details

    this function read in pro survey data from

    • survey response: P:/OBI_abstracted_data/Current_Data/data/input/pro_6_week_postpartum.csv

    • contact log pts who received emails: P:/OBI_abstracted_data/Current_Data/data/input/contactlog.csv

    -
    -

    Examples

    -
    obi_dt <- read_current_data() |> 
    +    
    +

    Examples

    +
    if (FALSE) {
    +obi_dt <- read_current_data() |> 
       create_obi_cohort(limit_to_locked = FALSE) 
    -#> Error in df %>% mutate(infant_dob_dt = lubridate::dmy_hms(infant_dob_dt),     case_lock_dt = lubridate::date(infant_dob_dt) + days(90),     case_locked = ifelse(case_lock_dt < lubridate::today(), 1,         0), across(c(starts_with("opioid_e"), starts_with("opioid_dose"),         starts_with("opioid_quantity_no"), starts_with("opioid_unit")),         ~ifelse(discharge_opioid_e == 1, .x, NA)), mdhhs_id = case_when(external_mdhhs_site_id ==         4001 ~ "04001", external_mdhhs_site_id == 8001 ~ "08001",         external_mdhhs_site_id == 9005 ~ "09005", TRUE ~ as.character(external_mdhhs_site_id))): could not find function "%>%"
     create_pv_response_dt(obi_dt) 
    -#> Error in data.table::fread("/Volumes/nur-kanelow/OBI_abstracted_data/Current_Data/data/input/pro_6_week_postpartum.csv"): File '/Volumes/nur-kanelow/OBI_abstracted_data/Current_Data/data/input/pro_6_week_postpartum.csv' does not exist or is non-readable. getwd()=='/Users/xilinchen/Documents/repos/obstinit/docs/reference'
    +}
      
     
    -

    +
    + +
    -
    +
    + diff --git a/docs/reference/index.html b/docs/reference/index.html index 7885ff1..47988f8 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,191 +1,167 @@ -Function reference • obstinitFunction reference • obstinit - Skip to contents + -
    -
    -
    +
    +
    +
    -
    -

    All functions

    - - -
    - - - +
    +
    + -
    - - add_CI_values() -
    -
    confidence interval for a rate
    -
    - - add_benchmark() -
    -
    Add benchmark to plot
    -
    - - calculate_IA_comp() -
    -
    Calculate IA compliance
    -
    - - calculate_TB_comp() -
    -
    Calculate TeamBirth compliance
    -
    - - calculate_cat_II_comp() -
    -
    Calculate cat II compliance
    -
    - - calculate_dys_comp() -
    -
    Calculate dystocia compliance
    -
    - - create_90_day_lock_dt() -
    -
    Create OBI case lock dates
    -
    - - create_IA_cohort() -
    -
    Create IA cohort
    -
    - - create_cat_II_cohort() -
    -
    Create cat II cohort
    -
    - - create_caterpillar_df() -
    -
    Create a data frame for caterpillar plots
    -
    - - create_ctrl_df() -
    -
    Structure OBI data for plotting control charts
    -
    - - create_dystocia_cohort() -
    -
    Create dystocia cohort
    -
    - - create_obi_cohort() -
    -
    Create OBI cohort of locked, complete cases for most analyses
    -
    - - create_pv_response_dt() -
    -
    create patient voice response data
    -
    - - plot_caterpillar_chart() -
    -
    Plot caterpillar chart
    -
    - - plot_ctrl_chart() -
    -
    Plot control chart
    -
    - - plot_ctrl_hchart() -
    -
    Plot interactive ctrl chart using highcharter package
    -
    - - read_crosswalk() -
    -
    Read in OBI crosswalk
    -
    - - read_current_data() -
    -
    Read current OBI data
    -
    - - send_email() -
    -
    send emails from R
    -
    - - sites_w_all_years_dt() -
    -
    Limit dataset to hospitals that have data for all years 2020 - max year of your choice
    -
    - - sort_muti_selection() -
    -
    sort multiple selected varible as list
    -
    - - sort_muti_selection_var() -
    -
    sort multiple selected variable in dataset
    -
    - - structure_data() -
    -
    Structure OBI data for plotting control charts
    -
    - - theme_obi() -
    -
    Add OBI ggplot theme
    -
    -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    All functions

    +

    +
    +

    add_CI_values()

    +

    confidence interval for a rate

    +

    add_benchmark()

    +

    Add benchmark to plot

    +

    calculate_IA_comp()

    +

    Calculate IA compliance

    +

    calculate_TB_comp()

    +

    Calculate TeamBirth compliance

    +

    calculate_cat_II_comp()

    +

    Calculate cat II compliance

    +

    calculate_dys_comp()

    +

    Calculate dystocia compliance

    +

    create_90_day_lock_dt()

    +

    Create OBI case lock dates

    +

    create_IA_cohort()

    +

    Create IA cohort

    +

    create_cat_II_cohort()

    +

    Create cat II cohort

    +

    create_caterpillar_df()

    +

    Create a data frame for caterpillar plots

    +

    create_ctrl_df()

    +

    Structure OBI data for plotting control charts

    +

    create_dystocia_cohort()

    +

    Create dystocia cohort

    +

    create_obi_cohort()

    +

    Create OBI cohort of locked, complete cases for most analyses

    +

    create_pv_response_dt()

    +

    create patient voice response data

    +

    plot_caterpillar_chart()

    +

    Plot caterpillar chart

    +

    plot_ctrl_chart()

    +

    Plot control chart

    +

    plot_ctrl_hchart()

    +

    Plot interactive ctrl chart using highcharter package

    +

    read_crosswalk()

    +

    Read in OBI crosswalk

    +

    read_current_data()

    +

    Read current OBI data

    +

    send_email()

    +

    send emails from R

    +

    sites_w_all_years_dt()

    +

    Limit dataset to hospitals that have data for all years 2020 - max year of your choice

    +

    sort_muti_selection()

    +

    sort multiple selected varible as list

    +

    sort_muti_selection_var()

    +

    sort multiple selected variable in dataset

    +

    structure_data()

    +

    Structure OBI data for plotting control charts

    +

    theme_obi()

    +

    Add OBI ggplot theme

    + + +
    -
    +
    + diff --git a/docs/reference/plot_caterpillar_chart.html b/docs/reference/plot_caterpillar_chart.html index dd647e5..d2edb1f 100644 --- a/docs/reference/plot_caterpillar_chart.html +++ b/docs/reference/plot_caterpillar_chart.html @@ -1,47 +1,49 @@ -Plot caterpillar chart — plot_caterpillar_chart • obstinitPlot caterpillar chart — plot_caterpillar_chart • obstinit - Skip to contents + -
    -
    -
    -
    +

    this function plots a caterpillar chart using the dataframe created by create_caterpillar_df()

    -
    -

    Usage

    +
    plot_caterpillar_chart(
       df,
       y_var = rate,
    @@ -53,8 +55,8 @@ 

    Usage )

    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame created by create_caterpillar_df()

    @@ -84,22 +86,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/plot_ctrl_chart.html b/docs/reference/plot_ctrl_chart.html index f9c1240..8a97b68 100644 --- a/docs/reference/plot_ctrl_chart.html +++ b/docs/reference/plot_ctrl_chart.html @@ -1,52 +1,54 @@ -Plot control chart — plot_ctrl_chart • obstinitPlot control chart — plot_ctrl_chart • obstinit - Skip to contents + -
    -
    -
    -
    +

    Plot control chart

    -
    -

    Usage

    +
    plot_ctrl_chart(df, plot_center_line = T)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    A data frame in wide format, created by the structure_data function

    @@ -56,22 +58,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/plot_ctrl_hchart.html b/docs/reference/plot_ctrl_hchart.html index ef999a4..87e229a 100644 --- a/docs/reference/plot_ctrl_hchart.html +++ b/docs/reference/plot_ctrl_hchart.html @@ -1,52 +1,54 @@ -Plot interactive ctrl chart using highcharter package — plot_ctrl_hchart • obstinitPlot interactive ctrl chart using highcharter package — plot_ctrl_hchart • obstinit - Skip to contents + -
    -
    -
    -
    +

    Plot interactive ctrl chart using highcharter package

    -
    -

    Usage

    +
    plot_ctrl_hchart(df, title, ymin = NA, ymax = NA)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    A data frame - should be in the structure of obstinit::structure_data

    @@ -56,22 +58,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/reference/read_crosswalk.html b/docs/reference/read_crosswalk.html index a128480..a11738f 100644 --- a/docs/reference/read_crosswalk.html +++ b/docs/reference/read_crosswalk.html @@ -1,66 +1,73 @@ -Read in OBI crosswalk — read_crosswalk • obstinitRead in OBI crosswalk — read_crosswalk • obstinit - Skip to contents + -
    -
    -
    -
    +

    this function reads the current OBI crosswalk file. This file contains information on hospital variables like teaching status, as well as group 1 status and color.

    -
    -

    Usage

    +
    read_crosswalk()
    -
    +
    + +
    -
    +
    + diff --git a/docs/reference/read_current_data.html b/docs/reference/read_current_data.html index 78463c6..2d2fa0b 100644 --- a/docs/reference/read_current_data.html +++ b/docs/reference/read_current_data.html @@ -1,66 +1,73 @@ -Read current OBI data — read_current_data • obstinitRead current OBI data — read_current_data • obstinit - Skip to contents + -
    -
    -
    -
    +

    read OBI analytic data from Turbo

    -
    -

    Usage

    +
    read_current_data()
    -
    +
    + +
    -
    +
    + diff --git a/docs/reference/send_email.html b/docs/reference/send_email.html index 11bc8b4..f676acd 100644 --- a/docs/reference/send_email.html +++ b/docs/reference/send_email.html @@ -1,47 +1,49 @@ -send emails from R — send_email • obstinitsend emails from R — send_email • obstinit - Skip to contents + -
    -
    -
    -
    +

    send or save draft emails from R

    -
    -

    Usage

    +
    send_email(
       email_message = "<p> This is an automatic message. </p> <p> OBI analytics team </p> ",
       email_to = "obianalysts@umich.edu",
    @@ -51,8 +53,8 @@ 

    Usage )

    -
    -

    Arguments

    +
    +

    Arguments

    email_message

    your email body; use html code for breaks and hyperlinks

    @@ -73,37 +75,40 @@

    Arguments

    -
    -

    Value

    +
    +

    Value

    a message in the console

    -
    -

    Examples

    -
    send_email(email_message = "<p> This is an automatic message. </p> <p> OBI analytics team </p>")
    -#>  This function was only tested using outlook app
    -#> Error in send_email(email_message = "<p> This is an automatic message. </p> <p> OBI analytics team </p>"): this function only works on Windows, see package RDCOMClient
    -#> requirement.
    +    
    +

    Examples

    +
    if (FALSE) {
    +send_email(email_message = "<p> This is an automatic message. </p> <p> OBI analytics team </p>")
    +}
     
    -
    +
    + +
    -
    +
    + diff --git a/docs/reference/sites_w_all_years_dt.html b/docs/reference/sites_w_all_years_dt.html index 0eb4b4d..29f95c6 100644 --- a/docs/reference/sites_w_all_years_dt.html +++ b/docs/reference/sites_w_all_years_dt.html @@ -1,73 +1,79 @@ -Limit dataset to hospitals that have data for all years 2020 - max year of your choice — sites_w_all_years_dt • obstinitLimit dataset to hospitals that have data for all years 2020 - max year of your choice — sites_w_all_years_dt • obstinit - Skip to contents + -
    -
    -
    -
    +

    Limit dataset to hospitals that have data for all years 2020 - max year of your choice

    -
    -

    Usage

    +
    sites_w_all_years_dt(df, max_year)
    -
    -

    Arguments

    +
    +

    Arguments

    df

    Data frame -- usually this is OBI's current, processed data read into R using data.table::fread. Preferably this has already been run through obstinit::create_obi_cohort()

    -
    +
    + + -
    +
    + diff --git a/docs/reference/sort_muti_selection.html b/docs/reference/sort_muti_selection.html index f189b40..ea00805 100644 --- a/docs/reference/sort_muti_selection.html +++ b/docs/reference/sort_muti_selection.html @@ -1,83 +1,88 @@ -sort multiple selected varible as list — sort_muti_selection • obstinitsort multiple selected varible as list — sort_muti_selection • obstinit - Skip to contents + -
    -
    -
    -
    +

    multiple selected varibales shouldn't have different values based on order for example, 1|2 euqal to 2|1. This function short the numbers

    -
    -

    Usage

    +
    sort_muti_selection(var)
    -
    -

    Arguments

    +
    +

    Arguments

    var

    variable you want to sort

    -
    -

    Examples

    +
    +

    Examples

    val = "8,1,0,3"
     sort_muti_selection(val)
     #> Error in sort_muti_selection(val): could not find function "sort_muti_selection"
     
    -
    +
    + + -
    +
    + diff --git a/docs/reference/sort_muti_selection_var.html b/docs/reference/sort_muti_selection_var.html index b8389c1..ce40b7b 100644 --- a/docs/reference/sort_muti_selection_var.html +++ b/docs/reference/sort_muti_selection_var.html @@ -1,84 +1,90 @@ -sort multiple selected variable in dataset — sort_muti_selection_var • obstinitsort multiple selected variable in dataset — sort_muti_selection_var • obstinit - Skip to contents + -
    -
    -
    -
    +

    multiple selected varibales shouldn't have different values based on order for example, 1|2 euqal to 2|1. This function short the numbers

    -
    -

    Usage

    +
    sort_muti_selection_var(var)
    -
    -

    Arguments

    +
    +

    Arguments

    var

    variable you want to sort

    -
    -

    Examples

    +
    +

    Examples

    df <- tibble(col = c("{1|2}", "{2|1}", "{3|2|1}", "{2|3|1}", "{2|1|3}"))
    -#> Error in tibble(col = c("{1|2}", "{2|1}", "{3|2|1}", "{2|3|1}", "{2|1|3}")): could not find function "tibble"
     df %>% mutate(new = sort_muti_selection_var(col))
    -#> Error in df %>% mutate(new = sort_muti_selection_var(col)): could not find function "%>%"
    +#> Error in mutate(., new = sort_muti_selection_var(col)):  In argument: `new = sort_muti_selection_var(col)`.
    +#> Caused by error in `str_extract_all()`:
    +#> ! could not find function "str_extract_all"
     
    -
    +
    + + -
    +
    + diff --git a/docs/reference/structure_data.html b/docs/reference/structure_data.html index 0a8d6c2..e038c27 100644 --- a/docs/reference/structure_data.html +++ b/docs/reference/structure_data.html @@ -1,53 +1,53 @@ -Structure OBI data for plotting control charts — structure_data • obstinitStructure OBI data for plotting control charts — structure_data • obstinit - Skip to contents - - -
    -
    -
    -
    +

    This function takes in a data frame row per observation like OBI data. It then summarize the numerator and denominator of a rate of interest. This function also use control chart principles to calculate CIs and flag alerts.

    -
    -

    Usage

    +
    structure_data(
       df,
       date_var,
    @@ -61,8 +61,8 @@ 

    Usage )

    -
    -

    Arguments

    +
    +

    Arguments

    df

    A data frame, for example OBI export data

    @@ -100,33 +100,49 @@

    Arguments -

    Value

    +
    +

    Value

    An tibble with the aggridated numerator and denominator by input date variable

    -
    -

    Examples

    - +
    +

    Examples

    +
    # It might take a min to load OBI data
    +if (FALSE) {
    +library(tidyverse)
    +OBI_data = read_current_data()
    +structure_data(
    + df = OBI_data,
    + date_var = infant_dob_dt,
    + num_var = cesarean,
    + den_var = birth
    + )
    + }
    + 
    +
    -

    +
    + + -
    +
    + diff --git a/docs/reference/theme_obi.html b/docs/reference/theme_obi.html index 2fbdd02..4611b7e 100644 --- a/docs/reference/theme_obi.html +++ b/docs/reference/theme_obi.html @@ -1,47 +1,49 @@ -Add OBI ggplot theme — theme_obi • obstinitAdd OBI ggplot theme — theme_obi • obstinit - Skip to contents + -
    -
    -
    -
    +

    Add OBI ggplot theme

    -
    -

    Usage

    +
    theme_obi(
       x_axis_title_size = 12,
       x_axis_text_size = 10,
    @@ -58,8 +60,8 @@ 

    Usage )

    -
    -

    Arguments

    +
    +

    Arguments

    x_axis_title_size

    Size for x axis title. Default is 12.

    @@ -109,22 +111,26 @@

    Arguments

    +
    + +
    -
    + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 9b78076..ed6b47d 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,96 +1,96 @@ - https://obianalysts-umich.github.io/obstinit/404.html + /404.html - https://obianalysts-umich.github.io/obstinit/LICENSE-text.html + /LICENSE-text.html - https://obianalysts-umich.github.io/obstinit/LICENSE.html + /LICENSE.html - https://obianalysts-umich.github.io/obstinit/authors.html + /authors.html - https://obianalysts-umich.github.io/obstinit/index.html + /index.html - https://obianalysts-umich.github.io/obstinit/reference/add_CI_values.html + /reference/add_CI_values.html - https://obianalysts-umich.github.io/obstinit/reference/add_benchmark.html + /reference/add_benchmark.html - https://obianalysts-umich.github.io/obstinit/reference/calculate_IA_comp.html + /reference/calculate_IA_comp.html - https://obianalysts-umich.github.io/obstinit/reference/calculate_TB_comp.html + /reference/calculate_TB_comp.html - https://obianalysts-umich.github.io/obstinit/reference/calculate_cat_II_comp.html + /reference/calculate_cat_II_comp.html - https://obianalysts-umich.github.io/obstinit/reference/calculate_dys_comp.html + /reference/calculate_dys_comp.html - https://obianalysts-umich.github.io/obstinit/reference/create_90_day_lock_dt.html + /reference/create_90_day_lock_dt.html - https://obianalysts-umich.github.io/obstinit/reference/create_IA_cohort.html + /reference/create_IA_cohort.html - https://obianalysts-umich.github.io/obstinit/reference/create_cat_II_cohort.html + /reference/create_cat_II_cohort.html - https://obianalysts-umich.github.io/obstinit/reference/create_caterpillar_df.html + /reference/create_caterpillar_df.html - https://obianalysts-umich.github.io/obstinit/reference/create_ctrl_df.html + /reference/create_ctrl_df.html - https://obianalysts-umich.github.io/obstinit/reference/create_dystocia_cohort.html + /reference/create_dystocia_cohort.html - https://obianalysts-umich.github.io/obstinit/reference/create_obi_cohort.html + /reference/create_obi_cohort.html - https://obianalysts-umich.github.io/obstinit/reference/create_pv_response_dt.html + /reference/create_pv_response_dt.html - https://obianalysts-umich.github.io/obstinit/reference/index.html + /reference/index.html - https://obianalysts-umich.github.io/obstinit/reference/plot_caterpillar_chart.html + /reference/plot_caterpillar_chart.html - https://obianalysts-umich.github.io/obstinit/reference/plot_ctrl_chart.html + /reference/plot_ctrl_chart.html - https://obianalysts-umich.github.io/obstinit/reference/plot_ctrl_hchart.html + /reference/plot_ctrl_hchart.html - https://obianalysts-umich.github.io/obstinit/reference/read_crosswalk.html + /reference/read_crosswalk.html - https://obianalysts-umich.github.io/obstinit/reference/read_current_data.html + /reference/read_current_data.html - https://obianalysts-umich.github.io/obstinit/reference/send_email.html + /reference/send_email.html - https://obianalysts-umich.github.io/obstinit/reference/sites_w_all_years_dt.html + /reference/sites_w_all_years_dt.html - https://obianalysts-umich.github.io/obstinit/reference/sort_muti_selection.html + /reference/sort_muti_selection.html - https://obianalysts-umich.github.io/obstinit/reference/sort_muti_selection_var.html + /reference/sort_muti_selection_var.html - https://obianalysts-umich.github.io/obstinit/reference/structure_data.html + /reference/structure_data.html - https://obianalysts-umich.github.io/obstinit/reference/theme_obi.html + /reference/theme_obi.html