| Title: | Advice and Scenarios Database Web Services |
|---|---|
| Description: | R interface to access the web services of the ICES Advice and Scenarios database <https://asd.ices.dk/AdviceList>. |
| Authors: | Colin Millar [aut, cre], Luca Lamoni [aut], Carlos Pinto [aut], Laura Petre [aut], David Miller [ctb], Neil Maginis [ctb] |
| Maintainer: | Colin Millar <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.0.2 |
| Built: | 2026-06-02 08:42:39 UTC |
| Source: | https://github.com/ices-tools-prod/icesASD |
R interface to access the web services of the ICES Stock Advice and Scenarios database.
Get dataset:
getAdviceViewRecord |
Get Advice Record |
getCatchScenariosTable |
Get Advice Catch Scenario Table |
getCatchScenariosNotes |
Get Advice Catch Scenario Table Footnotes |
Colin Millar, Luca Lamoni, Carlos Pinto, Laura Petre, David Miller and Neil Maginis.
ICES Advice and Scenarios database: http://sg.ices.dk.
ICES Advice and Scenarios database web services: http://sg.ices.dk/webservices.aspx.
Download a zip file of a set of advice scenarios
adviceDownload(adviceKeys, dir = ".")adviceDownload(adviceKeys, dir = ".")
adviceKeys |
a vector of advice view ids. |
dir |
directory to download to. |
## Not run: adviceDownload(c(1009, 1011, 1022)) ## End(Not run)## Not run: adviceDownload(c(1009, 1011, 1022)) ## End(Not run)
utility to build a url with optional query arguments
asd_api(service, ...)asd_api(service, ...)
service |
the name of the service |
... |
named arguments will be added as queries |
a complete url as a character string
asd_api("hi", bye = 21) asd_api("csquares", argument1 = 2021, argument2 = NULL)asd_api("hi", bye = 21) asd_api("csquares", argument1 = 2021, argument2 = NULL)
Check catch scenario notes in a browser
checkNotes(notes)checkNotes(notes)
notes |
df of culumns element of catch scenario table |
## Not run: data(scenarioNotes) checkNotes(scenarioNotes) ## End(Not run)## Not run: data(scenarioNotes) checkNotes(scenarioNotes) ## End(Not run)
Check catch scenario table in a browser
checkTable(columns, rows, values)checkTable(columns, rows, values)
columns |
df of culumns element of catch scenario table |
rows |
df of rows element of catch scenario table |
values |
df of values element of catch scenario table |
data(scenarioColumns) data(scenarioRows) data(scenarioValues) checkTable(scenarioColumns, scenarioRows, scenarioValues)data(scenarioColumns) data(scenarioRows) data(scenarioValues) checkTable(scenarioColumns, scenarioRows, scenarioValues)
Create the XML format for catch scenario data
createASDxml( info, scenarioColumns, scenarioRows, scenarioValues, scenarioNotes )createASDxml( info, scenarioColumns, scenarioRows, scenarioValues, scenarioNotes )
info |
details |
scenarioColumns |
details |
scenarioRows |
details |
scenarioValues |
details |
scenarioNotes |
details |
## Not run: checkTable(col, rows, vals) ## End(Not run)## Not run: checkTable(col, rows, vals) ## End(Not run)
Returns the catch scenario table for the selected stock and year using the advice view web service.
get_catch_scenario_table(adviceKey, assessmentYear)get_catch_scenario_table(adviceKey, assessmentYear)
adviceKey |
integer value of stock adviceKey |
assessmentYear |
integer value of assessment year |
data.frame containing the catch scenarios table for the advice view record
https://sg.ices.dk/adviceview/AdviceList
get_catch_scenario_table(3056,2022)get_catch_scenario_table(3056,2022)
Get Advice View Record
getAdviceViewRecord(stockcode = NULL, year = NULL, assessmentKey = NULL)getAdviceViewRecord(stockcode = NULL, year = NULL, assessmentKey = NULL)
stockcode |
string value of the stock code you wish to look |
year |
integer value of assessment year |
assessmentKey |
integer value of SAG assessmentKey |
catch_scenario_list <- getAdviceViewRecord() head(catch_scenario_list, 3) getAdviceViewRecord("bll.27.3a47de", 2021, 15609)catch_scenario_list <- getAdviceViewRecord() head(catch_scenario_list, 3) getAdviceViewRecord("bll.27.3a47de", 2021, 15609)
This function combines the functionality of getListStocks,
getFishStockReferencePoints, getSummaryTable
and getStockDownloadData.
It supports querying many stocks and years in one function call.
getASD( stock = NULL, year = NULL, assessmentKey = NULL, outputData = "table", purpose = "Advice" )getASD( stock = NULL, year = NULL, assessmentKey = NULL, outputData = "table", purpose = "Advice" )
stock |
a stock name, e.g. cod-347d, or cod to find all cod stocks, or NULL to process all stocks. |
year |
the assessment year, e.g. 2015, or 0 to process all years. |
assessmentKey |
the assessmentKey of the stock of interest. |
outputData |
the data you want to retrieve, either "table", "record", or "notes". |
purpose |
the purpose of the entry, options are "Advice", "Bench", "InitAdvice", default is "Advice". |
A data frame (default) or a list if combine is TRUE.
Only years with "Published" status are returned.
Luca Lamoni.
findAssessmentKey finds lookup keys.
icesSAG-package gives an overview of the package.
## Not run: # Example usage getASD(stock = "cod.27.7e-k", year = 2023, outputData = "record") # Example usage with assessmentKey getASD(assessmentKey = 18719, outputData = "table") ## End(Not run)## Not run: # Example usage getASD(stock = "cod.27.7e-k", year = 2023, outputData = "record") # Example usage with assessmentKey getASD(assessmentKey = 18719, outputData = "table") ## End(Not run)
Get Catch Scenarios Notes for a given record
getCatchScenariosNotes(adviceKey)getCatchScenariosNotes(adviceKey)
adviceKey |
advice view id(s) |
catch_scenario_note <- getCatchScenariosNotes(2814) catch_scenario_notes <- getCatchScenariosNotes(c(2814, 2815))catch_scenario_note <- getCatchScenariosNotes(2814) catch_scenario_notes <- getCatchScenariosNotes(c(2814, 2815))
Get Catch Scenarios Table for a given record
getCatchScenariosTable(adviceKey)getCatchScenariosTable(adviceKey)
adviceKey |
advice view id(s) |
catch_scenario_table <- getCatchScenariosTable(2814) catch_scenario_tables <- getCatchScenariosTable(c(2814, 2815))catch_scenario_table <- getCatchScenariosTable(2814) catch_scenario_tables <- getCatchScenariosTable(c(2814, 2815))
Predefined colors that can be useful in TAF plots.
infoinfo
List containing four entries:
stockCode |
ICES fish stock code |
AssessmentYear |
assessment year |
Purpose |
assessment purpose |
contact |
contact person |
The data are an excerpt from ...
ICES (2024).
Read a file in the ASD upload format, returning a list of metadata and data.frame
readAsdUpload(filename, format = FALSE)readAsdUpload(filename, format = FALSE)
filename |
the file path of the file to read |
format |
should the output be formatted into an easy to read table |
#filename <- system.file("CatchScenarios_AdviceKey_3207.xml", package = "icesASD") #asd <- readAsdUpload(filename)#filename <- system.file("CatchScenarios_AdviceKey_3207.xml", package = "icesASD") #asd <- readAsdUpload(filename)
Predefined colors that can be useful in TAF plots.
scenarioColumnsscenarioColumns
List containing four entries:
stockCode |
ICES fish stock code |
AssessmentYear |
assessment year |
Purpose |
assessment purpose |
contact |
contact person |
The data are an excerpt from ...
ICES (2024).
Predefined colors that can be useful in TAF plots.
scenarioNotesscenarioNotes
List containing four entries:
stockCode |
ICES fish stock code |
AssessmentYear |
assessment year |
Purpose |
assessment purpose |
contact |
contact person |
The data are an excerpt from ...
ICES (2024).
Predefined colors that can be useful in TAF plots.
scenarioRowsscenarioRows
List containing four entries:
stockCode |
ICES fish stock code |
AssessmentYear |
assessment year |
Purpose |
assessment purpose |
contact |
contact person |
The data are an excerpt from ...
ICES (2024).
Predefined colors that can be useful in TAF plots.
scenarioValuesscenarioValues
List containing four entries:
stockCode |
ICES fish stock code |
AssessmentYear |
assessment year |
Purpose |
assessment purpose |
contact |
contact person |
The data are an excerpt from ...
ICES (2024).
In this web service the user can upload a file to be screen and validated by the VMS database. The service can be called using post and the file will have to be part of the body of the call. The user needs to be authenticated in order to call this service. This file can be later pushed to the database by the same user.
screen_asd_file(file, verbose = FALSE)screen_asd_file(file, verbose = FALSE)
file |
file name of the file containing the data to screen |
verbose |
return verbose information about the POST request |
text message from the screening process