2 Module : Gargantext.API
3 Description : Server API
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 module Gargantext.Core.Ext.IMT where
14 import Gargantext.Prelude
15 import Data.Text (Text, splitOn)
18 import qualified Data.Set as S
19 import qualified Data.List as DL
20 import qualified Data.Vector as DV
21 import qualified Data.Map as M
23 import Gargantext.Core.Text.Metrics.Freq as F
24 import Gargantext.Core.Text.Corpus.Parsers.CSV as CSV
26 data School = School { school_shortName :: Text
27 , school_longName :: Text
29 } deriving (Show, Read, Eq)
33 ("Mines Albi-Carmaux")
34 ("Mines Albi-Carmaux - École nationale supérieure des Mines d'Albi‐Carmaux")
38 ("EMA - École des Mines d'Alès")
42 ("Mines Douai EMD - École des Mines de Douai")
46 ("Mines Lille - École des Mines de Lille")
54 ("Mines Nantes - Mines Nantes")
62 ("IMT Atlantique - IMT Atlantique Bretagne-Pays de la Loire")
65 ("Mines Saint-Étienne")
66 ("Mines Saint-Étienne MSE - École des Mines de Saint-Étienne")
69 ("Télécom École de Management")
70 ("TEM - Télécom Ecole de Management")
73 ("IMT Business School")
74 ("IMT Business School")
82 ("TSP - Télécom SudParis")
94 ("MINES ParisTech - École nationale supérieure des mines de Paris")
98 mapIdSchool :: Map Text Text
99 mapIdSchool = M.fromList $ Gargantext.Prelude.map (\(School n _ i) -> (i,n)) schools
101 hal_data :: IO (DV.Vector CsvHal)
102 hal_data = snd <$> CSV.readCsvHal "doc/corpus_imt/Gargantext_Corpus.csv"
105 names = S.fromList $ Gargantext.Prelude.map (\s -> school_id s) schools
107 toSchoolName :: Text -> Text
108 toSchoolName t = case M.lookup t mapIdSchool of
112 publisBySchool :: DV.Vector CsvHal -> [(Maybe Text, Int)]
113 publisBySchool hal_data' = Gargantext.Prelude.map (\(i,n) -> (M.lookup i mapIdSchool, n))
114 $ DL.filter (\i -> S.member (fst i) names)
121 $ DV.map (\n -> splitOn ( ", ") (csvHal_instStructId_i n) )
122 $ DV.filter (\n -> csvHal_publication_year n == 2017) hal_data'