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
ccdec52e
Commit
ccdec52e
authored
Jan 12, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[document-export] some code cleanup
parent
cc2be9dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
16 deletions
+0
-16
Export.hs
src/Gargantext/API/Node/Document/Export.hs
+0
-16
No files found.
src/Gargantext/API/Node/Document/Export.hs
View file @
ccdec52e
...
...
@@ -14,9 +14,7 @@ module Gargantext.API.Node.Document.Export
import
qualified
Data.ByteString.Lazy.Char8
as
BSC
import
Data.Csv
(
encodeDefaultOrderedByName
)
import
qualified
Data.Text
as
T
--import qualified Data.Text.Conversions as TC
import
qualified
Data.Text.Encoding
as
TE
import
qualified
Data.Text.IO
as
T
import
Data.Version
(
showVersion
)
import
Gargantext.API.Node.Document.Export.Types
import
Gargantext.API.Prelude
(
GargNoServer
,
GargServer
)
...
...
@@ -40,14 +38,9 @@ getDocumentsJSON :: UserId
->
DocId
->
GargNoServer
DocumentExport
getDocumentsJSON
uId
pId
=
do
printDebug
"[getDocuments] pId"
pId
mcId
<-
getClosestParentIdByType
pId
NodeCorpus
let
cId
=
maybe
(
panic
"[G.A.N.D.Export] Node has no parent"
)
identity
mcId
printDebug
"[getDocuments] cId"
cId
--docs <- getDocumentsWithParentId cId -- NodeDocument (Proxy :: Proxy HyperdataDocument)
docs
<-
runViewDocuments
cId
False
Nothing
Nothing
Nothing
Nothing
--printDebug "[getDocuments] got docs" docs
--de_docs <- mapM mapFacetDoc docs
pure
$
DocumentExport
{
_de_documents
=
mapFacetDoc
<$>
docs
,
_de_garg_version
=
T
.
pack
$
showVersion
PG
.
version
}
where
...
...
@@ -74,16 +67,7 @@ getDocumentsCSV :: UserId
->
GargNoServer
T
.
Text
-- [Document]
getDocumentsCSV
uId
pId
=
do
DocumentExport
{
_de_documents
}
<-
getDocumentsJSON
uId
pId
printDebug
"[getDocumentsCSV] documents"
$
_d_document
<$>
head
_de_documents
--let ret = T.pack $ BSC.unpack $ encodeDefaultOrderedByName _de_documents
--let ret = TC.convertText $ encodeDefaultOrderedByName _de_documents
let
ret
=
TE
.
decodeUtf8
$
BSC
.
toStrict
$
encodeDefaultOrderedByName
_de_documents
--printDebug "[getDocumentsCSV] ret" ret
liftBase
$
T
.
writeFile
"/tmp/out.csv"
ret
--liftBase $ BSC.writeFile "/tmp/out.csv" $ encodeDefaultOrderedByName _de_documents
pure
ret
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