Download IMR Biotic database and to place it into a duckdb database
Source:R/compileDatabase.R
compileDatabase.RdDownloads, formulates and indexes IMR Biotic database into a format used by BioticExplorer
Arguments
- years
Vector of integers specifying the years to be downloaded. The database reaches 1914:year(Sys.Date())
- dbPath
Character string specifying the folder where the duckdb and dbIndex files should be saved.
- dbIndexFile
Character string specifying the file path where the index of the database should be saved. Must include
.rdaat the end. The index is used by BioticExplorer.- dbName
Character string or
NULL. IfNULLuses the default name ("bioticexplorer").- overwrite
Logical indicating whether requested years and reference tables already present in the duckdb database should be downloaded again and replaced. Existing annual rows are deleted transactionally before replacement, so they are not duplicated.
Value
Called for its side effects: creates and populates a DuckDB database and index file. Returns NULL invisibly.
Details
Runs the prepareCruiseSeriesList, prepareGearList, prepareTaxaList, prepareReferenceCodes, downloadDatabase and indexDatabase functions, and saves the results into a duckdb. The cruise-series, gear and taxa reference lists are written as the csindex, gearindex and taxaindex tables, respectively, and the coded KeyType fields (sex, maturationstage, missiontype, nation, …) are written as the long-format codeindex table so they can be decoded offline with a join. Completed databases are stamped with the package and database-schema versions used to build them; updateDatabase uses this information to decide whether an incremental update is safe. Be aware that running these functions requires access to the IMR intranet and reasonably stable internet. It is advisable to run the function in a separate R session or in a screen session in the terminal on Unix machines, as downloading the database takes several hours and requires a stable internet connection. If the connection is unstable, the function may return an error. In such cases, ensure that the connection is stable and rerun the function. The function should continue downloading from where it left off.