Skip to content

Commit

Permalink
Merge pull request #18 from OdyOSG/develop
Browse files Browse the repository at this point in the history
prep v0.1.7 release
  • Loading branch information
mdlavallee92 authored Oct 3, 2023
2 parents 49bda70 + 22c2ed3 commit 9612291
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 16 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# EHDEN HMB v0.1.7

* Correct event in time to procedure intervention

# EHDEN HMB v0.1.6

* Minor bug fix to treatment patterns analysis
Expand Down
63 changes: 49 additions & 14 deletions analysis/private/_procedureAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,52 @@ getWindowPrevalence <- function(tb, timeA, timeB) {
}


getTteRes <- function(tb, outcomeCohortId) {

##CORRECTION needs to be time to event happening
tab2 <- tb %>%
dplyr::filter(cohortDefinitionId == outcomeCohortId) %>%
dplyr::mutate(
event = ifelse(is.na(cohortDefinitionId), 0, 1),
duration = dplyr::case_when(
event == 0 ~ as.integer(cohortEndDate - cohortStartDate) / 365.25,
event == 1 ~ as.integer(eventDate - cohortStartDate) / 365.25
)
) %>%
dplyr::select(duration, event)


if (nrow(tab2) > 0) {
# get surv fit object
survFit <- ggsurvfit::survfit2(
survival::Surv(duration, event) ~ 1, data = tab2
)
# retrieve tidy survfit
survDat <- ggsurvfit::tidy_survfit(survFit) %>%
dplyr::select(time, `n.risk`, `n.event`, estimate, std.error) %>%
dplyr::filter(
time <= 3 # only take first 3 years of data
) %>%
dplyr::mutate(
outcomeCohortId = !!outcomeCohortId
)
} else {
# if no data return an all zero row
survDat <- tibble::tibble(
time = 0,
n.risk = 0,
n.event = 0,
estimate = 0,
std.error = 0,
outcomeCohortId = outcomeCohortId
)
}

return(survDat)

}


