Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 3.05 KB

README.md

File metadata and controls

57 lines (37 loc) · 3.05 KB

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

# run the api container with queue worker
# This pulls and runs image for current SHA. If none is pushed to registry you can build and push
# locally using ./docker/build
./docker/run_containers

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

# stop the containers
./docker/clear_containers

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.