free-agent
Safe HaskellNone
LanguageGHC2024

Free.Agent.BusStats

Description

Pure log analysis for the free-agent bus.

Computes flow metrics from a stamped JSONL log: Re_bus, SNR, posts-per-deliverable, and time-to-quiescence. Classifications are regex-driven and overridable so old transcripts can be re-analysed.

Synopsis

Rules

data Rules Source #

Regex-driven classification rules. Each field is a single regex; the default signalRE combines path, mark, and decision-word alternatives.

Constructors

Rules 

Fields

Instances

Instances details
Eq Rules Source # 
Instance details

Defined in Free.Agent.BusStats

Methods

(==) :: Rules -> Rules -> Bool #

(/=) :: Rules -> Rules -> Bool #

Show Rules Source # 
Instance details

Defined in Free.Agent.BusStats

Methods

showsPrec :: Int -> Rules -> ShowS #

show :: Rules -> String #

showList :: [Rules] -> ShowS #

defaultRules :: Rules Source #

Sensible defaults decided with the card.

data Classification Source #

A post is signal, noise, or neutral.

Constructors

Signal 
Noise 
Neutral 

Instances

Instances details
Eq Classification Source # 
Instance details

Defined in Free.Agent.BusStats

Show Classification Source # 
Instance details

Defined in Free.Agent.BusStats

classify :: Rules -> Post Text -> Classification Source #

Classify a post. Signal takes precedence over noise: a post matching the noise regex but carrying a path or mark is counted as signal.

isDeliverable :: Rules -> Post Text -> Bool Source #

Whether a post is a conductor deliverable.

isDoneClaim :: Post Text -> Bool Source #

Whether a post claims completion and cites a path.

Slicing

data SliceMode Source #

How to partition the log for metric computation.

Constructors

WholeLog

One slice over the entire log.

WindowMinutes Int

Fixed-width time buckets in minutes.

ByThread

One slice per thread tree (grouped by root post id).

ByAgent

One slice per authoring agent.

Instances

Instances details
Eq SliceMode Source # 
Instance details

Defined in Free.Agent.BusStats

Show SliceMode Source # 
Instance details

Defined in Free.Agent.BusStats

slicePosts :: SliceMode -> [Stamped Text] -> [(Text, [Stamped Text])] Source #

Partition stamped posts into slices. Posts without a parseable timestamp are dropped from time-based slicing, but kept for thread slicing (where the id is enough).

Statistics

data Stats Source #

Computed metrics for one slice.

Instances

Instances details
Eq Stats Source # 
Instance details

Defined in Free.Agent.BusStats

Methods

(==) :: Stats -> Stats -> Bool #

(/=) :: Stats -> Stats -> Bool #

Show Stats Source # 
Instance details

Defined in Free.Agent.BusStats

Methods

showsPrec :: Int -> Stats -> ShowS #

show :: Stats -> String #

showList :: [Stats] -> ShowS #

computeStats :: Rules -> Int -> Text -> [Stamped Text] -> Stats Source #

Compute stats for one slice given classification rules and a damping count.

Rendering

renderStats :: Rules -> [Stats] -> Text Source #

Human-readable plain-text report.

renderStatsJson :: Rules -> [Stats] -> Text Source #

JSON report.