Skip to content

Commit

Permalink
Merge pull request #8 from ECCC-lavoie-ecotox/import_met-thg-23-19
Browse files Browse the repository at this point in the history
Import met thg 23 19
  • Loading branch information
SteveViss authored Oct 15, 2024
2 parents f25b4db + 3e77ecb commit 08c43df
Show file tree
Hide file tree
Showing 10 changed files with 572 additions and 56 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.quarto
/docs/*
/pkgdown/*
contaminants-rlavoie-eccc.sqlite
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ Imports:
RSQLite (>= 2.3.5),
reactable (>= 0.4.4),
shiny (>= 1.8.0),
shinyWidgets (>= 0.8.6),
stringr (>= 1.5.1),
tidyselect (>= 1.2.1)
Suggests:
knitr,
readxl (>= 1.4.3),
mockery (>= 0.4.4),
rmarkdown,
testthat (>= 3.0.0),
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export(check_fields_pkeys)
export(delete_entry)
export(detect_cens)
export(fct_start)
export(get_db)
export(get_db_cached)
export(get_tbl_info)
export(get_tbl_notnulls)
export(get_tbl_pkeys)
Expand Down
11 changes: 8 additions & 3 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' @noRd
app_ui <- function(request) {
# Leave this function for adding external resources
waiter::useWaiter()
waiter::waiterPreloader()
golem_add_external_resources()
bslib::page_navbar(
id = "page",
Expand Down Expand Up @@ -38,12 +40,15 @@ app_ui <- function(request) {
)
),
bslib::nav_panel("Import data", icon = shiny::icon("upload")),
bslib::nav_spacer(),
bslib::nav_menu(
"Documentation",
icon = shiny::icon("book"),
bslib::nav_item("R package"),
bslib::nav_item("How this database has been build?"),
bslib::nav_item(tags$a("R package")),
bslib::nav_item(tags$a("How this database has been build?")),
),
tags$head(
tags$style(".card{ overflow: visible !important; }"),
tags$style(".card-body{ overflow: visible !important; }")
)
)
}
Expand Down
20 changes: 20 additions & 0 deletions R/fct_search.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#' Get full database to cascade filter
#'
#' @export

get_db <- function(con = NULL) {
dplyr::tbl(
con, dplyr::sql("
SELECT * FROM lab_measurement
INNER JOIN analyte USING (id_analyte)
INNER JOIN lab_sample USING (id_lab_sample)
INNER JOIN lab_field_sample USING (id_lab_sample)
INNER JOIN field_sample USING (id_field_sample)
INNER JOIN sites USING (id_site)
INNER JOIN species USING (id_species)")
)
}

#' Get full database cacheds
#' @export
get_db_cached <- memoise::memoise(get_db)
Loading

0 comments on commit 08c43df

Please sign in to comment.