Skip to content

Configuration Options

The recruIT modules are configured through environment variables. This page lists every setting of the screening list (list) and the query module (query-sql-on-fhir).

How you set them depends on how recruIT is deployed:

  • Docker Compose: compose.yaml passes the most important settings from variables in your .env file, see below. To set any other setting on this page, add it to the service's environment in a compose.override.yaml, see Mail server and port for an example.
  • Helm: the chart sets these from its values, which are documented in the chart's README. For a setting the chart doesn't expose, use list.extraEnv or querySqlOnFhir.extraEnv.

Docker Compose

These are the variables compose.yaml reads from your .env file, and the module settings they set:

.env variable Required Screening list setting Query module setting
FHIR_SERVER_BASE_URL yes FhirServer__BaseUrl FHIR_SERVER_BASE_URL
LIST_CONNECTIONSTRINGS_APPDB yes ConnectionStrings__AppDb
PGPASSWORD yes PGPASSWORD
AUTH_ENABLED no Auth__Enabled
AUTH_OIDC_AUTHORITY yes¹ Auth__Oidc__Authority
AUTH_OIDC_CLIENT_ID yes¹ Auth__Oidc__ClientId
AUTH_OIDC_CLIENT_SECRET yes¹ Auth__Oidc__ClientSecret
AUTH_OIDC_ROLE_CLAIM_TYPE no Auth__Oidc__RoleClaimType
TRINO_JDBC_URL yes SPRING_DATASOURCE_URL
TRINO_USERNAME yes SPRING_DATASOURCE_USERNAME
TRINO_PASSWORD yes² SPRING_DATASOURCE_PASSWORD
SQL_ON_FHIR_URL no SQL_ON_FHIR_URL
QUERY_SQL_ON_FHIR_SCHEDULE_CRON no QUERY_SQL_ON_FHIR_SCHEDULE_CRON

¹ Required when AUTH_ENABLED=true.

² May be empty: Trino only accepts passwords over TLS, so a Trino without authentication needs an empty password.

Two more variables select the images: RECRUIT_IMAGE_BASE_NAME (default ghcr.io/open-recruit/recruit) and RECRUIT_IMAGE_TAG (default: the release the Compose files belong to).

The create-search-parameters job only uses FHIR_SERVER_BASE_URL.

Screening list

The screening list is an ASP.NET Core app. Nested settings use __ as the separator in environment variable names, e.g. Auth__Oidc__Authority sets Oidc.Authority inside the Auth section.

FHIR server

  • FhirServer__BaseUrl (required): base URL of the FHIR server, e.g. https://fhir.example.com/fhir.

Database

The screening list stores user permissions, notification subscriptions and its job queue in PostgreSQL.

  • ConnectionStrings__AppDb (required): an Npgsql connection string, e.g. Host=postgres;Port=5432;Database=recruit;Username=recruit.
  • PGUSER, PGPASSWORD: database user and password, used if the connection string doesn't contain them.

