Commit 686f7f12 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[PHYLO] backend POST/GET ok.

parent d5ce52fe
...@@ -80,7 +80,7 @@ instance MimeRender SVG SVG where ...@@ -80,7 +80,7 @@ instance MimeRender SVG SVG where
type GetPhylo = QueryParam "listId" ListId type GetPhylo = QueryParam "listId" ListId
:> QueryParam "level" Level :> QueryParam "level" Level
:> QueryParam "minSizeBranch" MinSizeBranch :> QueryParam "minSizeBranch" MinSizeBranch
:> QueryParam "filiation" Filiation {- :> QueryParam "filiation" Filiation
:> QueryParam "childs" Bool :> QueryParam "childs" Bool
:> QueryParam "depth" Level :> QueryParam "depth" Level
:> QueryParam "metrics" [Metric] :> QueryParam "metrics" [Metric]
...@@ -93,15 +93,16 @@ type GetPhylo = QueryParam "listId" ListId ...@@ -93,15 +93,16 @@ type GetPhylo = QueryParam "listId" ListId
:> QueryParam "export" ExportMode :> QueryParam "export" ExportMode
:> QueryParam "display" DisplayMode :> QueryParam "display" DisplayMode
:> QueryParam "verbose" Bool :> QueryParam "verbose" Bool
-}
:> Get '[SVG] SVG :> Get '[SVG] SVG
-- | TODO -- | TODO
-- Add real text processing -- Add real text processing
-- Fix Filter parameters -- Fix Filter parameters
getPhylo :: PhyloId -> GargServer GetPhylo getPhylo :: PhyloId -> GargServer GetPhylo
getPhylo phId _lId l msb _f _b _l' _ms _x _y _z _ts _s _o _e _d _b' = do --getPhylo phId _lId l msb _f _b _l' _ms _x _y _z _ts _s _o _e _d _b' = do
getPhylo phId _lId l msb = do
phNode <- getNodePhylo phId phNode <- getNodePhylo phId
let let
level = maybe 1 identity l level = maybe 1 identity l
branc = maybe 2 identity msb branc = maybe 2 identity msb
...@@ -111,19 +112,19 @@ getPhylo phId _lId l msb _f _b _l' _ms _x _y _z _ts _s _o _e _d _b' = do ...@@ -111,19 +112,19 @@ getPhylo phId _lId l msb _f _b _l' _ms _x _y _z _ts _s _o _e _d _b' = do
pure (SVG p) pure (SVG p)
------------------------------------------------------------------------ ------------------------------------------------------------------------
type PostPhylo = QueryParam "listId" ListId type PostPhylo = QueryParam "listId" ListId
:> ReqBody '[JSON] PhyloQueryBuild -- :> ReqBody '[JSON] PhyloQueryBuild
:> (Post '[JSON] NodeId) :> (Post '[JSON] NodeId)
postPhylo :: CorpusId -> UserId -> GargServer PostPhylo postPhylo :: CorpusId -> UserId -> GargServer PostPhylo
postPhylo n userId _lId _q = do postPhylo n userId _lId = do
-- TODO get Reader settings -- TODO get Reader settings
-- s <- ask -- s <- ask
let let
-- _vrs = Just ("1" :: Text) -- _vrs = Just ("1" :: Text)
-- _sft = Just (Software "Gargantext" "4") -- _sft = Just (Software "Gargantext" "4")
-- _prm = initPhyloParam vrs sft (Just q) -- _prm = initPhyloParam vrs sft (Just q)
ph <- flowPhylo n phy <- flowPhylo n
pId <- insertNodes [nodePhyloW (Just "Phylo") (Just $ HyperdataPhylo Nothing (Just ph)) n userId] pId <- insertNodes [nodePhyloW (Just "Phylo") (Just $ HyperdataPhylo Nothing (Just phy)) n userId]
pure $ NodeId (fromIntegral pId) pure $ NodeId (fromIntegral pId)
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
...@@ -18,7 +18,6 @@ Portability : POSIX ...@@ -18,7 +18,6 @@ Portability : POSIX
module Gargantext.Viz.Phylo.Main module Gargantext.Viz.Phylo.Main
where where
import Control.Monad.IO.Class (liftIO)
import Data.GraphViz import Data.GraphViz
import Data.Maybe import Data.Maybe
import Data.Text (Text) import Data.Text (Text)
...@@ -38,7 +37,6 @@ import Gargantext.Viz.Phylo.LevelMaker ...@@ -38,7 +37,6 @@ import Gargantext.Viz.Phylo.LevelMaker
import Gargantext.Viz.Phylo.Tools import Gargantext.Viz.Phylo.Tools
import Gargantext.Viz.Phylo.View.Export import Gargantext.Viz.Phylo.View.Export
import Gargantext.Viz.Phylo.View.ViewMaker -- TODO Just Maker is fine import Gargantext.Viz.Phylo.View.ViewMaker -- TODO Just Maker is fine
import Servant
import qualified Data.ByteString as DB import qualified Data.ByteString as DB
import qualified Data.List as List import qualified Data.List as List
import qualified Data.Map as Map import qualified Data.Map as Map
...@@ -64,7 +62,7 @@ flowPhylo cId = do ...@@ -64,7 +62,7 @@ flowPhylo cId = do
patterns = buildPatterns termList patterns = buildPatterns termList
-- | To filter the Ngrams of a document based on the termList -- | To filter the Ngrams of a document based on the termList
filterTerms :: Patterns -> (Date, Text) -> (Date, [Text]) filterTerms :: Patterns -> (Date, Text) -> (Date, [Text])
filterTerms patterns (y,d) = (y,termsInText patterns d) filterTerms patterns' (y,d) = (y,termsInText patterns' d)
where where
-------------------------------------- --------------------------------------
termsInText :: Patterns -> Text -> [Text] termsInText :: Patterns -> Text -> [Text]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment