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
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
210b31cf
Commit
210b31cf
authored
Apr 16, 2024
by
mzheng
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commenting DOT export for now
parent
d05e9762
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
23 deletions
+44
-23
Export.hs
src/Gargantext/API/Node/Phylo/Export.hs
+30
-12
Types.hs
src/Gargantext/API/Node/Phylo/Export/Types.hs
+10
-3
Routes.hs
src/Gargantext/API/Routes.hs
+4
-8
No files found.
src/Gargantext/API/Node/Phylo/Export.hs
View file @
210b31cf
...
...
@@ -14,12 +14,16 @@ module Gargantext.API.Node.Phylo.Export
-- import Control.Lens (view)
-- import Data.ByteString.Lazy.Char8 qualified as BSC
-- import Data.Csv (encodeDefaultOrderedByName)
import
Data.Aeson
-- import Debug.Trace qualified as DT
import
Data.Text
qualified
as
T
-- import Data.Text.Encoding qualified as TE
-- import Data.Version (showVersion)
import
Gargantext.API.Node.Phylo.Export.Types
import
Gargantext.API.Prelude
(
GargNoServer
,
GargServer
)
-- import Gargantext.Core (toDBid)
import
Gargantext.Core.Viz.Phylo.API.Tools
import
Gargantext.Core.Viz.Phylo.Example
(
phyloCleopatre
)
import
Gargantext.Database.Admin.Types.Node
(
PhyloId
,
NodeId
,)
-- NodeType(..))
-- import Gargantext.Database.Query.Facet (runViewDocuments, Facet(..))
-- import Gargantext.Database.Query.Table.Node (getClosestParentIdByType)
...
...
@@ -33,22 +37,36 @@ api :: NodeId
-- ^ The ID of the target user
->
PhyloId
->
GargServer
API
api
userNodeId
dId
=
get
Test
userNodeId
dId
:<|>
getTest2
userNodeId
dId
api
userNodeId
dId
=
get
Phylo
userNodeId
dId
--
:<|> getTest2 userNodeId dId
getTest
::
NodeId
-- ^ The ID of the target user
->
PhyloId
->
GargNoServer
(
Headers
'[
H
eader
"Content-Disposition"
T
.
Text
]
User
)
getTest
_
pId
=
pure
$
addHeader
(
T
.
concat
[
"attachment; filename="
getPhylo
::
NodeId
-- ^ The ID of the target user
->
PhyloId
->
GargNoServer
(
Headers
'[
H
eader
"Content-Disposition"
T
.
Text
]
Value
)
getPhylo
_
pId
=
do
maybePhyloData
<-
getPhyloData
pId
let
phyloData
=
fromMaybe
phyloCleopatre
maybePhyloData
phyloJson
<-
liftBase
$
phylo2dot2json
phyloData
pure
$
addHeader
(
T
.
concat
[
"attachment; filename="
,
"GarganText_Phylo-"
,
T
.
pack
(
show
pId
)
,
".json"
])
User
{
_us_name
=
"test"
,
_us_age
=
80
,
_us_email
=
"mail"
}
phyloJson
-- getTest :: NodeId
-- -- ^ The ID of the target user
-- -> PhyloId
-- -> GargNoServer (Headers '[Header "Content-Disposition" T.Text] User)
-- getTest _ pId = pure $ addHeader (T.concat [ "attachment; filename="
-- , "GarganText_Phylo-"
-- , T.pack (show pId)
-- , ".json" ])
-- User {
-- _us_name = "test"
-- , _us_age = 80
-- , _us_email = "mail"
-- }
getTest2
::
NodeId
-- ^ The ID of the target user
...
...
src/Gargantext/API/Node/Phylo/Export/Types.hs
View file @
210b31cf
...
...
@@ -13,7 +13,7 @@ Portability : POSIX
module
Gargantext.API.Node.Phylo.Export.Types
where
import
Data.Aeson
(
ToJSON
,
encode
)
import
Data.Aeson
(
ToJSON
,
Value
,
encode
)
import
Data.Aeson.TH
(
deriveJSON
)
-- import Data.Csv (DefaultOrdered(..), ToNamedRecord(..), (.=), header, namedRecord)
import
Data.Swagger
(
genericDeclareNamedSchema
,
ToParamSchema
(
..
),
ToSchema
(
..
)
)
...
...
@@ -98,14 +98,21 @@ instance ToParamSchema Phylo where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
--------------------------------------------------
type
API
=
Summary
"Phylo Export"
type
API
Test
=
Summary
"Phylo Export"
:>
"export"
:>
(
"json"
:>
Get
'[
J
SON
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
User
)
:>
Get
'[
J
SON
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Value
)
:<|>
"dot"
:>
Get
'[
J
SON
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
User
)
)
type
API
=
Summary
"Phylo Export"
:>
"export"
:>
(
"json"
:>
Get
'[
J
SON
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Value
)
)
data
User
=
User
{
_us_name
::
Text
,
_us_age
::
Int
...
...
src/Gargantext/API/Routes.hs
View file @
210b31cf
...
...
@@ -183,17 +183,9 @@ type GargPrivateAPI' =
:<|>
"texts"
:>
Capture
"node_id"
DocId
:>
DocumentExport
.
API
-- :<|> "phylo" :> Capture "node_id" DocId
-- :> DocumentExport.API
:<|>
"phylo"
:>
Capture
"node_id"
DocId
:>
PhyloExport
.
API
-- :<|> "phylo" :> Capture "phylo_id" PhyloId
-- :> Capture "action" Text
-- :> Capture "format" Text
-- :> Raw
-- :<|> "counts" :> Stream GET NewLineFraming '[JSON] Count :> CountAPI
-- TODO-SECURITY
:<|>
"count"
:>
Summary
"Count endpoint"
...
...
@@ -209,6 +201,10 @@ type GargPrivateAPI' =
:>
Capture
"graph_id"
NodeId
:>
GraphAPI
-- :<|> "phylo" :> Summary "Phylo endpoint"
-- :> Capture "pylo_id" NodeId
-- :>
-- TODO move to NodeAPI?
-- Tree endpoint
:<|>
"tree"
:>
Summary
"Tree endpoint"
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
5660aec0
·
Oct 08, 2024
mentioned in commit
5660aec0
mentioned in commit 5660aec07ec5a0a0a5468f440092c1a8f57a864e
Toggle commit list
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