Authentication

  • Auth__Enabled (default false): whether users sign in via OpenID Connect. When false, anyone who can reach the screening list is treated as a signed-in admin and can see every study and patient. Always set it to true in production.
  • Auth__AdminRoles (default admin): the roles that can see every study and manage eligibility criteria and access permissions. Holding any one of them is enough. Set one variable per role, numbered from 0, e.g. Auth__AdminRoles__0=admin and Auth__AdminRoles__1=recruit-admin. Setting roles replaces the admin default. Users with none of the roles only see the studies they've been given access to.
  • Auth__AdminRole (deprecated): the single-role predecessor of Auth__AdminRoles. It still works and is treated as the first admin role, but the screening list logs a warning at startup. Move it to Auth__AdminRoles__0 instead.
  • Auth__RequireVerifiedEmail (default true): study access that was given to an email address, before that person had ever signed in, only applies once the identity provider reports the address as verified (the email_verified claim). Without this, anyone who can register at the identity provider with someone else's address would get that person's access. A user whose address isn't verified can still use access given to them by their account, and can't subscribe to email notifications. Set it to false only for an identity provider that doesn't send email_verified and doesn't let users choose unverified addresses. It takes effect at the next sign-in, so people already signed in lose email-based access until they sign in again.
  • Auth__Oidc__Authority: issuer URL of the OpenID Connect provider, e.g. https://auth.example.com/realms/recruit.
  • Auth__Oidc__ClientId, Auth__Oidc__ClientSecret: the screening list's client credentials.
  • Auth__Oidc__RoleClaimType (default role): the ID token claim holding the user's roles. It must be a top-level claim: a path into a nested claim, such as realm_access.roles or resource_access.recruit.roles, matches nothing. Don't point it at a claim that holds the groups or roles of every app your identity provider serves, such as groups: an admin there may belong to a different app, and would make its holder an admin here as well.
  • Auth__Oidc__GroupClaimType (default groups) and Auth__Oidc__GroupRoleMappings: grant a role to the members of an identity provider group. GroupRoleMappings maps group names to roles, e.g. { "/recruit-admins": "admin" } in the Auth:Oidc section of the app's configuration. Only map groups that are specific to the screening list, not a name other apps use too, such as a bare admin.

Register the screening list as a confidential client with the OpenID Connect provider, with the redirect URI https://<screening list host>/signin-oidc. The screening list requests the openid, profile, email and offline_access scopes.

Keycloak

Keycloak sends a client's own roles in the nested resource_access.<client ID>.roles claim, and by default only in the access token, so the screening list can't read them. Add a mapper that also puts them in a top-level claim of the ID token: in the screening list's client, open Client scopes → <client ID>-dedicated → Add mapper → By configuration → User Client Role and set

  • Client ID: the screening list's client
  • Token Claim Name: role, or whatever Auth__Oidc__RoleClaimType is set to
  • Multivalued and Add to ID token: on

Then create the roles from Auth__AdminRoles as roles of that client and assign them to your admins. To check the result, pick a user under the client's Client scopes → Evaluate and open Generated ID token: it should contain e.g. "role": ["admin"], holding only the screening list's own roles.

Notifications

See Notifications for how notifications work. They are sent by email:

  • Notifications__Email__SmtpHost, Notifications__Email__SmtpPort (default 25): the SMTP server. TLS is negotiated automatically based on the port.
  • Notifications__Email__SmtpUsername, Notifications__Email__SmtpPassword: SMTP credentials, if the server needs them.
  • Notifications__Email__From: the sender address.
  • Notifications__Email__SubjectTemplate: the subject line. {0} is replaced with the study's acronym.
  • Notifications__Email__PublicBaseUrl: the URL users open the screening list at, e.g. https://recruit.example.com/. Every link in the emails is built from it, so it must be reachable from where your users read their email.

  • Notifications__ScanSchedule (default * * * * *, every minute): when the screening list checks for new candidates, as a cron expression in UTC. It has five fields (minute, hour, day of month, month, day of week), or six with seconds first. For example */5 * * * * checks every 5 minutes and 0 6-18 * * * on the hour from 06:00 to 18:00. A value that isn't a valid cron expression stops the screening list from starting.

Due emails are sent every 5 minutes, which isn't configurable.

  • Notifications__Testing__Enabled (default false): adds buttons to the admin-only Notification Test page to simulate a new recommendation and to send due emails straight away, see Trying it out in the demo. Simulating a recommendation notifies everyone subscribed to the trial for real and changes its screening list on the FHIR server, so only turn this on for development, demo and test installations.

Ports and observability

  • HTTP_PORT (default 8080): port of the web app.
  • METRICS_PORT (default 8081): port serving Prometheus metrics at /metrics.
  • Tracing__Enabled (default false): export OpenTelemetry traces, configured via the standard variables like OTEL_EXPORTER_OTLP_ENDPOINT.

Query module

The query module is a Spring Boot app. Its settings can be set as environment variables using Spring Boot's relaxed binding, e.g. QUERY_SQL_ON_FHIR_SCHEDULE_CRON for query-sql-on-fhir.schedule.cron.

