Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
37af3986
Commit
37af3986
authored
May 14, 2020
by
qlobbe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a new group by docs
parent
e9693985
Pipeline
#847
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
PhyloMaker.hs
src/Gargantext/Viz/Phylo/PhyloMaker.hs
+14
-3
No files found.
src/Gargantext/Viz/Phylo/PhyloMaker.hs
View file @
37af3986
...
@@ -15,8 +15,8 @@ Portability : POSIX
...
@@ -15,8 +15,8 @@ Portability : POSIX
module
Gargantext.Viz.Phylo.PhyloMaker
where
module
Gargantext.Viz.Phylo.PhyloMaker
where
import
Data.List
(
concat
,
nub
,
partition
,
sort
,
(
++
),
group
,
intersect
,
null
,
sortOn
,
groupBy
)
import
Data.List
(
concat
,
nub
,
partition
,
sort
,
(
++
),
group
,
intersect
,
null
,
sortOn
,
groupBy
,
tail
)
import
Data.Map
(
Map
,
fromListWith
,
keys
,
unionWith
,
fromList
,
empty
,
toList
,
elems
,
(
!
),
restrictKeys
,
foldlWithKey
)
import
Data.Map
(
Map
,
fromListWith
,
keys
,
unionWith
,
fromList
,
empty
,
toList
,
elems
,
(
!
),
restrictKeys
,
foldlWithKey
,
insert
)
import
Data.Set
(
size
)
import
Data.Set
(
size
)
import
Data.Vector
(
Vector
)
import
Data.Vector
(
Vector
)
...
@@ -137,7 +137,8 @@ toPhylo1 docs phyloBase = case (getSeaElevation phyloBase) of
...
@@ -137,7 +137,8 @@ toPhylo1 docs phyloBase = case (getSeaElevation phyloBase) of
phyloClique
=
toPhyloClique
phyloBase
docs'
phyloClique
=
toPhyloClique
phyloBase
docs'
--------------------------------------
--------------------------------------
docs'
::
Map
(
Date
,
Date
)
[
Document
]
docs'
::
Map
(
Date
,
Date
)
[
Document
]
docs'
=
groupDocsByPeriod'
date
(
getPeriodIds
phyloBase
)
docs
docs'
=
groupDocsByPeriodRec
date
(
getPeriodIds
phyloBase
)
(
sortOn
date
docs
)
empty
-- docs' = groupDocsByPeriod' date (getPeriodIds phyloBase) docs
--------------------------------------
--------------------------------------
...
@@ -227,6 +228,16 @@ docsToTimeScaleCooc docs fdt =
...
@@ -227,6 +228,16 @@ docsToTimeScaleCooc docs fdt =
-- | to Phylo Base | --
-- | to Phylo Base | --
-----------------------
-----------------------
groupDocsByPeriodRec
::
(
NFData
doc
,
Ord
date
,
Enum
date
)
=>
(
doc
->
date
)
->
[(
date
,
date
)]
->
[
doc
]
->
Map
(
date
,
date
)
[
doc
]
->
Map
(
date
,
date
)
[
doc
]
groupDocsByPeriodRec
f
prds
docs
acc
=
if
((
null
prds
)
||
(
null
docs
))
then
acc
else
let
prd
=
head'
"groupBy"
prds
docs'
=
partition
(
\
d
->
(
f
d
>=
fst
prd
)
&&
(
f
d
<=
snd
prd
))
docs
in
groupDocsByPeriodRec
f
(
tail
prds
)
(
snd
docs'
)
(
insert
prd
(
fst
docs'
)
acc
)
-- | To group a list of Documents by fixed periods
-- | To group a list of Documents by fixed periods
groupDocsByPeriod'
::
(
NFData
doc
,
Ord
date
,
Enum
date
)
=>
(
doc
->
date
)
->
[(
date
,
date
)]
->
[
doc
]
->
Map
(
date
,
date
)
[
doc
]
groupDocsByPeriod'
::
(
NFData
doc
,
Ord
date
,
Enum
date
)
=>
(
doc
->
date
)
->
[(
date
,
date
)]
->
[
doc
]
->
Map
(
date
,
date
)
[
doc
]
groupDocsByPeriod'
f
pds
docs
=
groupDocsByPeriod'
f
pds
docs
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment