diff --git a/.env b/.env index 7cd663c..880b4c4 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ # development settings CONFIGURATION_FILE=./app-configuration.json PRINT_CONFIGURATION=yes -SOURCE_FILE=./data/raw/yahatinda1.rds +SOURCE_FILE=./data/raw/input4_move2loc_LatLon.rds OUTPUT_FILE=./data/output/output.rds ERROR_FILE=./data/output/error.log APP_ARTIFACTS_DIR=./data/output/ diff --git a/.gitignore b/.gitignore index 1ebe4c1..1abc430 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ .Rhistory .RData .Ruserdata -data/output +.DS_Store +data/output/** +!data/output/.keep +tests/testthat/plot.png diff --git a/CHANGELOG_SDK.md b/CHANGELOG_SDK.md new file mode 100644 index 0000000..96ef5b7 --- /dev/null +++ b/CHANGELOG_SDK.md @@ -0,0 +1,55 @@ +# Changelog SDK +## XXX XXX +- update of `README.md` including new sections +- update of `developer_README.md` + +## 2024-03 `v3.2.0` + +- introduce app-setting-type `USER_FILE` +- deprecate app-setting-type `LOCAL_FILE` + +## 2024-02 `v3.1.0` + +- introduce `appspec.json` version `1.2` + - removed `createsArtifacts`. It is safe to remove it completely from your `appspec.json` - MoveApps tries now to fetch artifacts for every running App. + - verify to include the `null` option for setting types `DROPDOWN` and `RADIOBUTTONS` if `defaultValue` is set to `null`. +- drop `move1` dependency + +## 2023-12 `v3.0.5` + +- update of input files for testing apps. Files now include `move2_loc` and `telemetry.list` I/O types, and projected and not projected data. All details included in the README.txt in the data/raw folder. + +## 2023-11 `v3.0.4` + +- Upgrade `R` framework to `4.3.2` + +## 2023-09 `v3.0.3` + +- introduce `appspec.json` version `1.1` + - documentation link is not required any more + +## 2023-08 `v3.0.2` + +- removed MoveApps IO-Type dependency + +## 2023-07 `v3.0.1` + +- provide new `move2` input files +- minor fixes in src/io files + +## 2023-06 `v3.0.0` + +- introduces template versioning (starting w/ `v3.0.0` as this is the third major iteration) +- introduces `dotenv` to control/adjust local app-development +- updates developer readme +- introduces a _Template Synchronization_ GH action. Use it to synchronize your forked app with template updates. If you already forked from the template _before_ SDK `v3.0.0` you can (*only use this option if your app is written for input data of class `move2`*): + 1. manually add the files `.github/workflows/template-sync.yml` and `.github/.templatesyncignore` to your fork. + 1. with these files you can manually execute the GH action named _.github/workflows/template-sync.yml_. + 1. after merging the generated pull request add the file `app-configuration.json` manually to the root directory of your App. + +- fix app-configuration for execution on moveapps.org +- clear app output of previously app run at each start of the SDK + +- SDK supports [`move2`](https://gitlab.com/bartk/move2/), if input is of class [`move`](https://gitlab.com/bartk/move/) it will be converted into class `move2`. +- output is always move2 +- Upgrade `R` framework to `4.3.1` diff --git a/Dockerfile b/Dockerfile index d24871b..7e93807 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ ######################################################################################################################## -# MoveApps R SDK aka co-pilot-r +# MoveApps R SDK ######################################################################################################################## -FROM rocker/geospatial:4.2.1 +FROM rocker/geospatial:4.4.2 LABEL maintainer = "couchbits GmbH " @@ -16,19 +16,14 @@ USER moveapps:staff WORKDIR /home/moveapps/co-pilot-r -# renv -ENV RENV_VERSION 0.15.5 -RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))" -RUN R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')" -COPY --chown=moveapps:staff renv.lock .Rprofile ./ -COPY --chown=moveapps:staff renv/activate.R renv/settings.dcf ./renv/ - # copy the SDK COPY --chown=moveapps:staff src/ ./src/ COPY --chown=moveapps:staff data/ ./data/ -COPY --chown=moveapps:staff co-pilot-sdk.R RFunction.R start-process.sh ./ -RUN mkdir ./data/output -# and restore the R libraries +COPY --chown=moveapps:staff sdk.R RFunction.R .env app-configuration.json start-process.sh ./ + +# restore the current snapshot via renv +COPY --chown=moveapps:staff renv.lock .Rprofile ./ +COPY --chown=moveapps:staff renv/activate.R renv/settings.dcf ./renv/ RUN R -e 'renv::restore()' ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/data/output/.keep b/data/output/.keep new file mode 100644 index 0000000..e69de29 diff --git a/data/raw/README.txt b/data/raw/README.txt new file mode 100644 index 0000000..c41e351 --- /dev/null +++ b/data/raw/README.txt @@ -0,0 +1,37 @@ +Set of input data to test apps. + +*Content* +- input1: 1 goat, median fix rate = 30mins, tracking duration 7.5 month, gps, local movement +- input2: 3 storks, median fix rate = 1sec, tracking duration 2 weeks, gps, local movement +- input3: 1 stork, median fix rate = 1h | 1day | 1 week, tracking duration 11.5 years, argos, includes migration +- input4: 3 geese, median fix rate = 1h | 4h, tracking duration 1.5 years, gps, includes migration + +*I/O types* +- all data sets are provided as 'move2_loc' +- input1 & input2 are also provided as 'telemetry.list' + +*Projection* +- for 'move2_loc', data are provided in "lat/long" (EPSG:4326) and projected to "Mollweide" (ESRI:54009) in order to test your app accordingly for not projected and projected data. If your app does not allow projected data or only can deal with projected data, document and either build a automatic transformation in the app or make it fail with an informative error message. The app "Change projection" can be refered to for the user to change the projection of the data acordingly previous to your app. + +- the 'telemetry.list' examples are in a "aeqd" projection with 0,0 in the center of the track, as this is a common projection used within the ctmm library + + +*File names* +input1_move2loc_LatLon.rds +input1_move2loc_Mollweide.rds + +input2_move2loc_LatLon.rds +input2_move2loc_Mollweide.rds + +input3_move2loc_LatLon.rds +input3_move2loc_Mollweide.rds + +input4_move2loc_LatLon.rds +input4_move2loc_Mollweide.rds + + +input1_telemetrylist_aeqd.rds +input2_telemetrylist_aeqd.rds + + + diff --git a/data/raw/input1_move2loc_LatLon.rds b/data/raw/input1_move2loc_LatLon.rds new file mode 100644 index 0000000..8f52791 Binary files /dev/null and b/data/raw/input1_move2loc_LatLon.rds differ diff --git a/data/raw/input1_move2loc_Mollweide.rds b/data/raw/input1_move2loc_Mollweide.rds new file mode 100644 index 0000000..3312cea Binary files /dev/null and b/data/raw/input1_move2loc_Mollweide.rds differ diff --git a/data/raw/input1_telemetrylist_aeqd.rds b/data/raw/input1_telemetrylist_aeqd.rds new file mode 100644 index 0000000..ea3aaba Binary files /dev/null and b/data/raw/input1_telemetrylist_aeqd.rds differ diff --git a/data/raw/input2_move2loc_LatLon.rds b/data/raw/input2_move2loc_LatLon.rds new file mode 100644 index 0000000..428cec9 Binary files /dev/null and b/data/raw/input2_move2loc_LatLon.rds differ diff --git a/data/raw/input2_move2loc_Mollweide.rds b/data/raw/input2_move2loc_Mollweide.rds new file mode 100644 index 0000000..57398eb Binary files /dev/null and b/data/raw/input2_move2loc_Mollweide.rds differ diff --git a/data/raw/input2_telemetrylist_aeqd.rds b/data/raw/input2_telemetrylist_aeqd.rds new file mode 100644 index 0000000..443067d Binary files /dev/null and b/data/raw/input2_telemetrylist_aeqd.rds differ diff --git a/data/raw/input3_move2loc_LatLon.rds b/data/raw/input3_move2loc_LatLon.rds new file mode 100644 index 0000000..a77ceae Binary files /dev/null and b/data/raw/input3_move2loc_LatLon.rds differ diff --git a/data/raw/input3_move2loc_Mollweide.rds b/data/raw/input3_move2loc_Mollweide.rds new file mode 100644 index 0000000..8e0e52f Binary files /dev/null and b/data/raw/input3_move2loc_Mollweide.rds differ diff --git a/data/raw/input4_move2loc_LatLon.rds b/data/raw/input4_move2loc_LatLon.rds new file mode 100644 index 0000000..8d7825b Binary files /dev/null and b/data/raw/input4_move2loc_LatLon.rds differ diff --git a/data/raw/input4_move2loc_Mollweide.rds b/data/raw/input4_move2loc_Mollweide.rds new file mode 100644 index 0000000..0fc0fac Binary files /dev/null and b/data/raw/input4_move2loc_Mollweide.rds differ diff --git a/developer_README.md b/developer_README.md index 54a52c4..3fb12fc 100644 --- a/developer_README.md +++ b/developer_README.md @@ -1,29 +1,86 @@ -# Developing with the MoveApps SDK +# MoveApps R Software Development Kit (SDK) -### General notes +***NOTE*: this SDK supports code written for input data of class `move2` and not `moveStack`, as all input data of class `moveStack` will be converted to class `move2`. For all other input/output types, this SDK works as usual. Please contact us under support@moveapps.org if you have any questions.** -- get an overview with the help of the [user manual](https://docs.moveapps.org/#/create_app) -- files needed for your app: - - your app codes goes to `./RFunction.R` - - setup your app arguments and your environment by adjusting `./appspec.json` - - the documentation of your app goes to `./README.md` -- to run and test your app code locally in a simulated MoveApps environment adjust and execute the file `./co-pilot-sdk.R` - - adjust the `inputFileName` - - state the arguments of your function if present +This documentation provides a short introduction to the [MoveApps](https://www.moveapps.org) **R SDK**. -### R packages management (optional) +As a first step, and before your read this, you should have used this GitHub template to create a copy of it in your personal space and named the repository as your App will be named in MoveApps. -The template is prepared to use [`renv` as a dependency manager](https://rstudio.github.io/renv/articles/renv.html) - but is disabled ("opt-in") by default. +**The [MoveApps User Manual](https://docs.moveapps.org/#/create_app) provides a step-by-step explanation of how to create an App.** Please carefully follow these steps when creating a MoveApps App. + + +## Files in the SDK/template + +This template is designed according to a file structure that is necessary for your App to run in your local development environment similar to the way it will run in the MoveApps environment later. Please contain the structure and only change/add files as necessary for your App's functionality. Take a look at the [overview in the User Manual](https://docs.moveapps.org/#/create_app) to see which files can be changed and which should remain as is for simulation of the behaviour on MoveApps on your local system. + +Here you find an overview of the files and their function in the SDK: + +1. `./RFunction.R`: must be modified by the developer. This is the entrypoint for your App logic. MoveApps will call this function during a Workflow execution which includes your App. The file must be named `RFunction.R`, do not alter it. See [Step 3](https://docs.moveapps.org/#/create_app#step-3-develop-the-app-code-locally-within-the-template) in the User Manual. +1. `./appspec.json`: must be modified by the developer. This file defines the settings and metadata of your App. See [Step 5](https://docs.moveapps.org/#/create_app#step-5-write-app-specifications) in the User Manual. +1. `./README.md`: must be modified by the developer. Provided template for the documentation of the App (see [Step 6](https://docs.moveapps.org/#/create_app#step-6-write-a-documentation-file) in the User Manual). +1. `./tests/**`: must be modified by the developer. Location for *Unit Tests*. See [Step 4](https://docs.moveapps.org/#/create_app#=step-4-test-your-app-locally) of the User Manual. +1. `./renv.lock`: Definition of the dependencies of your App. We use `renv` as library manager. Optional, see below. +1. `./sdk.R`: use for App testing. The main entrypoint of the SDK. Use it to execute your App in your compiler (e.g. RStudio). +1. `./app-configuration.json`: adjust for App testing. The configuration/settings file of your App (in [JSON](https://www.w3schools.com/js/js_json_intro.asp) format - must correspondent with the `settings` of your `appspec.json`, see [MoveApps parameters](https://docs.moveapps.org/#/copilot-r-sdk.md#moveapps-parameters) for an example). +1. `/.env`: adjust for App testing. Defining the SDK Runtime environment, see below. Make sure to check _Show Hidden Files_ in the settings menu of the _Files_ tab in RStudio. +1. `./data/**`: use for App testing. Resources of the SDK + 1. `auxiliary/**`: Simulates the usage of [*auxiliary files*](https://docs.moveapps.org/#/auxiliary). You can put files into this folder to simulate an App run with provided/user-uploaded files. + 1. `output/**`: The output data (`output.rds`) that will be passed on to the next App in a Workflow and other output files (artifacts) that your App may produce will be stored here. See [*producing artifacts*](https://docs.moveapps.org/#/copilot-r-sdk?id=producing-artefacts) for more information. + 1. `raw/**`: Collection of sample App input data. You can use these data to test an App run with real input. +1. all remaining files are used to emulate MoveApps when testing the App locally, to setup the automatic sync of your repository with the template, or to provide information related to the template. **These files are not to be modified**. Modifying them will prevent you from testing your App appropriately. + +## SDK runtime environment + +Critical parts of the SDK can be adjusted by `environment variables`. Keep in mind that these variables are only changeable during App development and not during an App run on MoveApps. They are predefined with sensible defaults - they should work for you as they are. While testing your App you will want to modify the `SOURCE_FILE` variable to either call the different example data sets provided in the template or other data sets that you want to use to test your App. + +- `CONFIGURATION_FILE`: path to the configuration/settings file of your App (in [JSON](https://www.w3schools.com/js/js_json_intro.asp) format - must correspondent with the `settings` of your `appspec.json`, see [MoveApps parameters](https://docs.moveapps.org/#/copilot-r-sdk.md#moveapps-parameters) for an example of the `app-configuration.json` file). +- `PRINT_CONFIGURATION`: prints the configuration your App receives (`yes|no`) +- `SOURCE_FILE`: path to an input file for your App during development +- `OUTPUT_FILE`: path to the output file of your App +- `ERROR_FILE`: path to a file collecting error messages +- `APP_ARTIFACTS_DIR`: base directory for writing App artifacts +- `USER_APP_FILE_HOME_DIR`: home aka base directory of your local user/auxiliary App files +- `CLEAR_OUTPUT`: clears all output of the previously app run at each start of the SDK aka the next app start + +You can adjust these environment variables by adjusting the file `./.env`. + +The file `./.env` is **hidden** by default in `RStudio`! You can show it by + +1. Tab `Files` in `RStudio` +1. `More` Button in the Files-Toolbar +1. Activate _Show Hidden Files_ + +## MoveApps App Bundle + +Which files will be bundled into the final App running on MoveApps? + +- the file `./RFunction.R +- all directories defined in your `appspec.json` at `providedAppFiles` + +- the file `./appspec.json` will be used to build and create the metadata of your App +- the file `./README.md` will be reference to for the documentation of your App + +Nothing else. + + +## R packages management / renv (optional) + +The template is prepared to use [`renv` as a dependency manager](https://rstudio.github.io/renv/articles/renv.html) - but is disabled by default (_opt-in_). You can [activate `renv` with `renv::activate()`](https://rstudio.github.io/renv/articles/renv.html#uninstalling-renv) and then use it in the [usual `renv` workflow](https://rstudio.github.io/renv/articles/renv.html#workflow). ### Docker support (optional) -- at the end your app will be executed on MoveApps in a Docker container. -- if you like you can test your app in the almost final environment by running your app locally in a docker container: +Your app will be executed on MoveApps in a Docker container. Specially for debugging errors that are not straight forward, it can be very useful to execute your App in a docker container. These more complex errors are often due to system libraries that need to be installed in MoveApps to run the App. The easiest way to find out which ones they are is to run the App locally in a docker container: + + +1. enable `renv` (see above) +1. set a working title for your app by `export MY_MOVEAPPS_APP=hello-world` (in your terminal) +1. build the Docker image locally by `docker build --platform=linux/amd64 -t $MY_MOVEAPPS_APP .` (in your terminal) +1. execute the image with `docker run --platform=linux/amd64 --rm --name $MY_MOVEAPPS_APP -it $MY_MOVEAPPS_APP` (in your terminal) +1. you will get a `bash` terminal of the running container. There you can get a R console by `R` or simply start your app by invoking `/home/moveapps/co-pilot-r/start-process.sh` (in the `bash` of the running container) + + +## Synchronisation of your App repository with this template -1. add each R library you added to your app via `renv` to the docker image by adding eg. `RUN R -e 'remotes::install_version("foreach")'` to the `./Dockerfile` before `RUN R -e 'renv::restore()'` -1. set a working title for your app by `export MY_MOVEAPPS_APP=hello-world` -1. build the Docker image locally by `docker build -t $MY_MOVEAPPS_APP .` -1. execute the image with `docker run --rm --name $MY_MOVEAPPS_APP -it $MY_MOVEAPPS_APP` -1. you will get a `bash` terminal of the running container. There you can get a R console by `R` or simply start your app by invoking `/home/moveapps/co-pilot-r/start-process.sh` inside the running container. +This template includes a _GitHub action_ to keep your copy synchronized with the original template. Take a look at the [documentation](https://docs.moveapps.org/#/manage_Rapp_github?id=keep-your-repositories-up-to-date-sync-with-templates) and make sure to keep your repository up-to-date. diff --git a/renv.lock b/renv.lock index a940fff..cde5ede 100644 --- a/renv.lock +++ b/renv.lock @@ -1,253 +1,793 @@ { "R": { - "Version": "4.2.1", + "Version": "4.4.2", "Repositories": [ { "Name": "CRAN", - "URL": "https://packagemanager.rstudio.com/cran/2022-03-09" + "URL": "https://ftp.gwdg.de/pub/misc/cran" } ] }, "Packages": { + "DBI": { + "Package": "DBI", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "065ae649b05f1ff66bb0c793107508f5" + }, + "KernSmooth": { + "Package": "KernSmooth", + "Version": "2.23-24", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats" + ], + "Hash": "9f33a1ee37bbe8919eb2ec4b9f2473a5" + }, + "MASS": { + "Package": "MASS", + "Version": "7.3-61", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "methods", + "stats", + "utils" + ], + "Hash": "0cafd6f0500e5deba33be22c46bf6055" + }, "R6": { "Package": "R6", "Version": "2.5.1", "Source": "Repository", "Repository": "RSPM", - "Hash": "470851b6d5d0ac559e9d01bb352b4021", - "Requirements": [] + "Requirements": [ + "R" + ], + "Hash": "470851b6d5d0ac559e9d01bb352b4021" }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.8", + "Version": "1.0.13-1", "Source": "Repository", - "Repository": "RSPM", - "Hash": "22b546dd7e337f6c0c58a39983a496bc", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "methods", + "utils" + ], + "Hash": "6b868847b365672d6c1677b1608da9ed" }, - "askpass": { - "Package": "askpass", - "Version": "1.1", + "assertthat": { + "Package": "assertthat", + "Version": "0.2.1", "Source": "Repository", "Repository": "RSPM", - "Hash": "e8a22846fff485f0be3770c2da758713", "Requirements": [ - "sys" - ] + "tools" + ], + "Hash": "50c838a310445e954bc13f26f26a6ecf" }, - "cachem": { - "Package": "cachem", - "Version": "1.0.6", + "bit": { + "Package": "bit", + "Version": "4.5.0", "Source": "Repository", - "Repository": "RSPM", - "Hash": "648c5b3d71e6a37e3043617489a0a0e9", + "Repository": "CRAN", "Requirements": [ - "fastmap", - "rlang" - ] + "R" + ], + "Hash": "5dc7b2677d65d0e874fc4aaf0e879987" + }, + "bit64": { + "Package": "bit64", + "Version": "4.5.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit", + "methods", + "stats", + "utils" + ], + "Hash": "e84984bf5f12a18628d9a02322128dfd" + }, + "brio": { + "Package": "brio", + "Version": "1.1.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "c1ee497a6d999947c2c224ae46799b1a" + }, + "callr": { + "Package": "callr", + "Version": "3.7.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "processx", + "utils" + ], + "Hash": "d7e13f49c19103ece9e58ad2d83a7354" + }, + "class": { + "Package": "class", + "Version": "7.3-22", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "MASS", + "R", + "stats", + "utils" + ], + "Hash": "f91f6b29f38b8c280f2b9477787d4bb2" + }, + "classInt": { + "Package": "classInt", + "Version": "0.4-10", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "KernSmooth", + "R", + "class", + "e1071", + "grDevices", + "graphics", + "stats" + ], + "Hash": "f5a40793b1ae463a7ffb3902a95bf864" + }, + "cli": { + "Package": "cli", + "Version": "3.6.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "b21916dd77a27642b447374a5d30ecf3" }, "cpp11": { "Package": "cpp11", - "Version": "0.4.2", + "Version": "0.5.0", "Source": "Repository", - "Repository": "RSPM", - "Hash": "fa53ce256cd280f468c080a58ea5ba8c", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "91570bba75d0c9d3f1040c835cee8fba" + }, + "crayon": { + "Package": "crayon", + "Version": "1.5.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grDevices", + "methods", + "utils" + ], + "Hash": "859d96e65ef198fd43e82b9628d593ef" + }, + "desc": { + "Package": "desc", + "Version": "1.4.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "utils" + ], + "Hash": "99b79fcbd6c4d1ce087f5c5c758b384f" }, - "curl": { - "Package": "curl", - "Version": "4.3.2", + "diffobj": { + "Package": "diffobj", + "Version": "0.3.5", "Source": "Repository", "Repository": "RSPM", - "Hash": "022c42d49c28e95d69ca60446dbabf88", - "Requirements": [] + "Requirements": [ + "R", + "crayon", + "methods", + "stats", + "tools", + "utils" + ], + "Hash": "bcaa8b95f8d7d01a5dedfd959ce88ab8" + }, + "digest": { + "Package": "digest", + "Version": "0.6.37", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "33698c4b3127fc9f506654607fb73676" }, - "fastmap": { - "Package": "fastmap", - "Version": "1.1.0", + "dotenv": { + "Package": "dotenv", + "Version": "1.0.3", "Source": "Repository", "Repository": "RSPM", - "Hash": "77bd60a6157420d4ffa93b27cf6a58b8", - "Requirements": [] + "Hash": "7e1213a65b6190437c644a14ec814ef3" + }, + "dplyr": { + "Package": "dplyr", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "generics", + "glue", + "lifecycle", + "magrittr", + "methods", + "pillar", + "rlang", + "tibble", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "fedd9d00c2944ff00a0e2696ccf048ec" + }, + "e1071": { + "Package": "e1071", + "Version": "1.7-16", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "class", + "grDevices", + "graphics", + "methods", + "proxy", + "stats", + "utils" + ], + "Hash": "27a09ca40266a1066d62ef5402dd51d6" + }, + "evaluate": { + "Package": "evaluate", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "3fd29944b231036ad67c3edb32e02201" + }, + "fansi": { + "Package": "fansi", + "Version": "1.0.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "utils" + ], + "Hash": "962174cf2aeb5b9eea581522286a911f" + }, + "fs": { + "Package": "fs", + "Version": "1.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "7f48af39fa27711ea5fbd183b399920d" }, "generics": { "Package": "generics", - "Version": "0.1.2", + "Version": "0.1.3", "Source": "Repository", - "Repository": "RSPM", - "Hash": "177475892cf4a55865868527654a7741", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "15e9634c0fcd294799e9b2e929ed1b86" }, - "geosphere": { - "Package": "geosphere", - "Version": "1.5-14", + "glue": { + "Package": "glue", + "Version": "1.8.0", "Source": "Repository", - "Repository": "RSPM", - "Hash": "1ce6e028f3d056dad1ea9c3c0a5444bf", + "Repository": "CRAN", "Requirements": [ - "sp" - ] + "R", + "methods" + ], + "Hash": "5899f1eaa825580172bb56c08266f37c" }, - "httr": { - "Package": "httr", - "Version": "1.4.2", + "hms": { + "Package": "hms", + "Version": "1.1.3", "Source": "Repository", - "Repository": "RSPM", - "Hash": "a525aba14184fec243f9eaec62fbed43", + "Repository": "CRAN", "Requirements": [ - "R6", - "curl", - "jsonlite", - "mime", - "openssl" - ] + "lifecycle", + "methods", + "pkgconfig", + "rlang", + "vctrs" + ], + "Hash": "b59377caa7ed00fa41808342002138f9" }, "jsonlite": { "Package": "jsonlite", - "Version": "1.8.0", + "Version": "1.8.9", "Source": "Repository", - "Repository": "RSPM", - "Hash": "d07e729b27b372429d42d24d503613a0", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "methods" + ], + "Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b" }, - "lattice": { - "Package": "lattice", - "Version": "0.20-45", + "lifecycle": { + "Package": "lifecycle", + "Version": "1.0.4", "Source": "Repository", "Repository": "CRAN", - "Hash": "b64cdbb2b340437c4ee047a1f4c4377b", - "Requirements": [] + "Requirements": [ + "R", + "cli", + "glue", + "rlang" + ], + "Hash": "b8552d117e1b808b09a832f589b79035" }, "lubridate": { "Package": "lubridate", - "Version": "1.8.0", + "Version": "1.9.3", "Source": "Repository", - "Repository": "RSPM", - "Hash": "2ff5eedb6ee38fb1b81205c73be1be5a", + "Repository": "CRAN", "Requirements": [ - "cpp11", - "generics" - ] + "R", + "generics", + "methods", + "timechange" + ], + "Hash": "680ad542fbcf801442c83a6ac5a2126c" }, - "memoise": { - "Package": "memoise", - "Version": "2.0.1", + "magrittr": { + "Package": "magrittr", + "Version": "2.0.3", "Source": "Repository", "Repository": "RSPM", - "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c", "Requirements": [ - "cachem", - "rlang" - ] + "R" + ], + "Hash": "7ce2733a9826b3aeb1775d56fd305472" }, - "mime": { - "Package": "mime", - "Version": "0.12", + "move2": { + "Package": "move2", + "Version": "0.3.0", "Source": "Repository", - "Repository": "RSPM", - "Hash": "18e9c28c1d3ca1560ce30658b22ce104", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "R", + "assertthat", + "bit64", + "cli", + "dplyr", + "methods", + "rlang", + "sf", + "tibble", + "tidyselect", + "units", + "vctrs", + "vroom" + ], + "Hash": "3d30188ce75e46bd69cb764aa26b797e" }, - "move": { - "Package": "move", - "Version": "4.1.6", + "pillar": { + "Package": "pillar", + "Version": "1.9.0", "Source": "Repository", - "Repository": "RSPM", - "Hash": "720a75f315293345ec1ca7734f71f271", + "Repository": "CRAN", "Requirements": [ - "Rcpp", - "geosphere", - "httr", - "memoise", - "raster", - "rgdal", - "sp", - "xml2" - ] - }, - "openssl": { - "Package": "openssl", - "Version": "2.0.0", + "cli", + "fansi", + "glue", + "lifecycle", + "rlang", + "utf8", + "utils", + "vctrs" + ], + "Hash": "15da5a8412f317beeee6175fbc76f4bb" + }, + "pkgbuild": { + "Package": "pkgbuild", + "Version": "1.4.5", "Source": "Repository", - "Repository": "RSPM", - "Hash": "cf4329aac12c2c44089974559c18e446", + "Repository": "CRAN", "Requirements": [ - "askpass" - ] + "R", + "R6", + "callr", + "cli", + "desc", + "processx" + ], + "Hash": "30eaaab94db72652e72e3475c1b55278" }, - "raster": { - "Package": "raster", - "Version": "3.5-15", + "pkgconfig": { + "Package": "pkgconfig", + "Version": "2.0.3", "Source": "Repository", "Repository": "RSPM", - "Hash": "70cf51235e017702ed77427797572ef0", "Requirements": [ - "Rcpp", - "sp", - "terra" - ] + "utils" + ], + "Hash": "01f28d4278f15c76cddbea05899c5d6f" }, - "renv": { - "Package": "renv", - "Version": "0.15.4", + "pkgload": { + "Package": "pkgload", + "Version": "1.4.0", "Source": "Repository", - "Repository": "RSPM", - "Hash": "c1078316e1d4f70275fc1ea60c0bc431", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "desc", + "fs", + "glue", + "lifecycle", + "methods", + "pkgbuild", + "processx", + "rlang", + "rprojroot", + "utils", + "withr" + ], + "Hash": "2ec30ffbeec83da57655b850cf2d3e0e" }, - "rgdal": { - "Package": "rgdal", - "Version": "1.5-28", + "praise": { + "Package": "praise", + "Version": "1.0.0", "Source": "Repository", "Repository": "RSPM", - "Hash": "0f625c5c628af2955aef2c561413ee30", + "Hash": "a555924add98c99d2f411e37e7d25e9f" + }, + "prettyunits": { + "Package": "prettyunits", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", "Requirements": [ - "sp" - ] + "R" + ], + "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" + }, + "processx": { + "Package": "processx", + "Version": "3.8.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "ps", + "utils" + ], + "Hash": "0c90a7d71988856bad2a2a45dd871bb9" + }, + "progress": { + "Package": "progress", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "crayon", + "hms", + "prettyunits" + ], + "Hash": "f4625e061cb2865f111b47ff163a5ca6" + }, + "proxy": { + "Package": "proxy", + "Version": "0.4-27", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats", + "utils" + ], + "Hash": "e0ef355c12942cf7a6b91a6cfaea8b3e" + }, + "ps": { + "Package": "ps", + "Version": "1.8.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "b4404b1de13758dea1c0484ad0d48563" + }, + "renv": { + "Package": "renv", + "Version": "1.0.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "47623f66b4e80b3b0587bc5d7b309888" }, "rlang": { "Package": "rlang", - "Version": "1.0.2", + "Version": "1.1.4", "Source": "Repository", - "Repository": "RSPM", - "Hash": "04884d9a75d778aca22c7154b8333ec9", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" }, - "sp": { - "Package": "sp", - "Version": "1.4-6", + "rprojroot": { + "Package": "rprojroot", + "Version": "2.0.4", "Source": "Repository", - "Repository": "RSPM", - "Hash": "ce8613f4e8c84ef4da9eba65b874ebe9", + "Repository": "CRAN", "Requirements": [ - "lattice" - ] + "R" + ], + "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" }, - "sys": { - "Package": "sys", - "Version": "3.4", + "s2": { + "Package": "s2", + "Version": "1.1.7", "Source": "Repository", - "Repository": "RSPM", - "Hash": "b227d13e29222b4574486cfcbde077fa", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "wk" + ], + "Hash": "3c8013cdd7f1d20de5762e3f97e5e274" }, - "terra": { - "Package": "terra", - "Version": "1.5-21", + "sf": { + "Package": "sf", + "Version": "1.0-19", "Source": "Repository", - "Repository": "RSPM", - "Hash": "a713f0d9f9a2b68af112a991adbfe5d5", + "Repository": "CRAN", "Requirements": [ + "DBI", + "R", + "Rcpp", + "classInt", + "grDevices", + "graphics", + "grid", + "magrittr", + "methods", + "s2", + "stats", + "tools", + "units", + "utils" + ], + "Hash": "fe02eec2f6b3ba0e24afe83d5ccfb528" + }, + "testthat": { + "Package": "testthat", + "Version": "3.2.1.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "brio", + "callr", + "cli", + "desc", + "digest", + "evaluate", + "jsonlite", + "lifecycle", + "magrittr", + "methods", + "pkgload", + "praise", + "processx", + "ps", + "rlang", + "utils", + "waldo", + "withr" + ], + "Hash": "3f6e7e5e2220856ff865e4834766bf2b" + }, + "tibble": { + "Package": "tibble", + "Version": "3.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "fansi", + "lifecycle", + "magrittr", + "methods", + "pillar", + "pkgconfig", + "rlang", + "utils", + "vctrs" + ], + "Hash": "a84e2cc86d07289b3b6f5069df7a004c" + }, + "tidyselect": { + "Package": "tidyselect", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang", + "vctrs", + "withr" + ], + "Hash": "829f27b9c4919c16b593794a6344d6c0" + }, + "timechange": { + "Package": "timechange", + "Version": "0.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "c5f3c201b931cd6474d17d8700ccb1c8" + }, + "tzdb": { + "Package": "tzdb", + "Version": "0.4.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "f561504ec2897f4d46f0c7657e488ae1" + }, + "units": { + "Package": "units", + "Version": "0.8-5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", "Rcpp" - ] + ], + "Hash": "119d19da480e873f72241ff6962ffd83" }, - "xml2": { - "Package": "xml2", - "Version": "1.3.3", + "utf8": { + "Package": "utf8", + "Version": "1.2.4", "Source": "Repository", - "Repository": "RSPM", - "Hash": "40682ed6a969ea5abfd351eb67833adc", - "Requirements": [] + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "62b65c52671e6665f803ff02954446e9" + }, + "vctrs": { + "Package": "vctrs", + "Version": "0.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang" + ], + "Hash": "c03fa420630029418f7e6da3667aac4a" + }, + "vroom": { + "Package": "vroom", + "Version": "1.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit64", + "cli", + "cpp11", + "crayon", + "glue", + "hms", + "lifecycle", + "methods", + "progress", + "rlang", + "stats", + "tibble", + "tidyselect", + "tzdb", + "vctrs", + "withr" + ], + "Hash": "390f9315bc0025be03012054103d227c" + }, + "waldo": { + "Package": "waldo", + "Version": "0.6.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "diffobj", + "glue", + "methods", + "rlang" + ], + "Hash": "52f574062a7b66e56926988c3fbdb3b7" + }, + "withr": { + "Package": "withr", + "Version": "3.0.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics" + ], + "Hash": "cc2d62c76458d425210d1eb1478b30b4" + }, + "wk": { + "Package": "wk", + "Version": "0.9.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "37be35d733130f1de1ef51672cf7cdc0" } } } diff --git a/start-process.sh b/start-process.sh index 1eb2698..bc8a330 100755 --- a/start-process.sh +++ b/start-process.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash ######################################################################################################################## -# calls the co-pilot-r SDK entry point +# calls the SDK entry point ######################################################################################################################## set -o errexit set -o pipefail set -o nounset -Rscript co-pilot-sdk.R +Rscript sdk.R diff --git a/tests/testthat/.plot.png b/tests/testthat/.plot.png new file mode 100644 index 0000000..ad370b8 Binary files /dev/null and b/tests/testthat/.plot.png differ diff --git a/tests/testthat/data/input3_move2loc_LatLon.rds b/tests/testthat/data/input3_move2loc_LatLon.rds new file mode 100644 index 0000000..a77ceae Binary files /dev/null and b/tests/testthat/data/input3_move2loc_LatLon.rds differ diff --git a/tests/testthat/data/output/.keep b/tests/testthat/data/output/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R new file mode 100644 index 0000000..2c10dc3 --- /dev/null +++ b/tests/testthat/helper.R @@ -0,0 +1,4 @@ +test_data <- function(test_file) { + test_data_root_dir <- test_path("data") + readRDS(file = file.path(test_data_root_dir, test_file)) +} \ No newline at end of file diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R new file mode 100644 index 0000000..2cc2de8 --- /dev/null +++ b/tests/testthat/setup.R @@ -0,0 +1,9 @@ +source(file.path("..", "..", "src", "common", "logger.R")) +source(file.path("..", "..", "src", "common", "runtime_configuration.R")) +source(file.path("..", "..", "src", "io", "app_files.R")) +source(file.path("..", "..", "src", "io", "io_handler.R")) +Sys.setenv("USER_APP_FILE_HOME_DIR" = "../../data/auxiliary/user-files") + +clearRecentOutput() +# the system under test (sut) +source(file.path("..", "..", "./RFunction.R")) \ No newline at end of file diff --git a/tests/testthat/test_readRdsInput.R b/tests/testthat/test_readRdsInput.R new file mode 100644 index 0000000..8798519 --- /dev/null +++ b/tests/testthat/test_readRdsInput.R @@ -0,0 +1,8 @@ +library('move2') + +source("../../src/io/rds.R") + +test_that("read move2", { + actual <- readRdsInput(sourceFile = "data/input3_move2loc_LatLon.rds") + expect_true(mt_is_move2(actual)) +}) diff --git a/tests/testthat/testthat.R b/tests/testthat/testthat.R new file mode 100644 index 0000000..90fa8ed --- /dev/null +++ b/tests/testthat/testthat.R @@ -0,0 +1 @@ +library(testthat) \ No newline at end of file