| 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.21 |
| Built: | 2026-06-05 10:48:20 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, dest = tempfile(), server = NULL, github_token = Sys.getenv("NAOMI_DOWNLOAD_DEBUG_TOKEN"), verbose = TRUE )download_debug( id, dest = tempfile(), server = NULL, github_token = Sys.getenv("NAOMI_DOWNLOAD_DEBUG_TOKEN"), verbose = TRUE )
id |
The model run id to download. This will be printed below the error message. |
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. |
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. |
github_token |
Token with access to read hivtools org team members. Used to check you are a person with access to download debugs. Ideally don't pass this and use env var or interactive prompt instead. |
verbose |
Add a progress bar |
This uses GitHub authentication to pull the debug file. You need to
Make sure you are a member of the naomi-debug GitHub team
Generate a GitHub personal access token. Create a new fine-grained token. Set the resource owner to "hivtools" organisation. Under "Permissions" add "Members" read-only permission. And generate the token.
Pass the token to this function, fill in the interactive prompt or set as an environment variable "NAOMI_DOWNLOAD_DEBUG_TOKEN".
This requires VPN or RDP access to work.
hintr_submit_prerun( inputs, model_output, calibrate_output, server = "https://naomi.unaids.org", port = "8888", output_zip_path = tempfile(fileext = ".zip") )hintr_submit_prerun( inputs, model_output, calibrate_output, server = "https://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