Skip to content

[UNDER DEVELOPMENT] API server for the DAEDALUS model via the R package {daedalus}

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

jameel-institute/daedalus.api

Repository files navigation

daedalus.api

Project Status: Concept -- Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept. CRAN status Codecov test coverage R-CMD-check Build status

daedalus.api is an API package for the daedalus package and is primarily intended for internal use.

Installation

You can install the development version of daedalus.api from GitHub with:

# install.packages("devtools")
devtools::install_github("jameel-institute/daedalus.api")

Quick start

# the image will be assigned the tag 'latest'
docker pull mrcide/daedalus.api:latest

# run the container
# see docker run --help for options
docker run -d --name daedalus-api --rm -p 8001:8001 mrcide/daedalus.api:latest

# check root endpoint `GET/`
curl -s http://localhost:8001 | jq

# stop the service
docker stop daedalus-api

Development

To add an endpoint, implement a method in api.R with @porcelain comment, then run roxygen2::roxygenize() to generate the porcelain code in porcelain.R. See the porcelain docs for more details.

Testing

Redis needs to be running for the e2e tests to pass. Use ./scripts/redis start, and tear down with ./scripts/redis kill.

Model versions

The API should be backwards compatible and support running older versions of the model. Some endpoints support providing modelVersion as part of the body, e.g. to run or get metadata for a particular version of the model.

Metadata is stored in the inst/json folder, in files named metadata_[VERSION].json where [VERSION] is the first model version where that metadata applied. Requesting metadata for a model version will return the metadata which applies to that version, (which may have been first introduced in an earlier version). The metadata response includes a modelVersion property - this value will be the modelVersion requested in the query string, if provided. If modelVersion was not provided in the query string, the returned model version will be the most recent metadata's [VERSION].

Related projects

See the daedalus package which implements the DAEDALUS integrated model of economic, social, and health costs of a pandemic.

About

[UNDER DEVELOPMENT] API server for the DAEDALUS model via the R package {daedalus}

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published