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
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
538bede2
Commit
538bede2
authored
Jan 19, 2023
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Node write upload] Add params
parent
3985d942
Pipeline
#3595
failed with stage
in 54 minutes and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
DocumentsFromWriteNodes.hs
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
+15
-4
No files found.
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
View file @
538bede2
...
...
@@ -44,12 +44,21 @@ import Gargantext.Prelude
import
Gargantext.Utils.Jobs
(
serveJobsAPI
)
import
GHC.Generics
(
Generic
)
import
Servant
import
Data.Text
(
Text
)
import
Gargantext.Core.Text.List.Social
(
FlowSocialListWith
)
import
Text.Read
(
readMaybe
)
import
Data.Maybe
(
fromMaybe
)
------------------------------------------------------------------------
type
API
=
Summary
" Documents from Write nodes."
:>
AsyncJobs
JobLog
'[
J
SON
]
Params
JobLog
------------------------------------------------------------------------
newtype
Params
=
Params
{
id
::
Int
}
data
Params
=
Params
{
id
::
Int
,
paragraphs
::
Text
,
lang
::
Lang
,
selection
::
FlowSocialListWith
}
deriving
(
Generic
,
Show
)
instance
FromJSON
Params
where
parseJSON
=
genericParseJSON
defaultOptions
...
...
@@ -71,7 +80,7 @@ documentsFromWriteNodes :: (HasSettings env, FlowCmdM env err m)
->
Params
->
(
JobLog
->
m
()
)
->
m
JobLog
documentsFromWriteNodes
uId
nId
_p
logStatus
=
do
documentsFromWriteNodes
uId
nId
Params
{
selection
,
lang
,
paragraphs
}
logStatus
=
do
let
jobLog
=
JobLog
{
_scst_succeeded
=
Just
1
,
_scst_failed
=
Just
0
,
_scst_remaining
=
Just
1
...
...
@@ -97,12 +106,14 @@ documentsFromWriteNodes uId nId _p logStatus = do
contents
<-
getHyperdataFrameContents
(
node
^.
node_hyperdata
)
pure
(
node
,
contents
)
)
frameWrites
let
paragraphs'
=
readMaybe
$
T
.
unpack
paragraphs
::
Maybe
Int
let
parsedE
=
(
\
(
node
,
contents
)
->
hyperdataDocumentFromFrameWrite
7
(
node
^.
node_hyperdata
,
contents
))
<$>
frameWritesWithContents
let
parsedE
=
(
\
(
node
,
contents
)
->
hyperdataDocumentFromFrameWrite
(
fromMaybe
7
paragraphs'
)
(
node
^.
node_hyperdata
,
contents
))
<$>
frameWritesWithContents
-- TODO hard coded param should be take
let
parsed
=
List
.
concat
$
rights
parsedE
_
<-
flowDataText
(
RootId
(
NodeId
uId
))
(
DataNew
(
Just
$
fromIntegral
$
length
parsed
,
yieldMany
parsed
))
(
Multi
EN
)
cId
Nothing
logStatus
_
<-
flowDataText
(
RootId
(
NodeId
uId
))
(
DataNew
(
Just
$
fromIntegral
$
length
parsed
,
yieldMany
parsed
))
(
Multi
lang
)
cId
(
Just
selection
)
logStatus
pure
$
jobLogSuccess
jobLog
------------------------------------------------------------------------
...
...
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