]> Git — Sourcephile - gargantext.git/blob - src/Data/Gargantext/Types/Node.hs
[FEAT] Ngrams extractor in English with tests : ok. Need to factor pattern matching...
[gargantext.git] / src / Data / Gargantext / Types / Node.hs
1 {-# LANGUAGE TemplateHaskell #-}
2 {-# LANGUAGE DeriveGeneric #-}
3
4 module Data.Gargantext.Types.Node where
5
6 import Data.Text (Text)
7 import GHC.Generics (Generic)
8 import Data.Time (UTCTime)
9 import Data.Gargantext.Utils.Prefix (unPrefix)
10 import Data.Aeson.TH (deriveJSON)
11
12 data NodePoly id typename userId parentId name date hyperdata = Node { node_id :: id
13 , node_typename :: typename
14 , node_userId:: userId
15 -- , nodeHashId :: hashId
16 , node_parentId :: parentId
17 , node_name :: name
18 , node_date :: date
19 , node_hyperdata :: hyperdata
20 } deriving (Show)
21
22
23 data Statut = Statut { statut_Date :: Maybe UTCTime
24 , statut_Error :: Maybe Text
25 , statut_Action :: Maybe Text
26 , statut_Complete :: Maybe Bool
27 , statut_Progress :: Maybe Int
28 } deriving (Show, Generic)
29 $(deriveJSON (unPrefix "statut_") ''Statut)
30
31
32 data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd :: Maybe Text
33 , hyperdataDocument_Doi :: Maybe Text
34 , hyperdataDocument_Url :: Maybe Text
35 , hyperdataDocument_Page :: Maybe Int
36 , hyperdataDocument_Title :: Maybe Text
37 , hyperdataDocument_Authors :: Maybe Text
38 , hyperdataDocument_Abstract :: Maybe Text
39 , hyperdataDocument_Statuses :: Maybe [Statut]
40 , hyperdataDocument_Publication_date :: Maybe Text
41 , hyperdataDocument_Publication_year :: Maybe Text
42 , hyperdataDocument_Publication_month :: Maybe Text
43 , hyperdataDocument_Publication_hour :: Maybe Text
44 , hyperdataDocument_Publication_minute :: Maybe Text
45 , hyperdataDocument_Publication_second :: Maybe Text
46 , hyperdataDocument_LanguageIso2 :: Maybe Text
47 } deriving (Show, Generic)
48 $(deriveJSON (unPrefix "hyperdataDocument_") ''HyperdataDocument)
49
50 data LanguageNodes = LanguageNodes { languageNodes___unknown__ :: [Int]}
51 deriving (Show, Generic)
52 $(deriveJSON (unPrefix "languageNodes_") ''LanguageNodes)
53
54
55 data Resource = Resource { resource_Url :: Maybe Text
56 , resource_Path :: Maybe Text
57 , resource_Type :: Maybe Int
58 , resource_Extracted :: Maybe Bool
59 } deriving (Show, Generic)
60 $(deriveJSON (unPrefix "resource_") ''Resource)
61
62
63 data HyperdataCorpus = HyperdataCorpus { hyperdataCorpus_Action :: Maybe Text
64 , hyperdataCorpus_Statuses :: Maybe [Statut]
65 , hyperdataCorpus_Languages :: Maybe LanguageNodes
66 , hyperdataCorpus_Resources :: Maybe [Resource]
67 , hyperdataCorpus_Language_id :: Maybe Text
68 , hyperdataCorpus_Skipped_docs :: Maybe [Int]
69 } deriving (Show, Generic)
70 $(deriveJSON (unPrefix "hyperdataCorpus_") ''HyperdataCorpus)
71
72
73 data HyperdataFolder = HyperdataFolder { hyperdataFolder_Preferences :: Maybe Text
74 } deriving (Show, Generic)
75 $(deriveJSON (unPrefix "hyperdataFolder_") ''HyperdataFolder)
76
77
78 data HyperdataList = HyperdataList { hyperdataList_Preferences :: Maybe Text
79 } deriving (Show, Generic)
80 $(deriveJSON (unPrefix "hyperdataList_") ''HyperdataList)
81
82 data HyperdataScore = HyperdataScore { hyperdataScore_Preferences :: Maybe Text
83 } deriving (Show, Generic)
84 $(deriveJSON (unPrefix "hyperdataScore_") ''HyperdataScore)
85
86
87
88 data HyperdataFavorites = HyperdataFavorites { hyperdataFavorites_Preferences :: Maybe Text
89 } deriving (Show, Generic)
90 $(deriveJSON (unPrefix "hyperdataFavorites_") ''HyperdataFavorites)
91
92 data HyperdataResource = HyperdataResource { hyperdataResource_Preferences :: Maybe Text
93 } deriving (Show, Generic)
94 $(deriveJSON (unPrefix "hyperdataResource_") ''HyperdataResource)
95
96
97
98 -- TODO add the Graph Structure here
99 data HyperdataGraph = HyperdataGraph { hyperdataGraph_Preferences :: Maybe Text
100 } deriving (Show, Generic)
101 $(deriveJSON (unPrefix "hyperdataGraph_") ''HyperdataGraph)
102
103
104 -- TODO add the Graph Structure here
105 data HyperdataPhylo = HyperdataPhylo { hyperdataPhylo_Preferences :: Maybe Text
106 } deriving (Show, Generic)
107 $(deriveJSON (unPrefix "hyperdataPhylo_") ''HyperdataPhylo)
108
109 -- | TODO FEATURE: Notebook saved in the node (to work with Python or Haskell)
110 data HyperdataNotebook = HyperdataNotebook { hyperdataNotebook_Preferences :: Maybe Text
111 } deriving (Show, Generic)
112 $(deriveJSON (unPrefix "hyperdataNotebook_") ''HyperdataNotebook)