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
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
Christian Merten
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
Changes
3
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
...
@@ -14,12 +14,23 @@ module Gargantext.API.Node.Document.Export
import
Gargantext.API.Node.Document.Export.Types
import
Gargantext.API.Node.Document.Export.Types
import
Gargantext.API.Prelude
(
GargNoServer
)
import
Gargantext.API.Prelude
(
GargNoServer
)
import
Gargantext.Core.Types
import
Gargantext.Core.Types
-- import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..))
import
Gargantext.Database.Query.Table.Node
(
getDocumentsWithParentId
)
import
Gargantext.Prelude
import
Gargantext.Prelude
-- import Servant (Proxy(..))
--------------------------------------------------
--------------------------------------------------
-- | Hashes are ordered by Set
-- | Hashes are ordered by Set
getDocuments
::
DocId
getDocuments
::
DocId
->
GargNoServer
[
Document
]
->
GargNoServer
DocumentExport
getDocuments
dId
=
do
getDocuments
pId
=
do
printDebug
"[getDocuments] dId"
dId
printDebug
"[getDocuments] pId"
pId
pure
[]
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
...
@@ -24,6 +24,11 @@ import Servant
-- | Document Export
-- | Document Export
data
DocumentExport
=
DocumentExport
{
_de_documents
::
[
Document
]
,
_de_garg_version
::
Text
}
deriving
(
Generic
)
data
Document
=
data
Document
=
Document
{
_d_document
::
Node
HyperdataDocument
Document
{
_d_document
::
Node
HyperdataDocument
,
_d_ngrams
::
Ngrams
,
_d_ngrams
::
Ngrams
...
@@ -37,6 +42,9 @@ data Ngrams =
...
@@ -37,6 +42,9 @@ data Ngrams =
type
Hash
=
Text
type
Hash
=
Text
-------
-------
instance
ToSchema
DocumentExport
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_de_"
)
instance
ToSchema
Document
where
instance
ToSchema
Document
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_d_"
)
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_d_"
)
...
@@ -44,6 +52,9 @@ instance ToSchema Ngrams where
...
@@ -44,6 +52,9 @@ instance ToSchema Ngrams where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_ng_"
)
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_ng_"
)
-------
-------
instance
ToParamSchema
DocumentExport
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
instance
ToParamSchema
Document
where
instance
ToParamSchema
Document
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
...
@@ -52,7 +63,8 @@ instance ToParamSchema Ngrams where
...
@@ -52,7 +63,8 @@ instance ToParamSchema Ngrams where
--------------------------------------------------
--------------------------------------------------
type
API
=
Summary
"Document Export"
type
API
=
Summary
"Document Export"
:>
"export"
:>
"export"
:>
Get
'[
J
SON
]
[
Document
]
:>
Get
'[
J
SON
]
DocumentExport
$
(
deriveJSON
(
unPrefix
"_de_"
)
''
D
ocumentExport
)
$
(
deriveJSON
(
unPrefix
"_d_"
)
''
D
ocument
)
$
(
deriveJSON
(
unPrefix
"_d_"
)
''
D
ocument
)
$
(
deriveJSON
(
unPrefix
"_ng_"
)
''
N
grams
)
$
(
deriveJSON
(
unPrefix
"_ng_"
)
''
N
grams
)
src/Gargantext/Client.hs
View file @
1f68e162
...
@@ -23,6 +23,7 @@ import Gargantext.API.Node
...
@@ -23,6 +23,7 @@ import Gargantext.API.Node
import
Gargantext.API.Node.Contact
import
Gargantext.API.Node.Contact
import
Gargantext.API.Node.Corpus.Export.Types
import
Gargantext.API.Node.Corpus.Export.Types
import
Gargantext.API.Node.Corpus.New
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.DocumentsFromWriteNodes
import
Gargantext.API.Node.DocumentUpload
import
Gargantext.API.Node.DocumentUpload
import
Gargantext.API.Node.File
import
Gargantext.API.Node.File
...
@@ -357,6 +358,9 @@ killDocumentNgramsTableAsyncJob :: Token -> DocId -> JobID 'Unsafe -> Maybe Limi
...
@@ -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
)
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
)
waitDocumentNgramsTableAsyncJob
::
Token
->
DocId
->
JobID
'U
n
safe
->
ClientM
(
JobOutput
JobLog
)
-- document export API
getDocumentExport
::
Token
->
DocId
->
ClientM
DocumentExport
.
DocumentExport
-- count api
-- count api
postCountQuery
::
Token
->
Query
->
ClientM
Counts
postCountQuery
::
Token
->
Query
->
ClientM
Counts
...
@@ -652,6 +656,7 @@ postAuth
...
@@ -652,6 +656,7 @@ postAuth
:<|>
killDocumentNgramsTableAsyncJob
:<|>
killDocumentNgramsTableAsyncJob
:<|>
pollDocumentNgramsTableAsyncJob
:<|>
pollDocumentNgramsTableAsyncJob
:<|>
waitDocumentNgramsTableAsyncJob
:<|>
waitDocumentNgramsTableAsyncJob
:<|>
getDocumentExport
:<|>
postCountQuery
:<|>
postCountQuery
:<|>
getGraphHyperdata
:<|>
getGraphHyperdata
:<|>
postGraphAsync
:<|>
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