1 {-# LANGUAGE TemplateHaskell #-}
2 {-# LANGUAGE DeriveGeneric #-}
3 -- {-# LANGUAGE DuplicateRecordFields #-}
5 module Gargantext.Types.Node where
7 import Gargantext.Prelude
9 import Text.Show (Show())
10 import Data.Text (Text)
11 import GHC.Generics (Generic)
12 import Data.Time (UTCTime)
13 import Gargantext.Utils.Prefix (unPrefix)
14 import Data.Aeson.TH (deriveJSON)
18 data Facet id hyperdata favorite ngramCount = FacetDoc { facetDoc_id :: id
19 , facetDoc_hyperdata :: hyperdata
20 , facetDoc_favorite :: favorite
21 , facetDoc_ngramCount :: ngramCount
23 $(deriveJSON (unPrefix "facetDoc_") ''Facet)
27 data NodePoly id typename userId parentId name date hyperdata = Node { node_id :: id
28 , node_typename :: typename
29 , node_userId :: userId
30 -- , nodeHashId :: hashId
31 , node_parentId :: parentId
34 , node_hyperdata :: hyperdata
35 -- , node_titleAbstract :: titleAbstract
37 $(deriveJSON (unPrefix "node_") ''NodePoly)
40 data Status = Status { status_Date :: Maybe UTCTime
41 , status_Error :: Maybe Text
42 , status_Action :: Maybe Text
43 , status_Complete :: Maybe Bool
44 , status_Progress :: Maybe Int
45 } deriving (Show, Generic)
46 $(deriveJSON (unPrefix "status_") ''Status)
49 data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd :: Maybe Text
50 , hyperdataDocument_Doi :: Maybe Text
51 , hyperdataDocument_Url :: Maybe Text
52 , hyperdataDocument_Page :: Maybe Int
53 , hyperdataDocument_Title :: Maybe Text
54 , hyperdataDocument_Authors :: Maybe Text
55 , hyperdataDocument_Abstract :: Maybe Text
56 , hyperdataDocument_Statuses :: Maybe [Status]
57 , hyperdataDocument_Publication_date :: Maybe Text
58 , hyperdataDocument_Publication_year :: Maybe Text
59 , hyperdataDocument_Publication_month :: Maybe Text
60 , hyperdataDocument_Publication_hour :: Maybe Text
61 , hyperdataDocument_Publication_minute :: Maybe Text
62 , hyperdataDocument_Publication_second :: Maybe Text
63 , hyperdataDocument_LanguageIso2 :: Maybe Text
64 } deriving (Show, Generic)
65 $(deriveJSON (unPrefix "hyperdataDocument_") ''HyperdataDocument)
67 data LanguageNodes = LanguageNodes { languageNodes___unknown__ :: [Int]}
68 deriving (Show, Generic)
69 $(deriveJSON (unPrefix "languageNodes_") ''LanguageNodes)
72 data Resource = Resource { resource_Url :: Maybe Text
73 , resource_Path :: Maybe Text
74 , resource_Type :: Maybe Int
75 , resource_Extracted :: Maybe Bool
76 } deriving (Show, Generic)
77 $(deriveJSON (unPrefix "resource_") ''Resource)
80 data HyperdataCorpus = HyperdataCorpus { hyperdataCorpus_Action :: Maybe Text
81 , hyperdataCorpus_Statuses :: Maybe [Status]
82 , hyperdataCorpus_Languages :: Maybe LanguageNodes
83 , hyperdataCorpus_Resources :: Maybe [Resource]
84 , hyperdataCorpus_Language_id :: Maybe Text
85 , hyperdataCorpus_Skipped_docs :: Maybe [Int]
86 } deriving (Show, Generic)
87 $(deriveJSON (unPrefix "hyperdataCorpus_") ''HyperdataCorpus)
91 data HyperdataUser = HyperdataUser { hyperdataUser_language :: Maybe Text
92 } deriving (Show, Generic)
93 $(deriveJSON (unPrefix "hyperdataUser_") ''HyperdataUser)
97 data HyperdataFolder = HyperdataFolder { hyperdataFolder_Preferences :: Maybe Text
98 } deriving (Show, Generic)
99 $(deriveJSON (unPrefix "hyperdataFolder_") ''HyperdataFolder)
102 data HyperdataProject = HyperdataProject { hyperdataProject_Preferences :: Maybe Text
103 } deriving (Show, Generic)
104 $(deriveJSON (unPrefix "hyperdataProject_") ''HyperdataProject)
108 data HyperdataList = HyperdataList { hyperdataList_Preferences :: Maybe Text
109 } deriving (Show, Generic)
110 $(deriveJSON (unPrefix "hyperdataList_") ''HyperdataList)
112 data HyperdataScore = HyperdataScore { hyperdataScore_Preferences :: Maybe Text
113 } deriving (Show, Generic)
114 $(deriveJSON (unPrefix "hyperdataScore_") ''HyperdataScore)
118 data HyperdataFavorites = HyperdataFavorites { hyperdataFavorites_Preferences :: Maybe Text
119 } deriving (Show, Generic)
120 $(deriveJSON (unPrefix "hyperdataFavorites_") ''HyperdataFavorites)
122 data HyperdataResource = HyperdataResource { hyperdataResource_Preferences :: Maybe Text
123 } deriving (Show, Generic)
124 $(deriveJSON (unPrefix "hyperdataResource_") ''HyperdataResource)
128 -- TODO add the Graph Structure here
129 data HyperdataGraph = HyperdataGraph { hyperdataGraph_Preferences :: Maybe Text
130 } deriving (Show, Generic)
131 $(deriveJSON (unPrefix "hyperdataGraph_") ''HyperdataGraph)
134 -- TODO add the Graph Structure here
135 data HyperdataPhylo = HyperdataPhylo { hyperdataPhylo_Preferences :: Maybe Text
136 } deriving (Show, Generic)
137 $(deriveJSON (unPrefix "hyperdataPhylo_") ''HyperdataPhylo)
139 -- | TODO FEATURE: Notebook saved in the node (to work with Python or Haskell)
140 data HyperdataNotebook = HyperdataNotebook { hyperdataNotebook_Preferences :: Maybe Text
141 } deriving (Show, Generic)
142 $(deriveJSON (unPrefix "hyperdataNotebook_") ''HyperdataNotebook)