Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
bc8a34b0
Commit
bc8a34b0
authored
Oct 26, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 86-dev-graphql
parents
76e614dd
f26f41e8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
31 deletions
+95
-31
package.yaml
package.yaml
+1
-1
NodeStory.hs
src/Gargantext/Core/NodeStory.hs
+3
-0
Graph.hs
src/Gargantext/Core/Viz/Graph.hs
+36
-9
API.hs
src/Gargantext/Core/Viz/Graph/API.hs
+43
-12
Tools.hs
src/Gargantext/Core/Viz/Graph/Tools.hs
+12
-9
No files found.
package.yaml
View file @
bc8a34b0
name
:
gargantext
version
:
'
0.0.4.
5
'
version
:
'
0.0.4.
6
'
synopsis
:
Search, map, share
description
:
Please see README.md
category
:
Data
...
...
src/Gargantext/Core/NodeStory.hs
View file @
bc8a34b0
...
...
@@ -7,6 +7,9 @@ Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
A Node Story is a Map between NodeId and an Archive (with state,
version and history) for that node.
TODO:
- remove
- filter
...
...
src/Gargantext/Core/Viz/Graph.hs
View file @
bc8a34b0
This diff is collapsed.
Click to expand it.
src/Gargantext/Core/Viz/Graph/API.hs
View file @
bc8a34b0
...
...
@@ -33,6 +33,7 @@ import Gargantext.Core.Viz.Graph
import
Gargantext.Core.Viz.Graph.GEXF
()
import
Gargantext.Core.Viz.Graph.Tools
-- (cooc2graph)
import
Gargantext.Database.Action.Metrics.NgramsByNode
(
getNodesByNgramsOnlyUser
)
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Action.Node
(
mkNodeWithParent
)
import
Gargantext.Database.Admin.Config
import
Gargantext.Database.Admin.Types.Node
...
...
@@ -78,7 +79,11 @@ graphAPI u n = getGraph u n
:<|>
graphVersionsAPI
u
n
------------------------------------------------------------------------
getGraph
::
UserId
->
NodeId
->
GargNoServer
HyperdataGraphAPI
--getGraph :: UserId -> NodeId -> GargServer HyperdataGraphAPI
getGraph
::
FlowCmdM
env
err
m
=>
UserId
->
NodeId
->
m
HyperdataGraphAPI
getGraph
_uId
nId
=
do
nodeGraph
<-
getNodeWith
nId
(
Proxy
::
Proxy
HyperdataGraph
)
...
...
@@ -109,7 +114,12 @@ getGraph _uId nId = do
HyperdataGraphAPI
graph'
camera
recomputeGraph
::
UserId
->
NodeId
->
Maybe
GraphMetric
->
GargNoServer
Graph
--recomputeGraph :: UserId -> NodeId -> Maybe GraphMetric -> GargNoServer Graph
recomputeGraph
::
FlowCmdM
env
err
m
=>
UserId
->
NodeId
->
Maybe
GraphMetric
->
m
Graph
recomputeGraph
_uId
nId
maybeDistance
=
do
nodeGraph
<-
getNodeWith
nId
(
Proxy
::
Proxy
HyperdataGraph
)
let
...
...
@@ -122,7 +132,7 @@ recomputeGraph _uId nId maybeDistance = do
_
->
maybeDistance
let
cId
=
maybe
(
panic
"[G.V.G.API.recomputeGraph] Node has no parent"
)
cId
=
maybe
(
panic
"[G.
C.
V.G.API.recomputeGraph] Node has no parent"
)
identity
$
nodeGraph
^.
node_parent_id
similarity
=
case
graphMetric
of
...
...
@@ -151,12 +161,18 @@ recomputeGraph _uId nId maybeDistance = do
-- TODO use Database Monad only here ?
computeGraph
::
HasNodeError
err
--computeGraph :: HasNodeError err
-- => CorpusId
-- -> Distance
-- -> NgramsType
-- -> NodeListStory
-- -> Cmd err Graph
computeGraph
::
FlowCmdM
env
err
m
=>
CorpusId
->
Distance
->
NgramsType
->
NodeListStory
->
Cmd
err
Graph
->
m
Graph
computeGraph
cId
d
nt
repo
=
do
lId
<-
defaultList
cId
lIds
<-
selectNodesWithUsername
NodeList
userMaster
...
...
@@ -172,9 +188,11 @@ computeGraph cId d nt repo = do
-- printDebug "myCooc" myCooc
-- saveAsFileDebug "debug/my-cooc" myCooc
listNgrams
<-
getListNgrams
[
lId
]
nt
graph
<-
liftBase
$
cooc2graphWith
Spinglass
d
0
myCooc
-- saveAsFileDebug "debug/graph" graph
pure
graph
pure
$
mergeGraphNgrams
graph
(
Just
listNgrams
)
defaultGraphMetadata
::
HasNodeError
err
...
...
@@ -214,10 +232,15 @@ graphAsync u n =
JobFunction
(
\
_
log'
->
graphRecompute
u
n
(
liftBase
.
log'
))
graphRecompute
::
UserId
--graphRecompute :: UserId
-- -> NodeId
-- -> (JobLog -> GargNoServer ())
-- -> GargNoServer JobLog
graphRecompute
::
FlowCmdM
env
err
m
=>
UserId
->
NodeId
->
(
JobLog
->
GargNoServer
()
)
->
GargNoServer
JobLog
->
(
JobLog
->
m
()
)
->
m
JobLog
graphRecompute
u
n
logStatus
=
do
logStatus
JobLog
{
_scst_succeeded
=
Just
0
,
_scst_failed
=
Just
0
...
...
@@ -274,7 +297,11 @@ graphVersions n nId = do
pure
$
GraphVersions
{
gv_graph
=
listVersion
,
gv_repo
=
v
}
recomputeVersions
::
UserId
->
NodeId
->
GargNoServer
Graph
--recomputeVersions :: UserId -> NodeId -> GargNoServer Graph
recomputeVersions
::
FlowCmdM
env
err
m
=>
UserId
->
NodeId
->
m
Graph
recomputeVersions
uId
nId
=
recomputeGraph
uId
nId
Nothing
------------------------------------------------------------
...
...
@@ -300,9 +327,13 @@ graphClone uId pId (HyperdataGraphAPI { _hyperdataAPIGraph = graph
pure
nId
------------------------------------------------------------
getGraphGexf
::
UserId
--getGraphGexf :: UserId
-- -> NodeId
-- -> GargNoServer (Headers '[Servant.Header "Content-Disposition" Text] Graph)
getGraphGexf
::
FlowCmdM
env
err
m
=>
UserId
->
NodeId
->
GargNoServer
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Graph
)
->
m
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Graph
)
getGraphGexf
uId
nId
=
do
HyperdataGraphAPI
{
_hyperdataAPIGraph
=
graph
}
<-
getGraph
uId
nId
pure
$
addHeader
"attachment; filename=graph.gexf"
graph
...
...
src/Gargantext/Core/Viz/Graph/Tools.hs
View file @
bc8a34b0
...
...
@@ -205,21 +205,24 @@ data2graph :: ToComId a
->
Map
(
Int
,
Int
)
Double
->
[
a
]
->
Graph
data2graph
labels
coocs
bridge
conf
partitions
=
Graph
nodes
edges
Nothing
data2graph
labels
coocs
bridge
conf
partitions
=
Graph
{
_graph_nodes
=
nodes
,
_graph_edges
=
edges
,
_graph_metadata
=
Nothing
}
where
community_id_by_node_id
=
Map
.
fromList
$
map
nodeId2comId
partitions
nodes
=
map
(
setCoord
ForceAtlas
labels
bridge
)
[
(
n
,
Node
{
node_size
=
maybe
0
identity
(
Map
.
lookup
(
n
,
n
)
coocs
)
,
node_type
=
Terms
-- or Unknown
,
node_id
=
cs
(
show
n
)
,
node_label
=
l
,
node_x_coord
=
0
,
node_y_coord
=
0
,
node_attributes
=
Attributes
{
clust_default
=
maybe
0
identity
(
Map
.
lookup
n
community_id_by_node_id
)
}
}
,
node_type
=
Terms
-- or Unknown
,
node_id
=
cs
(
show
n
)
,
node_label
=
l
,
node_x_coord
=
0
,
node_y_coord
=
0
,
node_attributes
=
Attributes
{
clust_default
=
maybe
0
identity
(
Map
.
lookup
n
community_id_by_node_id
)
}
,
node_children
=
[]
}
)
|
(
l
,
n
)
<-
labels
,
Set
.
member
n
$
Set
.
fromList
...
...
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