Starts a Plumber API server for the ROMOPAPI package. If no database configuration is provided, it automatically uses the test FinnGen Eunomia database and creates necessary code counts tables.

runApiServer(
  cohortTableHandlerConfig = NULL,
  host = "127.0.0.1",
  port = 8564,
  buildCountsTable = FALSE,
  ...
)

Arguments

cohortTableHandlerConfig

Configuration for connecting to the OMOP CDM database. If NULL, uses test Eunomia database

host

Host address to run the API server on. Defaults to "127.0.0.1"

port

Port number to run the API server on. Defaults to 8564

buildCountsTable

Logical indicating whether to build code counts tables. Defaults to FALSE

...

Additional arguments passed to plumber::pr_run()

Note

The API server includes CORS support and automatic API documentation. When using the test database, code counts tables are automatically created.

Examples

if (FALSE) { # \dontrun{
# Run with default test database
runApiServer()

# Run with custom configuration
config <- list(...) # your database config
runApiServer(cohortTableHandlerConfig = config, port = 9000)
} # }