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
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
8d844d13
Commit
8d844d13
authored
Nov 28, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[pubmed] use the upstream pubmed version, with reader monad
parent
bc39f7dc
Pipeline
#3428
passed with stage
in 92 minutes and 23 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
Pubmed.hs
src/Gargantext/Core/Text/Corpus/API/Pubmed.hs
+9
-3
stack.yaml
stack.yaml
+1
-1
No files found.
src/Gargantext/Core/Text/Corpus/API/Pubmed.hs
View file @
8d844d13
...
...
@@ -14,6 +14,7 @@ module Gargantext.Core.Text.Corpus.API.Pubmed
where
import
Conduit
import
Control.Monad.Reader
(
runReaderT
)
import
Data.Either
(
Either
)
import
Data.Maybe
import
Data.Text
(
Text
)
...
...
@@ -30,7 +31,7 @@ import PUBMED.Types (Config(..))
type
Query
=
Text
type
Limit
=
PubMed
.
Limit
type
Limit
=
Integer
-- | TODO put default pubmed query in gargantext.ini
...
...
@@ -40,8 +41,13 @@ get :: Maybe Text
->
Maybe
Limit
->
IO
(
Either
ClientError
(
Maybe
Integer
,
ConduitT
()
HyperdataDocument
IO
()
))
get
mAPIKey
q
l
=
do
eRes
<-
PubMed
.
getMetadataWithC
(
Config
{
mAPIKey
=
mAPIKey
})
q
l
pure
$
(
\
(
len
,
docsC
)
->
(
len
,
docsC
.|
mapC
(
toDoc
EN
)))
<$>
eRes
eRes
<-
runReaderT
PubMed
.
getMetadataWithC
(
Config
{
apiKey
=
mAPIKey
,
query
=
q
,
perPage
=
Nothing
})
let
takeLimit
=
case
l
of
Nothing
->
mapC
identity
Just
l'
->
takeC
$
fromIntegral
l'
pure
$
(
\
(
len
,
docsC
)
->
(
len
,
docsC
.|
takeLimit
.|
mapC
(
toDoc
EN
)))
<$>
eRes
--either (\e -> panic $ "CRAWL: PubMed" <> e) (map (toDoc EN))
-- <$> PubMed.getMetadataWithC q l
...
...
stack.yaml
View file @
8d844d13
...
...
@@ -74,7 +74,7 @@ extra-deps:
# External Data API connectors
-
git
:
https://gitlab.iscpif.fr/gargantext/crawlers/pubmed.git
commit
:
b78bdc85c222019d1eb6c7959b175d76f70532f1
commit
:
31cb4d28dcb5d17274cede5e67b2a01914379129
#commit: 364885c891cbadcd4d8a623d2e41394b09f653aa
-
git
:
https://gitlab.iscpif.fr/gargantext/crawlers/istex.git
commit
:
a34bb341236d82cf3d488210bc1d8448a98f5808
...
...
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