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
610eabe2
Commit
610eabe2
authored
Jul 23, 2024
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/582-dev-phylo-default-behavior' into dev
parents
520c7701
dd00da1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
Types.hs
src/Gargantext/API/Viz/Types.hs
+2
-2
API.hs
src/Gargantext/Core/Viz/Phylo/API.hs
+16
-11
Tools.hs
src/Gargantext/Core/Viz/Phylo/API/Tools.hs
+4
-0
No files found.
src/Gargantext/API/Viz/Types.hs
View file @
610eabe2
...
...
@@ -36,8 +36,8 @@ instance ToSchema Value where declareNamedSchema _ = declareNamedSchema (Proxy :
-- 'purescript-gargantext' package.
data
PhyloData
=
PhyloData
{
pd_corpusId
::
NodeId
,
pd_listId
::
NodeId
,
pd_data
::
GraphData
,
pd_config
::
PhyloConfig
,
pd_data
::
Maybe
GraphData
,
pd_config
::
Maybe
PhyloConfig
}
deriving
(
Generic
,
Show
,
Eq
)
...
...
src/Gargantext/Core/Viz/Phylo/API.hs
View file @
610eabe2
...
...
@@ -28,7 +28,6 @@ import Gargantext.Core.Types.Phylo (GraphData(..))
import
Gargantext.Core.Viz.LegacyPhylo
hiding
(
Phylo
(
..
))
import
Gargantext.Core.Viz.Phylo
(
PhyloConfig
(
..
),
defaultConfig
,
_phylo_param
,
_phyloParam_config
)
import
Gargantext.Core.Viz.Phylo.API.Tools
import
Gargantext.Core.Viz.Phylo.Example
(
phyloCleopatre
)
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Admin.Types.Node
-- (PhyloId, ListId, CorpusId, UserId, NodeId(..))
import
Gargantext.Database.Query.Table.Node
(
getClosestParentIdByType
,
defaultList
)
...
...
@@ -58,21 +57,27 @@ getPhylo phyloId = Named.GetPhylo $ \lId _level _minSizeBranch -> do
listId
<-
case
lId
of
Nothing
->
defaultList
corpusId
Just
ld
->
pure
ld
(
gd
,
phyloConfig
)
<-
getPhyloDataJson
phyloId
pd
<-
getPhyloDataJson
phyloId
-- printDebug "getPhylo" theData
pure
$
PhyloData
corpusId
listId
gd
phyloConfig
case
pd
of
Nothing
->
pure
$
PhyloData
corpusId
listId
Nothing
Nothing
Just
(
gd
,
phyloConfig
)
->
pure
$
PhyloData
corpusId
listId
(
Just
gd
)
(
Just
phyloConfig
)
getPhyloDataJson
::
PhyloId
->
GargNoServer
(
GraphData
,
PhyloConfig
)
getPhyloDataJson
::
PhyloId
->
GargNoServer
(
Maybe
(
GraphData
,
PhyloConfig
)
)
getPhyloDataJson
phyloId
=
do
maybePhyloData
<-
getPhyloData
phyloId
let
phyloData
=
fromMaybe
phyloCleopatre
maybePhyloData
let
phyloConfig
=
_phyloParam_config
$
_phylo_param
phyloData
phyloJson
<-
liftBase
$
phylo2dot2json
phyloData
case
parseEither
parseJSON
phyloJson
of
Left
err
->
panicTrace
$
T
.
pack
$
"[Gargantext.Core.Viz.Phylo.API] getPhyloDataJson: "
<>
err
Right
gd
->
pure
(
gd
,
phyloConfig
)
phyloData
<-
getPhyloData
phyloId
phyloJson
<-
liftBase
$
maybePhylo2dot2json
phyloData
case
phyloJson
of
Nothing
->
pure
Nothing
Just
pj
->
case
parseEither
parseJSON
pj
of
Left
err
->
panicTrace
$
T
.
pack
$
"[Gargantext.Core.Viz.Phylo.API] getPhyloDataJson: "
<>
err
Right
gd
->
pure
$
Just
(
gd
,
phyloConfig
phyloData
)
where
phyloConfig
phyloData
=
_phyloParam_config
.
_phylo_param
$
fromMaybe
(
panicTrace
"[Gargantext.Core.Viz.Phylo.API] getPhyloDataJson: no phylo data"
)
phyloData
-- getPhyloDataSVG phId _lId l msb = do
...
...
src/Gargantext/Core/Viz/Phylo/API/Tools.hs
View file @
610eabe2
...
...
@@ -69,6 +69,10 @@ savePhylo :: PhyloId -> DBCmd err ()
savePhylo
=
undefined
--------------------------------------------------------------------
maybePhylo2dot2json
::
Maybe
Phylo
->
IO
(
Maybe
Value
)
maybePhylo2dot2json
Nothing
=
pure
Nothing
maybePhylo2dot2json
(
Just
phylo
)
=
Just
<$>
phylo2dot2json
phylo
phylo2dot2json
::
Phylo
->
IO
Value
phylo2dot2json
phylo
=
do
withTempDirectory
"/tmp"
"phylo"
$
\
dirPath
->
do
...
...
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