Extract analysis

extract code that analyzes the values
make it compatible with streaming values by separating accumulating and
summarizing