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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
48a8c59d
Commit
48a8c59d
authored
Apr 04, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Async] back (corpus input test) but still needs work.
parent
005d8dcc
Pipeline
#796
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
17 deletions
+30
-17
New.hs
src/Gargantext/API/Corpus/New.hs
+10
-9
API.hs
src/Gargantext/Viz/Graph/API.hs
+20
-8
No files found.
src/Gargantext/API/Corpus/New.hs
View file @
48a8c59d
...
...
@@ -257,11 +257,11 @@ addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
PresseRIS
->
Parser
.
parseFormat
Parser
.
RisPresse
newDocs
<-
liftIO
newEmptyMVar
docs
<-
liftIO
$
splitEvery
500
_
<-
liftIO
$
forkIO
<$>
putMVar
newDocs
<$>
splitEvery
500
<$>
take
1000000
<$>
parse
(
cs
d
)
_
<-
liftIO
$
forkIO
$
putMVar
newDocs
docs
logStatus
ScraperStatus
{
_scst_succeeded
=
Just
1
,
_scst_failed
=
Just
0
...
...
@@ -269,13 +269,14 @@ addToCorpusWithForm cid (WithForm ft d l _n) logStatus = do
,
_scst_events
=
Just
[]
}
docs'
<-
liftIO
$
takeMVar
newDocs
docs'
<-
liftIO
$
takeMVar
newDocs
newCid
<-
liftIO
newEmptyMVar
cid'
<-
flowCorpus
"user1"
(
Right
[
cid
])
(
Multi
$
fromMaybe
EN
l
)
(
map
(
map
toHyperdataDocument
)
docs'
)
_
<-
liftIO
$
forkIO
$
putMVar
newCid
cid'
_
<-
forkIO
<$>
putMVar
newCid
<$>
flowCorpus
"user1"
(
Right
[
cid
]
)
(
Multi
$
fromMaybe
EN
l
)
(
map
(
map
toHyperdataDocument
)
docs'
)
cid''
<-
liftIO
$
takeMVar
newCid
printDebug
"cid'"
cid''
...
...
src/Gargantext/Viz/Graph/API.hs
View file @
48a8c59d
...
...
@@ -158,25 +158,37 @@ recomputeGraph uId nId = do
g
<-
case
graph
of
Nothing
->
do
graph'
<-
computeGraph
cId
NgramsTerms
repo
graph'
<-
computeGraph
Async
cId
NgramsTerms
repo
_
<-
insertGraph
cId
uId'
(
HyperdataGraph
$
Just
graph'
)
pure
$
trace
"[recomputeGraph] Graph empty, computing"
$
graph'
Just
graph'
->
if
listVersion
==
Just
v
then
pure
graph'
else
do
graph''
<-
computeGraph
cId
NgramsTerms
repo
graph''
<-
computeGraph
Async
cId
NgramsTerms
repo
_
<-
updateHyperdata
nId
(
HyperdataGraph
$
Just
graph''
)
pure
$
trace
"[recomputeGraph] Graph exists, recomputing"
$
graph''
newGraph
<-
liftIO
newEmptyMVar
_
<-
liftIO
$
forkIO
$
putMVar
newGraph
g
g'
<-
liftIO
$
takeMVar
newGraph
pure
g
computeGraphAsync
::
HasNodeError
err
=>
CorpusId
->
NgramsType
->
NgramsRepo
->
Cmd
err
Graph
computeGraphAsync
cId
nt
repo
=
do
g
<-
liftIO
newEmptyMVar
_
<-
forkIO
<$>
putMVar
g
<$>
computeGraph
cId
nt
repo
g'
<-
liftIO
$
takeMVar
g
pure
g'
-- TODO use Database Monad only here ?
computeGraph
::
HasNodeError
err
=>
CorpusId
->
NgramsType
->
NgramsRepo
->
Cmd
err
Graph
computeGraph
::
HasNodeError
err
=>
CorpusId
->
NgramsType
->
NgramsRepo
->
Cmd
err
Graph
computeGraph
cId
nt
repo
=
do
lId
<-
defaultList
cId
...
...
@@ -190,12 +202,12 @@ computeGraph cId nt repo = do
lIds
<-
selectNodesWithUsername
NodeList
userMaster
let
ngs
=
filterListWithRoot
GraphTerm
$
mapTermListRoot
[
lId
]
nt
repo
myCooc
<-
inMVarIO
$
Map
.
filter
(
>
1
)
myCooc
<-
Map
.
filter
(
>
1
)
<$>
getCoocByNgrams
(
Diagonal
False
)
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
Map
.
keys
ngs
)
graph
<-
liftIO
$
inMVar
$
cooc2graph
0
myCooc
let
graph
=
cooc2graph
0
myCooc
let
graph'
=
set
graph_metadata
(
Just
metadata
)
graph
pure
graph'
...
...
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