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