Package 'peermodels'

Title: Client-Side R API Wrapper for Peer Models Network Model Repository
Description: Enables direct cloud access to health care decision models hosted on the PRISM server of the Peer Models Network.
Authors: amin adibi [aut, cre], Mohsen Sadatsafavi [aut, cph]
Maintainer: amin adibi <[email protected]>
License: GPL-3
Version: 0.10.3
Built: 2025-03-11 02:59:36 UTC
Source: https://github.com/cran/peermodels

Help Index


Returns the default server path for PRISM server

Description

Returns the default server path for PRISM server

Usage

default_server()

Value

the default server path for PRISM server


draws plots generated by the model in R Session

Description

draws plots generated by the model in R Session

Usage

draw_plots(plot_number = NULL)

Arguments

plot_number

the number of the plot to be rendered

Value

graphical object in R


Retrieves async results

Description

Retrieves async results

Usage

get_async_results(
  model_name = NULL,
  token = NULL,
  api_key = NULL,
  server = NULL
)

Arguments

model_name

name of the model

token

async job token

api_key

API key

server

Server address. Defaults to PMN.

Value

processed (from JSON to R object result of the call)


Returns default PRISM model input

Description

Returns default PRISM model input

Usage

get_default_input(model_name = NULL, api_key = NULL, server = NULL)

Arguments

model_name

name of the model. If null, it will be set to the last call's value.

api_key

API key. If null, it will be set to the last call's value.

server

Server address. If null, it will be set to Peer Models Network PRISM server on the first run and to the last call's value on subsequent runs.

Value

default model inputs, which can be changed and submitted to the model for a different run.

Examples

## Not run: 
sample_input <- get_default_input(model_name = "accept", api_key = "YOUR_API_KEY")

## End(Not run)

Retrieves plots generated by the model in R Session

Description

Retrieves plots generated by the model in R Session

Usage

get_plots()

Value

URL of plots


returns session info

Description

returns session info

Usage

get_session()

Value

returns current session variables


checks to see if a model is available on the cloud server

Description

checks to see if a model is available on the cloud server

Usage

handshake(model_name, server = default_server())

Arguments

model_name

name of the model

server

base url of the server

Value

TRUE if model is available on the server, FALSE otherwise

Examples

handshake("accept")

Executes PRISM model

Description

Executes PRISM model

Usage

model_run(
  model_name = NULL,
  model_input = NULL,
  api_key = NULL,
  server = NULL,
  async = FALSE,
  email_address = NULL
)

Arguments

model_name

name of the model

model_input

required custom parameters for current model

api_key

API key

server

server address. Defaults to the Peer Models Network PRSIM repository.

async

should the model be called in async mode?

email_address

async results will be emailed to this address

Value

0 for success and 1 for error

Examples

## Not run: 
sample_input <- get_default_input(model_name = "epic", api_key = "YOUR_API_KEY")
sample_input$global_parameters.time_horizon <- 15
model_run ("epic", model_input = sample_input)

## End(Not run)

Generic call to PRISM server

Description

Generic call to PRISM server

Usage

prism_call(func, base_url, api_key = NULL, ...)

Arguments

func

function to call

base_url

the url to call

api_key

API key

...

other parameters

Value

processed (from JSON to R object result of the call)


resets session info and clears stored environmental variables such as API keys and server address.

Description

resets session info and clears stored environmental variables such as API keys and server address.

Usage

reset_session()