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
5a43e4bd
Commit
5a43e4bd
authored
Jul 15, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] uniforming hyperdata fields name
parent
51641162
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
175 additions
and
142 deletions
+175
-142
Main.hs
bin/gargantext-adaptative-phylo/Main.hs
+6
-6
Main.hs
bin/gargantext-phylo/Main.hs
+5
-5
Export.hs
src/Gargantext/API/Node/Corpus/Export.hs
+1
-1
Types.hs
src/Gargantext/Core/Flow/Types.hs
+1
-1
Flow.hs
src/Gargantext/Database/Action/Flow.hs
+5
-5
Learn.hs
src/Gargantext/Database/Action/Learn.hs
+2
-2
Hyperdata.hs
src/Gargantext/Database/Admin/Types/Hyperdata.hs
+2
-0
Corpus.hs
src/Gargantext/Database/Admin/Types/Hyperdata/Corpus.hs
+28
-57
Document.hs
src/Gargantext/Database/Admin/Types/Hyperdata/Document.hs
+42
-42
Frame.hs
src/Gargantext/Database/Admin/Types/Hyperdata/Frame.hs
+61
-0
Node.hs
src/Gargantext/Database/Query/Table/Node.hs
+3
-4
Insert.hs
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
+9
-9
NodeNode.hs
src/Gargantext/Database/Query/Table/NodeNode.hs
+1
-1
CSV.hs
src/Gargantext/Text/Corpus/Parsers/CSV.hs
+7
-7
Main.hs
src/Gargantext/Viz/Phylo/Main.hs
+2
-2
No files found.
bin/gargantext-adaptative-phylo/Main.hs
View file @
5a43e4bd
...
@@ -89,16 +89,16 @@ wosToCorpus :: Int -> FilePath -> IO ([(Int,Text)])
...
@@ -89,16 +89,16 @@ wosToCorpus :: Int -> FilePath -> IO ([(Int,Text)])
wosToCorpus
limit
path
=
do
wosToCorpus
limit
path
=
do
files
<-
getFilesFromPath
path
files
<-
getFilesFromPath
path
take
limit
take
limit
<$>
map
(
\
d
->
let
date'
=
fromJust
$
_h
yperdataDocument
_publication_year
d
<$>
map
(
\
d
->
let
date'
=
fromJust
$
_h
d
_publication_year
d
title
=
fromJust
$
_h
yperdataDocument
_title
d
title
=
fromJust
$
_h
d
_title
d
abstr
=
if
(
isJust
$
_h
yperdataDocument
_abstract
d
)
abstr
=
if
(
isJust
$
_h
d
_abstract
d
)
then
fromJust
$
_h
yperdataDocument
_abstract
d
then
fromJust
$
_h
d
_abstract
d
else
""
else
""
in
(
date'
,
title
<>
" "
<>
abstr
))
in
(
date'
,
title
<>
" "
<>
abstr
))
<$>
concat
<$>
concat
<$>
mapConcurrently
(
\
file
->
<$>
mapConcurrently
(
\
file
->
filter
(
\
d
->
(
isJust
$
_h
yperdataDocument
_publication_year
d
)
filter
(
\
d
->
(
isJust
$
_h
d
_publication_year
d
)
&&
(
isJust
$
_h
yperdataDocument
_title
d
))
&&
(
isJust
$
_h
d
_title
d
))
<$>
parseFile
WOS
(
path
<>
file
)
)
files
<$>
parseFile
WOS
(
path
<>
file
)
)
files
...
...
bin/gargantext-phylo/Main.hs
View file @
5a43e4bd
...
@@ -132,11 +132,11 @@ csvToCorpus limit csv = DV.toList
...
@@ -132,11 +132,11 @@ csvToCorpus limit csv = DV.toList
-- | To transform a Wos nfile into a readable corpus
-- | To transform a Wos nfile into a readable corpus
wosToCorpus
::
Limit
->
CorpusPath
->
IO
([(
Int
,
Text
)])
wosToCorpus
::
Limit
->
CorpusPath
->
IO
([(
Int
,
Text
)])
wosToCorpus
limit
path
=
DL
.
take
limit
wosToCorpus
limit
path
=
DL
.
take
limit
.
map
(
\
d
->
((
fromJust
$
_h
yperdataDocument
_publication_year
d
)
.
map
(
\
d
->
((
fromJust
$
_h
d
_publication_year
d
)
,(
fromJust
$
_h
yperdataDocument_title
d
)
<>
" "
<>
(
fromJust
$
_hyperdataDocument
_abstract
d
)))
,(
fromJust
$
_h
d_title
d
)
<>
" "
<>
(
fromJust
$
_hd
_abstract
d
)))
.
filter
(
\
d
->
(
isJust
$
_h
yperdataDocument
_publication_year
d
)
.
filter
(
\
d
->
(
isJust
$
_h
d
_publication_year
d
)
&&
(
isJust
$
_h
yperdataDocument
_title
d
)
&&
(
isJust
$
_h
d
_title
d
)
&&
(
isJust
$
_h
yperdataDocument
_abstract
d
))
&&
(
isJust
$
_h
d
_abstract
d
))
.
concat
.
concat
<$>
mapConcurrently
(
\
idx
->
parseFile
WOS
(
path
<>
show
(
idx
)
<>
".txt"
))
[
1
..
20
]
<$>
mapConcurrently
(
\
idx
->
parseFile
WOS
(
path
<>
show
(
idx
)
<>
".txt"
))
[
1
..
20
]
...
...
src/Gargantext/API/Node/Corpus/Export.hs
View file @
5a43e4bd
...
@@ -118,7 +118,7 @@ getCorpus cId lId nt' = do
...
@@ -118,7 +118,7 @@ getCorpus cId lId nt' = do
)
ns
ngs
)
ns
ngs
where
where
ng_hash
b
=
sha
$
List
.
foldl
(
\
x
y
->
x
<>
y
)
""
$
List
.
sort
$
Set
.
toList
b
ng_hash
b
=
sha
$
List
.
foldl
(
\
x
y
->
x
<>
y
)
""
$
List
.
sort
$
Set
.
toList
b
d_hash
a
b
=
sha
$
(
fromMaybe
""
(
_h
yperdataDocument
_uniqId
$
_node_hyperdata
a
))
d_hash
a
b
=
sha
$
(
fromMaybe
""
(
_h
d
_uniqId
$
_node_hyperdata
a
))
<>
(
ng_hash
b
)
<>
(
ng_hash
b
)
pure
$
Corpus
(
Map
.
elems
r
)
(
sha
$
List
.
foldl
(
\
a
b
->
a
<>
b
)
""
pure
$
Corpus
(
Map
.
elems
r
)
(
sha
$
List
.
foldl
(
\
a
b
->
a
<>
b
)
""
...
...
src/Gargantext/Core/Flow/Types.hs
View file @
5a43e4bd
...
@@ -32,7 +32,7 @@ class UniqId a
...
@@ -32,7 +32,7 @@ class UniqId a
instance
UniqId
HyperdataDocument
instance
UniqId
HyperdataDocument
where
where
uniqId
=
h
yperdataDocument
_uniqId
uniqId
=
h
d
_uniqId
instance
UniqId
HyperdataContact
instance
UniqId
HyperdataContact
where
where
...
...
src/Gargantext/Database/Action/Flow.hs
View file @
5a43e4bd
...
@@ -347,8 +347,8 @@ instance ExtractNgramsT HyperdataContact
...
@@ -347,8 +347,8 @@ instance ExtractNgramsT HyperdataContact
instance
HasText
HyperdataDocument
instance
HasText
HyperdataDocument
where
where
hasText
h
=
catMaybes
[
_h
yperdataDocument
_title
h
hasText
h
=
catMaybes
[
_h
d
_title
h
,
_h
yperdataDocument
_abstract
h
,
_h
d
_abstract
h
]
]
instance
ExtractNgramsT
HyperdataDocument
instance
ExtractNgramsT
HyperdataDocument
...
@@ -364,15 +364,15 @@ instance ExtractNgramsT HyperdataDocument
...
@@ -364,15 +364,15 @@ instance ExtractNgramsT HyperdataDocument
extractNgramsT'
lang'
doc
=
do
extractNgramsT'
lang'
doc
=
do
let
source
=
text2ngrams
let
source
=
text2ngrams
$
maybe
"Nothing"
identity
$
maybe
"Nothing"
identity
$
_h
yperdataDocument
_source
doc
$
_h
d
_source
doc
institutes
=
map
text2ngrams
institutes
=
map
text2ngrams
$
maybe
[
"Nothing"
]
(
map
toSchoolName
.
(
splitOn
", "
))
$
maybe
[
"Nothing"
]
(
map
toSchoolName
.
(
splitOn
", "
))
$
_h
yperdataDocument
_institutes
doc
$
_h
d
_institutes
doc
authors
=
map
text2ngrams
authors
=
map
text2ngrams
$
maybe
[
"Nothing"
]
(
splitOn
", "
)
$
maybe
[
"Nothing"
]
(
splitOn
", "
)
$
_h
yperdataDocument
_authors
doc
$
_h
d
_authors
doc
terms'
<-
map
text2ngrams
terms'
<-
map
text2ngrams
<$>
map
(
intercalate
" "
.
_terms_label
)
<$>
map
(
intercalate
" "
.
_terms_label
)
...
...
src/Gargantext/Database/Action/Learn.hs
View file @
5a43e4bd
...
@@ -76,8 +76,8 @@ fav2bool ft = if (==) ft IsFav then True else False
...
@@ -76,8 +76,8 @@ fav2bool ft = if (==) ft IsFav then True else False
text
::
FacetDoc
->
Text
text
::
FacetDoc
->
Text
text
(
FacetDoc
_
_
_
h
_
_
)
=
title
<>
""
<>
Text
.
take
100
abstr
text
(
FacetDoc
_
_
_
h
_
_
)
=
title
<>
""
<>
Text
.
take
100
abstr
where
where
title
=
maybe
""
identity
(
_h
yperdataDocument
_title
h
)
title
=
maybe
""
identity
(
_h
d
_title
h
)
abstr
=
maybe
""
identity
(
_h
yperdataDocument
_abstract
h
)
abstr
=
maybe
""
identity
(
_h
d
_abstract
h
)
---------------------------------------------------------------------------
---------------------------------------------------------------------------
...
...
src/Gargantext/Database/Admin/Types/Hyperdata.hs
View file @
5a43e4bd
...
@@ -17,6 +17,7 @@ module Gargantext.Database.Admin.Types.Hyperdata
...
@@ -17,6 +17,7 @@ module Gargantext.Database.Admin.Types.Hyperdata
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Dashboard
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Dashboard
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Document
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Document
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Folder
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Folder
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Frame
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
List
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
List
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Model
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Model
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Prelude
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Prelude
...
@@ -30,6 +31,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Corpus
...
@@ -30,6 +31,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Corpus
import
Gargantext.Database.Admin.Types.Hyperdata.Dashboard
import
Gargantext.Database.Admin.Types.Hyperdata.Dashboard
import
Gargantext.Database.Admin.Types.Hyperdata.Document
import
Gargantext.Database.Admin.Types.Hyperdata.Document
import
Gargantext.Database.Admin.Types.Hyperdata.Folder
import
Gargantext.Database.Admin.Types.Hyperdata.Folder
import
Gargantext.Database.Admin.Types.Hyperdata.Frame
import
Gargantext.Database.Admin.Types.Hyperdata.List
import
Gargantext.Database.Admin.Types.Hyperdata.List
import
Gargantext.Database.Admin.Types.Hyperdata.Model
import
Gargantext.Database.Admin.Types.Hyperdata.Model
import
Gargantext.Database.Admin.Types.Hyperdata.Prelude
(
Hyperdata
)
import
Gargantext.Database.Admin.Types.Hyperdata.Prelude
(
Hyperdata
)
...
...
src/Gargantext/Database/Admin/Types/Hyperdata/Corpus.hs
View file @
5a43e4bd
...
@@ -57,7 +57,6 @@ instance ToSchema CorpusField where
...
@@ -57,7 +57,6 @@ instance ToSchema CorpusField where
&
mapped
.
schema
.
description
?~
"CorpusField"
&
mapped
.
schema
.
description
?~
"CorpusField"
&
mapped
.
schema
.
example
?~
toJSON
defaultCorpusField
&
mapped
.
schema
.
example
?~
toJSON
defaultCorpusField
------------------------------------------------------------------------
------------------------------------------------------------------------
data
HyperdataField
a
=
data
HyperdataField
a
=
HyperdataField
{
_hf_type
::
!
CodeType
HyperdataField
{
_hf_type
::
!
CodeType
...
@@ -89,84 +88,57 @@ instance (Typeable a, ToSchema a) => ToSchema (HyperdataField a) where
...
@@ -89,84 +88,57 @@ instance (Typeable a, ToSchema a) => ToSchema (HyperdataField a) where
data
HyperdataCorpus
=
data
HyperdataCorpus
=
HyperdataCorpus
{
_hc_fields
::
!
[
HyperdataField
CorpusField
]
}
HyperdataCorpus
{
_hc_fields
::
!
[
HyperdataField
CorpusField
]
}
deriving
(
Generic
)
deriving
(
Generic
)
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
instance
Hyperdata
HyperdataCorpus
$
(
deriveJSON
(
unPrefix
"_hc_"
)
''
H
yperdataCorpus
)
$
(
makeLenses
''
H
yperdataCorpus
)
------------------------------------------------------------------------
data
HyperdataFrame
=
HyperdataFrame
{
base
::
!
Text
,
frame_id
::
!
Text
}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
""
)
''
H
yperdataFrame
)
$
(
makeLenses
''
H
yperdataFrame
)
instance
Hyperdata
HyperdataFrame
------------------------------------------------------------------------
corpusExample
::
ByteString
corpusExample
=
""
-- TODO
defaultCorpus
::
HyperdataCorpus
defaultCorpus
=
HyperdataCorpus
[
HyperdataField
JSON
"Mandatory fields"
(
JsonField
"Title"
"Descr"
"Bool query"
"Authors"
)
,
HyperdataField
Markdown
"Optional Text"
(
MarkdownField
"# title
\n
## subtitle"
)
]
hyperdataCorpus
::
HyperdataCorpus
hyperdataCorpus
=
case
decode
corpusExample
of
Just
hp
->
hp
Nothing
->
defaultCorpus
defaultHyperdataCorpus
::
HyperdataCorpus
defaultHyperdataCorpus
::
HyperdataCorpus
defaultHyperdataCorpus
=
defaultCorpus
defaultHyperdataCorpus
=
HyperdataCorpus
[
HyperdataField
JSON
instance
Arbitrary
HyperdataCorpus
where
"Mandatory fields"
arbitrary
=
pure
hyperdataCorpus
-- TODO
(
JsonField
"Title"
"Descr"
"Bool query"
"Authors"
)
,
HyperdataField
Markdown
"Optional Text"
(
MarkdownField
"# title
\n
## subtitle"
)
]
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
data
HyperdataAnnuaire
=
HyperdataAnnuaire
{
hyperdataAnnuaire_title
::
!
(
Maybe
Text
)
-- | Annuaire and Corpus should be the same
,
hyperdataAnnuaire_desc
::
!
(
Maybe
Text
)
data
HyperdataAnnuaire
=
HyperdataAnnuaire
{
_ha_title
::
!
(
Maybe
Text
)
,
_ha_desc
::
!
(
Maybe
Text
)
}
deriving
(
Show
,
Generic
)
}
deriving
(
Show
,
Generic
)
$
(
deriveJSON
(
unPrefix
"hyperdataAnnuaire_"
)
''
H
yperdataAnnuaire
)
instance
Hyperdata
HyperdataAnnuaire
defaultHyperdataAnnuaire
::
HyperdataAnnuaire
defaultHyperdataAnnuaire
::
HyperdataAnnuaire
defaultHyperdataAnnuaire
=
HyperdataAnnuaire
(
Just
"Title"
)
(
Just
"Description"
)
defaultHyperdataAnnuaire
=
HyperdataAnnuaire
(
Just
"Title"
)
(
Just
"Description"
)
instance
Arbitrary
HyperdataAnnuaire
where
arbitrary
=
pure
defaultHyperdataAnnuaire
-- TODO
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
------------------------------------------------------------------------
data
HyperdataNotebook
=
instance
Hyperdata
HyperdataCorpus
HyperdataNotebook
{
hn_preferences
::
!
(
Maybe
Text
)}
instance
Hyperdata
HyperdataAnnuaire
deriving
(
Show
,
Generic
)
$
(
makeLenses
''
H
yperdataCorpus
)
$
(
makeLenses
''
H
yperdataAnnuaire
)
$
(
deriveJSON
(
unPrefix
"_hc_"
)
''
H
yperdataCorpus
)
$
(
deriveJSON
(
unPrefix
"_ha_"
)
''
H
yperdataAnnuaire
)
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
------------------------------------------------------------------------
instance
ToSchema
HyperdataCorpus
where
instance
ToSchema
HyperdataCorpus
where
declareNamedSchema
proxy
=
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_hc_"
)
proxy
genericDeclareNamedSchema
(
unPrefixSwagger
"_hc_"
)
proxy
&
mapped
.
schema
.
description
?~
"Corpus"
&
mapped
.
schema
.
description
?~
"Corpus
Hyperdata
"
&
mapped
.
schema
.
example
?~
toJSON
h
yperdataCorpus
&
mapped
.
schema
.
example
?~
toJSON
defaultH
yperdataCorpus
instance
ToSchema
HyperdataAnnuaire
where
instance
ToSchema
HyperdataAnnuaire
where
declareNamedSchema
proxy
=
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"
hyperdataAnnuaire
_"
)
proxy
genericDeclareNamedSchema
(
unPrefixSwagger
"
_ha
_"
)
proxy
&
mapped
.
schema
.
description
?~
"
an annuaire
"
&
mapped
.
schema
.
description
?~
"
Annuaire Hyperdata
"
&
mapped
.
schema
.
example
?~
toJSON
defaultHyperdataAnnuaire
&
mapped
.
schema
.
example
?~
toJSON
defaultHyperdataAnnuaire
------------------------------------------------------------------------
instance
Arbitrary
HyperdataCorpus
where
arbitrary
=
pure
defaultHyperdataCorpus
instance
Arbitrary
HyperdataAnnuaire
where
arbitrary
=
pure
defaultHyperdataAnnuaire
------------------------------------------------------------------------
------------------------------------------------------------------------
instance
FromField
HyperdataCorpus
instance
FromField
HyperdataCorpus
where
where
...
@@ -175,7 +147,6 @@ instance FromField HyperdataCorpus
...
@@ -175,7 +147,6 @@ instance FromField HyperdataCorpus
instance
FromField
HyperdataAnnuaire
instance
FromField
HyperdataAnnuaire
where
where
fromField
=
fromField'
fromField
=
fromField'
------------------------------------------------------------------------
------------------------------------------------------------------------
instance
QueryRunnerColumnDefault
PGJsonb
HyperdataCorpus
instance
QueryRunnerColumnDefault
PGJsonb
HyperdataCorpus
where
where
...
...
src/Gargantext/Database/Admin/Types/Hyperdata/Document.hs
View file @
5a43e4bd
...
@@ -25,25 +25,25 @@ import Gargantext.Database.Admin.Types.Hyperdata.Prelude
...
@@ -25,25 +25,25 @@ import Gargantext.Database.Admin.Types.Hyperdata.Prelude
------------------------------------------------------------------------
------------------------------------------------------------------------
data
HyperdataDocument
=
HyperdataDocument
{
_h
yperdataDocument
_bdd
::
!
(
Maybe
Text
)
data
HyperdataDocument
=
HyperdataDocument
{
_h
d
_bdd
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_doi
::
!
(
Maybe
Text
)
,
_h
d
_doi
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_url
::
!
(
Maybe
Text
)
,
_h
d
_url
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_uniqId
::
!
(
Maybe
Text
)
,
_h
d
_uniqId
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_uniqIdBdd
::
!
(
Maybe
Text
)
,
_h
d
_uniqIdBdd
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_page
::
!
(
Maybe
Int
)
,
_h
d
_page
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_title
::
!
(
Maybe
Text
)
,
_h
d
_title
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_authors
::
!
(
Maybe
Text
)
,
_h
d
_authors
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_institutes
::
!
(
Maybe
Text
)
,
_h
d
_institutes
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_source
::
!
(
Maybe
Text
)
,
_h
d
_source
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_abstract
::
!
(
Maybe
Text
)
,
_h
d
_abstract
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_publication_date
::
!
(
Maybe
Text
)
,
_h
d
_publication_date
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_publication_year
::
!
(
Maybe
Int
)
,
_h
d
_publication_year
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_month
::
!
(
Maybe
Int
)
,
_h
d
_publication_month
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_day
::
!
(
Maybe
Int
)
,
_h
d
_publication_day
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_hour
::
!
(
Maybe
Int
)
,
_h
d
_publication_hour
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_minute
::
!
(
Maybe
Int
)
,
_h
d
_publication_minute
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_second
::
!
(
Maybe
Int
)
,
_h
d
_publication_second
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_language_iso2
::
!
(
Maybe
Text
)
,
_h
d
_language_iso2
::
!
(
Maybe
Text
)
}
deriving
(
Show
,
Generic
)
}
deriving
(
Show
,
Generic
)
...
@@ -68,23 +68,23 @@ data StatusV3 = StatusV3 { statusV3_error :: !(Maybe Text)
...
@@ -68,23 +68,23 @@ data StatusV3 = StatusV3 { statusV3_error :: !(Maybe Text)
$
(
deriveJSON
(
unPrefix
"statusV3_"
)
''
S
tatusV3
)
$
(
deriveJSON
(
unPrefix
"statusV3_"
)
''
S
tatusV3
)
------------------------------------------------------------------------
------------------------------------------------------------------------
data
HyperdataDocumentV3
=
HyperdataDocumentV3
{
hyperdataDocumentV
3_publication_day
::
!
(
Maybe
Int
)
data
HyperdataDocumentV3
=
HyperdataDocumentV3
{
_hdv
3_publication_day
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_language_iso2
::
!
(
Maybe
Text
)
,
_hdv
3_language_iso2
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_publication_second
::
!
(
Maybe
Int
)
,
_hdv
3_publication_second
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_minute
::
!
(
Maybe
Int
)
,
_hdv
3_publication_minute
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_month
::
!
(
Maybe
Int
)
,
_hdv
3_publication_month
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_hour
::
!
(
Maybe
Int
)
,
_hdv
3_publication_hour
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_error
::
!
(
Maybe
Text
)
,
_hdv
3_error
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_language_iso3
::
!
(
Maybe
Text
)
,
_hdv
3_language_iso3
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_authors
::
!
(
Maybe
Text
)
,
_hdv
3_authors
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_publication_year
::
!
(
Maybe
Int
)
,
_hdv
3_publication_year
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_date
::
!
(
Maybe
Text
)
,
_hdv
3_publication_date
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_language_name
::
!
(
Maybe
Text
)
,
_hdv
3_language_name
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_statuses
::
!
(
Maybe
[
StatusV3
])
,
_hdv
3_statuses
::
!
(
Maybe
[
StatusV3
])
,
hyperdataDocumentV
3_realdate_full_
::
!
(
Maybe
Text
)
,
_hdv
3_realdate_full_
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_source
::
!
(
Maybe
Text
)
,
_hdv
3_source
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_abstract
::
!
(
Maybe
Text
)
,
_hdv
3_abstract
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_title
::
!
(
Maybe
Text
)
,
_hdv
3_title
::
!
(
Maybe
Text
)
}
deriving
(
Show
,
Generic
)
}
deriving
(
Show
,
Generic
)
...
@@ -100,11 +100,11 @@ instance ToHyperdataDocument HyperdataDocument
...
@@ -100,11 +100,11 @@ instance ToHyperdataDocument HyperdataDocument
------------------------------------------------------------------------
------------------------------------------------------------------------
instance
Eq
HyperdataDocument
where
instance
Eq
HyperdataDocument
where
(
==
)
h1
h2
=
(
==
)
(
_h
yperdataDocument_uniqId
h1
)
(
_hyperdataDocument
_uniqId
h2
)
(
==
)
h1
h2
=
(
==
)
(
_h
d_uniqId
h1
)
(
_hd
_uniqId
h2
)
------------------------------------------------------------------------
------------------------------------------------------------------------
instance
Ord
HyperdataDocument
where
instance
Ord
HyperdataDocument
where
compare
h1
h2
=
compare
(
_h
yperdataDocument_publication_date
h1
)
(
_hyperdataDocument
_publication_date
h2
)
compare
h1
h2
=
compare
(
_h
d_publication_date
h1
)
(
_hd
_publication_date
h2
)
------------------------------------------------------------------------
------------------------------------------------------------------------
instance
Arbitrary
HyperdataDocument
where
instance
Arbitrary
HyperdataDocument
where
arbitrary
=
elements
arbitraryHyperdataDocuments
arbitrary
=
elements
arbitraryHyperdataDocuments
...
@@ -132,14 +132,14 @@ instance Hyperdata HyperdataDocument
...
@@ -132,14 +132,14 @@ instance Hyperdata HyperdataDocument
instance
Hyperdata
HyperdataDocumentV3
instance
Hyperdata
HyperdataDocumentV3
------------------------------------------------------------------------
------------------------------------------------------------------------
$
(
makeLenses
''
H
yperdataDocument
)
$
(
makeLenses
''
H
yperdataDocument
)
--
$(makeLenses ''HyperdataDocumentV3)
$
(
makeLenses
''
H
yperdataDocumentV3
)
$
(
deriveJSON
(
unPrefix
"_h
yperdataDocument
_"
)
''
H
yperdataDocument
)
$
(
deriveJSON
(
unPrefix
"_h
d
_"
)
''
H
yperdataDocument
)
$
(
deriveJSON
(
unPrefix
"
hyperdataDocumentV
3_"
)
''
H
yperdataDocumentV3
)
$
(
deriveJSON
(
unPrefix
"
_hdv
3_"
)
''
H
yperdataDocumentV3
)
instance
ToSchema
HyperdataDocument
where
instance
ToSchema
HyperdataDocument
where
declareNamedSchema
proxy
=
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_h
yperdataDocument
_"
)
proxy
genericDeclareNamedSchema
(
unPrefixSwagger
"_h
d
_"
)
proxy
&
mapped
.
schema
.
description
?~
"Document Hyperdata"
&
mapped
.
schema
.
description
?~
"Document Hyperdata"
&
mapped
.
schema
.
example
?~
toJSON
defaultHyperdataDocument
&
mapped
.
schema
.
example
?~
toJSON
defaultHyperdataDocument
...
...
src/Gargantext/Database/Admin/Types/Hyperdata/Frame.hs
0 → 100644
View file @
5a43e4bd
{-|
Module : Gargantext.Database.Admin.Types.Hyperdata.Frame
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Database.Admin.Types.Hyperdata.Frame
where
import
Gargantext.Prelude
import
Gargantext.Database.Admin.Types.Hyperdata.Prelude
------------------------------------------------------------------------
data
HyperdataFrame
=
HyperdataFrame
{
_hf_base
::
!
Text
,
_hf_frame_id
::
!
Text
}
deriving
(
Generic
)
defaultHyperdataFrame
::
HyperdataFrame
defaultHyperdataFrame
=
HyperdataFrame
""
""
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
instance
Hyperdata
HyperdataFrame
$
(
makeLenses
''
H
yperdataFrame
)
$
(
deriveJSON
(
unPrefix
"_hf_"
)
''
H
yperdataFrame
)
instance
Arbitrary
HyperdataFrame
where
arbitrary
=
pure
defaultHyperdataFrame
instance
FromField
HyperdataFrame
where
fromField
=
fromField'
instance
QueryRunnerColumnDefault
PGJsonb
HyperdataFrame
where
queryRunnerColumnDefault
=
fieldQueryRunnerColumn
instance
ToSchema
HyperdataFrame
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_hf_"
)
proxy
&
mapped
.
schema
.
description
?~
"Frame Hyperdata"
&
mapped
.
schema
.
example
?~
toJSON
defaultHyperdataFrame
src/Gargantext/Database/Query/Table/Node.hs
View file @
5a43e4bd
...
@@ -164,9 +164,8 @@ nodeContactW maybeName maybeContact aId =
...
@@ -164,9 +164,8 @@ nodeContactW maybeName maybeContact aId =
name
=
maybe
"Contact"
identity
maybeName
name
=
maybe
"Contact"
identity
maybeName
contact
=
maybe
arbitraryHyperdataContact
identity
maybeContact
contact
=
maybe
arbitraryHyperdataContact
identity
maybeContact
------------------------------------------------------------------------
------------------------------------------------------------------------
defaultFolder
::
HyperdataCorpus
defaultFolder
::
HyperdataFolder
defaultFolder
=
defaultCorpus
defaultFolder
=
defaultHyperdataFolder
nodeFolderW
::
Maybe
Name
->
Maybe
HyperdataCorpus
->
ParentId
->
UserId
->
NodeWrite
nodeFolderW
::
Maybe
Name
->
Maybe
HyperdataCorpus
->
ParentId
->
UserId
->
NodeWrite
...
@@ -179,7 +178,7 @@ nodeCorpusW :: Maybe Name -> Maybe HyperdataCorpus -> ParentId -> UserId -> Node
...
@@ -179,7 +178,7 @@ nodeCorpusW :: Maybe Name -> Maybe HyperdataCorpus -> ParentId -> UserId -> Node
nodeCorpusW
maybeName
maybeCorpus
pId
=
node
NodeCorpus
name
corpus
(
Just
pId
)
nodeCorpusW
maybeName
maybeCorpus
pId
=
node
NodeCorpus
name
corpus
(
Just
pId
)
where
where
name
=
maybe
"Corpus"
identity
maybeName
name
=
maybe
"Corpus"
identity
maybeName
corpus
=
maybe
defaultCorpus
identity
maybeCorpus
corpus
=
maybe
default
Hyperdata
Corpus
identity
maybeCorpus
--------------------------
--------------------------
nodeDocumentW
::
Maybe
Name
->
Maybe
HyperdataDocument
->
CorpusId
->
UserId
->
NodeWrite
nodeDocumentW
::
Maybe
Name
->
Maybe
HyperdataDocument
->
CorpusId
->
UserId
->
NodeWrite
...
...
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
View file @
5a43e4bd
...
@@ -119,8 +119,8 @@ instance InsertDb HyperdataDocument
...
@@ -119,8 +119,8 @@ instance InsertDb HyperdataDocument
insertDb'
u
p
h
=
[
toField
$
nodeTypeId
NodeDocument
insertDb'
u
p
h
=
[
toField
$
nodeTypeId
NodeDocument
,
toField
u
,
toField
u
,
toField
p
,
toField
p
,
toField
$
maybe
"No Title"
(
DT
.
take
255
)
(
_h
yperdataDocument
_title
h
)
,
toField
$
maybe
"No Title"
(
DT
.
take
255
)
(
_h
d
_title
h
)
,
toField
$
_h
yperdataDocument
_publication_date
h
-- TODO USE UTCTime
,
toField
$
_h
d
_publication_date
h
-- TODO USE UTCTime
,
(
toField
.
toJSON
)
h
,
(
toField
.
toJSON
)
h
]
]
...
@@ -202,17 +202,17 @@ instance AddUniqId HyperdataDocument
...
@@ -202,17 +202,17 @@ instance AddUniqId HyperdataDocument
addUniqId
=
addUniqIdsDoc
addUniqId
=
addUniqIdsDoc
where
where
addUniqIdsDoc
::
HyperdataDocument
->
HyperdataDocument
addUniqIdsDoc
::
HyperdataDocument
->
HyperdataDocument
addUniqIdsDoc
doc
=
set
h
yperdataDocument
_uniqIdBdd
(
Just
shaBdd
)
addUniqIdsDoc
doc
=
set
h
d
_uniqIdBdd
(
Just
shaBdd
)
$
set
h
yperdataDocument
_uniqId
(
Just
shaUni
)
doc
$
set
h
d
_uniqId
(
Just
shaUni
)
doc
where
where
shaUni
=
sha
$
DT
.
concat
$
map
(
$
doc
)
shaParametersDoc
shaUni
=
sha
$
DT
.
concat
$
map
(
$
doc
)
shaParametersDoc
shaBdd
=
sha
$
DT
.
concat
$
map
(
$
doc
)
([(
\
d
->
maybeText
(
_h
yperdataDocument
_bdd
d
))]
<>
shaParametersDoc
)
shaBdd
=
sha
$
DT
.
concat
$
map
(
$
doc
)
([(
\
d
->
maybeText
(
_h
d
_bdd
d
))]
<>
shaParametersDoc
)
shaParametersDoc
::
[(
HyperdataDocument
->
Text
)]
shaParametersDoc
::
[(
HyperdataDocument
->
Text
)]
shaParametersDoc
=
[
\
d
->
maybeText
(
_h
yperdataDocument
_title
d
)
shaParametersDoc
=
[
\
d
->
maybeText
(
_h
d
_title
d
)
,
\
d
->
maybeText
(
_h
yperdataDocument
_abstract
d
)
,
\
d
->
maybeText
(
_h
d
_abstract
d
)
,
\
d
->
maybeText
(
_h
yperdataDocument
_source
d
)
,
\
d
->
maybeText
(
_h
d
_source
d
)
,
\
d
->
maybeText
(
_h
yperdataDocument
_publication_date
d
)
,
\
d
->
maybeText
(
_h
d
_publication_date
d
)
]
]
---------------------------------------------------------------------------
---------------------------------------------------------------------------
...
...
src/Gargantext/Database/Query/Table/NodeNode.hs
View file @
5a43e4bd
...
@@ -123,7 +123,7 @@ nodeNodesCategory inputData = map (\(PGS.Only a) -> a)
...
@@ -123,7 +123,7 @@ nodeNodesCategory inputData = map (\(PGS.Only a) -> a)
selectDocsDates
::
CorpusId
->
Cmd
err
[
Text
]
selectDocsDates
::
CorpusId
->
Cmd
err
[
Text
]
selectDocsDates
cId
=
map
(
head'
"selectDocsDates"
.
splitOn
"-"
)
selectDocsDates
cId
=
map
(
head'
"selectDocsDates"
.
splitOn
"-"
)
<$>
catMaybes
<$>
catMaybes
<$>
map
(
view
h
yperdataDocument
_publication_date
)
<$>
map
(
view
h
d
_publication_date
)
<$>
selectDocs
cId
<$>
selectDocs
cId
selectDocs
::
CorpusId
->
Cmd
err
[
HyperdataDocument
]
selectDocs
::
CorpusId
->
Cmd
err
[
HyperdataDocument
]
...
...
src/Gargantext/Text/Corpus/Parsers/CSV.hs
View file @
5a43e4bd
...
@@ -169,13 +169,13 @@ instance ToNamedRecord CsvDoc where
...
@@ -169,13 +169,13 @@ instance ToNamedRecord CsvDoc where
]
]
hyperdataDocument2csvDoc
::
HyperdataDocument
->
CsvDoc
hyperdataDocument2csvDoc
::
HyperdataDocument
->
CsvDoc
hyperdataDocument2csvDoc
h
=
CsvDoc
(
m
$
_hyperdataDocument
_title
h
)
hyperdataDocument2csvDoc
h
=
CsvDoc
(
m
$
_hd
_title
h
)
(
m
$
_hyperdataDocument
_source
h
)
(
m
$
_hd
_source
h
)
(
mI
$
_h
yperdataDocument
_publication_year
h
)
(
mI
$
_h
d
_publication_year
h
)
(
mI
$
_h
yperdataDocument
_publication_month
h
)
(
mI
$
_h
d
_publication_month
h
)
(
mI
$
_h
yperdataDocument
_publication_day
h
)
(
mI
$
_h
d
_publication_day
h
)
(
m
$
_hyperdataDocument
_abstract
h
)
(
m
$
_hd
_abstract
h
)
(
m
$
_hyperdataDocument
_authors
h
)
(
m
$
_hd
_authors
h
)
where
where
m
=
maybe
""
identity
m
=
maybe
""
identity
...
...
src/Gargantext/Viz/Phylo/Main.hs
View file @
5a43e4bd
...
@@ -52,8 +52,8 @@ flowPhylo cId = do
...
@@ -52,8 +52,8 @@ flowPhylo cId = do
termList
<-
Map
.
toList
<$>
getTermsWith
Text
.
words
[
list
]
NgramsTerms
MapTerm
termList
<-
Map
.
toList
<$>
getTermsWith
Text
.
words
[
list
]
NgramsTerms
MapTerm
docs'
<-
catMaybes
docs'
<-
catMaybes
<$>
map
(
\
h
->
(,)
<$>
_h
yperdataDocument
_publication_year
h
<$>
map
(
\
h
->
(,)
<$>
_h
d
_publication_year
h
<*>
_h
yperdataDocument
_abstract
h
<*>
_h
d
_abstract
h
)
)
<$>
selectDocs
cId
<$>
selectDocs
cId
...
...
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