---
title: "PatientLevelPrediction Protocol "
date: "`r Sys.Date() `"
params:
  include_diagnostic: TRUE
  include_results: TRUE
  plpCitation: "Reps JM, Schuemie MJ, Suchard MA, Ryan PB, Rijnbeek P (2018). 'Design and implementation of a standardized framework to generate and evaluate patient level prediction models using observational healthcare data'. Journal of the American Medical Informatics Association, 25(8), 969-975."
  tripodCitation: "Collins, G., et al. (2017). 'Transparent reporting of a multivariable prediction model for individual prognosis or diagnosis (TRIPOD): the TRIPOD statement.' Journal of British Surgery 102.3 (2015): 148-158."
  progressCitation: "Steyerberg EW, Moons KG, van der Windt DA, Hayden JA, Perel P, Schroter S, Riley RD, Hemingway H, Altman DG; PROGRESS Group. Prognosis Research Strategy (PROGRESS) 3: prognostic model research. PLoS Med. 2013;10(2):e1001381."
  rCitation: "R Core Team (2013). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL http://www.R-project.org/."
  connectionHandler: ""
  resultSchema: "plp_results"
  myTableAppend: ""
  databaseTableAppend: ""
  cohortTableAppend: ""
  modelDesignIds: 1
output: 
  html_fragment:
    toc: FALSE
    toc_depth: 5
    toc_float: true
---

# Project Details
  
Study Title: PatientLevelPrediction Report
Prepared on: ``r Sys.Date()``

# Abbreviations

```{r abbreviations, echo=FALSE}

abb <- data.frame(rbind(
  c("AUROC", "Area Under the Receiver Operating Characteristic Curve"),
  c("CDM","Common Data Model"),
  c("O","Outcome Cohort"),
  c("OHDSI","Observational Health Data Sciences & Informatics"),
  c("OMOP","Observational Medical Outcomes Partnership"),
  c("T", "Target Cohort"),
  c("TAR", "Time at Risk")
))
names(abb) <- c("Abbreviation","Phrase")
abb <- abb[order(abb$Abbreviation),]

knitr::kable(x = abb, caption = 'List of Abbreviations')

```


# Framework

In this study the model development follows the framework presented in ``r  params$plpCitation ``

# Evaluation Metrics and Plots

```{r metrics, child = "plp-metrics.Rmd"}
```

```{r output, child = "plp-output.Rmd"}
```

```{r plots, child = "plp-plots.Rmd"}
```


```{r design diag results, results='asis', echo=FALSE}
    for (i in 1:length(params$modelDesignIds)) {
      modelDesignId <- params$modelDesignIds[i]
      modelDesign <- knitr::knit_child("model-design.Rmd", quiet = TRUE, envir = environment())
      cat(modelDesign, sep = '\n')
      
      if(params$include_diagnostic){
      diagnostic <- knitr::knit_child("plp-diagnostic.Rmd", quiet = TRUE, envir = environment())
      cat(diagnostic , sep = '\n')
      }
      
      if(params$include_results){
      results <- knitr::knit_child("plp-results.Rmd", quiet = TRUE, envir = environment())
      cat(results , sep = '\n')
      }
    }

```


# Tools

This study will be designed using OHDSI tools and run with R

``r params$rCitation ``

