BirdFlowAPI is an R package containing the API and backend code for the Avian Influenza Project. It provides tools for analyzing Avian Influenza data, including bird abundance, movement patterns, and outbreak information across North America.
You can build and install BirdFlowAPI locally or from GitHub.
Install from local cloned repository:
devtools::install()Install from GitHub:
devtools::install_github("UMassCDS/BirdFlowAPI")The load_models.R file defines a function load_models that loads the the models of all species. The load_models function must be explicitly called while configuring the API. This is done by running load_models().
Run the full test suite:
devtools::test()Run a specific test file:
testthat::test_file("tests/testthat/test-example.R")BirdFlowAPI supports saving output files to AWS S3 or locally, with flexible credential management:
Supported Modes:
- IAM Role (EC2/AWS):
- Attach an IAM role with S3 permissions to your EC2 instance.
- Set only the region and bucket name:
Sys.setenv(AWS_DEFAULT_REGION = "us-east-1", S3_BUCKET_NAME = "your-bucket-name") # Or in R: set_s3_config(region = "us-east-1", bucket = "your-bucket-name")
- Do NOT set access/secret keys; they are auto-detected.
- Environment Variables:
- Set
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_DEFAULT_REGION, andS3_BUCKET_NAMEin your environment or.Renviron.
- Set
- Explicit Setter Function:
- Call
set_s3_config(access_key, secret_key, region, bucket)in R.
- Call
- GitHub Secrets (CI/CD):
- Use GitHub Actions to set environment variables from secrets before running R code.
Default Behavior:
- If S3 is not configured, files are saved locally.
- To force local mode, use
flow(..., save_local = TRUE).
Example:
set_s3_config(region = "us-east-1", bucket = "my-bucket")
flow(...)See package documentation for more details.