]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core/Text/Corpus/API.hs
[VERSION] +1 to 0.0.4.8.6
[gargantext.git] / src / Gargantext / Core / Text / Corpus / API.hs
1 {-|
2 Module : Gargantext.Core.Text.Corpus.API
3 Description : All crawlers of Gargantext in one file.
4 Copyright : (c) CNRS, 2017
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 -}
11
12 module Gargantext.Core.Text.Corpus.API
13 ( ExternalAPIs(..)
14 , Query
15 , Limit
16 , get
17 , externalAPIs
18 )
19 where
20
21 import Data.Maybe
22 import Gargantext.API.Admin.Orchestrator.Types (ExternalAPIs(..), externalAPIs)
23 import Gargantext.Core (Lang(..))
24 import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..))
25 import Gargantext.Prelude
26 import qualified Gargantext.Core.Text.Corpus.API.Hal as HAL
27 import qualified Gargantext.Core.Text.Corpus.API.Isidore as ISIDORE
28 import qualified Gargantext.Core.Text.Corpus.API.Istex as ISTEX
29 import qualified Gargantext.Core.Text.Corpus.API.Pubmed as PUBMED
30
31 -- | TODO put in gargantext.init
32 default_limit :: Maybe Integer
33 default_limit = Just 10000
34
35 -- | Get External API metadata main function
36 get :: ExternalAPIs
37 -> Lang
38 -> Query
39 -> Maybe Limit
40 -> IO [HyperdataDocument]
41 get PubMed _la q _l = PUBMED.get q default_limit -- EN only by default
42 get HAL la q _l = HAL.get la q default_limit
43 get IsTex la q _l = ISTEX.get la q default_limit
44 get Isidore la q _l = ISIDORE.get la (fromIntegral <$> default_limit) (Just q) Nothing
45 get _ _ _ _ = undefined
46
47 -- | Some Sugar for the documentation
48 type Query = PUBMED.Query
49 type Limit = PUBMED.Limit