Commit 90af97f8 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into dev-graph-search-in-groups-not-in-labels

parents cafa3ccd 2e5c7242
name: gargantext
version: '0.0.4.4'
version: '0.0.4.5'
synopsis: Search, map, share
description: Please see README.md
category: Data
......
......@@ -285,7 +285,7 @@ updatePie cId maybeListId tabType maybeLimit = do
pure ()
updatePie' :: FlowCmdM env err m =>
CorpusId
CorpusId
-> Maybe ListId
-> TabType
-> Maybe Limit
......
......@@ -42,7 +42,7 @@ instance ToSchema DocumentUpload
instance FromJSON DocumentUpload
where
parseJSON = genericParseJSON
( defaultOptions { sumEncoding = ObjectWithSingleField
( defaultOptions { sumEncoding = ObjectWithSingleField
, fieldLabelModifier = unCapitalize . dropPrefix "_du_"
, omitNothingFields = True
}
......@@ -50,7 +50,7 @@ instance FromJSON DocumentUpload
instance ToJSON DocumentUpload
where
toJSON = genericToJSON
( defaultOptions { sumEncoding = ObjectWithSingleField
( defaultOptions { sumEncoding = ObjectWithSingleField
, fieldLabelModifier = unCapitalize . dropPrefix "_du_"
, omitNothingFields = True
}
......@@ -81,7 +81,6 @@ documentUpload uId nId doc logStatus = do
, _scst_remaining = Just 1
, _scst_events = Just [] }
logStatus jl
mcId <- getClosestParentIdByType' nId NodeCorpus
let cId = case mcId of
Just c -> c
......@@ -89,7 +88,6 @@ documentUpload uId nId doc logStatus = do
(year, month, day) <- liftBase $ getCurrentTime >>= return . toGregorian . utctDay
let nowS = T.pack $ show year <> "-" <> show month <> "-" <> show day
let hd = HyperdataDocument { _hd_bdd = Nothing
, _hd_doi = Nothing
, _hd_url = Nothing
......@@ -109,7 +107,6 @@ documentUpload uId nId doc logStatus = do
, _hd_publication_minute = Nothing
, _hd_publication_second = Nothing
, _hd_language_iso2 = Just $ T.pack $ show EN }
_ <- flowDataText (RootId (NodeId uId)) (DataNew [[hd]]) (Multi EN) cId Nothing
pure $ jobLogSuccess jl
......@@ -23,17 +23,19 @@ import Data.Swagger
import GHC.Generics (Generic)
import Gargantext.API.Admin.Orchestrator.Types (JobLog(..), AsyncJobs)
import Gargantext.API.Admin.Types (HasSettings)
import qualified Gargantext.API.Metrics as Metrics
import Gargantext.API.Ngrams.List (reIndexWith)
import qualified Gargantext.API.Ngrams.Types as NgramsTypes
import Gargantext.API.Prelude (GargServer, simuLogs)
import Gargantext.Core.Methods.Distances (GraphMetric(..))
import Gargantext.Core.Viz.Graph.API (recomputeGraph)
import Gargantext.Database.Query.Table.Node (getNode)
import Gargantext.Database.Schema.Node (node_parent_id)
import Gargantext.Core.Types.Main (ListType(..))
import Gargantext.Database.Schema.Ngrams (NgramsType(NgramsTerms))
import Gargantext.Core.Viz.Graph.API (recomputeGraph)
import Gargantext.Database.Action.Flow.Pairing (pairing)
import Gargantext.Database.Action.Flow.Types (FlowCmdM)
import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Query.Table.Node (getNode)
import Gargantext.Database.Schema.Node (node_parent_id)
import Gargantext.Database.Schema.Ngrams (NgramsType(NgramsTerms))
import Gargantext.Prelude (Ord, Eq, (<$>), ($), liftBase, (.), printDebug, pure, show, cs, (<>), panic)
import qualified Gargantext.Utils.Aeson as GUA
import Prelude (Enum, Bounded, minBound, maxBound)
......@@ -119,6 +121,35 @@ updateNode _uId nid1 (LinkNodeReq nt nid2) logStatus = do
, _scst_events = Just []
}
-- | `Advanced` to update graphs
updateNode _uId lId (UpdateNodeParamsList Advanced) logStatus = do
logStatus JobLog { _scst_succeeded = Just 1
, _scst_failed = Just 0
, _scst_remaining = Just 2
, _scst_events = Just []
}
corpusId <- view node_parent_id <$> getNode lId
logStatus JobLog { _scst_succeeded = Just 2
, _scst_failed = Just 0
, _scst_remaining = Just 1
, _scst_events = Just []
}
_ <- case corpusId of
Just cId -> do
_ <- Metrics.updatePie' cId (Just lId) NgramsTypes.Authors Nothing
_ <- Metrics.updateTree' cId (Just lId) NgramsTypes.Institutes MapTerm
_ <- Metrics.updatePie' cId (Just lId) NgramsTypes.Sources Nothing
pure ()
Nothing -> pure ()
pure JobLog { _scst_succeeded = Just 3
, _scst_failed = Just 0
, _scst_remaining = Just 0
, _scst_events = Just []
}
updateNode _uId lId (UpdateNodeParamsList _mode) logStatus = do
logStatus JobLog { _scst_succeeded = Just 1
, _scst_failed = Just 0
......
......@@ -69,7 +69,11 @@ chartData cId nt lt = do
(_total,mapTerms) <- countNodesByNgramsWith (group dico)
<$> getNodesByNgramsOnlyUser cId (ls' <> ls) nt terms
let (dates, count) = V.unzip $ fmap (\(NgramsTerm t,(d,_)) -> (t, d)) $ V.fromList $ HashMap.toList mapTerms
let (dates, count) = V.unzip $
V.fromList $
List.sortOn snd $
(\(NgramsTerm t,(d,_)) -> (t, d)) <$>
HashMap.toList mapTerms
pure (Histo dates (round <$> count))
......
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