Maybe pass the event through a series of “categorisers” a func or something looking for various things, each tags the event on the way, and the compute the total by looking up the (current) numerical value assigned to that tag?