executeProcedureAnalysis <- function(con,
executionSettings,
analysisSettings) {
Expand Down Expand Up @@ -191,21 +237,10 @@ executeProcedureAnalysis <- function(con,
bullet = "checkbox_on", bullet_col = "green")

# subset table for survival analysis
tab2 <- tb %>%
dplyr::filter(!is.na(cohortDefinitionId)) %>%
dplyr::mutate(
event = 1,
duration = as.integer(eventDate - cohortStartDate) / 365.25
) %>%
dplyr::select(cohortDefinitionId, duration, event)

# get surv fit object
survFit <- ggsurvfit::survfit2(
survival::Surv(duration, event) ~ cohortDefinitionId, data = tab2
survDat <- purrr::map_dfr(
procedureCohortIds,
~getTteRes(tb, outcomeCohortId = .x)
)
# retrieve tidy survfit
survDat <- ggsurvfit::tidy_survfit(survFit) %>%
dplyr::select(time, `n.risk`, `n.event`, estimate:strata)

fileNm2 <- glue::glue("procedure_survival_{idx}")

Expand Down
9 changes: 8 additions & 1 deletion docs/news.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@
<h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#ehden-hmb-v0.1.6" id="toc-ehden-hmb-v0.1.6" class="nav-link active" data-scroll-target="#ehden-hmb-v0.1.6">EHDEN HMB v0.1.6</a></li>
<li><a href="#ehden-hmb-v0.1.7" id="toc-ehden-hmb-v0.1.7" class="nav-link active" data-scroll-target="#ehden-hmb-v0.1.7">EHDEN HMB v0.1.7</a></li>
<li><a href="#ehden-hmb-v0.1.6" id="toc-ehden-hmb-v0.1.6" class="nav-link" data-scroll-target="#ehden-hmb-v0.1.6">EHDEN HMB v0.1.6</a></li>
<li><a href="#ehden-hmb-v0.1.5" id="toc-ehden-hmb-v0.1.5" class="nav-link" data-scroll-target="#ehden-hmb-v0.1.5">EHDEN HMB v0.1.5</a></li>
<li><a href="#ehden-hmb-v0.1.4" id="toc-ehden-hmb-v0.1.4" class="nav-link" data-scroll-target="#ehden-hmb-v0.1.4">EHDEN HMB v0.1.4</a></li>
<li><a href="#ehden-hmb-v0.1.3" id="toc-ehden-hmb-v0.1.3" class="nav-link" data-scroll-target="#ehden-hmb-v0.1.3">EHDEN HMB v0.1.3</a></li>
Expand Down Expand Up @@ -192,6 +193,12 @@ <h1 class="title">News</h1>

</header>

<section id="ehden-hmb-v0.1.7" class="level1">
<h1>EHDEN HMB v0.1.7</h1>
<ul>
<li>Correct event in time to procedure intervention</li>
</ul>
</section>
<section id="ehden-hmb-v0.1.6" class="level1">
<h1>EHDEN HMB v0.1.6</h1>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"href": "news.html",
"title": "News",
"section": "",
"text": "EHDEN HMB v0.1.6\n\nMinor bug fix to treatment patterns analysis\nCorrect typo in functions\n\n\n\nEHDEN HMB v0.1.5\n\nCorrect bug in analysis settings (Issue #12)\nUpdate package website\nAdd yearly incidence to Incidence Analysis (Issue #13)\nAdd R scripts for data exchange and CD preview (Issue #14)\nupdate cohort definitions from Siir\n\ncopperIUDproc\ncopperIUDdrug\ndisorderOfOvary\n\n\n\n\nEHDEN HMB v0.1.4\n\nFix bug in baseline characteristics; typo in analysis settings (Issue #10)\nCorrections to the study website\n\n\n\nEHDEN HMB v0.1.3\n\nUpdate cohort definitions\n\nadd baseline procedures\nadd baseline drugs\n\nInclude procedure prevalence at baseline [-365,0]\n\n\n\nEHDEN HMB v0.1.2\n\nUpdate cohort definitions\n\nrerun drug exposure with Capr\nrerun procedures with Capr\nadd time restraints to nsaids\nadd hmb cohort without hysterectomy censor\n\nAdd secondary treatment sequence including procedures\n\n\n\nEHDEN HMB v0.1.1\n\nAdd study website\nUpdate cohort definitions for denominator\nAddition of executeStudy.R file to automate execution\nadd age strata [under 30, 30-45, 45-55]\n\n\n\nEHDEN HMB v0.1.0\n\nFirst release of study code for EHDEN HMB\n\nAdd Incidence Analysis\nAdd Baseline Characteristics\nAdd Treatment Patterns\nAdd Procedure Analysis\n\n\n\n\nEHDEN HMB v0.0.6\n\nAdd file StoreResults to upload cohort diagnostics zip to aws s3 bucket\nUpdate KeyringSetup to match Ulysses\nUpdate renv.lock to add aws.s3 and Ulysses v0.0.2\nminor correction to study task files\n\n\n\nEHDEN HMB v0.0.5\n\nAdd in renv\nminor correction to HMB cohort for cohort diagnostics\n\n\n\nEHDEN HMB v0.0.4\n\nFix errors in KeyringSetup.R file\nFix cohort diagnostics to use integer64 with id in cohortDefinitionSet\n\n\n\nEHDEN HMB v0.0.3\n\nUpdate How to run file with installation instructions for usethis and Ulysses\nFix extras/KeyringSetup.R file to correctly set up credentials and check them\nEdit startSnowflakeSession function to handle string split of workDatabaseSchema\nEdit study tasks to order snowflake start correctly and close connection at end of file\n\n\n\nEHDEN HMB v0.0.2\n\nUpdate cohort definition for HMB to fix error\nAdd cohort diagnostics script\nAdd How to Run file and key ring file\n\n\n\nEHDEN HMB v0.0.1\n\nAdd HMB cohort definition to repo\nStart preparing documentation about study\nInitialize OHDSI study\nAdd NEWS.md to"
"text": "EHDEN HMB v0.1.7\n\nCorrect event in time to procedure intervention\n\n\n\nEHDEN HMB v0.1.6\n\nMinor bug fix to treatment patterns analysis\nCorrect typo in functions\n\n\n\nEHDEN HMB v0.1.5\n\nCorrect bug in analysis settings (Issue #12)\nUpdate package website\nAdd yearly incidence to Incidence Analysis (Issue #13)\nAdd R scripts for data exchange and CD preview (Issue #14)\nupdate cohort definitions from Siir\n\ncopperIUDproc\ncopperIUDdrug\ndisorderOfOvary\n\n\n\n\nEHDEN HMB v0.1.4\n\nFix bug in baseline characteristics; typo in analysis settings (Issue #10)\nCorrections to the study website\n\n\n\nEHDEN HMB v0.1.3\n\nUpdate cohort definitions\n\nadd baseline procedures\nadd baseline drugs\n\nInclude procedure prevalence at baseline [-365,0]\n\n\n\nEHDEN HMB v0.1.2\n\nUpdate cohort definitions\n\nrerun drug exposure with Capr\nrerun procedures with Capr\nadd time restraints to nsaids\nadd hmb cohort without hysterectomy censor\n\nAdd secondary treatment sequence including procedures\n\n\n\nEHDEN HMB v0.1.1\n\nAdd study website\nUpdate cohort definitions for denominator\nAddition of executeStudy.R file to automate execution\nadd age strata [under 30, 30-45, 45-55]\n\n\n\nEHDEN HMB v0.1.0\n\nFirst release of study code for EHDEN HMB\n\nAdd Incidence Analysis\nAdd Baseline Characteristics\nAdd Treatment Patterns\nAdd Procedure Analysis\n\n\n\n\nEHDEN HMB v0.0.6\n\nAdd file StoreResults to upload cohort diagnostics zip to aws s3 bucket\nUpdate KeyringSetup to match Ulysses\nUpdate renv.lock to add aws.s3 and Ulysses v0.0.2\nminor correction to study task files\n\n\n\nEHDEN HMB v0.0.5\n\nAdd in renv\nminor correction to HMB cohort for cohort diagnostics\n\n\n\nEHDEN HMB v0.0.4\n\nFix errors in KeyringSetup.R file\nFix cohort diagnostics to use integer64 with id in cohortDefinitionSet\n\n\n\nEHDEN HMB v0.0.3\n\nUpdate How to run file with installation instructions for usethis and Ulysses\nFix extras/KeyringSetup.R file to correctly set up credentials and check them\nEdit startSnowflakeSession function to handle string split of workDatabaseSchema\nEdit study tasks to order snowflake start correctly and close connection at end of file\n\n\n\nEHDEN HMB v0.0.2\n\nUpdate cohort definition for HMB to fix error\nAdd cohort diagnostics script\nAdd How to Run file and key ring file\n\n\n\nEHDEN HMB v0.0.1\n\nAdd HMB cohort definition to repo\nStart preparing documentation about study\nInitialize OHDSI study\nAdd NEWS.md to"
},
{
"objectID": "contribution.html",
Expand Down
5 changes: 5 additions & 0 deletions documentation/news.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
title: "News"
---

# EHDEN HMB v0.1.7

* Correct event in time to procedure intervention


# EHDEN HMB v0.1.6

* Minor bug fix to treatment patterns analysis
Expand Down

0 comments on commit 9612291

Please sign in to comment.