| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Free.Agent.BusStats
Contents
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
- data Rules = Rules {}
- defaultRules :: Rules
- data Classification
- classify :: Rules -> Post Text -> Classification
- isDeliverable :: Rules -> Post Text -> Bool
- isDoneClaim :: Post Text -> Bool
- data SliceMode
- slicePosts :: SliceMode -> [Stamped Text] -> [(Text, [Stamped Text])]
- data Stats = Stats {
- statSlice :: Text
- statPosts :: Int
- statAgents :: Int
- statDurationMinutes :: Double
- statPostsPerMinute :: Double
- statDamping :: Int
- statReBus :: Double
- statSignal :: Int
- statNoise :: Int
- statUnclassified :: Int
- statSNR :: Maybe Double
- statSNRPrime :: Maybe Double
- statDeliverables :: Int
- statDoneClaims :: Int
- statPostsPerDeliverable :: Maybe Double
- statTimeToQuiescenceMinutes :: Double
- computeStats :: Rules -> Int -> Text -> [Stamped Text] -> Stats
- renderStats :: Rules -> [Stats] -> Text
- renderStatsJson :: Rules -> [Stats] -> Text
Rules
Regex-driven classification rules. Each field is a single regex; the
default signalRE combines path, mark, and decision-word alternatives.
Constructors
| Rules | |
defaultRules :: Rules Source #
Sensible defaults decided with the card.
data Classification Source #
A post is signal, noise, or neutral.
Instances
| Eq Classification Source # | |
Defined in Free.Agent.BusStats Methods (==) :: Classification -> Classification -> Bool # (/=) :: Classification -> Classification -> Bool # | |
| Show Classification Source # | |
Defined in Free.Agent.BusStats Methods showsPrec :: Int -> Classification -> ShowS # show :: Classification -> String # showList :: [Classification] -> ShowS # | |
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.
Slicing
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. |
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
Computed metrics for one slice.
Constructors
| Stats | |
Fields
| |
computeStats :: Rules -> Int -> Text -> [Stamped Text] -> Stats Source #
Compute stats for one slice given classification rules and a damping count.