Skip to content

Clinical-Pharmacy-Saarland-University/abdataapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABDATA Database API

Project Status Package version minimal R version

Description

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.

Requirements

  1. The application should run on Windows and Linux.

  2. To the start the application you need a runtime of at least R Version 4.1 and packages listed in src/helper/packages.R.

  3. Is is highly recommended to use the just command line tool to run the commands in the justfile. The just command line tool can be installed via the following command:

winget install just # windows
apt-get install just # linux

Quick Start

Thse steps will install or update the necessary packages, initialize the application settings file and start the application.

just rpkg
just init
just start

After configuration via secrets.json you can also start the application via the following command:

setwd("src")
source("start_api.R")

Settings File

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
  }
}

Management

TODO

Developement

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]

API Endpoint Tests

Test are implemented in the tests directory (file api_test.R).

  1. Install test related r packages via the following command:
just test-rpkg
  1. Initalize login credentatls and host information via:
just test-init

Edit the files dev_credentials.yaml and prod_credentials.yaml in the tests directory to provide the necessary information.

  1. Tests for development and production environment can be run via the following commands:
just test-dev
just test-prod

About

Plumber API for ABDATA DDI Checks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •