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
197
Issues
197
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
1f68e162
Commit
1f68e162
authored
Dec 22, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[document] export works now, first version
parent
2c2ac330
Pipeline
#2293
passed with stage
in 72 minutes and 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
5 deletions
+33
-5
Export.hs
src/Gargantext/API/Node/Document/Export.hs
+15
-4
Types.hs
src/Gargantext/API/Node/Document/Export/Types.hs
+13
-1
Client.hs
src/Gargantext/Client.hs
+5
-0
No files found.
src/Gargantext/API/Node/Document/Export.hs
View file @
1f68e162
...
...
@@ -14,12 +14,23 @@ module Gargantext.API.Node.Document.Export
import
Gargantext.API.Node.Document.Export.Types
import
Gargantext.API.Prelude
(
GargNoServer
)
import
Gargantext.Core.Types
-- import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..))
import
Gargantext.Database.Query.Table.Node
(
getDocumentsWithParentId
)
import
Gargantext.Prelude
-- import Servant (Proxy(..))
--------------------------------------------------
-- | Hashes are ordered by Set
getDocuments
::
DocId
->
GargNoServer
[
Document
]
getDocuments
dId
=
do
printDebug
"[getDocuments] dId"
dId
pure
[]
->
GargNoServer
DocumentExport
getDocuments
pId
=
do
printDebug
"[getDocuments] pId"
pId
docs
<-
getDocumentsWithParentId
pId
-- NodeDocument (Proxy :: Proxy HyperdataDocument)
printDebug
"[getDocuments] got docs"
docs
pure
$
DocumentExport
{
_de_documents
=
mapDoc
<$>
docs
,
_de_garg_version
=
""
}
where
mapDoc
d
=
Document
{
_d_document
=
d
,
_d_ngrams
=
Ngrams
{
_ng_ngrams
=
[]
,
_ng_hash
=
""
}
,
_d_hash
=
""
}
src/Gargantext/API/Node/Document/Export/Types.hs
View file @
1f68e162
...
...
@@ -24,6 +24,11 @@ import Servant
-- | Document Export
data
DocumentExport
=
DocumentExport
{
_de_documents
::
[
Document
]
,
_de_garg_version
::
Text
}
deriving
(
Generic
)
data
Document
=
Document
{
_d_document
::
Node
HyperdataDocument
,
_d_ngrams
::
Ngrams
...
...
@@ -37,6 +42,9 @@ data Ngrams =
type
Hash
=
Text
-------
instance
ToSchema
DocumentExport
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_de_"
)
instance
ToSchema
Document
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_d_"
)
...
...
@@ -44,6 +52,9 @@ instance ToSchema Ngrams where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_ng_"
)
-------
instance
ToParamSchema
DocumentExport
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
instance
ToParamSchema
Document
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
...
...
@@ -52,7 +63,8 @@ instance ToParamSchema Ngrams where
--------------------------------------------------
type
API
=
Summary
"Document Export"
:>
"export"
:>
Get
'[
J
SON
]
[
Document
]
:>
Get
'[
J
SON
]
DocumentExport
$
(
deriveJSON
(
unPrefix
"_de_"
)
''
D
ocumentExport
)
$
(
deriveJSON
(
unPrefix
"_d_"
)
''
D
ocument
)
$
(
deriveJSON
(
unPrefix
"_ng_"
)
''
N
grams
)
src/Gargantext/Client.hs
View file @
1f68e162
...
...
@@ -23,6 +23,7 @@ import Gargantext.API.Node
import
Gargantext.API.Node.Contact
import
Gargantext.API.Node.Corpus.Export.Types
import
Gargantext.API.Node.Corpus.New
import
qualified
Gargantext.API.Node.Document.Export.Types
as
DocumentExport
import
Gargantext.API.Node.DocumentsFromWriteNodes
import
Gargantext.API.Node.DocumentUpload
import
Gargantext.API.Node.File
...
...
@@ -357,6 +358,9 @@ killDocumentNgramsTableAsyncJob :: Token -> DocId -> JobID 'Unsafe -> Maybe Limi
pollDocumentNgramsTableAsyncJob
::
Token
->
DocId
->
JobID
'U
n
safe
->
Maybe
Limit
->
Maybe
Offset
->
ClientM
(
JobStatus
'S
a
fe
JobLog
)
waitDocumentNgramsTableAsyncJob
::
Token
->
DocId
->
JobID
'U
n
safe
->
ClientM
(
JobOutput
JobLog
)
-- document export API
getDocumentExport
::
Token
->
DocId
->
ClientM
DocumentExport
.
DocumentExport
-- count api
postCountQuery
::
Token
->
Query
->
ClientM
Counts
...
...
@@ -652,6 +656,7 @@ postAuth
:<|>
killDocumentNgramsTableAsyncJob
:<|>
pollDocumentNgramsTableAsyncJob
:<|>
waitDocumentNgramsTableAsyncJob
:<|>
getDocumentExport
:<|>
postCountQuery
:<|>
getGraphHyperdata
:<|>
postGraphAsync
...
...
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