Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 52 additions & 22 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
release:
types: [published]
branches: [main, dev]
push:
branches: [main]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all
name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write

steps:
- uses: actions/checkout@v4

Expand All @@ -33,17 +26,54 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
extra-packages: any::pkgdown
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
- name: Generate sample reports
shell: Rscript {0}
run: |
install.packages(c("devtools", "here"))
devtools::load_all()
dir.create(here::here("pkgdown", "assets"), recursive = TRUE)
library(gsm.kri)
library(gsm.core)

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
lCharts <- gsm.kri::MakeCharts(
dfResults = gsm.core::reportingResults,
dfGroups = gsm.core::reportingGroups,
dfMetrics = gsm.core::reportingMetrics,
dfBounds = gsm.core::reportingBounds
)

gsm.kri::Report_KRI(
lCharts = lCharts,
dfResults = gsm.kri::FilterByLatestSnapshotDate(gsm.core::reportingResults),
dfGroups = gsm.core::reportingGroups,
dfMetrics = gsm.core::reportingMetrics,
strOutputDir = here::here("pkgdown", "assets"),
strOutputFile = "report_kri_site.html"
)

## Country Report
lCharts_country <- gsm.kri::MakeCharts(
dfResults = gsm.core::reportingResults_country,
dfGroups = gsm.core::reportingGroups_country,
dfMetrics = gsm.core::reportingMetrics_country,
dfBounds = gsm.core::reportingBounds_country
)

gsm.kri::Report_KRI(
lCharts = lCharts_country,
dfResults = gsm.kri::FilterByLatestSnapshotDate(gsm.core::reportingResults_country),
dfGroups = gsm.core::reportingGroups_country,
dfMetrics = gsm.core::reportingMetrics_country,
strOutputDir = here::here("pkgdown", "assets"),
strOutputFile = "report_kri_country.html"
)


