Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read cohort incidence options from lookup tables #309

Closed
Closed
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
18 changes: 9 additions & 9 deletions R/characterization-caseSeries.R
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ characterizationGetCaseSeriesOptions <- function(
and s.database_id = cd.database_id
and cd.target_cohort_id = @target_id
and cd.outcome_cohort_id = @outcome_id
and cd.cohort_type = 'TnO'
and cd.cohort_type = 'Cases'

inner join
@schema.@cg_table_prefixcohort_definition ct1
Expand Down Expand Up @@ -256,9 +256,9 @@ characterizationGetCaseSeriesData <- function(

sql <- "SELECT
case
when cov.cohort_type = 'TnO' then 'Before'
when cov.cohort_type = 'TnObetween' then 'During'
when cov.cohort_type = 'OnT' then 'After'
when cov.cohort_type = 'CasesBefore' then 'Before'
when cov.cohort_type = 'CasesBetween' then 'During'
when cov.cohort_type = 'CaseAfter' then 'After'
end as type,
cr.covariate_name,
s.min_prior_observation, s.outcome_washout_days,
Expand All @@ -277,7 +277,7 @@ characterizationGetCaseSeriesData <- function(

where cov.target_cohort_id = @target_id
and cov.outcome_cohort_id = @outcome_id
and cov.cohort_type in ('TnObetween','OnT','TnO')
and cov.cohort_type in ('CasesBetween','CasesAfter','CasesBefore')
--and cov.setting_id = @setting_id
and s.risk_window_start = @risk_window_start
and s.risk_window_end = @risk_window_end
Expand Down Expand Up @@ -309,9 +309,9 @@ characterizationGetCaseSeriesData <- function(

sql <- "SELECT
case
when cov.cohort_type = 'TnO' then 'Before'
when cov.cohort_type = 'TnObetween' then 'During'
when cov.cohort_type = 'OnT' then 'After'
when cov.cohort_type = 'CasesBefore' then 'Before'
when cov.cohort_type = 'CasesBetween' then 'During'
when cov.cohort_type = 'CasesAfter' then 'After'
end as type,
cr.covariate_name,
s.min_prior_observation, s.outcome_washout_days,
Expand All @@ -333,7 +333,7 @@ characterizationGetCaseSeriesData <- function(

where cov.target_cohort_id = @target_id
and cov.outcome_cohort_id = @outcome_id
and cov.cohort_type in ('TnObetween','OnT','TnO')
and cov.cohort_type in ('CasesBetween','CasesAfter','CasesBefore')
and s.risk_window_start = @risk_window_start
and s.risk_window_end = @risk_window_end
and s.start_anchor = '@start_anchor'
Expand Down
2 changes: 1 addition & 1 deletion R/characterization-cohorts.R
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ characterizatonGetCohortComparisonDataContinuous <- function(
res <- res %>% dplyr::select(-"cohortDefinitionId", -"databaseId", -"type",
-"settingId", -"targetCohortId", -"outcomeCohortId",
-"cohortType") %>%
dplyr::relocate(.data$databaseName, .after = .data$covariateName)
dplyr::relocate("databaseName", .after = "covariateName")
}

shiny::incProgress(4/4, detail = paste("Done"))
Expand Down
Loading
Loading