Skip to content

Commit

Permalink
Merge pull request #57 from NOAA-EDAB/fix_herring_source
Browse files Browse the repository at this point in the history
Fix herring database source
  • Loading branch information
andybeet authored Apr 8, 2024
2 parents 7d8ea3e + 2044b2b commit 28b4c58
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 19 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Suggests:
ggforce,
NEFSCspatial
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Imports:
data.table,
sf,
Expand Down
2 changes: 1 addition & 1 deletion R/get_gears.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ get_gears <- function(channel,gears="all") {
query <- DBI::dbGetQuery(channel,sqlStatement)

# get column names
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'GEAR' and owner='CFDBS';"
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'GEAR' and owner='CFDBS'"
colNames <- DBI::dbGetQuery(channel,sqlcolName)

return (list(data=dplyr::as_tibble(query),sql=sqlStatement, colNames=colNames))
Expand Down
2 changes: 1 addition & 1 deletion R/get_herring_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ get_herring_data <- function(channel, comland, filterByYear, filterByArea,

herr.qry <- paste0("select year, month, category, stock_area, negear, gearname,
keptmt, discmt
from cfdbs.maine_herring_catch
from NEFSC_GARFO.maine_herring_catch
where year ", years)
if(!is.na(filterByArea[1])){
herr.qry <- paste0(herr.qry, " and stock_area in (", survdat:::sqltext(filterByArea), ")
Expand Down
4 changes: 2 additions & 2 deletions R/get_locations.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#' @export
#'
#
get_locations <- function(channel,sqlStatement="select * from cfdbs.loc;"){
get_locations <- function(channel,sqlStatement="select * from cfdbs.loc"){

query <- DBI::dbGetQuery(channel,sqlStatement)

Expand All @@ -56,7 +56,7 @@ get_locations <- function(channel,sqlStatement="select * from cfdbs.loc;"){
#save(species,file="data/speciesDefinitions.RData")

# get column names
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'LOC' and owner='CFDBS';"
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'LOC' and owner='CFDBS'"
colNames <- DBI::dbGetQuery(channel,sqlcolName)

return (list(data=dplyr::as_tibble(query),sql=sqlStatement, colNames=colNames))
Expand Down
8 changes: 4 additions & 4 deletions R/get_species_itis.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ get_species_itis <- function(channel,species="all",nameType="common_name"){
sqlStatement <- sub(";","",sqlStatement)
if (length(species) == 1) {
if (tolower(species) == "all") {
sqlStatement <- paste0(sqlStatement," where NESPP4_FLAG = 1;")
sqlStatement <- paste0(sqlStatement," where NESPP4_FLAG = 1")
} else {
sqlStatement <- paste0(sqlStatement," and NESPP4_FLAG = 1;")
sqlStatement <- paste0(sqlStatement," and NESPP4_FLAG = 1")
}
} else {
sqlStatement <- paste0(sqlStatement," and NESPP4_FLAG = 1;")
sqlStatement <- paste0(sqlStatement," and NESPP4_FLAG = 1")
}

query <- DBI::dbGetQuery(channel,sqlStatement)

# get column names
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'SPECIES_ITIS_NE' and owner='CFDBS';"
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'SPECIES_ITIS_NE' and owner='CFDBS'"
colNames <- t(DBI::dbGetQuery(channel,sqlcolName))

return (list(data=dplyr::as_tibble(query),sql=sqlStatement, colNames=colNames))
Expand Down
4 changes: 2 additions & 2 deletions R/get_vessels.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ get_vessels <- function(channel,sqlStatement="select * from cfdbs.mstrvess",wher

#appends where
if (!is.null(where)) {
sqlStatement <- paste(sqlStatement,"where",where,";")
sqlStatement <- paste(sqlStatement,"where",where)
}

query <- DBI::dbGetQuery(channel,sqlStatement)
Expand All @@ -59,7 +59,7 @@ get_vessels <- function(channel,sqlStatement="select * from cfdbs.mstrvess",wher
#save(species,file="data/speciesDefinitions.RData")

# get column names
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'MSTRVESS' and owner='CFDBS';"
sqlcolName <- "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = 'MSTRVESS' and owner='CFDBS'"
colNames <- DBI::dbGetQuery(channel,sqlcolName)

return (list(data=dplyr::as_tibble(query),sql=sqlStatement, colNames=colNames))
Expand Down
18 changes: 18 additions & 0 deletions man/comlandr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_areas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_gears.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/get_locations.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_ports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/get_vessels.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/process_foreign_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 28b4c58

Please sign in to comment.