Skip to content

KQL functions

Stored functions defined in fabric/kql/02_policies.kql. The app-facing functions live in the FDA folder; the validation function in FDA/internal.

Function Folder Consumer
SearchFdaInteractions FDA Review app (results grid)
GetFdaInteraction FDA Review app (detail)
FdaTuningSummary FDA Dashboards / aggregate pages
FdaFailures FDA Review backlog / ops
FdaTopQuestions FDA Dashboard / tuning
BuildFdaInteractionsKql FDA/internal Validation / fallback

SearchFdaInteractions

Filtered search/list of curated interactions. Empty string / null = no filter.

SearchFdaInteractions(
    term:string = "",
    fromTime:datetime = datetime(null),
    toTime:datetime = datetime(null),
    agent:string = "",
    user:string = "",
    status:string = "",
    onlyMatched:bool = false,
    maxRows:long = 1000)
Parameter Default Effect
term "" Free-text — matches Question, Answer, GeneratedDax, or ExecutedDax (has)
fromTime / toTime last 30 days → now Time window (null → ago(30d)now())
agent "" Matches AgentName or AgentId exactly
user "" User has user
status "" Exact Status match (Ok/Error/Unknown)
onlyMatched false When true, drops MatchConfidence == "Unmatched" rows
maxRows 1000 Row cap (take)

Returns the review columns (timestamp, user, host, agent, model, question, answer, both DAX fields, DaxQueries, perf, status, error, match confidence, sources, thread, id), newest first.


GetFdaInteraction

Single interaction by id, for the detail pane.

GetFdaInteraction(id:string)

Returns the one FdaInteractions row where InteractionId == id.


FdaTuningSummary

Tuning KPIs over a window, grouped by agent and day — for dashboards.

FdaTuningSummary(fromTime:datetime = datetime(null), toTime:datetime = datetime(null))

Defaults to the last 7 days. Per AgentName × bin(Timestamp, 1d) it returns: Interactions, Users (dcount), Failures, FailureRatePct, UnmatchedDaxPct, P50DurationMs, P95DurationMs.


FdaFailures

Interactions needing attention.

FdaFailures(fromTime:datetime = datetime(null), toTime:datetime = datetime(null))

Defaults to the last 7 days. Returns rows where Status == "Error" or MatchConfidence == "Unmatched" or ExecutedDax is empty — projecting timestamp, user, agent, question, status, error, match confidence, and executed DAX, newest first.


FdaTopQuestions

Most frequent question patterns — tuning candidate list.

FdaTopQuestions(fromTime:datetime = datetime(null), toTime:datetime = datetime(null), topN:long = 50)

Defaults to the last 30 days. Normalizes questions (trim + tolower), groups by the normalized text, and returns the top topN by count with: Example (a representative original), Count, Users, FailureRatePct, AvgDurationMs. Feed the high-volume patterns back into the FDA as example queries.


BuildFdaInteractionsKql

KQL-native reproduction of the collector's correlation, for validation / spot-checks. The collector notebook is authoritative; this function lets you cross-check without re-running it.

BuildFdaInteractionsKql(lookback:timespan = 2d, windowSec:long = 90)

It pairs Graph prompts/responses by ConversationId, window-joins Raw_ExecutedDax by User == ExecutingUser within ±windowSec, computes MatchConfidence (Exact / Windowed / Unmatched), aggregates the per-turn DaxQueries array, and projects an FdaInteractions-shaped result. See Correlation model for the algorithm this mirrors.

Note

This validation path produces Status = "Unknown" and Sources = ["graph","monitoring"] — it does not apply the notebook's per-query status derivation. Use it to sanity-check the join, not as a replacement for the curated table.