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