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
381d49db
Commit
381d49db
authored
Jan 03, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] WIP CSV export work
parent
6078ebf1
Pipeline
#3512
failed with stage
in 49 minutes and 59 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
List.hs
src/Gargantext/API/Ngrams/List.hs
+14
-3
Prelude.hs
src/Gargantext/API/Ngrams/Prelude.hs
+2
-2
No files found.
src/Gargantext/API/Ngrams/List.hs
View file @
381d49db
...
...
@@ -58,13 +58,15 @@ import qualified Data.Map as Map
import
qualified
Data.Set
as
Set
import
qualified
Data.Text
as
Text
import
qualified
Data.Vector
as
Vec
import
qualified
Gargantext.Utils.Servant
as
GUS
import
qualified
Prelude
import
qualified
Protolude
as
P
------------------------------------------------------------------------
type
GETAPI
=
Summary
"Get List"
:>
"lists"
:>
Capture
"listId"
ListId
:>
Get
'[
J
SON
,
HTML
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
:>
Capture
"fileType"
Text
:>
Get
'[
J
SON
,
GUS
.
CSV
,
HTML
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
getApi
::
GargServer
GETAPI
getApi
=
get
...
...
@@ -95,8 +97,8 @@ csvApi = csvPostAsync
------------------------------------------------------------------------
get
::
HasNodeStory
env
err
m
=>
ListId
->
m
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
get
lId
=
do
ListId
->
Text
->
m
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
get
lId
"JSON"
=
do
lst
<-
getNgramsList
lId
let
(
NodeId
id'
)
=
lId
return
$
addHeader
(
concat
[
"attachment; filename=GarganText_NgramsList-"
...
...
@@ -104,6 +106,15 @@ get lId = do
,
".json"
]
)
lst
get
lId
"CSV"
=
do
lst
<-
getNgramsList
lId
let
(
NodeId
id'
)
=
lId
return
$
addHeader
(
concat
[
"attachment; filename=GarganText_NgramsList-"
,
pack
$
show
id'
,
".csv"
]
)
lst
get
lId
_
=
get
lId
"JSON"
------------------------------------------------------------------------
-- TODO : purge list
...
...
src/Gargantext/API/Ngrams/Prelude.hs
View file @
381d49db
...
...
@@ -71,10 +71,10 @@ toTermList lt nt nl = toTermList' lt <$> Map.lookup nt nl
children'
=
catMaybes
$
map
(
\
(
t
,
nre
)
->
(,)
<$>
view
nre_root
nre
<*>
Just
(
map
toTerm
$
[
t
]
<*>
Just
(
map
toTerm
$
[
t
]
<>
(
unMSet
$
view
nre_children
nre
)
)
)
children
)
children
------------------------------------------
patchMSet_toList
::
(
Ord
a
,
Hashable
a
)
=>
PatchMSet
a
->
[(
a
,
AddRem
)]
...
...
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