Skip to content

Commit

Permalink
Merge pull request #499 from OHDSI/broken_links
Browse files Browse the repository at this point in the history
Fix broken links and update docs
  • Loading branch information
egillax authored Nov 1, 2024
2 parents 851f56c + 2d8f225 commit 253d1b7
Show file tree
Hide file tree
Showing 16 changed files with 638 additions and 670 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -28,9 +28,14 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache: always
extra-packages: any::pkgdown, ohdsi/OhdsiRTools
needs: website

- uses: lycheeverse/lychee-action@v2
with:
args: --base . --verbose --no-progress --accept '100..=103, 200..=299, 403' './**/*.md' './**/*.Rmd'

- name: Build site
run: Rscript -e 'pkgdown::build_site_github_pages(new_process = FALSE, install = TRUE)'

Expand All @@ -39,7 +44,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
PatientLevelPrediction develop
======================
- Fixed linting errors and R codestyle in docs to conform to HADES style
- Remove links to pdf's, point to website instead.
- Fix broken links in Readme and BuildingPredictiveModels vignette
- Added an action to detect broken links in repo
- Official maintainer updated to Egill Fridgeirsson


Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ install Python 3.9 or higher using Anaconda (https://www.continuum.io/downloads)
Getting Started
===============

- To install the package please read the [Package Installation guide](https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/InstallationGuide.pdf)
- To install the package please read the [Package Installation guide](https://ohdsi.github.io/PatientLevelPrediction/articles/InstallationGuide.html)

- Have a look at the video below for an extensive demo of the package.

Expand All @@ -93,25 +93,22 @@ alt="Video Vignette PLP Package" width="240" height="180" border="10" /></a>

Please read the main vignette for the package:

- [Building Single Patient-Level Predictive Models](https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/BuildingPredictiveModels.pdf)
- [Building Single Patient-Level Predictive Models](https://ohdsi.github.io/PatientLevelPrediction/articles/BuildingPredictiveModels.html)

In addition we have created vignettes that describe advanced functionality in more detail:

- [Building Multiple Patient-Level Predictive Models](https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/BuildingMultiplePredictiveModels.pdf)
- [Implementing Existing Patient-Level Predictive Models](https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/ImplementingExistingModels.pdf)
- [Adding Custom Machine Learning Algorithms](https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/AddingCustomAlgorithms.pdf)
- [Building Multiple Patient-Level Predictive Models](https://ohdsi.github.io/PatientLevelPrediction/articles/BuildingMultiplePredictiveModels.html)
- [Adding Custom Machine Learning Algorithms](https://ohdsi.github.io/PatientLevelPrediction/articles/AddingCustomModels.html)
- [Building Deep Learning Models](https://github.com/OHDSI/DeepPatientLevelPrediction)
- [Building Ensemble Models](https://github.com/OHDSI/EnsemblePatientLevelPrediction)
- [Creating Learning Curves](https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/CreatingLearningCurves.pdf)
- [Creating Learning Curves](https://ohdsi.github.io/PatientLevelPrediction/articles/CreatingLearningCurves.html)

Package manual: [PatientLevelPrediction.pdf](https://github.com/OHDSI/PatientLevelPrediction/blob/main/extras/PatientLevelPrediction.pdf)
Package function reference: [Reference](https://ohdsi.github.io/PatientLevelPrediction/reference/index.html)

User Documentation
==================
Documentation can be found on the [package website](https://ohdsi.github.io/PatientLevelPrediction).

PDF versions of the documentation are also available, as mentioned above.

Support
=======
* Developer questions/comments/feedback: <a href="http://forums.ohdsi.org/c/developers">OHDSI Forum</a>
Expand All @@ -133,5 +130,5 @@ PatientLevelPrediction is being developed in R Studio.
# Acknowledgements

- The package is maintained by Egill Fridgeirsson and Jenna Reps and has been developed with major contributions from Peter Rijnbeek, Martijn Schuemie, Patrick Ryan, and Marc Suchard.
- We like to thank the following persons for their contributions to the package: Seng Chan You, Ross Williams, Henrik John, Xiaoyong Pan, James Wiggins, Alex Rekkas
- We like to thank the following persons for their contributions to the package: Seng Chan You, Ross Williams, Henrik John, Xiaoyong Pan, James Wiggins, Alexandros Rekkas
- This project is supported in part through the National Science Foundation grant IIS 1251151.
60 changes: 29 additions & 31 deletions vignettes/AddingCustomFeatureEngineering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ library(PatientLevelPrediction)

# Introduction

This vignette describes how you can add your own custom function for feature engineering in the Observational Health Data Sciences and Informatics (OHDSI) [`PatientLevelPrediction`](http://github.com/OHDSI/PatientLevelPrediction) package. This vignette assumes you have read and are comfortable with building single patient level prediction models as described in the [`BuildingPredictiveModels` vignette](https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/BuildingPredictiveModels.pdf).
This vignette describes how you can add your own custom function for feature engineering in the Observational Health Data Sciences and Informatics (OHDSI) [`PatientLevelPrediction`](http://github.com/OHDSI/PatientLevelPrediction) package. This vignette assumes you have read and are comfortable with building single patient level prediction models as described in the `vignette('BuildingPredictiveModels')`.

**We invite you to share your new feature engineering functions with the OHDSI community through our [GitHub repository](http://github.com/OHDSI/PatientLevelPrediction).**

Expand Down Expand Up @@ -65,22 +65,18 @@ Let's consider the situation where we wish to create an age spline feature. To m
Our age spline feature function will create a new feature using the `plpData$cohorts$ageYear` column. We will implement a restricted cubic spline that requires specifying the number of knots. Therefore, the inputs for this are: `knots` - an integer/double specifying the number of knots.

```{r, echo = TRUE, eval=FALSE}
createAgeSpline <- function(
knots = 5
){
createAgeSpline <- function(knots = 5) {
# create list of inputs to implement function
featureEngineeringSettings <- list(
knots = knots
)
)
# specify the function that will implement the sampling
attr(featureEngineeringSettings, "fun") <- "implementAgeSplines"
# make sure the object returned is of class "sampleSettings"
class(featureEngineeringSettings) <- "featureEngineeringSettings"
return(featureEngineeringSettings)
}
```

Expand All @@ -93,65 +89,67 @@ All 'implement' functions must take as input the `trainData` and the `featureEng
In our example, the `createAgeSpline()` will return a list with 'knots'. The `featureEngineeringSettings` therefore contains this.

```{r tidy=FALSE,eval=FALSE}
implementAgeSplines <- function(trainData, featureEngineeringSettings, model=NULL) {
implementAgeSplines <- function(trainData, featureEngineeringSettings, model = NULL) {
# if there is a model, it means this function is called through applyFeatureengineering, meaning it # should apply the model fitten on training data to the test data
if (is.null(model)) {
knots <- featureEngineeringSettings$knots
ageData <- trainData$labels
y <- ageData$outcomeCount
X <- ageData$ageYear
model <- mgcv::gam(
y ~ s(X, bs='cr', k=knots, m=2)
y ~ s(X, bs = "cr", k = knots, m = 2)
)
newData <- data.frame(
rowId = ageData$rowId,
covariateId = 2002,
covariateValue = model$fitted.values
)
}
else {
} else {
ageData <- trainData$labels
X <- trainData$labels$ageYear
y <- ageData$outcomeCount
newData <- data.frame(y=y, X=X)
newData <- data.frame(y = y, X = X)
yHat <- predict(model, newData)
newData <- data.frame(
rowId = trainData$labels$rowId,
covariateId = 2002,
covariateValue = yHat
)
}
# remove existing age if in covariates
trainData$covariateData$covariates <- trainData$covariateData$covariates |>
dplyr::filter(!covariateId %in% c(1002))
# remove existing age if in covariates
trainData$covariateData$covariates <- trainData$covariateData$covariates |>
dplyr::filter(!.data$covariateId %in% c(1002))
# update covRef
Andromeda::appendToTable(trainData$covariateData$covariateRef,
data.frame(covariateId=2002,
covariateName='Cubic restricted age splines',
analysisId=2,
conceptId=2002))
Andromeda::appendToTable(
trainData$covariateData$covariateRef,
data.frame(
covariateId = 2002,
covariateName = "Cubic restricted age splines",
analysisId = 2,
conceptId = 2002
)
)
# update covariates
Andromeda::appendToTable(trainData$covariateData$covariates, newData)
featureEngineering <- list(
funct = 'implementAgeSplines',
funct = "implementAgeSplines",
settings = list(
featureEngineeringSettings = featureEngineeringSettings,
model = model
)
)
attr(trainData$covariateData, 'metaData')$featureEngineering = listAppend(
attr(trainData$covariateData, 'metaData')$featureEngineering,
attr(trainData$covariateData, "metaData")$featureEngineering <- listAppend(
attr(trainData$covariateData, "metaData")$featureEngineering,
featureEngineering
)
return(trainData)
}
```

# Acknowledgments
Expand Down
Loading

0 comments on commit 253d1b7

Please sign in to comment.