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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
a893dd4c
Commit
a893dd4c
authored
Jul 07, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[list chart] some improvements to list charts
parent
19071e4b
Pipeline
#933
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
31 deletions
+21
-31
HashedResponse.hs
src/Gargantext/API/HashedResponse.hs
+4
-2
Metrics.hs
src/Gargantext/API/Metrics.hs
+17
-29
No files found.
src/Gargantext/API/HashedResponse.hs
View file @
a893dd4c
...
...
@@ -6,7 +6,9 @@ import qualified Data.Digest.Pure.MD5 as DPMD5
import
GHC.Generics
(
Generic
)
import
Protolude
data
HashedResponse
a
=
HashedResponse
{
md5
::
Text
,
value
::
a
}
type
MD5
=
Text
data
HashedResponse
a
=
HashedResponse
{
md5
::
MD5
,
value
::
a
}
deriving
(
Generic
)
instance
ToSchema
a
=>
ToSchema
(
HashedResponse
a
)
...
...
@@ -16,4 +18,4 @@ instance ToJSON a => ToJSON (HashedResponse a) where
constructHashedResponse
::
ToJSON
a
=>
a
->
HashedResponse
a
constructHashedResponse
v
=
HashedResponse
{
md5
=
md5'
,
value
=
v
}
where
md5'
=
show
$
DPMD5
.
md5
$
encode
v
\ No newline at end of file
md5'
=
show
$
DPMD5
.
md5
$
encode
v
src/Gargantext/API/Metrics.hs
View file @
a893dd4c
...
...
@@ -59,7 +59,7 @@ type ScatterAPI = Summary "SepGen IncExc metrics"
Summary
"Scatter MD5"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
Get
'[
J
SON
]
Text
:>
Get
'[
J
SON
]
MD5
scatterApi
::
NodeId
->
GargServer
ScatterAPI
scatterApi
id'
=
getScatter
id'
...
...
@@ -115,11 +115,8 @@ updateScatter' cId maybeListId tabType maybeLimit = do
Just
lid
->
pure
lid
Nothing
->
defaultList
cId
node
<-
getNodeWith
listId
(
Proxy
::
Proxy
HyperdataList
)
let
HyperdataList
{
hd_chart
=
hdc
,
hd_list
=
hdl
,
hd_pie
=
hdp
,
hd_tree
=
hdt
}
=
node
^.
node_hyperdata
_
<-
updateHyperdata
listId
$
HyperdataList
hdc
hdl
hdp
(
Just
$
Metrics
metrics
)
hdt
let
hl
=
node
^.
node_hyperdata
_
<-
updateHyperdata
listId
$
hl
{
hd_scatter
=
Just
$
Metrics
metrics
}
pure
$
Metrics
metrics
...
...
@@ -127,7 +124,7 @@ getScatterMD5 :: FlowCmdM env err m =>
CorpusId
->
Maybe
ListId
->
TabType
->
m
Text
->
m
MD5
getScatterMD5
cId
maybeListId
tabType
=
do
HashedResponse
{
md5
=
md5'
}
<-
getScatter
cId
maybeListId
tabType
Nothing
pure
md5'
...
...
@@ -150,7 +147,7 @@ type ChartApi = Summary " Chart API"
Summary
"Chart MD5"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
Get
'[
J
SON
]
Text
:>
Get
'[
J
SON
]
MD5
chartApi
::
NodeId
->
GargServer
ChartApi
chartApi
id'
=
getChart
id'
...
...
@@ -200,12 +197,9 @@ updateChart' cId maybeListId _tabType _maybeLimit = do
Just
lid
->
pure
lid
Nothing
->
defaultList
cId
node
<-
getNodeWith
listId
(
Proxy
::
Proxy
HyperdataList
)
let
HyperdataList
{
hd_list
=
hdl
,
hd_pie
=
hdp
,
hd_scatter
=
hds
,
hd_tree
=
hdt
}
=
node
^.
node_hyperdata
let
hl
=
node
^.
node_hyperdata
h
<-
histoData
cId
_
<-
updateHyperdata
listId
$
HyperdataList
(
Just
$
ChartMetrics
h
)
hdl
hdp
hds
hdt
_
<-
updateHyperdata
listId
$
hl
{
hd_chart
=
Just
$
ChartMetrics
h
}
pure
$
ChartMetrics
h
...
...
@@ -214,7 +208,7 @@ getChartMD5 :: FlowCmdM env err m =>
CorpusId
->
Maybe
ListId
->
TabType
->
m
Text
->
m
MD5
getChartMD5
cId
maybeListId
tabType
=
do
HashedResponse
{
md5
=
md5'
}
<-
getChart
cId
Nothing
Nothing
maybeListId
tabType
pure
md5'
...
...
@@ -235,7 +229,7 @@ type PieApi = Summary "Pie Chart"
Summary
"Pie MD5"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
Get
'[
J
SON
]
Text
:>
Get
'[
J
SON
]
MD5
pieApi
::
NodeId
->
GargServer
PieApi
pieApi
id'
=
getPie
id'
...
...
@@ -284,13 +278,10 @@ updatePie' cId maybeListId tabType _maybeLimit = do
Just
lid
->
pure
lid
Nothing
->
defaultList
cId
node
<-
getNodeWith
listId
(
Proxy
::
Proxy
HyperdataList
)
let
HyperdataList
{
hd_chart
=
hdc
,
hd_list
=
hdl
,
hd_scatter
=
hds
,
hd_tree
=
hdt
}
=
node
^.
node_hyperdata
let
hl
=
node
^.
node_hyperdata
p
<-
pieData
cId
(
ngramsTypeFromTabType
tabType
)
MapTerm
_
<-
updateHyperdata
listId
$
HyperdataList
hdc
hdl
(
Just
$
ChartMetrics
p
)
hds
hdt
_
<-
updateHyperdata
listId
$
hl
{
hd_pie
=
Just
$
ChartMetrics
p
}
pure
$
ChartMetrics
p
...
...
@@ -298,7 +289,7 @@ getPieMD5 :: FlowCmdM env err m =>
CorpusId
->
Maybe
ListId
->
TabType
->
m
Text
->
m
MD5
getPieMD5
cId
maybeListId
tabType
=
do
HashedResponse
{
md5
=
md5'
}
<-
getPie
cId
Nothing
Nothing
maybeListId
tabType
pure
md5'
...
...
@@ -322,7 +313,7 @@ type TreeApi = Summary " Tree API"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"listType"
ListType
:>
Get
'[
J
SON
]
Text
:>
Get
'[
J
SON
]
MD5
-- Depending on the Type of the Node, we could post
-- New documents for a corpus
...
...
@@ -379,12 +370,9 @@ updateTree' cId maybeListId tabType listType = do
Nothing
->
defaultList
cId
node
<-
getNodeWith
listId
(
Proxy
::
Proxy
HyperdataList
)
let
HyperdataList
{
hd_chart
=
hdc
,
hd_list
=
hdl
,
hd_scatter
=
hds
,
hd_pie
=
hdp
}
=
node
^.
node_hyperdata
let
hl
=
node
^.
node_hyperdata
t
<-
treeData
cId
(
ngramsTypeFromTabType
tabType
)
listType
_
<-
updateHyperdata
listId
$
HyperdataList
hdc
hdl
hdp
hds
(
Just
$
ChartMetrics
t
)
_
<-
updateHyperdata
listId
$
hl
{
hd_tree
=
Just
$
ChartMetrics
t
}
pure
$
ChartMetrics
t
...
...
@@ -393,7 +381,7 @@ getTreeMD5 :: FlowCmdM env err m =>
->
Maybe
ListId
->
TabType
->
ListType
->
m
Text
->
m
MD5
getTreeMD5
cId
maybeListId
tabType
listType
=
do
HashedResponse
{
md5
=
md5'
}
<-
getTree
cId
Nothing
Nothing
maybeListId
tabType
listType
pure
md5'
\ No newline at end of file
pure
md5'
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