Configuration

Configuration

Sentra Assist reads its runtime configuration from environment variables. All variables are defined in apps/healthcare/sentra-assistv1/.env.example. Copy that file to .env.local and fill in your values. Never commit .env.local to git.

Variables fall into six categories: backend API, development options, feature flags, OpenAI LLM settings, safety toggles, and debug channels.


Backend API

These three variables are required for any environment that talks to the Sentra backend.

VariableDefaultDescription
VITE_SENTRA_API_URLhttps://api.sentra.localBase URL for the Sentra API. HTTPS is enforced in production.
VITE_SENTRA_API_KEYsk_dev_your_api_key_hereAPI key for authenticating with the Sentra backend. Get this from a Sentra admin.
VITE_FACILITY_IDPUSKESMAS_BALOWERTIFacility identifier for multi-tenant setups. Used to scope data and configuration to a specific Puskesmas.

Development options

These variables control local development behavior, mock data, timeouts, and debug logging.

VariableDefaultDescription
VITE_USE_MOCKtrueWhen true, the extension uses local mock data instead of calling the real API. Keep this on during UI development.
VITE_API_TIMEOUT10000Global API request timeout in milliseconds.
VITE_DEBUGfalseMaster switch for debug logging across the extension.
VITE_DEBUG_RIWAYATfalseFocused debug logging for the visit history scraper and bridge.
VITE_DEBUG_BACKGROUNDfalseDebug logging for the background service worker. Falls back to VITE_DEBUG when omitted.
VITE_DEBUG_CONTENTfalseDebug logging for the content script that runs inside ePuskesmas pages. Falls back to VITE_DEBUG when omitted.
VITE_DEBUG_FILLERfalseDebug logging for the form auto-fill engine. Falls back to VITE_DEBUG when omitted.

Message timeout tuning

These values control how long the extension waits for a response from different subsystems. All values are clamped at runtime to the range [1000, 60000].

VariableDefaultDescription
VITE_MESSAGE_TIMEOUT_DEFAULT10000Default message timeout in milliseconds.
VITE_MESSAGE_TIMEOUT_FILL8000Timeout for form-fill operations.
VITE_MESSAGE_TIMEOUT_SCRAPE5000Timeout for page scraping operations.
VITE_MESSAGE_TIMEOUT_VISIT_FETCH15000Timeout for fetching visit history.
VITE_MESSAGE_TIMEOUT_AI30000Timeout for AI diagnosis and prescription requests.

Feature flags

Feature flags are boolean toggles that enable or disable major modules. They let you turn off an entire subsystem without touching code.

VariableDefaultDescription
VITE_FEATURE_DIAGNOSIS_AItrueEnables AI diagnosis suggestions from the Iskandar Diagnosis Engine.
VITE_FEATURE_PRESCRIPTION_AItrueEnables AI prescription recommendations.
VITE_FEATURE_DDI_CHECKtrueEnables real-time drug-drug interaction checking against the DDInter 2.0 database.
VITE_FEATURE_PEDIATRIC_DOSEtrueEnables the pediatric dosing calculator.

OpenAI LLM settings

The Iskandar Diagnosis Engine can optionally use an LLM for constrained reranking. These variables configure that layer.

VariableDefaultDescription
SENTRA_OPENAI_API_KEY(none)OpenAI API key. Without this, the engine falls back to knowledge-base-only reasoning.
SENTRA_OPENAI_MODELgpt-4o-miniModel to use. Alternatives: gpt-4o, gpt-4-turbo.
SENTRA_OPENAI_TIMEOUT_MS30000Timeout for OpenAI requests in milliseconds.

Safety toggles

These variables disable specific safety layers. They are commented out by default because disabling them reduces clinical safety. Only change them if you know exactly what you are doing.

VariableDefaultDescription
SENTRA_DISABLE_TRAJECTORY_BRIDGE(commented out)When set to true, disables the SYMPHONY trajectory bridge safety layer.
SENTRA_DISABLE_THERAPY(commented out)When set to true, disables pharmacotherapy recommendations entirely.

Diagnosis V2 shadow mode

VariableDefaultDescription
SENTRA_DIAGNOSIS_V2_SHADOWfalseWhen true, runs the new Diagnosis V2 pipeline in parallel with the production V1 engine and logs the comparison. Does not replace V1 output.

Naming conventions

  • Variables prefixed with VITE_ are exposed to the browser extension frontend via Vite's import.meta.env.
  • Variables prefixed with SENTRA_ are server-side or background-script only.
  • Boolean flags use string values ("true" or "false") because environment variables are always strings at the OS level. The codebase normalizes them with toFlagBool helpers.

If you add a new variable, follow the existing prefix and keep the description comment directly above the declaration so .env.example stays self-documenting.