Intelligence API

ProBeya’s intelligence layer combines statistical analysis, AI-powered predictions, cross-site benchmarking, and organizational knowledge management. All intelligence features enforce multi-tenant isolation and use pure statistical methods where possible (no external AI API calls required for core analytics).

AI Insights (KPI Analytics)

Statistical anomaly detection and trend prediction for KPI time-series data using z-score analysis, moving averages, and linear regression.

Endpoints


GET /api/v1/intelligence/kpi-anomalies

Run anomaly detection on a single KPI’s historical data. Uses both z-score and moving average methods to flag unusual values.

tRPC: aiInsights.detectKpiAnomalies Auth: Bearer token required (scope: read:items) or session cookie Org context: Required

Parameters:

NameTypeRequiredDescription
kpiDefinitionIdstringYesThe KPI definition to analyze
windowSizenumberNoRolling window size for calculations (default: 7, range: 2-90)
stdDevMultipliernumberNoZ-score threshold multiplier (default: 2.0, range: 0.5-5.0)
deviationThresholdnumberNoMoving average deviation threshold (default: 0.3, range: 0.05-1.0)

Response:

{
  "anomalies": [
    {
      "index": 42,
      "date": "2026-03-15",
      "value": 98.5,
      "expected": 72.3,
      "deviation": 36.2,
      "method": "zscore",
      "severity": "high"
    }
  ],
  "totalDataPoints": 90,
  "anomalyCount": 3
}

GET /api/v1/intelligence/kpi-trend

Run linear regression trend prediction on a KPI to forecast future values.

tRPC: aiInsights.predictKpiTrend Auth: Bearer token required (scope: read:items) or session cookie Org context: Required

Parameters:

NameTypeRequiredDescription
kpiDefinitionIdstringYesThe KPI definition to analyze

Response:

{
  "slope": 0.42,
  "intercept": 65.1,
  "rSquared": 0.87,
  "trend": "improving",
  "predictedValues": [
    { "date": "2026-04-15", "value": 78.2 },
    { "date": "2026-04-22", "value": 78.6 }
  ]
}

GET /api/v1/intelligence/board-insights

Combined anomalies and trend analysis for all KPIs on a board. Returns a comprehensive AI-generated insight report.

tRPC: aiInsights.getInsights Auth: Bearer token required (scope: read:items) or session cookie Org context: Required

Parameters:

NameTypeRequiredDescription
boardIdstringYesThe board to analyze

AI Project Intelligence

AI-powered project bootstrap templates and schedule prediction. Templates contain pre-built WBS structures, risk registers, and schedule frameworks for rapid project setup.

Endpoints


POST /api/v1/intelligence/bootstrap-templates

Create an industry-specific project template with pre-built WBS, risks, and schedule phases.

tRPC: aiIntelligence.createBootstrapTemplate Auth: Bearer token required (scope: write:items) or session cookie Org context: Required

Parameters:

NameTypeRequiredDescription
namestringYesTemplate name (e.g., “Pharma Phase III Clinical Trial”)
industrystringNoTarget industry (e.g., “pharma”, “automotive”)
projectTypestringNoProject type (e.g., “clinical_trial”, “process_improvement”)
wbsTemplateobjectNoPre-built WBS structure with elements array
riskTemplateobjectNoPre-built risk register with risk items
scheduleTemplateobjectNoPre-built schedule with phases and milestones

WBS element structure:

{
  "elements": [
    {
      "code": "1.1.2",
      "name": "Protocol Development",
      "level": 1,
      "durationDays": 60,
      "dependencies": ["1.1.1"],
      "resources": ["Clinical Lead", "Biostatistician"]
    }
  ]
}

GET /api/v1/intelligence/bootstrap-templates

List bootstrap templates with optional industry and project type filters.

tRPC: aiIntelligence.listBootstrapTemplates

tRPC-Only Intelligence Procedures

ProcedureTypeDescription
aiIntelligence.getBootstrapTemplatequeryFull template detail
aiIntelligence.updateBootstrapTemplatemutationUpdate template content
aiIntelligence.deleteBootstrapTemplatemutationRemove a template
aiIntelligence.recordScheduleSnapshotmutationRecord a schedule health snapshot with AI prediction
aiIntelligence.getScheduleHistoryqueryTime-series of schedule health for a project

Benchmarking

Cross-site KPI comparison for organizations with multiple sites. Enables executive-level comparisons across all level-1 workspaces (physical sites).

Data flow: workspaces (level=1) → projects → boards → kpiDefinitions → kpiValues

Endpoints


GET /api/v1/benchmarking/site

Compare a specific KPI across all sites using averaged values.

tRPC: benchmarking.getSiteBenchmark Auth: Bearer token required (scope: read:items) or session cookie Org context: Required

Parameters:

NameTypeRequiredDescription
kpiNamestringYesKPI name to compare across sites
categorystringNoSQCDP category filter
dateFromstringNoStart date for value aggregation
dateTostringNoEnd date for value aggregation

GET /api/v1/benchmarking/category

SQCDP scorecard per site showing a traffic-light matrix (red/amber/green) based on KPI thresholds.

tRPC: benchmarking.getCategoryBenchmark


GET /api/v1/benchmarking/trend

Time-series overlay of a KPI across all sites for trend comparison.

tRPC: benchmarking.getTrendComparison


GET /api/v1/benchmarking/ranking

Rank all sites by a specific KPI from best to worst.

tRPC: benchmarking.getRanking


Knowledge Forge

Internal knowledge base with articles, a knowledge graph of people/assets/processes, and expertise tracking per user per domain.

tRPC-Only Knowledge Forge Procedures

ProcedureTypeDescription
knowledgeForge.createmutationCreate a knowledge article (draft/published/archived)
knowledgeForge.listqueryPaginated list with category, status, and search filters
knowledgeForge.getByIdqueryFull article detail
knowledgeForge.updatemutationUpdate article content, category, status, tags
knowledgeForge.deletemutationRemove an article
knowledgeForge.createNodemutationAdd a node to the knowledge graph (person, asset, process, etc.)
knowledgeForge.listNodesqueryBrowse graph nodes by type
knowledgeForge.createEdgemutationCreate a relationship between nodes
knowledgeForge.listEdgesqueryList edges for a node
knowledgeForge.deleteEdgemutationRemove a relationship
knowledgeForge.upsertExpertisemutationSet or update a user’s expertise score for a domain
knowledgeForge.getExpertiseMatrixqueryWho-knows-what matrix across users and domains

Node types: person, asset, product, process, problem, procedure

Edge relations: solved_by, applies_to, requires, supersedes, related_to

Article statuses: draft, published, archived

Error Codes

CodeDescription
400Invalid input parameters (e.g., threshold out of range)
401Missing or invalid authentication
404KPI definition, template, article, or node not found
422Insufficient data points for statistical analysis