From 1a0f1da3de10d04759387f46d1edc31d5af7fb1c Mon Sep 17 00:00:00 2001 From: egillax Date: Sat, 14 Jun 2025 10:20:03 +0200 Subject: [PATCH 1/4] reactable table for Constrained predictors --- vignettes/ConstrainedPredictors.Rmd | 170 +++++++++++++++++----------- 1 file changed, 103 insertions(+), 67 deletions(-) diff --git a/vignettes/ConstrainedPredictors.Rmd b/vignettes/ConstrainedPredictors.Rmd index 7bd1e93fb..7ccf62905 100644 --- a/vignettes/ConstrainedPredictors.Rmd +++ b/vignettes/ConstrainedPredictors.Rmd @@ -18,7 +18,7 @@ Here we provide a set of phenotypes that can be used as predictors in prediction These phenotypes can be extracted from the PhenotypeLibrary R package. To install the R package run: ```{r, echo = TRUE, message = FALSE, warning = FALSE, tidy = FALSE, eval=FALSE} -remotes::install_github("ohdsi/PhenotypeLibrary") +remotes::install_github("OHDSI/PhenotypeLibrary") ``` To extract the cohort definition for Alcoholism with an id of 1165, just run: @@ -35,69 +35,105 @@ phenotypeDefinitions <- PhenotypeLibrary::getPlCohortDefinitionSet(1152:1215) ### The full set of predictor phenotypes -| Phenotype Name | Disorder classification | OHDSI Phenotype library ID | -|--------------------------------|--------------------|-------------------| -| Alcoholism | Behavioral | 1165 | -| Smoking | Behavioral | 1166 | -| Anemia | Blood | 1188 | -| Osteoarthritis | Bone | 1184 | -| Osteoporosis | Bone | 1185 | -| Cancer | Cancer | 1215 | -| Atrial fibrillation | Cardiovascular | 1160 | -| Congestive heart failure | Cardiovascular | 1154 | -| Coronary artery disease | Cardiovascular | 1162 | -| Heart valve disorder | Cardiovascular | 1172 | -| Hyperlipidemia | Cardiovascular | 1170 | -| Hypertension | Cardiovascular | 1198 | -| Angina | Cardiovascular | 1159 | -| Skin Ulcer | Debility | 1168 | -| Diabetes type 1 | Endocrine | 1193 | -| Diabetes type 2 | Endocrine | 1194 | -| Hypothyroidism | Endocrine | 1171 | -| Obesity | Endocrine | 1179 | -| Gastroesophageal reflux disease (GERD) | GI | 1178 | -| Gastrointestinal (GI) bleed | GI | 1197 | -| Inflammatory bowel disorder (IBD) | GI/Rheumatology | 1180 | -| Hormonal contraceptives | Gynecologic | 1190 | -| Antibiotics Aminoglycosides | Infection | 1201 | -| Antibiotics Carbapenems | Infection | 1202 | -| Antibiotics Cephalosporins | Infection | 1203 | -| Antibiotics Fluoroquinolones | Infection | 1204 | -| Antibiotics Glycopeptides and lipoglycopeptides | Infection | 1205 | -| Antibiotics Macrolides | Infection | 1206 | -| Antibiotics Monobactams | Infection | 1207 | -| Antibiotics Oxazolidinones | Infection | 1208 | -| Antibiotics Penicillins | Infection | 1209 | -| Antibiotics Polypeptides | Infection | 1210 | -| Antibiotics Rifamycins | Infection | 1211 | -| Antibiotics Sulfonamides | Infection | 1212 | -| Antibiotics Streptogramins | Infection | 1213 | -| Antibiotics Tetracyclines | Infection | 1214 | -| Pneumonia | Infection/Respiratory | 1199 | -| Sepsis | Infection | 1176 | -| Urinary tract infection (UTI) | Infection | 1186 | -| Hepatitis | Liver | 1169 | -| Anxiety | Mood | 1189 | -| Depression (MDD) | Mood | 1161 | -| Psychotic disorder | Mood | 1175 | -| Antiepileptics (pain) | Neurology/Pain | 1183 | -| Seizure | Neurology | 1153 | -| Hemorrhagic stroke | Neurology/Vascular | 1156 | -| Non-hemorrhagic stroke | Neurology/Vascular | 1155 | -| Acetaminophen prescription | Pain/Infection | 1187 | -| Low back pain | Pain | 1173 | -| Neuropathy | Pain/Neurology | 1174 | -| Opioids | Pain | 1182 | -| Acute kidney injury | Kidney | 1163 | -| Chronic kidney disease | Kidney | 1191 | -| Asthma | Respiratory | 1164 | -| Chronic obstructive pulmonary disorder (COPD) | Respiratory | 1192 | -| Dyspnea | Respiratory | 1195 | -| Respiratory failure | Respiratory | 1177 | -| Sleep apnea | Respiratory | 1167 | -| Rheumatoid arthritis | Rheumatology | 1200 | -| Steroids | Rheumatology/Pain/Pulmonary | 1181 | -| Peripheral vascular disease | Vascular | 1157 | -| Aspirin | Vascular | 1158 | -| Deep vein thrombosis (DVT) | Vascular | 1152 | -| Edema | Vascular | 1196 | +```{r show-table, eval=TRUE, echo=FALSE} +df <- tibble::tribble( + ~"Phenotype Name", ~"Disorder classification", ~"OHDSI Phenotype library ID", + "Alcoholism", "Behavioral", 1165, + "Smoking", "Behavioral", 1166, + "Anemia", "Blood", 1188, + "Osteoarthritis", "Bone", 1184, + "Osteoporosis", "Bone", 1185, + "Cancer", "Cancer", 1215, + "Atrial fibrillation", "Cardiovascular", 1160, + "Congestive heart failure", "Cardiovascular", 1154, + "Coronary artery disease", "Cardiovascular", 1162, + "Heart valve disorder", "Cardiovascular", 1172, + "Hyperlipidemia", "Cardiovascular", 1170, + "Hypertension", "Cardiovascular", 1198, + "Angina", "Cardiovascular", 1159, + "Skin Ulcer", "Debility", 1168, + "Diabetes type 1", "Endocrine", 1193, + "Diabetes type 2", "Endocrine", 1194, + "Hypothyroidism", "Endocrine", 1171, + "Obesity", "Endocrine", 1179, + "Gastroesophageal reflux disease (GERD)", "GI", 1178, + "Gastrointestinal (GI) bleed", "GI", 1197, + "Inflammatory bowel disorder (IBD)", "GI/Rheumatology", 1180, + "Hormonal contraceptives", "Gynecologic", 1190, + "Antibiotics Aminoglycosides", "Infection", 1201, + "Antibiotics Carbapenems", "Infection", 1202, + "Antibiotics Cephalosporins", "Infection", 1203, + "Antibiotics Fluoroquinolones", "Infection", 1204, + "Antibiotics Glycopeptides and lipoglycopeptides", "Infection", 1205, + "Antibiotics Macrolides", "Infection", 1206, + "Antibiotics Monobactams", "Infection", 1207, + "Antibiotics Oxazolidinones", "Infection", 1208, + "Antibiotics Penicillins", "Infection", 1209, + "Antibiotics Polypeptides", "Infection", 1210, + "Antibiotics Rifamycins", "Infection", 1211, + "Antibiotics Sulfonamides", "Infection", 1212, + "Antibiotics Streptogramins", "Infection", 1213, + "Antibiotics Tetracyclines", "Infection", 1214, + "Pneumonia", "Infection/Respiratory", 1199, + "Sepsis", "Infection", 1176, + "Urinary tract infection (UTI)", "Infection", 1186, + "Hepatitis", "Liver", 1169, + "Anxiety", "Mood", 1189, + "Depression (MDD)", "Mood", 1161, + "Psychotic disorder", "Mood", 1175, + "Antiepileptics (pain)", "Neurology/Pain", 1183, + "Seizure", "Neurology", 1153, + "Hemorrhagic stroke", "Neurology/Vascular", 1156, + "Non-hemorrhagic stroke", "Neurology/Vascular", 1155, + "Acetaminophen prescription", "Pain/Infection", 1187, + "Low back pain", "Pain", 1173, + "Neuropathy", "Pain/Neurology", 1174, + "Opioids", "Pain", 1182, + "Acute kidney injury", "Kidney", 1163, + "Chronic kidney disease", "Kidney", 1191, + "Asthma", "Respiratory", 1164, + "Chronic obstructive pulmonary disorder (COPD)", "Respiratory", 1192, + "Dyspnea", "Respiratory", 1195, + "Respiratory failure", "Respiratory", 1177, + "Sleep apnea", "Respiratory", 1167, + "Rheumatoid arthritis", "Rheumatology", 1200, + "Steroids", "Rheumatology/Pain/Pulmonary", 1181, + "Peripheral vascular disease", "Vascular", 1157, + "Aspirin", "Vascular", 1158, + "Deep vein thrombosis (DVT)", "Vascular", 1152, + "Edema", "Vascular", 1196 +) + +#Build a reactableTheme that *reads* Bootstrap CSS vars +bs_table_theme <- reactable::reactableTheme( + backgroundColor = "var(--bs-table-bg)", + color = "var(--bs-table-color)", + searchInputStyle = list( + backgroundColor = "var(--bs-table-bg)", + color = "var(--bs-table-color)" + ) +) +reactable::reactable( + df, + theme = bs_table_theme, + searchable = TRUE, # add the search box + defaultPageSize = 30, # rows per page + highlight = TRUE, # highlight row under cursor + bordered = TRUE, # add table borders + striped = TRUE, # zebra-striped rows + columns = list( + `Phenotype Name` = reactable::colDef( + name = "Phenotype", + minWidth = 200 + ), + `Disorder classification` = reactable::colDef( + name = "Category" + ), + `OHDSI Phenotype library ID` = reactable::colDef( + name = "Library ID", + defaultSortOrder = "desc", + align = "right" + ) + ) +) +``` From 71db2697e9a27b9b05a482c4249b6dfd0175604f Mon Sep 17 00:00:00 2001 From: egillax Date: Sat, 14 Jun 2025 10:33:02 +0200 Subject: [PATCH 2/4] fix vignette --- .Rbuildignore | 1 + .github/workflows/pkgdown.yaml | 2 +- _pkgdown.yml | 9 ++------- vignettes/ConstrainedPredictors.Rmd | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 050b9871b..73abf56bf 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -13,6 +13,7 @@ docs/* _pkgdown.yml ^vignettes/articles$ ^vignettes/Videos.Rmd +^vignettes/ConstrainedPredictors.Rmd ^doc$ ^Meta$ ^CRAN-RELEASE$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 83fa4efc1..07efc0ab3 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -29,7 +29,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: cache: always - extra-packages: any::pkgdown, ohdsi/OhdsiRTools + extra-packages: any::pkgdown, ohdsi/OhdsiRTools, any::reactable needs: website - uses: lycheeverse/lychee-action@v2 diff --git a/_pkgdown.yml b/_pkgdown.yml index 653210e87..09be06d7c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,7 +1,6 @@ template: bootstrap: 5 - params: - bootswatch: cosmo + bootswatch: cosmo light-switch: true development: @@ -20,12 +19,8 @@ navbar: - intro - reference - articles - - benchmarks - - predictors - - bestpractice - - clinicalmodels - news - right: [hades, github] + right: [hades, search, github, lightswitch] components: home: icon: fa-home fa-lg diff --git a/vignettes/ConstrainedPredictors.Rmd b/vignettes/ConstrainedPredictors.Rmd index 7ccf62905..591cd1b17 100644 --- a/vignettes/ConstrainedPredictors.Rmd +++ b/vignettes/ConstrainedPredictors.Rmd @@ -35,7 +35,7 @@ phenotypeDefinitions <- PhenotypeLibrary::getPlCohortDefinitionSet(1152:1215) ### The full set of predictor phenotypes -```{r show-table, eval=TRUE, echo=FALSE} +```{r show-table, eval=TRUE, echo=FALSE, tidy = FALSE} df <- tibble::tribble( ~"Phenotype Name", ~"Disorder classification", ~"OHDSI Phenotype library ID", "Alcoholism", "Behavioral", 1165, From 1c8c15227d8851a691e66011e288f0b88ee39009 Mon Sep 17 00:00:00 2001 From: egillax Date: Sat, 14 Jun 2025 11:52:35 +0200 Subject: [PATCH 3/4] fix atlas link --- vignettes/BuildingPredictiveModels.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/BuildingPredictiveModels.Rmd b/vignettes/BuildingPredictiveModels.Rmd index 7dc49854b..204034009 100644 --- a/vignettes/BuildingPredictiveModels.Rmd +++ b/vignettes/BuildingPredictiveModels.Rmd @@ -607,7 +607,7 @@ The T and O cohorts can be found here: - Ace inhibitors (T): - Angioedema (O) : -In depth explanation of cohort creation in ATLAS is out of scope of this vignette but can be found on the OHDSI wiki pages [(link)](https://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:atlas). +In depth explanation of cohort creation in ATLAS is out of scope of this vignette but can be found on the OHDSI wiki pages [(link)](https://github.com/OHDSI/Atlas/wiki). Note that when a cohort is created in ATLAS the cohortid is needed to extract the data in R. The cohortid can be found at the top of the ATLAS screen, e.g. 1770617 in Figure 6. From ad7b79e1964e4bed8dc90c3a3af2ec9af7e72b43 Mon Sep 17 00:00:00 2001 From: egillax Date: Sat, 14 Jun 2025 12:37:50 +0200 Subject: [PATCH 4/4] exclude codecov from link checking --- .github/workflows/pkgdown.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 07efc0ab3..3cf32da71 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -34,7 +34,7 @@ jobs: - uses: lycheeverse/lychee-action@v2 with: - args: --base . --verbose --no-progress --accept '100..=103, 200..=299, 403' './**/*.md' './**/*.Rmd' + args: --base . --verbose --no-progress --accept '100..=103, 200..=299, 403' --exclude https://codecov.io './**/*.md' './**/*.Rmd' - name: Build site run: Rscript -e 'pkgdown::build_site_github_pages(new_process = FALSE, install = TRUE)'