Package 'hintr'

Title: R API for calling naomi district level HIV model
Description: R API for calling naomi district level HIV model.
Authors: Robert Ashton [aut, cre]
Maintainer: Robert Ashton <[email protected]>
License: MIT + file LICENSE
Version: 1.2.12
Built: 2024-12-20 10:26:32 UTC
Source: https://github.com/mrc-ide/hintr

Help Index


Build and start the API

Description

Build and start the API

Usage

api(
  queue_id = NULL,
  workers = 2,
  results_dir = tempdir(),
  inputs_dir = NULL,
  log_level = "info",
  health_check_interval = 0
)

Arguments

queue_id

ID of an existing queue to connect to, creates a new one if NULL

workers

Number of workers to spawn

results_dir

The dir for results to be saved to

inputs_dir

THe directory where input files are stored

log_level

The "lgr" log level to use

health_check_interval

Interval in seconds, after which the next time the redis connection is used the connection will be reset. 0 for no reconnection. This is used on cloud services where the TCP connections have an idle timeout and must be manually kept alive or restarted by the client.

Value

Running API


Get debug output from naomi

Description

Get debug output from naomi

Usage

download_debug(id, server = NULL, dest = tempfile(), verbose = TRUE)

Arguments

id

The model run id to download. This will be printed below the error message.

server

The url of the server. The default is to use the production naomi/hint/hintr instance. It is not possible to use the staging instance. You can change this if running locally.

dest

The destination for the downloaded data. The actual data will be unpacked into a directory corresponding to the run id within this, so it is safe to use a common directory.

verbose

Add a progress bar


Submit a prerun to the web app

Description

This requires VPN or RDP access to work.

Usage

hintr_submit_prerun(
  inputs,
  model_output,
  calibrate_output,
  server = "http://naomi.unaids.org",
  port = "8888",
  output_zip_path = tempfile(fileext = ".zip")
)

Arguments

inputs

The model inputs, a named list of file paths including pjnz, shape, population, survey and optionally programme and anc.

model_output

The hintr_output object from model fit

calibrate_output

The hintr_output object from calibration

server

The server URL to upload files to

port

The port the API is running on

output_zip_path

The path to save the output zip at, will use a tempfile by default

Details

This will take all model files and upload to a specified server and output the model output zip which can be saved into the ADR or uploaded into the Naomi app to view plots of model outputs.

Can use this for countries which cannot get a fit to work via the app you can prepare a model fit locally and then upload those outputs into the app.

Value

Path to the generated output zip