This repository provides a RESTful API for the ABDATA DDI Checks. The API is based on the plumber package and provides endpoints for the operations specified in the manual. This repository does not provide the ABDA data base.
- 
The application should run on Windows and Linux.
 - 
To the start the application you need a runtime of at least
R Version 4.1and packages listed insrc/helper/packages.R. - 
Is is highly recommended to use the
justcommand line tool to run the commands in thejustfile. Thejustcommand line tool can be installed via the following command: 
winget install just # windows
apt-get install just # linuxThse steps will install or update the necessary packages, initialize the application settings file and start the application.
just rpkg
just init
just startAfter configuration via secrets.json you can also start the application via the following command:
setwd("src")
source("start_api.R")Provide secrets.json file in the src directory. The file should provide credentials for your data base instances in the following format:
{
  "sql": {
    "host": "db_host",
    "user": "db_user",
    "pwd": "db_pwd",
    "port": 0000,
    "database": "db_name"
  },
  "userdb": {
    "collection": "user_collection",
    "db": "db_for_users",
    "url": "url_to_mongodb"
  },
  "log_db": {
    "collection": "logs_collection",
    "db": "db_for_logs",
    "url": "url_to_mongodb"
  },
  "token": {
    "token_salt": "token_salt"
  },
  "server": {
    "host": "host",
    "port": 0001
  }
}TODO
The following just commands are available for development:
just doc # render the index.html file from the manual.md in manual directory (needs `pandoc`)
just init-hooks # install git pre-commit hooks (needs python3 installed)
just watch # watch the src directory for changes and restart the api (needs `watchexec`)Install pandoc and watchexec via the following commands in windows:
winget install pandoc
scoop install [email protected]Test are implemented in the tests directory (file api_test.R).
- Install test related 
rpackages via the following command: 
just test-rpkg- Initalize login credentatls and host information via:
 
just test-initEdit the files dev_credentials.yaml and prod_credentials.yaml in the tests directory to provide the necessary information.
- Tests for development and production environment can be run via the following commands:
 
just test-dev
just test-prod