Commit f9c5e6da authored by Alexandre Delanoë's avatar Alexandre Delanoë

[GRAPH] ok but empty.

parent f1e97bd1
...@@ -250,34 +250,28 @@ type ChartApi = Summary " Chart API" ...@@ -250,34 +250,28 @@ type ChartApi = Summary " Chart API"
type GraphAPI = Get '[JSON] Graph type GraphAPI = Get '[JSON] Graph
graphAPI :: NodeId -> GargServer GraphAPI graphAPI :: NodeId -> GargServer GraphAPI
graphAPI cId = undefined graphAPI nId = do
--graphAPI' :: NodeId -> GargServer GraphAPI nodeGraph <- getNode nId HyperdataGraph
graphAPI' :: NodeId -> Cmd err Graph -- GargServer GraphAPI
graphAPI' cId = do
nodeGraph <- getNode cId HyperdataGraph
let title = "IMT - Scientific publications - 1982-2017 - English" let title = "IMT - Scientific publications - 1982-2017 - English"
let metadata = GraphMetadata title [maybe 0 identity $ _node_parentId nodeGraph] [ LegendField 6 "#FFF" "Data processing" let metadata = GraphMetadata title [maybe 0 identity $ _node_parentId nodeGraph]
, LegendField 7 "#FFF" "Networks" [ LegendField 6 "#FFF" "Data processing"
, LegendField 1 "#FFF" "Material science" , LegendField 7 "#FFF" "Networks"
, LegendField 5 "#FFF" "Energy / Environment" , LegendField 1 "#FFF" "Material science"
] , LegendField 5 "#FFF" "Energy / Environment"
-- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10]) ]
lId <- defaultList cId -- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10])
cooc <- getCoocByDocDev cId lId myCooc <- getCoocByDocDev nId <$> defaultList (maybe (panic "no parentId") identity $ _node_parentId nodeGraph)
myCooc' <- myCooc
graph <- set graph_metadata (Just metadata) --{-
liftIO $ set graph_metadata (Just metadata)
<$> cooc2graph myCooc'
-- <$> maybe defaultGraph identity -- <$> maybe defaultGraph identity
<$> cooc2graph cooc -- <$> readGraphFromJson "purescript-gargantext/dist/examples/imtNew.json"
{-
<$> readGraphFromJson "purescript-gargantext/dist/examples/imtNew.json"
-}
pure graph
-- t <- textFlow (Mono EN) (Contexts contextText) -- t <- textFlow (Mono EN) (Contexts contextText)
-- liftIO $ liftIO $ pure $ maybe t identity maybeGraph -- liftIO $ liftIO $ pure $ maybe t identity maybeGraph
-- TODO what do we get about the node? to replace contextText -- TODO what do we get about the node? to replace contextText
......
...@@ -105,7 +105,7 @@ flowCorpus' :: HasNodeError err ...@@ -105,7 +105,7 @@ flowCorpus' :: HasNodeError err
flowCorpus' NodeCorpus hyperdataDocuments (ids,masterUserId,masterCorpusId, userId,userCorpusId) = do flowCorpus' NodeCorpus hyperdataDocuments (ids,masterUserId,masterCorpusId, userId,userCorpusId) = do
-------------------------------------------------- --------------------------------------------------
-- List Ngrams Flow -- List Ngrams Flow
userListId <- flowListUser userId userCorpusId 300 userListId <- flowListUser userId userCorpusId 3000
printDebug "Working on User ListId : " userListId printDebug "Working on User ListId : " userListId
let documentsWithId = mergeData (toInserted ids) (toInsert hyperdataDocuments) let documentsWithId = mergeData (toInserted ids) (toInsert hyperdataDocuments)
......
...@@ -11,9 +11,10 @@ Count Ngrams by Context ...@@ -11,9 +11,10 @@ Count Ngrams by Context
-} -}
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
module Gargantext.Database.Metrics.Count where module Gargantext.Database.Metrics.Count where
...@@ -30,7 +31,7 @@ import Gargantext.Database.Types.Node (ListId, CorpusId) ...@@ -30,7 +31,7 @@ import Gargantext.Database.Types.Node (ListId, CorpusId)
import Gargantext.Database.Types.Node (NodeId) import Gargantext.Database.Types.Node (NodeId)
import Gargantext.Database.Schema.Ngrams (NgramsId, NgramsType(..), ngramsTypeId, Ngrams(..), NgramsIndexed(..), ngrams, ngramsTerms) import Gargantext.Database.Schema.Ngrams (NgramsId, NgramsType(..), ngramsTypeId, Ngrams(..), NgramsIndexed(..), ngrams, ngramsTerms)
getCoocByDocDev :: HasNodeError err => CorpusId -> ListId -> Cmd err (Map ([Text], [Text]) Coocs) getCoocByDocDev :: HasNodeError err => CorpusId -> ListId -> Cmd err (Map ([Text], [Text]) Int)
getCoocByDocDev cId lId = coocOn (\n-> [ view ( ngrams . ngramsTerms) n]) <$> getNgramsByDoc cId lId getCoocByDocDev cId lId = coocOn (\n-> [ view ( ngrams . ngramsTerms) n]) <$> getNgramsByDoc cId lId
getCoocByDoc :: CorpusId -> ListId -> Cmd err (Map (NgramsIndexed, NgramsIndexed) Coocs) getCoocByDoc :: CorpusId -> ListId -> Cmd err (Map (NgramsIndexed, NgramsIndexed) Coocs)
......
...@@ -14,6 +14,7 @@ TFICF, generalization of TFIDF ...@@ -14,6 +14,7 @@ TFICF, generalization of TFIDF
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
module Gargantext.Database.Metrics.TFICF where module Gargantext.Database.Metrics.TFICF where
......
...@@ -35,7 +35,6 @@ import Database.PostgreSQL.Simple (Connection) ...@@ -35,7 +35,6 @@ import Database.PostgreSQL.Simple (Connection)
import Gargantext.Database.Schema.Node import Gargantext.Database.Schema.Node
import Gargantext.Database.Types.Node import Gargantext.Database.Types.Node
import Gargantext.Database.Utils (Cmd, mkCmd)
import Gargantext.Core (Lang) import Gargantext.Core (Lang)
import Gargantext.Prelude import Gargantext.Prelude
......
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