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
41cf1ee9
Commit
41cf1ee9
authored
Mar 19, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FLOW] Instances of HyperdataDocument + Grand Debat imports.
parent
6a45919d
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
184 additions
and
77 deletions
+184
-77
package.yaml
package.yaml
+1
-0
Facet.hs
src/Gargantext/Database/Facet.hs
+1
-1
Flow.hs
src/Gargantext/Database/Flow.hs
+3
-3
Node.hs
src/Gargantext/Database/Types/Node.hs
+81
-69
GrandDebat.hs
src/Gargantext/Text/Parsers/GrandDebat.hs
+98
-0
WOS.hs
src/Gargantext/Text/Parsers/WOS.hs
+0
-4
No files found.
package.yaml
View file @
41cf1ee9
...
...
@@ -59,6 +59,7 @@ library:
-
Gargantext.Text.Parsers.Date
-
Gargantext.Text.Parsers.Wikimedia
-
Gargantext.Text.Parsers.WOS
-
Gargantext.Text.Parsers.GrandDebat
-
Gargantext.Text.Search
-
Gargantext.Text.Terms
-
Gargantext.Text.Terms.Stop
...
...
src/Gargantext/Database/Facet.hs
View file @
41cf1ee9
...
...
@@ -148,7 +148,7 @@ instance Arbitrary FacetDoc where
|
id'
<-
[
1
..
10
]
,
year
<-
[
1990
..
2000
]
,
t
<-
[
"title"
,
"another title"
]
,
hp
<-
h
yperdataDocuments
,
hp
<-
arbitraryH
yperdataDocuments
,
fav
<-
[
True
,
False
]
,
ngramCount
<-
[
3
..
100
]
]
...
...
src/Gargantext/Database/Flow.hs
View file @
41cf1ee9
...
...
@@ -80,10 +80,10 @@ flowCorpus :: FlowCmdM env ServantErr m
=>
Username
->
CorpusName
->
TermType
Lang
->
FileFormat
->
FilePath
->
m
CorpusId
flowCorpus
u
cn
la
ff
fp
=
liftIO
(
parseDocs
ff
fp
)
>>=
\
docs
->
flowCorpus'
u
cn
la
docs
flowCorpus'
::
FlowCmdM
env
ServantErr
m
=>
Username
->
CorpusName
->
TermType
Lang
->
[
HyperdataDocument
]
->
m
CorpusId
flowCorpus'
::
(
FlowCmdM
env
ServantErr
m
,
ToHyperdataDocument
a
)
=>
Username
->
CorpusName
->
TermType
Lang
->
[
a
]
->
m
CorpusId
flowCorpus'
u
cn
la
docs
=
do
ids
<-
flowCorpusMaster
la
docs
ids
<-
flowCorpusMaster
la
(
map
toHyperdataDocument
docs
)
flowCorpusUser
u
cn
ids
...
...
src/Gargantext/Database/Types/Node.hs
View file @
41cf1ee9
This diff is collapsed.
Click to expand it.
src/Gargantext/Text/Parsers/GrandDebat.hs
0 → 100644
View file @
41cf1ee9
{-|
Module : Gargantext.Text.Parsers.GrandDebat
Description : Grand Debat Types
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
TODO: create a separate Lib.
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
module
Gargantext.Text.Parsers.GrandDebat
where
import
GHC.IO
(
FilePath
)
import
Data.Aeson
(
ToJSON
,
FromJSON
,
decode
)
import
Data.Maybe
(
Maybe
(),
maybe
)
import
Data.Text
(
Text
)
import
qualified
Data.Text
as
Text
import
qualified
Data.ByteString.Lazy
as
DBL
import
GHC.Generics
(
Generic
)
import
Gargantext.Prelude
import
Gargantext.Database.Types.Node
import
Gargantext.Core
(
Lang
(
..
))
data
GrandDebatReference
=
GrandDebatReference
{
id
::
!
(
Maybe
Text
)
,
reference
::
!
(
Maybe
Text
)
,
title
::
!
(
Maybe
Text
)
,
createdAt
::
!
(
Maybe
Text
)
,
publishedAt
::
!
(
Maybe
Text
)
,
updatedAt
::
!
(
Maybe
Text
)
,
trashed
::
!
(
Maybe
Bool
)
,
trashedStatus
::
!
(
Maybe
Text
)
,
authorId
::
!
(
Maybe
Text
)
,
authorType
::
!
(
Maybe
Text
)
,
authorZipCode
::
!
(
Maybe
Text
)
,
responses
::
!
(
Maybe
[
GrandDebatResponse
])
}
deriving
(
Show
,
Generic
)
data
GrandDebatResponse
=
GrandDebatResponse
{
questionId
::
!
(
Maybe
Text
)
,
questionTitle
::
!
(
Maybe
Text
)
,
value
::
!
(
Maybe
Text
)
,
formattedValue
::
!
(
Maybe
Text
)
}
deriving
(
Show
,
Generic
)
instance
FromJSON
GrandDebatResponse
instance
FromJSON
GrandDebatReference
instance
ToJSON
GrandDebatResponse
instance
ToJSON
GrandDebatReference
instance
ToHyperdataDocument
GrandDebatReference
where
toHyperdataDocument
(
GrandDebatReference
id'
_ref
title'
_createdAt'
publishedAt'
_updatedAt
_trashed
_trashedStatus
_authorId
authorType'
authorZipCode'
responses'
)
=
HyperdataDocument
(
Just
"GrandDebat"
)
id'
Nothing
Nothing
Nothing
Nothing
title'
authorType'
authorZipCode'
authorZipCode'
(
toAbstract
<$>
responses'
)
publishedAt'
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
(
Just
$
Text
.
pack
$
show
FR
)
where
toAbstract
=
(
Text
.
intercalate
" . "
)
.
(
map
toSentence
)
toSentence
(
GrandDebatResponse
_id
_qtitle
_qvalue
r
)
=
case
r
of
Nothing
->
""
Just
r'
->
case
Text
.
length
r'
>
10
of
True
->
r'
False
->
""
class
ReadFile
a
where
readFile
::
FilePath
->
IO
a
instance
ReadFile
[
GrandDebatReference
]
where
readFile
fp
=
maybe
[]
identity
<$>
decode
<$>
DBL
.
readFile
fp
src/Gargantext/Text/Parsers/WOS.hs
View file @
41cf1ee9
...
...
@@ -31,10 +31,6 @@ import Data.ByteString.Char8 (pack)
import
Control.Applicative
-------------------------------------------------------------
-- | wosParser parses ISI format from
-- Web Of Science Database
wosParser
::
Parser
[[(
ByteString
,
ByteString
)]]
...
...
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