From b874a4bf4310be5501f996c5ba5c235f42eba205 Mon Sep 17 00:00:00 2001 From: aviezerl Date: Tue, 11 Nov 2025 19:04:39 +0200 Subject: [PATCH 1/2] Removed non-API calls to `Rf_GetOption` in the C++ code. --- DESCRIPTION | 2 +- NEWS.md | 4 +++- R/db.R | 2 +- cran-comments.md | 3 +-- man/emr_db.connect.Rd | 2 +- src/NRTest.cpp | 2 +- src/naryn.cpp | 18 +++++++++--------- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d75c8cff..391b18a1 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: naryn Title: Native Access Medical Record Retriever for High Yield Analytics -Version: 2.6.30.9000 +Version: 2.6.31 Authors@R: c( person("Misha", "Hoichman", , "misha@hoichman.com", role = "aut"), person("Aviezer", "Lifshitz", , "aviezer.lifshitz@weizmann.ac.il", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index 3f50f791..26d0dad5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,6 @@ -# naryn (development version) +# naryn 2.6.31 + +* Removed non-API calls to `Rf_GetOption` in the C++ code. # naryn 2.6.30 diff --git a/R/db.R b/R/db.R index 98616803..a0a78c2e 100644 --- a/R/db.R +++ b/R/db.R @@ -63,7 +63,7 @@ #' variables are added to the .naryn environment. These variables should not be #' modified by the user! #' -#' \tabular{lll}{ +#' \tabular{ll}{ #' .naryn$EMR_GROOT \tab First db dir of tracks in the order of connections \cr #' .naryn$EMR_UROOT \tab Last db dir of tracks in the order of connection (user dir) \cr #' .naryn$EMR_ROOTS \tab Vector of directories (db_dirs) \cr diff --git a/cran-comments.md b/cran-comments.md index 0804fc38..2db4f907 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,5 +2,4 @@ 0 errors | 0 warnings | 0 notes -* Fixed *noRemap* additional issue. -* Removed non-API calls to R: 'PRENV', 'PRVALUE', 'R_PromiseExpr'. +* Removed non-API calls to `Rf_GetOption`. diff --git a/man/emr_db.connect.Rd b/man/emr_db.connect.Rd index bc83e6d8..99298e4f 100644 --- a/man/emr_db.connect.Rd +++ b/man/emr_db.connect.Rd @@ -96,7 +96,7 @@ Upon completion the connection is established with the database and a few variables are added to the .naryn environment. These variables should not be modified by the user! -\tabular{lll}{ +\tabular{ll}{ .naryn$EMR_GROOT \tab First db dir of tracks in the order of connections \cr .naryn$EMR_UROOT \tab Last db dir of tracks in the order of connection (user dir) \cr .naryn$EMR_ROOTS \tab Vector of directories (db_dirs) \cr diff --git a/src/NRTest.cpp b/src/NRTest.cpp index 0c428ebe..fbe0e29f 100755 --- a/src/NRTest.cpp +++ b/src/NRTest.cpp @@ -790,7 +790,7 @@ SEXP logical_track_vtrack(SEXP _track, SEXP envir){ // for (int i = 0; i < num_processes; ++i) { // if (!g_naryn->launch_process()) { // kid process // if (g_naryn->debug()){ -// SEXP rvar = Rf_GetOption(Rf_install("emr_child_run_delay"), R_NilValue); +// SEXP rvar = Rf_GetOption1(Rf_install("emr_child_run_delay")); // if (Rf_isReal(rvar) || Rf_isInteger(rvar)) // sleep(Rf_asInteger(rvar)); // } diff --git a/src/naryn.cpp b/src/naryn.cpp index 0028a434..f8b98af3 100755 --- a/src/naryn.cpp +++ b/src/naryn.cpp @@ -302,7 +302,7 @@ pid_t Naryn::launch_process() sigaction(SIGALRM, &s_old_sigalrm_act, NULL); sigaction(SIGCHLD, &s_old_sigchld_act, NULL); - SEXP r_multitasking_stdout = Rf_GetOption(Rf_install("emr_multitasking_stdout"), R_NilValue); + SEXP r_multitasking_stdout = Rf_GetOption1(Rf_install("emr_multitasking_stdout")); int devnull; if ((devnull = open("/dev/null", O_RDWR)) == -1){ @@ -495,43 +495,43 @@ void Naryn::load_options() { SEXP rvar; - rvar = Rf_GetOption(Rf_install("emr_debug"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_debug")); if (Rf_isLogical(rvar)){ m_debug = Rf_asLogical(rvar); } - rvar = Rf_GetOption(Rf_install("emr_multitasking"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_multitasking")); if (Rf_isLogical(rvar)){ m_multitasking_avail = Rf_asLogical(rvar); } - rvar = Rf_GetOption(Rf_install("emr_min.processes"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_min.processes")); if ((Rf_isReal(rvar) || Rf_isInteger(rvar)) && Rf_asInteger(rvar) >= 1){ m_min_processes = Rf_asInteger(rvar); } - rvar = Rf_GetOption(Rf_install("emr_max.processes"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_max.processes")); if ((Rf_isReal(rvar) || Rf_isInteger(rvar)) && Rf_asInteger(rvar) >= 1){ m_max_processes = Rf_asInteger(rvar); } m_max_processes = max(m_min_processes, m_max_processes); - rvar = Rf_GetOption(Rf_install("emr_max.data.size"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_max.data.size")); if ((Rf_isReal(rvar) || Rf_isInteger(rvar)) && Rf_asReal(rvar) >= 1){ m_max_data_size = (uint64_t)Rf_asReal(rvar); } - rvar = Rf_GetOption(Rf_install("emr_eval.buf.size"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_eval.buf.size")); if ((Rf_isReal(rvar) || Rf_isInteger(rvar)) && Rf_asInteger(rvar) >= 1){ m_eval_buf_size = Rf_asInteger(rvar); } - rvar = Rf_GetOption(Rf_install("emr_quantile.edge.data.size"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_quantile.edge.data.size")); if ((Rf_isReal(rvar) || Rf_isInteger(rvar)) && Rf_asReal(rvar) >= 0){ m_quantile_edge_data_size = (uint64_t)Rf_asReal(rvar); } - rvar = Rf_GetOption(Rf_install("emr_warning.itr.no.filter.size"), R_NilValue); + rvar = Rf_GetOption1(Rf_install("emr_warning.itr.no.filter.size")); if ((Rf_isReal(rvar) || Rf_isInteger(rvar)) && Rf_asReal(rvar) >= 1){ m_beat_itr_warning_size = (uint64_t)Rf_asReal(rvar); } From dbd32ade3be971a54d2181e4fe56047d5938d5f2 Mon Sep 17 00:00:00 2001 From: aviezerl Date: Tue, 11 Nov 2025 17:10:13 +0000 Subject: [PATCH 2/2] Style code (GHA) --- R/db.R | 3 --- R/extract.R | 5 ----- R/filter.R | 4 ---- R/time.R | 4 ---- R/track-attributes.R | 2 -- R/track-vars.R | 3 --- R/track.R | 8 -------- R/vtrack.R | 5 ----- R/zzz.R | 3 +-- tests/testthat/test-logical_tracks.R | 1 - 10 files changed, 1 insertion(+), 37 deletions(-) diff --git a/R/db.R b/R/db.R index a0a78c2e..712e04c8 100644 --- a/R/db.R +++ b/R/db.R @@ -208,7 +208,6 @@ emr_db.init_examples <- function(n_dbs = 1) { } - #' Reloads database #' #' Reloads database @@ -292,7 +291,6 @@ emr_db.subset <- function(src = "", fraction = NULL, complementary = NULL) { } - #' Returns the ids that constitute the current ids subset #' #' Returns the ids that constitute the current ids subset. @@ -312,7 +310,6 @@ emr_db.subset.ids <- function() { } - #' Returns information about the current subset #' #' Returns information about the current subset. diff --git a/R/extract.R b/R/extract.R index 14d080a2..00d55e37 100644 --- a/R/extract.R +++ b/R/extract.R @@ -98,7 +98,6 @@ emr_cor <- function(..., cor.exprs = NULL, include.lowest = FALSE, right = TRUE, } - #' Calculates distribution of track expressions #' #' Calculates distribution of track expressions' values over the given set of @@ -300,7 +299,6 @@ emr_extract <- function(expr, tidy = FALSE, sort = FALSE, names = NULL, stime = } - #' Returns ids coverage per track #' #' Returns ids coverage per track. @@ -534,7 +532,6 @@ emr_ids_vals_coverage <- function(ids, tracks, stime = NULL, etime = NULL, filte } - #' Calculates quantiles of a track expression #' #' Calculates quantiles of a track expression for the given percentiles. @@ -576,7 +573,6 @@ emr_quantiles <- function(expr, percentiles = 0.5, stime = NULL, etime = NULL, i } - #' Finds Id-Time points that match track expression #' #' Finds all patient-time pairs where track expression is 'TRUE'. @@ -622,7 +618,6 @@ emr_screen <- function(expr, sort = FALSE, stime = NULL, etime = NULL, iterator } - #' Calculates summary statistics of track expression #' #' Calculates summary statistics of track expression. diff --git a/R/filter.R b/R/filter.R index 6f8ea67b..00ecee8a 100644 --- a/R/filter.R +++ b/R/filter.R @@ -226,7 +226,6 @@ } - #' Generate a default name for a naryn filter #' #' Generate a default name for a naryn filter @@ -747,7 +746,6 @@ emr_filter.attr.expiration <- function(filter, expiration) { } - #' Checks whether the named filter exists #' #' Checks whether the named filter exists. @@ -829,7 +827,6 @@ emr_filters.info <- function(filter) { } - #' Returns a list of named filters #' #' Returns a list of named filters. @@ -876,7 +873,6 @@ emr_filter.ls <- function(pattern = "", ignore.case = FALSE, perl = FALSE, fixed } - #' Deletes a named filter #' #' Deletes a named filter. diff --git a/R/time.R b/R/time.R index e9f46ffd..d462c042 100644 --- a/R/time.R +++ b/R/time.R @@ -30,7 +30,6 @@ emr_time2hour <- function(time) { } - #' Converts time from internal format to a day of month #' #' Converts time from internal format to a day of month. @@ -63,7 +62,6 @@ emr_time2dayofmonth <- function(time) { } - #' Converts time from internal format to a month #' #' Converts time from internal format to a month. @@ -96,7 +94,6 @@ emr_time2month <- function(time) { } - #' Converts time from internal format to a year #' #' Converts time from internal format to a year. @@ -128,7 +125,6 @@ emr_time2year <- function(time) { } - #' Converts date and hour to internal time format #' #' Converts date and hour to internal time format. diff --git a/R/track-attributes.R b/R/track-attributes.R index 91158df6..0e6509f4 100644 --- a/R/track-attributes.R +++ b/R/track-attributes.R @@ -121,7 +121,6 @@ emr_track.attr.get <- function(track = NULL, attr = NULL) { } - #' Deletes a track attribute #' #' Deletes a track attribute. @@ -169,7 +168,6 @@ emr_track.attr.rm <- function(track, attr) { } - #' Assigns a value to the track attribute #' #' Assigns a value to the track attribute. diff --git a/R/track-vars.R b/R/track-vars.R index 9317b344..965f4822 100644 --- a/R/track-vars.R +++ b/R/track-vars.R @@ -64,7 +64,6 @@ emr_track.var.get <- function(track, var) { } - #' Returns a list of track variables for a track #' #' Returns a list of track variables for a track. @@ -119,7 +118,6 @@ emr_track.var.ls <- function(track, pattern = "", ignore.case = FALSE, perl = FA } - #' Deletes a track variable #' #' Deletes a track variable. @@ -174,7 +172,6 @@ emr_track.var.rm <- function(track, var) { } - #' Assigns value to a track variable #' #' Assigns value to a track variable. diff --git a/R/track.R b/R/track.R index 45eb6af7..187489ef 100644 --- a/R/track.R +++ b/R/track.R @@ -77,7 +77,6 @@ } - #' Adds new records to a track #' #' Adds new records to a track from a TAB-delimited file or a data frame. @@ -239,7 +238,6 @@ emr_track.create <- function(track, space, categorical, expr, stime = NULL, etim } - #' Checks whether the track exists #' #' Checks whether the track exists. @@ -298,7 +296,6 @@ multiple_tracks_exist <- function(tracks, db_id = NULL) { } - #' Returns track ids #' #' Returns the ids contained by the track. @@ -327,7 +324,6 @@ emr_track.ids <- function(track) { } - #' Imports a track from a file or data-frame #' #' Imports a track from a file or data-frame. @@ -624,8 +620,6 @@ emr_track.logical.ls <- function(..., ignore.case = FALSE, perl = FALSE, fixed = } - - #' Moves (renames) a track #' #' Moves (renames) a track @@ -714,7 +708,6 @@ emr_track.mv <- function(src, tgt, space = NULL) { } - #' Returns track percentile of the values #' #' Returns track percentile of the values. @@ -770,7 +763,6 @@ emr_track.percentile <- function(track, val, lower = TRUE) { } - #' Gets or sets "read-only" property of a track #' #' Gets or sets "readonly" property of a track. diff --git a/R/vtrack.R b/R/vtrack.R index ac5717c4..8d72c994 100644 --- a/R/vtrack.R +++ b/R/vtrack.R @@ -422,7 +422,6 @@ emr_vtrack.create <- function(vtrack, src, func = NULL, params = NULL, keepref = } - #' Get or set attributes of a virtual track #' #' Get or set attributes of a virtual track. @@ -640,7 +639,6 @@ emr_vtrack.attr.filter <- function(vtrack, filter) { } - #' Checks whether the virtual track exists #' #' Checks whether the virtual track exists. @@ -671,7 +669,6 @@ emr_vtrack.exists <- function(vtrack) { } - #' Returns the definition of a virtual track #' #' Returns the definition of a virtual track. @@ -697,7 +694,6 @@ emr_vtrack.info <- function(vtrack) { } - #' Returns a list of virtual track names #' #' Returns a list of virtual track names. @@ -743,7 +739,6 @@ emr_vtrack.ls <- function(pattern = "", ignore.case = FALSE, perl = FALSE, fixed } - #' Deletes a virtual track #' #' Deletes a virtual track. diff --git a/R/zzz.R b/R/zzz.R index 766336df..ceeedf7f 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -6,8 +6,7 @@ .naryn$entries <- list() .naryn$entries_timestamp <- list() -.onLoad <- function(lib, pkg) { -} +.onLoad <- function(lib, pkg) {} .onAttach <- function(lib, pkg) { Sys.umask("007") diff --git a/tests/testthat/test-logical_tracks.R b/tests/testthat/test-logical_tracks.R index f6ab6dce..98688190 100644 --- a/tests/testthat/test-logical_tracks.R +++ b/tests/testthat/test-logical_tracks.R @@ -85,7 +85,6 @@ test_that("emr_track.logical.create tracks works in batch mode length of values }) - test_that("emr_track.logical.create fails when track length do not equal names length", { expect_error(emr_track.logical.create(c("a", "b"), c("ph1"))) })