FHIR server access

  • FHIR_SERVER_BASE_URL (required): base URL of the FHIR server.
  • FHIR_SERVER_TIMEOUT_IN_SECONDS (default 300): timeout of requests to the FHIR server.
  • FHIR_USE_UPDATE_AS_CREATE (default false): write screening list entries using PUT with a deterministic id instead of conditional creates, for FHIR servers that don't support conditional creates.

Criteria database

The database the eligibility criteria's SQL is run against.

  • SPRING_DATASOURCE_URL (required): JDBC URL, e.g. jdbc:trino://trino.example.com:443/fhir/default?SSL=true. For Trino, it must include the catalog and schema holding the FHIR tables.
  • SPRING_DATASOURCE_USERNAME, SPRING_DATASOURCE_PASSWORD: database credentials.
  • QUERY_SQL_ON_FHIR_SQL_DIALECT (default trino): the database's SQL dialect, trino or duckdb. A criterion is run directly if its Library has application/sql;dialect=<dialect> content. For DuckDB, also set SPRING_DATASOURCE_DRIVERCLASSNAME=org.duckdb.DuckDBDriver, see Querying FHIR resources with DuckDB.
  • SQL_ON_FHIR_URL: base URL of a SQL on FHIR server such as Pathling. Criteria that depend on ViewDefinitions or have no content in the configured dialect are sent to its $sqlquery-run operation.

Schedule

  • QUERY_SQL_ON_FHIR_RUN_MODE (default scheduled): scheduled runs forever on the schedule below. one-shot runs once and exits, with a non-zero exit code if any study failed, e.g. for running it as a Kubernetes Job.
  • QUERY_SQL_ON_FHIR_SCHEDULE_CRON (default @hourly): when to update the screening lists, as a Spring cron expression with six fields (seconds first) or a macro like @hourly.
  • MANAGEMENT_PROMETHEUS_METRICS_EXPORT_PUSHGATEWAY_ENABLED (default false): push the metrics to a Prometheus Pushgateway at MANAGEMENT_PROMETHEUS_METRICS_EXPORT_PUSHGATEWAY_ADDRESS (host:port), for one-shot runs that exit before Prometheus would scrape them. MANAGEMENT_PROMETHEUS_METRICS_EXPORT_PUSHGATEWAY_GROUPINGKEY_<NAME> adds a label to every pushed metric. See Metrics for one-shot runs.

Screening behavior

  • QUERY_SQL_ON_FHIR_REQUIRE_ALL_CRITERIA_MET (default false): by default, patients for whom a criterion can't be evaluated because of missing data are also recommended, for manual review. When true, only patients who meet every criterion are recommended.
  • QUERY_SQL_ON_FHIR_MAX_RESEARCH_SUBJECTS (default -1, unlimited): skip a study if it would recommend more patients than this.
  • QUERY_SQL_ON_FHIR_DRY_RUN (default false): run the criteria and log how many patients would be recommended, without writing anything to the FHIR server.
  • QUERY_SQL_ON_FHIR_TRANSACTION_BUNDLE_CHUNK_SIZE (default 500): the maximum number of patients written to the FHIR server per transaction.
  • QUERY_SQL_ON_FHIR_FUNNEL_ENABLED (default false): also compute each study's attrition funnel, i.e. how many patients remain after applying each criterion, shown in the screening list. It's a considerably more expensive query.
  • QUERY_SQL_ON_FHIR_FUNNEL_TOTAL_POPULATION_SQL (default SELECT COUNT(*) FROM Patient): the query counting the funnel's total population, e.g. SELECT COUNT(*) FROM fhir.default.patient.

Observability

  • OTEL_SDK_DISABLED (default true): set to false to export OpenTelemetry traces, configured via the standard variables like OTEL_EXPORTER_OTLP_ENDPOINT.
  • Health checks are served at /actuator/health and Prometheus metrics at /actuator/prometheus on port 8080.