Main
health_check()
Performs a basic health check of the API and database availability.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
A dictionary containing:
- |
Source code in api/main.py
68 69 70 71 72 73 74 75 76 77 78 | |
lifespan(app)
async
Manages the application lifecycle (startup and shutdown events).
This context manager handles the initialization of critical services before the API starts accepting requests.
Startup Sequence:
- Directory Setup: Creates the
PLOTS_DIRif it does not exist. - Telemetry: Initializes OpenTelemetry/Tracing setup.
- Data Integrity (ETL): Triggers the
run_pipeline()function to ensure clean data is available for the agents. If this fails, a critical error is logged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
FastAPI
|
The FastAPI application instance. |
required |
Yields:
| Name | Type | Description |
|---|---|---|
None |
Control is yielded back to the application loop. |
Source code in api/main.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |