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
8c18bf76
Commit
8c18bf76
authored
Apr 07, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[arxiv] more work on arxiv endpoint for corpus
parent
2d431a63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
4 deletions
+55
-4
gargantext.cabal
gargantext.cabal
+2
-0
package.yaml
package.yaml
+1
-0
Arxiv.hs
src/Gargantext/Core/Text/Corpus/API/Arxiv.hs
+52
-4
No files found.
gargantext.cabal
View file @
8c18bf76
...
@@ -95,6 +95,7 @@ library
...
@@ -95,6 +95,7 @@ library
Gargantext.Core.Viz.Phylo.SynchronicClustering
Gargantext.Core.Viz.Phylo.SynchronicClustering
Gargantext.Core.Viz.Types
Gargantext.Core.Viz.Types
other-modules:
other-modules:
ConcurrentTest
Gargantext.API.Admin.Auth
Gargantext.API.Admin.Auth
Gargantext.API.Admin.FrontEnd
Gargantext.API.Admin.FrontEnd
Gargantext.API.Admin.Orchestrator
Gargantext.API.Admin.Orchestrator
...
@@ -342,6 +343,7 @@ library
...
@@ -342,6 +343,7 @@ library
, aeson-lens
, aeson-lens
, aeson-pretty
, aeson-pretty
, array
, array
, arxiv
, async
, async
, attoparsec
, attoparsec
, auto-update
, auto-update
...
...
package.yaml
View file @
8c18bf76
...
@@ -132,6 +132,7 @@ library:
...
@@ -132,6 +132,7 @@ library:
-
aeson-lens
-
aeson-lens
-
aeson-pretty
-
aeson-pretty
-
array
-
array
-
arxiv
-
async
-
async
-
attoparsec
-
attoparsec
-
auto-update
-
auto-update
...
...
src/Gargantext/Core/Text/Corpus/API/Arxiv.hs
View file @
8c18bf76
...
@@ -18,20 +18,68 @@ import Conduit
...
@@ -18,20 +18,68 @@ import Conduit
import
Data.Either
(
Either
(
..
))
import
Data.Either
(
Either
(
..
))
import
Data.Maybe
import
Data.Maybe
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
--
import qualified Data.Text as Text
import
qualified
Data.Text
as
Text
import
Servant.Client
(
ClientError
)
import
Servant.Client
(
ClientError
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataDocument
(
..
))
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataDocument
(
..
))
--import qualified Arxiv.Wrapper as Arxiv
import
qualified
Arxiv
as
Arxiv
import
qualified
Network.Api.Arxiv
as
Ax
type
Query
=
Text
type
Query
=
Text
type
Limit
=
In
t
type
Limit
=
Arxiv
.
Limi
t
-- | TODO put default pubmed query in gargantext.ini
-- | TODO put default pubmed query in gargantext.ini
-- by default: 10K docs
-- by default: 10K docs
get
::
Lang
->
Query
->
Maybe
Limit
->
IO
(
Either
ClientError
(
Maybe
Integer
,
ConduitT
()
HyperdataDocument
IO
()
))
get
::
Lang
->
Query
->
Maybe
Limit
->
IO
(
Either
ClientError
(
Maybe
Integer
,
ConduitT
()
HyperdataDocument
IO
()
))
get
_la
_q
_l
=
pure
$
Right
$
(
Nothing
,
yieldMany
[]
)
get
la
q
l
=
do
(
cnt
,
resC
)
<-
Arxiv
.
apiSimpleC
l
[
Text
.
unpack
q
]
pure
$
Right
(
Just
$
fromIntegral
cnt
,
resC
.|
mapC
(
toDoc
la
))
toDoc
::
Lang
->
Arxiv
.
Result
->
HyperdataDocument
toDoc
l
(
Arxiv
.
Result
{
abstract
,
authors
=
aus
,
categories
,
doi
,
journal
,
primaryCategory
,
publication_date
,
title
,
total
,
url
,
year
}
)
=
HyperdataDocument
{
_hd_bdd
=
Just
"Arxiv"
,
_hd_doi
=
Nothing
,
_hd_url
=
Nothing
,
_hd_uniqId
=
Just
$
Text
.
pack
doi
,
_hd_uniqIdBdd
=
Nothing
,
_hd_page
=
Nothing
,
_hd_title
=
Just
$
Text
.
pack
title
,
_hd_authors
=
authors
aus
,
_hd_institutes
=
institutes
aus
,
_hd_source
=
Just
$
Text
.
pack
journal
,
_hd_abstract
=
Just
$
Text
.
pack
abstract
,
_hd_publication_date
=
Just
$
Text
.
pack
publication_date
,
_hd_publication_year
=
fromIntegral
<$>
year
,
_hd_publication_month
=
Nothing
-- TODO parse publication_date
,
_hd_publication_day
=
Nothing
,
_hd_publication_hour
=
Nothing
,
_hd_publication_minute
=
Nothing
,
_hd_publication_second
=
Nothing
,
_hd_language_iso2
=
Just
$
(
Text
.
pack
.
show
)
l
}
where
authors
::
[
Ax
.
Author
]
->
Maybe
Text
authors
[]
=
Nothing
authors
aus
=
Just
$
(
Text
.
intercalate
", "
)
$
map
Text
.
pack
$
map
Ax
.
auName
aus
institutes
::
[
Ax
.
Author
]
->
Maybe
Text
institutes
[]
=
Nothing
institutes
aus
=
Just
$
(
Text
.
intercalate
", "
)
$
(
map
(
Text
.
replace
", "
" - "
))
$
map
Text
.
pack
$
map
Ax
.
auFil
aus
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