[WIP] epo: some work

parent c71dbb14
Pipeline #5322 failed with stages
in 1 minute and 1 second
...@@ -6,6 +6,8 @@ with-compiler: ghc-8.10.7 ...@@ -6,6 +6,8 @@ with-compiler: ghc-8.10.7
packages: packages:
./ ./
../epo-api-client
../openalex
source-repository-package source-repository-package
type: git type: git
...@@ -91,6 +93,11 @@ source-repository-package ...@@ -91,6 +93,11 @@ source-repository-package
location: https://gitlab.iscpif.fr/gargantext/crawlers/isidore.git location: https://gitlab.iscpif.fr/gargantext/crawlers/isidore.git
tag: 3db385e767d2100d8abe900833c6e7de3ac55e1b tag: 3db385e767d2100d8abe900833c6e7de3ac55e1b
source-repository-package
type: git
location: https://gitlab.iscpif.fr/gargantext/iso639.git
tag: 1a9e23e210a02da3b846d7cdc666541e2148334d
source-repository-package source-repository-package
type: git type: git
location: https://gitlab.iscpif.fr/gargantext/crawlers/istex.git location: https://gitlab.iscpif.fr/gargantext/crawlers/istex.git
......
...@@ -431,6 +431,7 @@ library ...@@ -431,6 +431,7 @@ library
, duckling ^>= 0.2.0.0 , duckling ^>= 0.2.0.0
, ekg-core ^>= 0.1.1.7 , ekg-core ^>= 0.1.1.7
, ekg-json ^>= 0.1.0.7 , ekg-json ^>= 0.1.0.7
, epo-api-client
, exceptions ^>= 0.10.4 , exceptions ^>= 0.10.4
, extra ^>= 1.7.9 , extra ^>= 1.7.9
, fast-logger ^>= 3.0.5 , fast-logger ^>= 3.0.5
...@@ -461,7 +462,7 @@ library ...@@ -461,7 +462,7 @@ library
, ihaskell ^>= 0.10.2.2 , ihaskell ^>= 0.10.2.2
, ini ^>= 0.4.1 , ini ^>= 0.4.1
, insert-ordered-containers ^>= 0.2.5.1 , insert-ordered-containers ^>= 0.2.5.1
, iso639 ^>= 0.1.0.3 , iso639
, jose ^>= 0.8.4 , jose ^>= 0.8.4
, json-stream ^>= 0.4.2.4 , json-stream ^>= 0.4.2.4
, lens ^>= 4.19.2 , lens ^>= 4.19.2
...@@ -494,7 +495,7 @@ library ...@@ -494,7 +495,7 @@ library
, process ^>= 1.6.13.2 , process ^>= 1.6.13.2
, product-profunctors ^>= 0.11.0.3 , product-profunctors ^>= 0.11.0.3
, profunctors ^>= 5.6.2 , profunctors ^>= 5.6.2
, protolude ^>= 0.3.0 , protolude ^>= 0.3.3
, pureMD5 ^>= 2.1.4 , pureMD5 ^>= 2.1.4
, quickcheck-instances ^>= 0.3.25.2 , quickcheck-instances ^>= 0.3.25.2
, rake ^>= 0.0.1 , rake ^>= 0.0.1
...@@ -667,7 +668,7 @@ executable gargantext-cli ...@@ -667,7 +668,7 @@ executable gargantext-cli
, gargantext-prelude , gargantext-prelude
, ini ^>= 0.4.1 , ini ^>= 0.4.1
, optparse-generic ^>= 1.4.7 , optparse-generic ^>= 1.4.7
, protolude ^>= 0.3.0 , protolude ^>= 0.3.3
, split ^>= 0.2.3.4 , split ^>= 0.2.3.4
, text ^>= 1.2.4.1 , text ^>= 1.2.4.1
, unordered-containers ^>= 0.2.16.0 , unordered-containers ^>= 0.2.16.0
......
...@@ -36,6 +36,7 @@ data ExternalAPIs = OpenAlex ...@@ -36,6 +36,7 @@ data ExternalAPIs = OpenAlex
| HAL | HAL
| IsTex | IsTex
| Isidore | Isidore
| EPO
deriving (Show, Eq, Generic, Enum, Bounded) deriving (Show, Eq, Generic, Enum, Bounded)
......
...@@ -32,6 +32,7 @@ data Database = Empty ...@@ -32,6 +32,7 @@ data Database = Empty
| HAL | HAL
| IsTex | IsTex
| Isidore | Isidore
| EPO
deriving (Eq, Show, Generic, Enum, Bounded) deriving (Eq, Show, Generic, Enum, Bounded)
instance Arbitrary Database where instance Arbitrary Database where
...@@ -49,6 +50,7 @@ database2origin Arxiv = ExternalOrigin Types.Arxiv ...@@ -49,6 +50,7 @@ database2origin Arxiv = ExternalOrigin Types.Arxiv
database2origin HAL = ExternalOrigin Types.HAL database2origin HAL = ExternalOrigin Types.HAL
database2origin IsTex = ExternalOrigin Types.IsTex database2origin IsTex = ExternalOrigin Types.IsTex
database2origin Isidore = ExternalOrigin Types.Isidore database2origin Isidore = ExternalOrigin Types.Isidore
database2origin EPO = ExternalOrigin Types.EPO
------------------------------------------------------------------------ ------------------------------------------------------------------------
data Datafield = Gargantext data Datafield = Gargantext
......
...@@ -21,9 +21,11 @@ module Gargantext.Core.Text.Corpus.API ...@@ -21,9 +21,11 @@ module Gargantext.Core.Text.Corpus.API
import Conduit import Conduit
import Control.Monad.Except import Control.Monad.Except
import Data.Text qualified as T import Data.Text qualified as T
import EPO.API.Client.Types qualified as EPO
import Gargantext.API.Admin.Orchestrator.Types (ExternalAPIs(..), externalAPIs) import Gargantext.API.Admin.Orchestrator.Types (ExternalAPIs(..), externalAPIs)
import Gargantext.Core (Lang(..), toISO639) import Gargantext.Core (Lang(..), toISO639)
import Gargantext.Core.Text.Corpus.API.Arxiv qualified as Arxiv import Gargantext.Core.Text.Corpus.API.Arxiv qualified as Arxiv
import Gargantext.Core.Text.Corpus.API.EPO qualified as EPO
import Gargantext.Core.Text.Corpus.API.Hal qualified as HAL import Gargantext.Core.Text.Corpus.API.Hal qualified as HAL
import Gargantext.Core.Text.Corpus.API.Isidore qualified as ISIDORE import Gargantext.Core.Text.Corpus.API.Isidore qualified as ISIDORE
import Gargantext.Core.Text.Corpus.API.Istex qualified as ISTEX import Gargantext.Core.Text.Corpus.API.Istex qualified as ISTEX
...@@ -47,6 +49,7 @@ get :: ExternalAPIs ...@@ -47,6 +49,7 @@ get :: ExternalAPIs
-> Lang -> Lang
-> Corpus.RawQuery -> Corpus.RawQuery
-> Maybe PUBMED.APIKey -> Maybe PUBMED.APIKey
-> Maybe EPO.AuthKey
-> Maybe Corpus.Limit -> Maybe Corpus.Limit
-- -> IO [HyperdataDocument] -- -> IO [HyperdataDocument]
-> IO (Either GetCorpusError (Maybe Integer, ConduitT () HyperdataDocument IO ())) -> IO (Either GetCorpusError (Maybe Integer, ConduitT () HyperdataDocument IO ()))
...@@ -69,5 +72,7 @@ get externalAPI la q mPubmedAPIKey limit = do ...@@ -69,5 +72,7 @@ get externalAPI la q mPubmedAPIKey limit = do
Isidore -> do Isidore -> do
docs <- ISIDORE.get la (Corpus.getLimit <$> limit) (Just $ Corpus.getRawQuery q) Nothing docs <- ISIDORE.get la (Corpus.getLimit <$> limit) (Just $ Corpus.getRawQuery q) Nothing
pure $ Right (Just $ fromIntegral $ length docs, yieldMany docs) pure $ Right (Just $ fromIntegral $ length docs, yieldMany docs)
EPO -> do
first ExternalAPIError <$> EPO.get (fromMaybe "" Nothing {- email -}) q (toISO639 la) limit
where where
parse_query = first (InvalidInputQuery q . T.pack) $ Corpus.parseQuery q parse_query = first (InvalidInputQuery q . T.pack) $ Corpus.parseQuery q
...@@ -45,10 +45,10 @@ toDoc (OA.Work { .. } ) = ...@@ -45,10 +45,10 @@ toDoc (OA.Work { .. } ) =
, _hd_institutes = institutes authorships , _hd_institutes = institutes authorships
, _hd_source = source , _hd_source = source
, _hd_abstract = Just abstract_reconstructed , _hd_abstract = Just abstract_reconstructed
, _hd_publication_date = Just $ show publication_date , _hd_publication_date = Just $ OA.showDate publication_date
, _hd_publication_year = Just $ publication_year , _hd_publication_year = Just $ publication_year
, _hd_publication_month = Nothing -- TODO , _hd_publication_month = Just $ OA.dateMonth publication_date
, _hd_publication_day = Nothing -- TODO , _hd_publication_day = Just $ OA.dateDay publication_date
, _hd_publication_hour = Nothing -- TODO , _hd_publication_hour = Nothing -- TODO
, _hd_publication_minute = Nothing -- TODO , _hd_publication_minute = Nothing -- TODO
, _hd_publication_second = Nothing -- TODO , _hd_publication_second = Nothing -- TODO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment