CI / ruff · pytest (pull_request) Successful in 1m50s
One Postgres with isolated identity/clinical databases and roles (ADR-003), FastAPI /health, Streamlit placeholder, typed settings with offline defaults. Refs #1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
933 B
Python
30 lines
933 B
Python
"""Application entrypoint: FastAPI API (+ scheduler and Telegram bot once implemented)."""
|
|
|
|
import logging
|
|
from collections.abc import AsyncGenerator
|
|
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from app.config import get_settings
|
|
|
|
# Logs carry only tokens, states and event codes — never PII or raw message text.
|
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s %(message)s")
|
|
log = logging.getLogger("app")
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(_: FastAPI) -> AsyncGenerator[None, None]:
|
|
settings = get_settings()
|
|
log.info("startup llm_provider=%s demo_clock=%s", settings.llm_provider, settings.demo_clock)
|
|
# DB init (#6), scheduler (#13) and Telegram bot (#11) hook in here.
|
|
yield
|
|
|
|
|
|
app = FastAPI(title="PTSRaiAgent API", version="0.1.0", lifespan=lifespan)
|
|
|
|
|
|
@app.get("/health")
|
|
async def health() -> dict[str, str]:
|
|
return {"status": "ok"}
|