Insights — Code Map
API
apps/api/src/insights/insights.module.tsapps/api/src/insights/insights.controller.ts— singleGET /organizations/:orgId/insightsendpoint.apps/api/src/insights/insights.service.ts—getOrgInsights(orgId)orchestrator,evalCancellationRequests,evalOutstandingDebt,evalAtRiskBilling,evalTasksOverdue.apps/api/src/insights/insights.service.driver.ts— test driver.apps/api/src/insights/insights.service.unit.spec.ts— rule unit tests.apps/api/src/insights/insights.controller.unit.spec.ts— controller-level tests (auth, shape).
Agent surface
apps/api/src/ai/agent/tools/leaves/analytics.tools.ts—org_insightsaction delegates toInsightsService.getOrgInsights.
Web
apps/web/src/components/dashboard/insights-widget.tsx(and related) — renders the card grid. The frontend reads the i18n dictionary byid.
i18n
apps/web/src/i18n/{en,he,ru}.jsonunderinsight.<id>.{title,description}.
Schema
libs/db/src/lib/schema/payments.ts—subscriptions,cancellation_requests,payment_transactions.libs/db/src/lib/schema/memberships.ts—memberships.libs/db/src/lib/schema/tasks.ts—tasks.libs/db/src/lib/schema/users.ts—users(read for the at-risk sample).