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
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
gargantext
haskell-gargantext
Commits
c2d21d28
Commit
c2d21d28
authored
Mar 12, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API TEXT Metrics] Chart in Text Tab for metrics scattering.
parent
633d8bcb
Pipeline
#271
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
20 deletions
+9
-20
Metrics.hs
src/Gargantext/API/Metrics.hs
+2
-10
Node.hs
src/Gargantext/API/Node.hs
+7
-10
No files found.
src/Gargantext/API/Metrics.hs
View file @
c2d21d28
...
...
@@ -28,18 +28,10 @@ module Gargantext.API.Metrics
import
Data.Text
(
Text
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Prelude
import
Data.Aeson
(
FromJSON
,
ToJSON
)
import
Gargantext.Text.Metrics
import
Data.Aeson
(
ToJSON
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
import
Gargantext.Core.Types
(
Limit
,
ListType
(
..
))
import
Gargantext.Database.Types.Node
import
Gargantext.Database.Utils
(
Cmd
)
import
Gargantext.API.Ngrams.Tools
-- (groupNodesByNgrams, getCoocByNgrams)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Database.Schema.Node
(
defaultList
)
import
Gargantext.Database.Metrics.NgramsByNode
(
getNodesByNgramsOnlyUser
)
import
Gargantext.Core.Types
(
ListType
(
..
))
import
Data.Swagger
import
qualified
Data.Map
as
Map
data
Metrics
=
Metrics
...
...
src/Gargantext/API/Node.hs
View file @
c2d21d28
...
...
@@ -178,7 +178,7 @@ nodeAPI p uId id
:<|>
favApi
id
:<|>
delDocs
id
:<|>
searchIn
id
:<|>
getMetrics
'
id
:<|>
getMetrics
id
-- Annuaire
-- :<|> upload
-- :<|> query
...
...
@@ -388,15 +388,13 @@ query s = pure s
-------------------------------------------------------------------------------
getMetrics'
=
undefined
type
MetricsAPI
=
Summary
"SepGen IncExc metrics"
:>
QueryParam
"list"
Int
:>
QueryParam
"list"
ListId
:>
QueryParam
"limit"
Int
:>
Get
'[
J
SON
]
Metrics
--getMetrics :: NodeId -> Maybe ListId -> Maybe Limit
-> GargServer MetricsAPI
getMetrics
::
NodeId
->
GargServer
MetricsAPI
getMetrics
cId
maybeListId
maybeLimit
=
do
lId
<-
case
maybeListId
of
Nothing
->
defaultList
cId
...
...
@@ -404,7 +402,7 @@ getMetrics cId maybeListId maybeLimit = do
-- TODO all terms
ngs'
<-
mapTermListRoot
[
lId
]
NgramsTerms
let
ngs
=
filterListWithRoot
GraphTerm
ngs'
let
ngs
=
Map
.
unions
$
map
(
\
t
->
filterListWithRoot
t
ngs'
)
[
GraphTerm
,
StopTerm
,
CandidateTerm
]
myCooc
<-
Map
.
filter
(
>
1
)
<$>
getCoocByNgrams
<$>
groupNodesByNgrams
ngs
...
...
@@ -412,13 +410,12 @@ getMetrics cId maybeListId maybeLimit = do
let
metrics
=
map
(
\
(
Scored
t
s1
s2
)
->
Metric
t
s1
s2
(
listType
t
ngs'
))
$
scored
myCooc
listType
t
m
=
maybe
(
panic
"error"
)
fst
$
Map
.
lookup
t
m
errorMsg
=
"API.Node.metrics: key absent"
listType
t
m
=
maybe
(
panic
errorMsg
)
fst
$
Map
.
lookup
t
m
metricsFiltered
=
case
maybeLimit
of
Nothing
->
metrics
Just
l
->
take
l
metrics
pure
$
Metrics
metricsFiltered
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