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
195
Issues
195
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
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)])
wosToCorpus
limit
path
=
do
files
<-
getFilesFromPath
path
take
limit
<$>
map
(
\
d
->
let
date'
=
fromJust
$
_h
yperdataDocument
_publication_year
d
title
=
fromJust
$
_h
yperdataDocument
_title
d
abstr
=
if
(
isJust
$
_h
yperdataDocument
_abstract
d
)
then
fromJust
$
_h
yperdataDocument
_abstract
d
<$>
map
(
\
d
->
let
date'
=
fromJust
$
_h
d
_publication_year
d
title
=
fromJust
$
_h
d
_title
d
abstr
=
if
(
isJust
$
_h
d
_abstract
d
)
then
fromJust
$
_h
d
_abstract
d
else
""
in
(
date'
,
title
<>
" "
<>
abstr
))
<$>
concat
<$>
mapConcurrently
(
\
file
->
filter
(
\
d
->
(
isJust
$
_h
yperdataDocument
_publication_year
d
)
&&
(
isJust
$
_h
yperdataDocument
_title
d
))
filter
(
\
d
->
(
isJust
$
_h
d
_publication_year
d
)
&&
(
isJust
$
_h
d
_title
d
))
<$>
parseFile
WOS
(
path
<>
file
)
)
files
...
...
bin/gargantext-phylo/Main.hs
View file @
5a43e4bd
...
...
@@ -132,11 +132,11 @@ csvToCorpus limit csv = DV.toList
-- | To transform a Wos nfile into a readable corpus
wosToCorpus
::
Limit
->
CorpusPath
->
IO
([(
Int
,
Text
)])
wosToCorpus
limit
path
=
DL
.
take
limit
.
map
(
\
d
->
((
fromJust
$
_h
yperdataDocument
_publication_year
d
)
,(
fromJust
$
_h
yperdataDocument_title
d
)
<>
" "
<>
(
fromJust
$
_hyperdataDocument
_abstract
d
)))
.
filter
(
\
d
->
(
isJust
$
_h
yperdataDocument
_publication_year
d
)
&&
(
isJust
$
_h
yperdataDocument
_title
d
)
&&
(
isJust
$
_h
yperdataDocument
_abstract
d
))
.
map
(
\
d
->
((
fromJust
$
_h
d
_publication_year
d
)
,(
fromJust
$
_h
d_title
d
)
<>
" "
<>
(
fromJust
$
_hd
_abstract
d
)))
.
filter
(
\
d
->
(
isJust
$
_h
d
_publication_year
d
)
&&
(
isJust
$
_h
d
_title
d
)
&&
(
isJust
$
_h
d
_abstract
d
))
.
concat
<$>
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
)
ns
ngs
where
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
)
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
instance
UniqId
HyperdataDocument
where
uniqId
=
h
yperdataDocument
_uniqId
uniqId
=
h
d
_uniqId
instance
UniqId
HyperdataContact
where
...
...
src/Gargantext/Database/Action/Flow.hs
View file @
5a43e4bd
...
...
@@ -347,8 +347,8 @@ instance ExtractNgramsT HyperdataContact
instance
HasText
HyperdataDocument
where
hasText
h
=
catMaybes
[
_h
yperdataDocument
_title
h
,
_h
yperdataDocument
_abstract
h
hasText
h
=
catMaybes
[
_h
d
_title
h
,
_h
d
_abstract
h
]
instance
ExtractNgramsT
HyperdataDocument
...
...
@@ -364,15 +364,15 @@ instance ExtractNgramsT HyperdataDocument
extractNgramsT'
lang'
doc
=
do
let
source
=
text2ngrams
$
maybe
"Nothing"
identity
$
_h
yperdataDocument
_source
doc
$
_h
d
_source
doc
institutes
=
map
text2ngrams
$
maybe
[
"Nothing"
]
(
map
toSchoolName
.
(
splitOn
", "
))
$
_h
yperdataDocument
_institutes
doc
$
_h
d
_institutes
doc
authors
=
map
text2ngrams
$
maybe
[
"Nothing"
]
(
splitOn
", "
)
$
_h
yperdataDocument
_authors
doc
$
_h
d
_authors
doc
terms'
<-
map
text2ngrams
<$>
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
text
::
FacetDoc
->
Text
text
(
FacetDoc
_
_
_
h
_
_
)
=
title
<>
""
<>
Text
.
take
100
abstr
where
title
=
maybe
""
identity
(
_h
yperdataDocument
_title
h
)
abstr
=
maybe
""
identity
(
_h
yperdataDocument
_abstract
h
)
title
=
maybe
""
identity
(
_h
d
_title
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
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Dashboard
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Document
,
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
.
Model
,
module
Gargantext
.
Database
.
Admin
.
Types
.
Hyperdata
.
Prelude
...
...
@@ -30,6 +31,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Corpus
import
Gargantext.Database.Admin.Types.Hyperdata.Dashboard
import
Gargantext.Database.Admin.Types.Hyperdata.Document
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.Model
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
&
mapped
.
schema
.
description
?~
"CorpusField"
&
mapped
.
schema
.
example
?~
toJSON
defaultCorpusField
------------------------------------------------------------------------
data
HyperdataField
a
=
HyperdataField
{
_hf_type
::
!
CodeType
...
...
@@ -89,84 +88,57 @@ instance (Typeable a, ToSchema a) => ToSchema (HyperdataField a) where
data
HyperdataCorpus
=
HyperdataCorpus
{
_hc_fields
::
!
[
HyperdataField
CorpusField
]
}
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
=
defaultCorpus
instance
Arbitrary
HyperdataCorpus
where
arbitrary
=
pure
hyperdataCorpus
-- TODO
defaultHyperdataCorpus
=
HyperdataCorpus
[
HyperdataField
JSON
"Mandatory fields"
(
JsonField
"Title"
"Descr"
"Bool query"
"Authors"
)
,
HyperdataField
Markdown
"Optional Text"
(
MarkdownField
"# title
\n
## subtitle"
)
]
------------------------------------------------------------------------
------------------------------------------------------------------------
data
HyperdataAnnuaire
=
HyperdataAnnuaire
{
hyperdataAnnuaire_title
::
!
(
Maybe
Text
)
,
hyperdataAnnuaire_desc
::
!
(
Maybe
Text
)
-- | Annuaire and Corpus should be the same
data
HyperdataAnnuaire
=
HyperdataAnnuaire
{
_ha_title
::
!
(
Maybe
Text
)
,
_ha_desc
::
!
(
Maybe
Text
)
}
deriving
(
Show
,
Generic
)
$
(
deriveJSON
(
unPrefix
"hyperdataAnnuaire_"
)
''
H
yperdataAnnuaire
)
instance
Hyperdata
HyperdataAnnuaire
defaultHyperdataAnnuaire
::
HyperdataAnnuaire
defaultHyperdataAnnuaire
=
HyperdataAnnuaire
(
Just
"Title"
)
(
Just
"Description"
)
instance
Arbitrary
HyperdataAnnuaire
where
arbitrary
=
pure
defaultHyperdataAnnuaire
-- TODO
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
data
HyperdataNotebook
=
HyperdataNotebook
{
hn_preferences
::
!
(
Maybe
Text
)}
deriving
(
Show
,
Generic
)
instance
Hyperdata
HyperdataCorpus
instance
Hyperdata
HyperdataAnnuaire
$
(
makeLenses
''
H
yperdataCorpus
)
$
(
makeLenses
''
H
yperdataAnnuaire
)
$
(
deriveJSON
(
unPrefix
"_hc_"
)
''
H
yperdataCorpus
)
$
(
deriveJSON
(
unPrefix
"_ha_"
)
''
H
yperdataAnnuaire
)
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
instance
ToSchema
HyperdataCorpus
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_hc_"
)
proxy
&
mapped
.
schema
.
description
?~
"Corpus"
&
mapped
.
schema
.
example
?~
toJSON
h
yperdataCorpus
&
mapped
.
schema
.
description
?~
"Corpus
Hyperdata
"
&
mapped
.
schema
.
example
?~
toJSON
defaultH
yperdataCorpus
instance
ToSchema
HyperdataAnnuaire
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"
hyperdataAnnuaire
_"
)
proxy
&
mapped
.
schema
.
description
?~
"
an annuaire
"
genericDeclareNamedSchema
(
unPrefixSwagger
"
_ha
_"
)
proxy
&
mapped
.
schema
.
description
?~
"
Annuaire Hyperdata
"
&
mapped
.
schema
.
example
?~
toJSON
defaultHyperdataAnnuaire
------------------------------------------------------------------------
instance
Arbitrary
HyperdataCorpus
where
arbitrary
=
pure
defaultHyperdataCorpus
instance
Arbitrary
HyperdataAnnuaire
where
arbitrary
=
pure
defaultHyperdataAnnuaire
------------------------------------------------------------------------
instance
FromField
HyperdataCorpus
where
...
...
@@ -175,7 +147,6 @@ instance FromField HyperdataCorpus
instance
FromField
HyperdataAnnuaire
where
fromField
=
fromField'
------------------------------------------------------------------------
instance
QueryRunnerColumnDefault
PGJsonb
HyperdataCorpus
where
...
...
src/Gargantext/Database/Admin/Types/Hyperdata/Document.hs
View file @
5a43e4bd
...
...
@@ -25,25 +25,25 @@ import Gargantext.Database.Admin.Types.Hyperdata.Prelude
------------------------------------------------------------------------
data
HyperdataDocument
=
HyperdataDocument
{
_h
yperdataDocument
_bdd
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_doi
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_url
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_uniqId
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_uniqIdBdd
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_page
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_title
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_authors
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_institutes
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_source
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_abstract
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_publication_date
::
!
(
Maybe
Text
)
,
_h
yperdataDocument
_publication_year
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_month
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_day
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_hour
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_minute
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_publication_second
::
!
(
Maybe
Int
)
,
_h
yperdataDocument
_language_iso2
::
!
(
Maybe
Text
)
data
HyperdataDocument
=
HyperdataDocument
{
_h
d
_bdd
::
!
(
Maybe
Text
)
,
_h
d
_doi
::
!
(
Maybe
Text
)
,
_h
d
_url
::
!
(
Maybe
Text
)
,
_h
d
_uniqId
::
!
(
Maybe
Text
)
,
_h
d
_uniqIdBdd
::
!
(
Maybe
Text
)
,
_h
d
_page
::
!
(
Maybe
Int
)
,
_h
d
_title
::
!
(
Maybe
Text
)
,
_h
d
_authors
::
!
(
Maybe
Text
)
,
_h
d
_institutes
::
!
(
Maybe
Text
)
,
_h
d
_source
::
!
(
Maybe
Text
)
,
_h
d
_abstract
::
!
(
Maybe
Text
)
,
_h
d
_publication_date
::
!
(
Maybe
Text
)
,
_h
d
_publication_year
::
!
(
Maybe
Int
)
,
_h
d
_publication_month
::
!
(
Maybe
Int
)
,
_h
d
_publication_day
::
!
(
Maybe
Int
)
,
_h
d
_publication_hour
::
!
(
Maybe
Int
)
,
_h
d
_publication_minute
::
!
(
Maybe
Int
)
,
_h
d
_publication_second
::
!
(
Maybe
Int
)
,
_h
d
_language_iso2
::
!
(
Maybe
Text
)
}
deriving
(
Show
,
Generic
)
...
...
@@ -68,23 +68,23 @@ data StatusV3 = StatusV3 { statusV3_error :: !(Maybe Text)
$
(
deriveJSON
(
unPrefix
"statusV3_"
)
''
S
tatusV3
)
------------------------------------------------------------------------
data
HyperdataDocumentV3
=
HyperdataDocumentV3
{
hyperdataDocumentV
3_publication_day
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_language_iso2
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_publication_second
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_minute
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_month
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_hour
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_error
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_language_iso3
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_authors
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_publication_year
::
!
(
Maybe
Int
)
,
hyperdataDocumentV
3_publication_date
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_language_name
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_statuses
::
!
(
Maybe
[
StatusV3
])
,
hyperdataDocumentV
3_realdate_full_
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_source
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_abstract
::
!
(
Maybe
Text
)
,
hyperdataDocumentV
3_title
::
!
(
Maybe
Text
)
data
HyperdataDocumentV3
=
HyperdataDocumentV3
{
_hdv
3_publication_day
::
!
(
Maybe
Int
)
,
_hdv
3_language_iso2
::
!
(
Maybe
Text
)
,
_hdv
3_publication_second
::
!
(
Maybe
Int
)
,
_hdv
3_publication_minute
::
!
(
Maybe
Int
)
,
_hdv
3_publication_month
::
!
(
Maybe
Int
)
,
_hdv
3_publication_hour
::
!
(
Maybe
Int
)
,
_hdv
3_error
::
!
(
Maybe
Text
)
,
_hdv
3_language_iso3
::
!
(
Maybe
Text
)
,
_hdv
3_authors
::
!
(
Maybe
Text
)
,
_hdv
3_publication_year
::
!
(
Maybe
Int
)
,
_hdv
3_publication_date
::
!
(
Maybe
Text
)
,
_hdv
3_language_name
::
!
(
Maybe
Text
)
,
_hdv
3_statuses
::
!
(
Maybe
[
StatusV3
])
,
_hdv
3_realdate_full_
::
!
(
Maybe
Text
)
,
_hdv
3_source
::
!
(
Maybe
Text
)
,
_hdv
3_abstract
::
!
(
Maybe
Text
)
,
_hdv
3_title
::
!
(
Maybe
Text
)
}
deriving
(
Show
,
Generic
)
...
...
@@ -100,11 +100,11 @@ instance ToHyperdataDocument HyperdataDocument
------------------------------------------------------------------------
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
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
arbitrary
=
elements
arbitraryHyperdataDocuments
...
...
@@ -132,14 +132,14 @@ instance Hyperdata HyperdataDocument
instance
Hyperdata
HyperdataDocumentV3
------------------------------------------------------------------------
$
(
makeLenses
''
H
yperdataDocument
)
--
$(makeLenses ''HyperdataDocumentV3)
$
(
makeLenses
''
H
yperdataDocumentV3
)
$
(
deriveJSON
(
unPrefix
"_h
yperdataDocument
_"
)
''
H
yperdataDocument
)
$
(
deriveJSON
(
unPrefix
"
hyperdataDocumentV
3_"
)
''
H
yperdataDocumentV3
)
$
(
deriveJSON
(
unPrefix
"_h
d
_"
)
''
H
yperdataDocument
)
$
(
deriveJSON
(
unPrefix
"
_hdv
3_"
)
''
H
yperdataDocumentV3
)
instance
ToSchema
HyperdataDocument
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_h
yperdataDocument
_"
)
proxy
genericDeclareNamedSchema
(
unPrefixSwagger
"_h
d
_"
)
proxy
&
mapped
.
schema
.
description
?~
"Document Hyperdata"
&
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 =
name
=
maybe
"Contact"
identity
maybeName
contact
=
maybe
arbitraryHyperdataContact
identity
maybeContact
------------------------------------------------------------------------
defaultFolder
::
HyperdataCorpus
defaultFolder
=
defaultCorpus
defaultFolder
::
HyperdataFolder
defaultFolder
=
defaultHyperdataFolder
nodeFolderW
::
Maybe
Name
->
Maybe
HyperdataCorpus
->
ParentId
->
UserId
->
NodeWrite
...
...
@@ -179,7 +178,7 @@ nodeCorpusW :: Maybe Name -> Maybe HyperdataCorpus -> ParentId -> UserId -> Node
nodeCorpusW
maybeName
maybeCorpus
pId
=
node
NodeCorpus
name
corpus
(
Just
pId
)
where
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
...
...
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
View file @
5a43e4bd
...
...
@@ -119,8 +119,8 @@ instance InsertDb HyperdataDocument
insertDb'
u
p
h
=
[
toField
$
nodeTypeId
NodeDocument
,
toField
u
,
toField
p
,
toField
$
maybe
"No Title"
(
DT
.
take
255
)
(
_h
yperdataDocument
_title
h
)
,
toField
$
_h
yperdataDocument
_publication_date
h
-- TODO USE UTCTime
,
toField
$
maybe
"No Title"
(
DT
.
take
255
)
(
_h
d
_title
h
)
,
toField
$
_h
d
_publication_date
h
-- TODO USE UTCTime
,
(
toField
.
toJSON
)
h
]
...
...
@@ -202,17 +202,17 @@ instance AddUniqId HyperdataDocument
addUniqId
=
addUniqIdsDoc
where
addUniqIdsDoc
::
HyperdataDocument
->
HyperdataDocument
addUniqIdsDoc
doc
=
set
h
yperdataDocument
_uniqIdBdd
(
Just
shaBdd
)
$
set
h
yperdataDocument
_uniqId
(
Just
shaUni
)
doc
addUniqIdsDoc
doc
=
set
h
d
_uniqIdBdd
(
Just
shaBdd
)
$
set
h
d
_uniqId
(
Just
shaUni
)
doc
where
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
=
[
\
d
->
maybeText
(
_h
yperdataDocument
_title
d
)
,
\
d
->
maybeText
(
_h
yperdataDocument
_abstract
d
)
,
\
d
->
maybeText
(
_h
yperdataDocument
_source
d
)
,
\
d
->
maybeText
(
_h
yperdataDocument
_publication_date
d
)
shaParametersDoc
=
[
\
d
->
maybeText
(
_h
d
_title
d
)
,
\
d
->
maybeText
(
_h
d
_abstract
d
)
,
\
d
->
maybeText
(
_h
d
_source
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)
selectDocsDates
::
CorpusId
->
Cmd
err
[
Text
]
selectDocsDates
cId
=
map
(
head'
"selectDocsDates"
.
splitOn
"-"
)
<$>
catMaybes
<$>
map
(
view
h
yperdataDocument
_publication_date
)
<$>
map
(
view
h
d
_publication_date
)
<$>
selectDocs
cId
selectDocs
::
CorpusId
->
Cmd
err
[
HyperdataDocument
]
...
...
src/Gargantext/Text/Corpus/Parsers/CSV.hs
View file @
5a43e4bd
...
...
@@ -169,13 +169,13 @@ instance ToNamedRecord CsvDoc where
]
hyperdataDocument2csvDoc
::
HyperdataDocument
->
CsvDoc
hyperdataDocument2csvDoc
h
=
CsvDoc
(
m
$
_hyperdataDocument
_title
h
)
(
m
$
_hyperdataDocument
_source
h
)
(
mI
$
_h
yperdataDocument
_publication_year
h
)
(
mI
$
_h
yperdataDocument
_publication_month
h
)
(
mI
$
_h
yperdataDocument
_publication_day
h
)
(
m
$
_hyperdataDocument
_abstract
h
)
(
m
$
_hyperdataDocument
_authors
h
)
hyperdataDocument2csvDoc
h
=
CsvDoc
(
m
$
_hd
_title
h
)
(
m
$
_hd
_source
h
)
(
mI
$
_h
d
_publication_year
h
)
(
mI
$
_h
d
_publication_month
h
)
(
mI
$
_h
d
_publication_day
h
)
(
m
$
_hd
_abstract
h
)
(
m
$
_hd
_authors
h
)
where
m
=
maybe
""
identity
...
...
src/Gargantext/Viz/Phylo/Main.hs
View file @
5a43e4bd
...
...
@@ -52,8 +52,8 @@ flowPhylo cId = do
termList
<-
Map
.
toList
<$>
getTermsWith
Text
.
words
[
list
]
NgramsTerms
MapTerm
docs'
<-
catMaybes
<$>
map
(
\
h
->
(,)
<$>
_h
yperdataDocument
_publication_year
h
<*>
_h
yperdataDocument
_abstract
h
<$>
map
(
\
h
->
(,)
<$>
_h
d
_publication_year
h
<*>
_h
d
_abstract
h
)
<$>
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