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.7 |
Built: | 2024-11-21 11:31:55 UTC |
Source: | https://github.com/mrc-ide/hintr |
Build and start the API
api( queue_id = NULL, workers = 2, results_dir = tempdir(), inputs_dir = NULL, log_level = "info", health_check_interval = 0 )
api( queue_id = NULL, workers = 2, results_dir = tempdir(), inputs_dir = NULL, log_level = "info", health_check_interval = 0 )
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. |
Running API
Get debug output from naomi
download_debug(id, server = NULL, dest = tempfile(), verbose = TRUE)
download_debug(id, server = NULL, dest = tempfile(), verbose = TRUE)
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 |
This requires VPN or RDP access to work.
hintr_submit_prerun( inputs, model_output, calibrate_output, server = "http://naomi.unaids.org", port = "8888", output_zip_path = tempfile(fileext = ".zip") )
hintr_submit_prerun( inputs, model_output, calibrate_output, server = "http://naomi.unaids.org", port = "8888", output_zip_path = tempfile(fileext = ".zip") )
inputs |
The model inputs, a named list of file paths including pjnz, shape, population, survey and optionally programme and anc. |
model_output |
The |
calibrate_output |
The |
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 |
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.
Path to the generated output zip