2 Module : Gargantext.Viz.Phylo.PhyloMaker
3 Description : Maker engine for rebuilding a Phylo
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
11 {-# LANGUAGE NoImplicitPrelude #-}
12 {-# LANGUAGE FlexibleContexts #-}
13 {-# LANGUAGE OverloadedStrings #-}
14 {-# LANGUAGE MultiParamTypeClasses #-}
16 module Gargantext.Viz.Phylo.PhyloMaker where
19 import Data.Map (Map, fromListWith, keys, unionWith, fromList)
21 import Gargantext.Prelude
22 import Gargantext.Viz.AdaptativePhylo
23 import Gargantext.Viz.Phylo.PhyloTools
30 nbDocsByTime :: [Document] -> Int -> Map Date Double
31 nbDocsByTime docs step =
32 let docs' = fromListWith (+) $ map (\d -> (date d,1)) docs
33 time = fromList $ map (\t -> (t,0)) $ toTimeScale (keys docs') step
34 in unionWith (+) time docs'