Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
33a3fc84
Commit
33a3fc84
authored
Oct 30, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API][NGRAMS] NgramsId changes and Patch added.
parent
4cd8e9d9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
14 deletions
+39
-14
package.yaml
package.yaml
+1
-0
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+30
-9
User.hs
src/Gargantext/Database/User.hs
+4
-2
Phylo.hs
src/Gargantext/Viz/Phylo.hs
+3
-3
stack.yaml
stack.yaml
+1
-0
No files found.
package.yaml
View file @
33a3fc84
...
...
@@ -115,6 +115,7 @@ library:
-
opaleye
-
pandoc
-
parsec
-
patches-map
-
path
-
path-io
-
postgresql-simple
...
...
src/Gargantext/API/Ngrams.hs
View file @
33a3fc84
...
...
@@ -14,9 +14,7 @@ Ngrams API
-- post :: update NodeNodeNgrams
-- group ngrams
get ngrams filtered by NgramsType
add get
-}
...
...
@@ -30,21 +28,28 @@ add get
module
Gargantext.API.Ngrams
where
import
GHC.Generics
(
Generic
)
import
Data.Aeson
(
FromJSON
,
ToJSON
)
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Map.Strict
(
Map
)
import
Data.Map.Strict.Patch
(
Patch
,
apply
,
transformWith
)
import
Data.Text
(
Text
)
import
Gargantext.Prelude
import
Data.Set
(
Set
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Database.Ngram
(
NgramsId
)
import
Gargantext.Database.User
(
UserId
)
import
Gargantext.Core.Types
(
ListType
(
..
))
import
Gargantext.Core.Types.Main
(
Tree
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.
Core.Types
(
ListType
(
..
))
import
Gargantext.
Prelude
data
NgramsElement
=
NgramsElement
{
_n
n_ngrams
::
Tex
t
,
_n
n_id
::
In
t
,
_n
n
_list
::
ListType
NgramsElement
{
_n
e_id
::
In
t
,
_n
e_ngrams
::
Tex
t
,
_n
e
_list
::
ListType
}
$
(
deriveJSON
(
unPrefix
"_n
n
_"
)
''
N
gramsElement
)
$
(
deriveJSON
(
unPrefix
"_n
e
_"
)
''
N
gramsElement
)
data
NgramsTable
=
NgramsTable
{
_ngramsTable
::
[
Tree
NgramsElement
]
}
...
...
@@ -56,6 +61,22 @@ instance FromJSON NgramsTable
instance
FromJSON
(
Tree
NgramsElement
)
-- TODO
instance
ToJSON
(
Tree
NgramsElement
)
--data Action = InGroup NgramsId NgramsId
-- | OutGroup NgramsId NgramsId
-- | SetListType NgramsId ListType
data
NgramsPatch
=
NgramsPatch
{
list_types
::
Map
UserId
ListType
,
add_children
::
Set
NgramsId
,
rem_children
::
Set
NgramsId
}
data
Patch
=
Map
NgramsId
NgramsPatch
-- applyPatchBack :: Patch -> IO Patch
-- isEmptyPatch = Map.all (\x -> Set.isEmpty (add_children x) && Set.isEmpty ... )
-------------------------------------------------------------------
-------------------------------------------------------------------
-------------------------------------------------------------------
src/Gargantext/Database/User.hs
View file @
33a3fc84
...
...
@@ -31,10 +31,12 @@ import Data.Profunctor.Product.TH (makeAdaptorAndInstance)
import
Data.Text
(
Text
)
import
Data.Time
(
UTCTime
)
import
GHC.Show
(
Show
(
..
))
import
Gargantext.Database.Node
(
Cmd
(
..
),
mkCmd
,
runCmd
)
import
Gargantext.Prelude
import
Opaleye
import
Gargantext.Prelude
import
Gargantext.Database.Node
(
Cmd
(
..
),
mkCmd
,
runCmd
)
------------------------------------------------------------------------
type
UserId
=
Int
data
UserLight
=
UserLight
{
userLight_id
::
Int
...
...
src/Gargantext/Viz/Phylo.hs
View file @
33a3fc84
...
...
@@ -33,6 +33,7 @@ import Data.Maybe (Maybe)
import
Data.Text
(
Text
)
import
Data.Time.Clock.POSIX
(
POSIXTime
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Database.Ngram
(
NgramsId
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Prelude
...
...
@@ -53,8 +54,7 @@ type Start = POSIXTime
type
End
=
POSIXTime
-- | Indexed Ngram
type
Ngram
=
(
NgramId
,
Text
)
type
NgramId
=
Int
type
Ngram
=
(
NgramsId
,
Text
)
-- | PhyloStep : steps of phylomemy on temporal axis
-- Period: tuple (start date, end date) of the step of the phylomemy
...
...
@@ -89,7 +89,7 @@ type PhyloLevelId = (PhyloPeriodId, Int)
data
PhyloGroup
=
PhyloGroup
{
_phylo_GroupId
::
PhyloGroupId
,
_phylo_GroupLabel
::
Maybe
Text
,
_phylo_GroupNgrams
::
[
NgramId
]
,
_phylo_GroupNgrams
::
[
Ngram
s
Id
]
,
_phylo_GroupPeriodParents
::
[
Edge
]
,
_phylo_GroupPeriodChilds
::
[
Edge
]
...
...
stack.yaml
View file @
33a3fc84
...
...
@@ -5,6 +5,7 @@ packages:
-
.
-
'
deps/servant-job'
-
'
deps/clustering-louvain'
-
'
deps/patches-map'
#- 'deps/imt-api-client'
allow-newer
:
true
...
...
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