- name: Deploy pkgdown
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(install = T)'
18 changes: 10 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: openrbqm
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Version: 0.0.1
Authors@R: c(
person("Jeremy", "Wildfire", email = "jwildfire@gmail.com", role = c("aut", "cre")),
person("Laura", "Maxwell", email = "lkmaxwell23@gmail.com", role = c("aut"))
Expand All @@ -23,15 +23,17 @@ Imports:
rstudioapi,
utils
Remotes:
gsm.core=Gilead-BioStats/gsm.core@main,
gsm.core=Gilead-BioStats/gsm.core@v1.1.0,
gsm.app=Gilead-BioStats/gsm.app,
gsm.datasim=Gilead-BioStats/gsm.datasim@dev,
gsm.kri=Gilead-BioStats/gsm.kri@main,
gsm.mapping=Gilead-BioStats/gsm.mapping@main,
gsm.reporting=Gilead-BioStats/gsm.reporting@main,
gsm.qc=Gilead-BioStats/gsm.qc@main
gsm.datasim=Gilead-BioStats/gsm.datasim@v1.0.0,
gsm.kri=Gilead-BioStats/gsm.kri@v1.1.0,
gsm.mapping=Gilead-BioStats/gsm.mapping@v1.0.1,
gsm.reporting=Gilead-BioStats/gsm.reporting@v1.0.1,
gsm.qc=Gilead-BioStats/gsm.qc@v1.0.1
Suggests:
knitr,
rmarkdown
rmarkdown,
DT,
gt
VignetteBuilder: knitr
URL: https://openrbqm.github.io/openrbqm/
4 changes: 0 additions & 4 deletions R/attach.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ openrbqm_detach <- function() {

#' List all packages imported by openrbqm
#'
#' @export
#'
#' @examples
#' #openrbqm_packages()
openrbqm_packages <- function() {
# get all imports from openrbqm's package description file
raw <- utils::packageDescription("openrbqm")$Imports
Expand Down
46 changes: 0 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,4 @@ Collection of R Packages designed for Risk Based Quality Management
5. gsm.reporting
6. gsm.app
7. gsm.template
8. grail
9. gsm.datasim


## Requirements before `{openrbqm}` v1.0.0 release

### Critical outstanding issues

#### Overview

- [ ] `{gsm.reporting}` repo needs to be created and reporting functions and workflows be migrated
- [ ] `{gsm.core}` stripped down after mapping, kri and reporting repo contents confirmed and with at least one release.
- [ ] all examples and most vignettes moved to `{openrbqm}`
- [ ] `{gsm.mapping}` v1.0.0 release candidate with stripped `{gsm}` dev version (or `{gsm.core}` v2.3.0-rc) as dependency
- [ ] `{gsm.kri}` v1.0.0 release candidate with `{gsm.mapping}` v1.0.0-rc and stripped `{gsm.core}` v2.3.0-rc as dependencies
- [ ] `{gsm.endpoints}` mapping edits
- [ ] direct from raw mapping yamls moved to `{gsm.mapping}` with more specific file names
- [ ] update dependencies appropriately

#### Detailed outstanding issues

- `{gsm.core}` issues
- [ ] [Feature: Migrate Mapping components to gsm.mapping](https://github.com/Gilead-BioStats/gsm/issues/1972)
- available on gsm branch `fix-1972v2` in this [PR](https://github.com/Gilead-BioStats/gsm/pull/2002)
- [ ] [Feature: Remove gsm.kri functions, workflows and tests](https://github.com/Gilead-BioStats/gsm/issues/2013)
- available on gsm branch `fix-2013`
- [ ] [Feature: Ensure all workflows are migrated to their respective packages](https://github.com/Gilead-BioStats/gsm/issues/2014)
- [ ] [Feature: Migrate reporting vignette to {gsm.reporting}](https://github.com/Gilead-BioStats/gsm/issues/2015)
- [ ] [Feature: Migrate vignettes to {openrbqm} package](https://github.com/Gilead-BioStats/gsm/issues/2016)
- [ ] [Feature: Migrate workflow/reporting qualification tests to {gsm.kri}](https://github.com/Gilead-BioStats/gsm/issues/2017)
- [ ] [QC: remove util- prefix in file names](https://github.com/Gilead-BioStats/gsm/issues/2026)
- `{gsm.mapping}` issues
- [x] [Write a vignette and template for how to request a new domain/variable](https://github.com/Gilead-BioStats/gsm.mapping/issues/4)
- [ ] [Write a vignette displaying all mapped dfs and variables ](https://github.com/Gilead-BioStats/gsm.mapping/issues/3)
- Begun, and merged into dev via PR #18, but needs some editing to fully address the issue
- `{gsm.kri}` issues
- [ ] [Migrate Vignettes and make pkgdown site](https://github.com/Gilead-BioStats/gsm.kri/issues/9)
- begun on gsm branch `fix-9`
- `{gsm.endpoints}` issues
- [ ] [Feature: Move rawplus mapping yamls to the gsm.mapping package](https://github.com/Gilead-BioStats/gsm.endpoints/issues/134)
- [ ] [Feature: Update names and meta information of workflows to be more specific](https://github.com/Gilead-BioStats/gsm.endpoints/issues/133)
- `{gsm.reporting}` issues

### Nice to haves
- `{gsm.template}` issues
- `{gsm.datasim}` issues
- add `{gsm.endpoints}` domains to available data and vars. [(Issue here)](https://github.com/Gilead-BioStats/gsm.datasim/issues/34)
9 changes: 8 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ navbar:
structure:
left: [articles, Reports, reference, news]
right: [search, github]

components:
Reports:
text: Sample Reports
menu:
- text: Site Report
href: report_kri_site.html
- text: Country Report
href: report_kri_country.html
55 changes: 55 additions & 0 deletions inst/examples/1_AdverseEventKRI.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#### Example 1.1 - Generate an Adverse Event Metric using the standard {gsm.core} workflow

dfInput <- Input_Rate(
dfSubjects= gsm.core::lSource$Raw_SUBJ,
dfNumerator= gsm.core::lSource$Raw_AE,
dfDenominator = gsm.core::lSource$Raw_SUBJ,
strSubjectCol = "subjid",
strGroupCol = "siteid",
strNumeratorMethod= "Count",
strDenominatorMethod= "Sum",
strDenominatorCol= "timeonstudy"
)

dfTransformed <- Transform_Rate(dfInput)
dfAnalyzed <- Analyze_NormalApprox(dfTransformed, strType = "rate")
dfFlagged <- Flag_NormalApprox(dfAnalyzed, vThreshold = c(-3,-2,2,3))
dfSummarized <- Summarize(dfFlagged)

table(dfSummarized$Flag)

#### Example 1.2 - Make an SAE Metric by adding a filter. Also works with pipes.

SAE_KRI <- Input_Rate(
dfSubjects= gsm.core::lSource$Raw_SUBJ,
dfNumerator= gsm.core::lSource$Raw_AE %>% filter(aeser=="Y"),
dfDenominator = gsm.core::lSource$Raw_SUBJ,
strSubjectCol = "subjid",
strGroupCol = "siteid",
strNumeratorMethod= "Count",
strDenominatorMethod= "Sum",
strDenominatorCol= "timeonstudy"
) %>%
Transform_Rate %>%
Analyze_NormalApprox(strType = "rate") %>%
Flag_NormalApprox(vThreshold = c(-3,-2,2,3)) %>%
Summarize

table(SAE_KRI$Flag)

### Example 1.3 - Visualize Metric distribution using Bar Charts using provided htmlwidgets
library(gsm.kri)

labels <- list(
Metric= "Serious Adverse Event Rate",
Numerator= "Serious Adverse Events",
Denominator= "Days on Study"
)

gsm.kri::Widget_BarChart(dfResults = SAE_KRI, lMetric=labels, strOutcome="Metric")
gsm.kri::Widget_BarChart(dfResults = SAE_KRI, lMetric=labels, strOutcome="Score")
gsm.kri::Widget_BarChart(dfResults = SAE_KRI, lMetric=labels, strOutcome="Numerator")

### Example 1.4 - Create Scatter plot with confidence bounds
dfBounds <- Analyze_NormalApprox_PredictBounds(SAE_KRI, vThreshold = c(-3,-2,2,3))
gsm.kri::Widget_ScatterPlot(SAE_KRI, lMetric = labels, dfBounds = dfBounds)
128 changes: 128 additions & 0 deletions inst/examples/2_AdverseEventWorkflow.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
library(gsm.mapping)
library(gsm.kri)

#### Example 2.1 - Configurable Adverse Event Workflow

# Define YAML workflow
AE_workflow <- read_yaml(text=
'meta:
Type: Analysis
ID: kri0001
GroupLevel: Site
Abbreviation: AE
Metric: Adverse Event Rate
Numerator: Adverse Events
Denominator: Days on Study
Model: Normal Approximation
Score: Adjusted Z-Score
AnalysisType: rate
Threshold: -2,-1,2,3
nMinDenominator: 30
spec:
Mapped_AE:
subjid:
type: character
Mapped_SUBJ:
subjid:
type: character
invid:
type: character
timeonstudy:
type: integer
steps:
- output: vThreshold
name: ParseThreshold
params:
strThreshold: Threshold
- output: Analysis_Input
name: Input_Rate
params:
dfSubjects: Mapped_SUBJ
dfNumerator: Mapped_AE
dfDenominator: Mapped_SUBJ
strSubjectCol: subjid
strGroupCol: invid
strGroupLevel: GroupLevel
strNumeratorMethod: Count
strDenominatorMethod: Sum
strDenominatorCol: timeonstudy
- output: Analysis_Transformed
name: Transform_Rate
params:
dfInput: Analysis_Input
- output: Analysis_Analyzed
name: Analyze_NormalApprox
params:
dfTransformed: Analysis_Transformed
strType: AnalysisType
- output: Analysis_Flagged
name: Flag_NormalApprox
params:
dfAnalyzed: Analysis_Analyzed
vThreshold: vThreshold
- output: Analysis_Summary
name: Summarize
params:
dfFlagged: Analysis_Flagged
nMinDenominator: nMinDenominator
- output: lAnalysis
name: list
params:
ID: ID
Analysis_Input: Analysis_Input
Analysis_Transformed: Analysis_Transformed
Analysis_Analyzed: Analysis_Analyzed
Analysis_Flagged: Analysis_Flagged
Analysis_Summary: Analysis_Summary
')

# Run the workflow
lMappingWorkflows <- MakeWorkflowList(
c("AE", "SUBJ"),
strPath = here::here("tests/testthat/testdata/mappings"),
bExact = TRUE
)
mappings_spec <- gsm.mapping::CombineSpecs(lMappingWorkflows)
lRawData <- gsm.mapping::Ingest(gsm.core::lSource, mappings_spec)
AE_data <-list(
Mapped_SUBJ= lRawData$Raw_SUBJ,
Mapped_AE= lRawData$Raw_AE
)
AE_KRI <- RunWorkflow(lWorkflow = AE_workflow, lData = AE_data)

# Create Barchart from workflow
Widget_BarChart(dfResults = AE_KRI$Analysis_Summary)

#### Example 2.2 - Run Country-Level Metric
AE_country_workflow <- AE_workflow
AE_country_workflow$meta$GroupLevel <- "Country"
AE_country_workflow$steps[[2]]$params$strGroupCol <- "country"

AE_country_KRI <- RunWorkflow(lWorkflow = AE_country_workflow, lData = AE_data)
gsm.kri::Widget_BarChart(dfResults = AE_country_KRI$Analysis_Summary, lMetric = AE_country_workflow$meta)

#### Example 2.3 - Create SAE workflow

# Tweak AE workflow metadata
SAE_workflow <- AE_workflow
SAE_workflow$meta$File <- "SAE_KRI"
SAE_workflow$meta$Metric <- "Serious Adverse Event Rate"
SAE_workflow$meta$Numerator <- "Serious Adverse Events"

# Add a step to filter out non-serious AEs `RunQuery`
filterStep <- list(list(
name = "RunQuery",
output = "Mapped_AE",
params= list(
df= "Mapped_AE",
strQuery = "SELECT * FROM df WHERE aeser = 'Y'"
))
)
SAE_workflow$steps <- SAE_workflow$steps %>% append(filterStep, after=0)

# Run the updated workflow
SAE_KRI <- RunWorkflow(lWorkflow = SAE_workflow, lData = AE_data )
gsm.kri::Widget_BarChart(dfResults = SAE_KRI$Analysis_Summary, lMetric = SAE_workflow$meta)



Loading