Skip to content

Commit

Permalink
Merge pull request #5 from MotusWTS/beta3
Browse files Browse the repository at this point in the history
Update master to motus v.3.1.0

# motus 3.1.0

### Small Changes
* Receiver downloads now have similar progress messages to Project downloads
* Move GPS fields from `alltags` to `alltagsGPS`
* New function `getGPS()` adds GPS fields to data
* Remove NOT NULL constraint on `motusTagID`s in ambiguous tag view

### Bug fixes
* Receivers updating to the new version errored on the download start
* Allow renaming (if possible) of large databases on data updates
* Continue checking for activity/nodeData even if first batch returns 0
* `nodeDataId` is corrected to `nodeDataID`
* Warn users with custom views if they need to be removed prior to updating
  • Loading branch information
steffilazerte authored Jul 16, 2020
2 parents 9a5a6d7 + 92c22af commit c7413a3
Show file tree
Hide file tree
Showing 143 changed files with 2,791 additions and 1,255 deletions.
9 changes: 8 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
^data-raw$
^.*\.Rproj$
^\.Rproj\.user$
RELEASE.R
^RELEASE\.R$
^appveyor.yml$
^.*\SG-.*$
^.*project-4.motus$
^\.travis\.yml$
^codecov\.yml$
^LICENSE\.md$
^appveyor\.yml$
^codecov\.R$
^CODE_DESIGN\.md$
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: R
cache: packages

script:
- |
R CMD build .
travis_wait 20 R CMD check motus*tar.gz
r_packages:
- covr

after_success:
- travis_wait 20 Rscript codecov.R

after_failure:
- ./travis-tool.sh dump_logs
81 changes: 81 additions & 0 deletions CODE_DESIGN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# motus design principles

This is a collection of developer notes and is by no means exhaustive or correct

- [Naming Conventions](#naming-conventions)
- [SQLite databases](#sqlite-databases)
- [Special data downloads](#special-data-downloads)
- [Special Files](#special-files)
- [Data Files](#data-files)
- [Testing](#testing)
- [Adding and Updating](#adding-and-updating)

## Naming Conventions
- Each function in a single file
- Exceptions
- `utils.R` contains internal utility functions
- `ensureDBTables.R` also contains `makeTable()` function to create tables
- `updateMotusDb.R` also contains `checkViews()` function to check for custom views

## SQLite databases
- Empty SQLite tables created
- `ensureDBTables()` checks for existing tables and creates empty tables if they
don't exist
- some tables are created with `makeTables()`
- When changing the data base, the `checkVersion()` function compares the date
in the `admInfo` table to the date in the internal data frame `sql_versions`
- `sql_versions` is created in `./data-raw/updatesql.R`
- If the database is out of date, `checkVersion()` applies the SQLite commands
in the `sql_version` data frame to update the data base
- Sometimes this involves making a temporary copy of a table, re-creating (with
changes) the original table and then copying the data back. In these cases the
table structure is created by the `makeTables()` function (so it can be used by
`updatesql.R` as well as by `ensureDBTables()` without duplicating the process.
- `checkDataVersion()` is used to update data versions (not database versions)

## Special data downloads
- Data that is downloaded by `batchID` after the main runs download
- `pageDataByBatch()` is a function that sets up the process
- `activity()` and `nodeData()` set the functions used to get going, but all is
passed to `pageDataByBatch()` as the workhorse function

## Special Files
- `z.onLoad.R`
- Set session variables (i.e., API links) and motus options
(i.e. max batches to get when testing)
- `Motus.R` - Define empty session variable (filled with `z.onLoad.R`)
- `motus-pkg.R` - Help file documentation for the motus package

## Data Files
- Sample data for examples and testing, created in `./data-raw/sample_data.R`
- INCOMPLETE
- `updatesql.R`

## Testing
- `sample_auth()` is used for automatic tests involving the motus.sample project
176
- `local_auth()` is used to load locally stored credentials for private projects
to test local functionality
- `skip_if_not_auth()` is used in tests to a) implement local authorizations if
present and b) skip the test if they are not present

`motusUpdateTagDB()` and `pageDataByBatch()` have checks in them that will halt
a download after `getOption("motus.test.max")` batches IF in a testing
environment. This way testing can be done much more quickly on a variety of
projects/receivers.

- `is_testing()` is an internal function that checks if a test is being run
- `set_testing()` is an internal function for declaring that testing is being performed (for interactive testing, use `set_testing()` to start and `set_testing(set = FALSE)` to stop)

## Adding and Updating

### Adding a new field/column
- Make change to `ensureDBTables()`
- Add update to `data-raw/updatesql.R` (run script)
- Add test to make sure new field is added
- Update internal data `source("data-raw/sample_data.R")`
- Push!




8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: motus
Type: Package
Version: 3.0.0
Version: 3.1.0
Title: Fetch and use data from the Motus Wildlife Tracking System
Description: Retrieve, filter, and visualize telemetry data from the Motus
Wildlife Tracking System http://motus.org.
Expand Down Expand Up @@ -29,13 +29,15 @@ Imports:
RSQLite (>= 2.1.1),
stringr (>= 1.4.0),
tidyr (>= 0.8.3),
tidyselect (>= 1.0.0)
Suggests:
ggmap (>= 3.0.0),
RCurl,
roxygen2,
spelling,
testthat
License: GPL-3 + file LICENSE
testthat,
covr
License: GPL-3
Date: 2019-03-28
RoxygenNote: 6.1.1
Roxygen: list(markdown = TRUE)
Expand Down
Loading

0 comments on commit c7413a3

Please sign in to comment.