Commit 64af3f11 authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Force the service if dataProfile is specified

parent d865d626
......@@ -155,23 +155,19 @@
#'
#' # Data profiles: "Sample Results (physical/chemical metadata)":
#' samp_data <- readWQPdata(siteid = "USGS-04024315",
#' dataProfile = "resultPhysChem",
#' service = "Result")
#' dataProfile = "resultPhysChem")
#'
#' # Data profiles: "Sample Results (biological metadata)"
#' samp_bio <- readWQPdata(siteid="USGS-04024315",
#' dataProfile = "biological",
#' service = "Result")
#' dataProfile = "biological")
#'
#' # Data profiles: "Sample Results (narrow)"
#' samp_narrow <- readWQPdata(siteid="USGS-04024315",
#' dataProfile = "narrowResult",
#' service = "Result")
#' dataProfile = "narrowResult")
#'
#' # Data profiles: "Sampling Activity"
#' samp_activity <- readWQPdata(siteid="USGS-04024315",
#' dataProfile = "activityAll",
#' service = "Activity")
#' dataProfile = "activityAll")
#'
#' # Data profile: "Sampling Activity Metrics"
#' act_metrics <- readWQPdata(statecode = "WI",
......
......@@ -23,6 +23,19 @@ readWQPdots <- function(...){
service <- "Result"
}
if("dataProfile" %in% names(matchReturn)){
profile <- matchReturn$dataProfile
if(profile == "activityAll"){
service <- "Activity"
matchReturn$service <- NULL
} else if(profile %in% c("resultPhysChem",
"biological",
"narrowResult")){
service <- "Result"
matchReturn$service <- NULL
}
}
match.arg(service, c("Result", "Station", "Activity", "Organization",
"ActivityMetric", "SiteSummary",
"Project", "ProjectMonitoringLocationWeighting",
......
......@@ -168,23 +168,19 @@ proj_mlwd <- readWQPdata(statecode = "WI",
# Data profiles: "Sample Results (physical/chemical metadata)":
samp_data <- readWQPdata(siteid = "USGS-04024315",
dataProfile = "resultPhysChem",
service = "Result")
dataProfile = "resultPhysChem")
# Data profiles: "Sample Results (biological metadata)"
samp_bio <- readWQPdata(siteid="USGS-04024315",
dataProfile = "biological",
service = "Result")
dataProfile = "biological")
# Data profiles: "Sample Results (narrow)"
samp_narrow <- readWQPdata(siteid="USGS-04024315",
dataProfile = "narrowResult",
service = "Result")
dataProfile = "narrowResult")
# Data profiles: "Sampling Activity"
samp_activity <- readWQPdata(siteid="USGS-04024315",
dataProfile = "activityAll",
service = "Activity")
dataProfile = "activityAll")
# Data profile: "Sampling Activity Metrics"
act_metrics <- readWQPdata(statecode = "WI",
......
......@@ -426,6 +426,7 @@ test_that("profiles", {
org_data <- readWQPdata(statecode = "WI",
countycode = "Dane",
service = "Organization")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(org_data)))
......@@ -433,12 +434,14 @@ test_that("profiles", {
site_data <- readWQPdata(statecode = "WI",
countycode = "Dane",
service = "Station")
expect_true(all(c("ProviderName", "MonitoringLocationIdentifier") %in% names(site_data)))
# Data profiles: "Project Data"
project_data <- readWQPdata(statecode = "WI",
countycode = "Dane",
service = "Project")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(project_data)))
......@@ -452,30 +455,29 @@ test_that("profiles", {
# Data profiles: "Sample Results (physical/chemical metadata)":
samp_data <- readWQPdata(siteid = "USGS-04024315",
dataProfile = "resultPhysChem",
service = "Result")
dataProfile = "resultPhysChem")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(samp_data)))
# Data profiles: "Sample Results (biological metadata)"
samp_bio <- readWQPdata(siteid="USGS-04024315",
dataProfile = "biological",
service = "Result")
dataProfile = "biological")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(samp_bio)))
# Data profiles: "Sample Results (narrow)"
samp_narrow <- readWQPdata(siteid="USGS-04024315",
dataProfile = "narrowResult",
service = "Result")
dataProfile = "narrowResult")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(samp_narrow)))
# Data profiles: "Sampling Activity"
samp_activity <- readWQPdata(siteid="USGS-04024315",
dataProfile = "activityAll",
service = "Activity")
dataProfile = "activityAll")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(samp_activity)))
......@@ -483,12 +485,14 @@ test_that("profiles", {
act_metrics <- readWQPdata(statecode = "WI",
countycode = "Dane",
service = "ActivityMetric")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(act_metrics)))
# Data profile: "Result Detection Quantitation Limit Data"
dl_data <- readWQPdata(siteid="USGS-04024315",
service = "ResultDetectionQuantitationLimit")
expect_true(all(c("OrganizationIdentifier",
"OrganizationFormalName") %in% names(dl_data)))
})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment