Skip to content

Commit

Permalink
first revision following BioConductor submission reviewing advice
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jan 13, 2024
1 parent 0894e09 commit 2c8957b
Show file tree
Hide file tree
Showing 20 changed files with 1,254 additions and 1,127 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
shell: Rscript {0}

- name: Style
run: styler::style_pkg()
run: styler::style_pkg(style = styler::tidyverse_style, indent_by = 4)
shell: Rscript {0}

- name: commit
Expand Down
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ Title: R interface for FDA Adverse Event Reporting System
Version: 0.99.3
Authors@R:
person("Yun", "Peng", , "yunyunp96@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2801-3332"))
Description: FAERS is a database for the spontaneous reporting of adverse events and medication errors involving human drugs and therapeutic biological products. faers is the bridge between FAERS and R.
BugReports: https://github.com/Yunuuuu/faers
Description: The FDA Adverse Event Reporting System (FAERS) is a database used for the spontaneous reporting of adverse events and medication errors related to human drugs and therapeutic biological products. faers pacakge serves as the interface between the FAERS database and R. Furthermore, faers pacakge offers a standardized approach for performing pharmacovigilance analysis.
License: MIT + file LICENSE
Depends:
R (>= 3.5.0)
R (>= 4.4.0)
Imports:
brio,
cli,
Expand All @@ -23,6 +24,7 @@ Imports:
vroom,
xml2
Suggests:
BiocStyle,
countrycode,
knitr,
rmarkdown,
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# faers 0.99.0

* Initial Bioconductor submission.
2 changes: 1 addition & 1 deletion R/athena.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ athena <- function(use = NULL, list = FALSE, force = FALSE, url = NULL) {
}

#' @inheritDotParams athena -use -list
#' @noRd
#' @noRd
athena_standardize_drug <- function(terms, ...) {
data <- athena(use = c("concept", "concept_synonym"), ..., list = FALSE)
data$concept <- data$concept[domain_id == "Drug"] # nolint
Expand Down
2 changes: 1 addition & 1 deletion R/available.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @return A logical indicates FAERS can have data for the `years` and
#' `quarters` required?
#' @examples
#' faers_available(c(2011, 2023), c("q1", "q2"))
#' faers_available(c(2011, 2023), c("q1", "q2"))
#' @export
faers_available <- function(years, quarters, force = FALSE, internal = FALSE) {
assert_inclusive(quarters, faers_file_quarters)
Expand Down
8 changes: 6 additions & 2 deletions R/counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#' data <- faers_dedup(data)
#' faers_counts(data)
#' }
#' std_data <- readRDS(system.file("extdata", "standardized_data.rds",
#' package = "faers"
#' ))
#' faers_counts(std_data)
#' @export
#' @name faers_counts
methods::setGeneric("faers_counts", function(.object, ...) {
Expand All @@ -31,8 +35,8 @@ methods::setGeneric("faers_counts", function(.object, ...) {
#' combination for all columns will define the interested events.
#' @param .fn A function or formula defined the preprocessing function before
#' creating contingency table, with the `.field` data as the input and return a
#' [data.table][data.table::data.table].
#'
#' [data.table][data.table::data.table].
#'
#' Note: When using the `set*` or `:=` function from `data.table` with the
#' "demo", "drug", "ther", "rpsr", and "outc" data, exercise caution as these
#' functions directly modify the internal data. In such cases, it is advisable
Expand Down
3 changes: 2 additions & 1 deletion R/dedup.R
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ dedup_faers_ascii <- function(data, deleted_cases = NULL) {

utils::globalVariables(c(
"drug_seq", "drugname", "indi_meddra_code", "start_dt",
"indi_drug_seq", "dsg_drug_seq", "primaryid", "caseversion", "fda_dt", "i_f_code", "event_dt", "year", "caseid", "age_in_years_round",
"indi_drug_seq", "dsg_drug_seq", "primaryid", "caseversion", "fda_dt",
"i_f_code", "event_dt", "year", "caseid", "age_in_years_round",
"meddra_code",
paste0(c("", "i."), rep(
c(
Expand Down
2 changes: 1 addition & 1 deletion R/import-standalone-cli.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ is_installed <- local({
out <- requireNamespace(pkg, quietly = TRUE) &&
utils::packageVersion(pkg) >= version
}
cache[[id]] <<- out
cache[[id]] <- out
}
out
}
Expand Down
1 change: 0 additions & 1 deletion R/period.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ is_before_period <- function(years, quarters, y, q, inclusive = TRUE) {
is_from_laers <- function(years, quarters) {
is_before_period(years, quarters, 2012L, "q3")
}

5 changes: 3 additions & 2 deletions R/rxnorm.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ rxnorm_getApproximateMatch <- function(terms, max_entries = NULL, option = NULL,
# rxnorm_findRxcuiByString(I("Lipitor+10+mg+Tab"), search = 1L)
rxnorm_findRxcuiByString <- function(names, allsrc = NULL, srclist = NULL, search = NULL, pool_size = 5L, retry = 0L) {
reqs <- lapply(names, function(term) {
rxnorm_api(.path = "rxcui",
rxnorm_api(
.path = "rxcui",
name = term,
allsrc = allsrc,
srclist = srclist, search = search
Expand Down Expand Up @@ -194,7 +195,7 @@ rxnorm_perform <- function(req) {
###########################################################
#' All values in dots should be named. If rxnorm_api_name is `NULL`, `path` must
#' contain format strings used by sprintf.
#' @noRd
#' @noRd
rxnorm_api <- function(.path, ..., .format = "xml") {
req <- httr2::req_url_path_append(
req = httr2::req_url_path(req = httr2::request(rxnorm_host), "REST"),
Expand Down
6 changes: 3 additions & 3 deletions R/unify.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#' @section Unification:
#' For all fields data:
#' For all fields data:
#' - All names have been converted to lowercase.
#' - Rename "isr" into "primaryid" for periods before 2012q3.
#'
#'
#' Field specific operations:
#' - `demo`:
#' - Rename "gndr_cod" into "sex" for periods before 2014q2.
#' - Rename "case" and "i_f_cod" into "caseid" and "i_f_code" for legacy aers,
#' before 2012q3.
#' before 2012q3.
#' - "age_in_years" was added, measured in years.
#' - "country_code" was added (encoded according to the `iso2c` standards), it
#' will be convenient to translate it into other code with
Expand Down
Loading

0 comments on commit 2c8957b

Please sign in to comment.