Data consolidation algebra for Scala