Skip to content

Commit

Permalink
chore: merged all into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kapsner committed Dec 6, 2024
2 parents 56fee58 + 834bc83 commit 9ee9e59
Show file tree
Hide file tree
Showing 59 changed files with 555 additions and 726 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: DQAstats
Title: Core Functions for Data Quality Assessment
Version: 0.3.5
Date: 2024-06-05
Version: 0.3.6
Date: 2024-11-27
Authors@R: c(
person("Lorenz A.", "Kapsner", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0003-1866-860X")),
Expand Down Expand Up @@ -45,4 +45,4 @@ Encoding: UTF-8
Roxygen: list(markdown = TRUE)
SystemRequirements: Quarto command line tools
(https://github.com/quarto-dev/quarto-cli).
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export(atemp_plausi_results)
export(check_date_restriction_requirements)
export(completeness)
export(create_helper_vars)
export(create_markdown)
export(create_pdf_report)
export(data_loading)
export(descriptive_results)
Expand Down
721 changes: 377 additions & 344 deletions NEWS.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion R/DQA.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/calc_cat_stats.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/calc_counts.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/calc_description.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/calc_stats.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/categorical_analysis.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/completeness.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/conformance.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion R/count_uniques.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
146 changes: 3 additions & 143 deletions R/create_pdf_report.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DQAstats - Perform data quality assessment (DQA) of electronic health
# records (EHR)
# Copyright (C) 2019-2022 Universitätsklinikum Erlangen
# Copyright (C) 2019-2024 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -220,9 +220,11 @@ create_pdf_report <- function(rv = rv,
tmpdir = tempdir(),
fileext = "-params.yml"
)

writeLines(
text = c(paste0("source_system_name: \"", rv$source$system_name, "\""),
paste0("target_system_name: \"", rv$target$system_name, "\""),
paste0("sitename: \"", rv$sitename, "\""),
paste0("restricting_date: \"", get_restricting_date_info(
restricting_date = rv$restricting_date, time = FALSE), "\""
)),
Expand Down Expand Up @@ -264,145 +266,3 @@ create_pdf_report <- function(rv = rv,
})
}
}


#' @title create_markdown helper function
#'
#' @description Internal function to generate the final PDF report.
#'
#' @param outdir A character string. The directory to store the resulting
#' PDF document. Default: \code{tempdir}.
#' @inheritParams load_csv
#' @inheritParams dqa
#'
#' @return No return value. This function renders the PDF markdown report with
#' the data quality assessment results and saves it to `outdir`.
#'
#' @examples
#' \donttest{# runtime > 5 sec.
#' utils_path <- system.file(
#' "demo_data/utilities/",
#' package = "DQAstats"
#' )
#' mdr_filename <- "mdr_example_data.csv"
#' rv <- list()
#' rv$mdr <- read_mdr(
#' utils_path = utils_path,
#' mdr_filename <- mdr_filename
#' )
#'
#' source_system_name <- "exampleCSV_source"
#' target_system_name <- "exampleCSV_target"
#'
#' rv <- c(rv, create_helper_vars(
#' mdr = rv$mdr,
#' source_db = source_system_name,
#' target_db = target_system_name
#' ))
#' # save source/target vars
#' rv$source$system_name <- source_system_name
#' rv$target$system_name <- target_system_name
#' rv$source$system_type <- "csv"
#' rv$target$system_type <- "csv"
#'
#' rv$log$logfile_dir <- tempdir()
#'
#' # set headless (without GUI, progressbars, etc.)
#' rv$headless <- TRUE
#'
#' # set configs
#' demo_files <- system.file("demo_data", package = "DQAstats")
#' Sys.setenv("EXAMPLECSV_SOURCE_PATH" = demo_files)
#' Sys.setenv("EXAMPLECSV_TARGET_PATH" = demo_files)
#'
#' # get configs
#' rv$source$settings <- DIZutils::get_config_env(
#' system_name = rv$source$system_name,
#' logfile_dir = rv$log$logfile_dir,
#' headless = rv$headless
#' )
#' rv$target$settings <- DIZutils::get_config_env(
#' system_name = tolower(rv$target$system_name),
#' logfile_dir = rv$log$logfile_dir,
#' headless = rv$headless
#' )
#'
#' # set start_time (e.g. when clicking the 'Load Data'-button in shiny
#' rv$start_time <- format(Sys.time(), usetz = TRUE, tz = "CET")
#'
#' # define restricting date
#' rv$restricting_date$use_it <- FALSE
#'
#' # load source data
#' tempdat <- data_loading(
#' rv = rv,
#' system = rv$source,
#' keys_to_test = rv$keys_source
#' )
#' rv$data_source <- tempdat$outdata
#'
#' # load target data
#' tempdat <- data_loading(
#' rv = rv,
#' system = rv$target,
#' keys_to_test = rv$keys_target
#' )
#' rv$data_target <- tempdat$outdata
#'
#' rv$data_plausibility$atemporal <- get_atemp_plausis(
#' rv = rv,
#' atemp_vars = rv$pl$atemp_vars,
#' mdr = rv$mdr,
#' headless = rv$headless
#' )
#'
#' # add the plausibility raw data to data_target and data_source
#' for (i in names(rv$data_plausibility$atemporal)) {
#' for (k in c("source_data", "target_data")) {
#' w <- gsub("_data", "", k)
#' raw_data <- paste0("data_", w)
#' rv[[raw_data]][[i]] <-
#' rv$data_plausibility$atemporal[[i]][[k]][[raw_data]]
#' rv$data_plausibility$atemporal[[i]][[k]][[raw_data]] <- NULL
#' }
#' gc()
#' }
#'
#' # calculate descriptive results
#' rv$results_descriptive <- descriptive_results(
#' rv = rv,
#' headless = rv$headless
#' )
#'
#' # calculate unique plausibilites
#' rv$results_plausibility_unique <- uniq_plausi_results(
#' rv = rv,
#' uniq_vars = rv$pl$uniq_vars,
#' mdr = rv$mdr,
#' headless = rv$headless
#' )
#'
#' create_markdown(
#' rv = rv,
#' utils_path = rv$utilspath,
#' outdir = output_dir,
#' headless = rv$headless
#' )
#' }
#' @export
#'
create_markdown <- function(rv = rv,
utils_path,
outdir = tempdir(),
headless = FALSE) {
warning(paste0(
"'create_markdown()' is deprecated ",
"and will be removed in a future version. ",
"Use 'create_pdf_report' instead."))
create_pdf_report(
rv = rv,
utils_path,
outdir = tempdir(),
headless = FALSE
)
}
Loading

0 comments on commit 9ee9e59

Please sign in to comment.