1 {-# LANGUAGE TemplateHaskell #-}
2 {-# LANGUAGE DeriveGeneric #-}
4 module Data.Gargantext.Types.Node where
6 import Data.Text (Text)
7 import Data.List (lookup)
8 import GHC.Generics (Generic)
9 import Data.Time (UTCTime)
10 import Data.Gargantext.Utils.Prefix
15 data NodePoly id typename userId parentId name date hyperdata = Node { node_id :: id
16 , node_typename :: typename
17 , node_userId:: userId
18 -- , nodeHashId :: hashId
19 , node_parentId :: parentId
22 , node_hyperdata :: hyperdata
26 data Statut = Statut { statut_Date :: Maybe UTCTime
27 , statut_Error :: Maybe Text
28 , statut_Action :: Maybe Text
29 , statut_Complete :: Maybe Bool
30 , statut_Progress :: Maybe Int
31 } deriving (Show, Generic)
32 $(deriveJSON (unPrefix "statut_") ''Statut)
35 data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd :: Maybe Text
36 , hyperdataDocument_Doi :: Maybe Text
37 , hyperdataDocument_Url :: Maybe Text
38 , hyperdataDocument_Page :: Maybe Int
39 , hyperdataDocument_Title :: Maybe Text
40 , hyperdataDocument_Authors :: Maybe Text
41 , hyperdataDocument_Abstract :: Maybe Text
42 , hyperdataDocument_Statuses :: Maybe [Statut]
43 , hyperdataDocument_Publication_date :: Maybe Text
44 , hyperdataDocument_Publication_year :: Maybe Text
45 , hyperdataDocument_Publication_month :: Maybe Text
46 , hyperdataDocument_Publication_hour :: Maybe Text
47 , hyperdataDocument_Publication_minute :: Maybe Text
48 , hyperdataDocument_Publication_second :: Maybe Text
49 , hyperdataDocument_LanguageIso2 :: Maybe Text
50 } deriving (Show, Generic)
51 $(deriveJSON (unPrefix "hyperdataDocument_") ''HyperdataDocument)
53 data LanguageNodes = LanguageNodes { languageNodes___unknown__ :: [Int]}
54 deriving (Show, Generic)
55 $(deriveJSON (unPrefix "languageNodes_") ''LanguageNodes)
58 data Resource = Resource { resource_Url :: Maybe Text
59 , resource_Path :: Maybe Text
60 , resource_Type :: Maybe Int
61 , resource_Extracted :: Maybe Bool
62 } deriving (Show, Generic)
63 $(deriveJSON (unPrefix "resource_") ''Resource)
66 data HyperdataCorpus = HyperdataCorpus { hyperdataCorpus_Action :: Maybe Text
67 , hyperdataCorpus_Statuses :: Maybe [Statut]
68 , hyperdataCorpus_Languages :: Maybe LanguageNodes
69 , hyperdataCorpus_Resources :: Maybe [Resource]
70 , hyperdataCorpus_Language_id :: Maybe Text
71 , hyperdataCorpus_Skipped_docs :: Maybe [Int]
72 } deriving (Show, Generic)
73 $(deriveJSON (unPrefix "hyperdataCorpus_") ''HyperdataCorpus)
76 data HyperdataFolder = HyperdataFolder { hyperdataFolder_Preferences :: Maybe Text
77 } deriving (Show, Generic)
78 $(deriveJSON (unPrefix "hyperdataFolder_") ''HyperdataFolder)
81 data HyperdataList = HyperdataList { hyperdataList_Preferences :: Maybe Text
82 } deriving (Show, Generic)
83 $(deriveJSON (unPrefix "hyperdataList_") ''HyperdataList)
85 data HyperdataScore = HyperdataScore { hyperdataScore_Preferences :: Maybe Text
86 } deriving (Show, Generic)
87 $(deriveJSON (unPrefix "hyperdataScore_") ''HyperdataScore)
91 data HyperdataFavorites = HyperdataFavorites { hyperdataFavorites_Preferences :: Maybe Text
92 } deriving (Show, Generic)
93 $(deriveJSON (unPrefix "hyperdataFavorites_") ''HyperdataFavorites)
95 data HyperdataResource = HyperdataResource { hyperdataResource_Preferences :: Maybe Text
96 } deriving (Show, Generic)
97 $(deriveJSON (unPrefix "hyperdataResource_") ''HyperdataResource)
101 -- TODO add the Graph Structure here
102 data HyperdataGraph = HyperdataGraph { hyperdataGraph_Preferences :: Maybe Text
103 } deriving (Show, Generic)
104 $(deriveJSON (unPrefix "hyperdataGraph_") ''HyperdataGraph)
107 -- TODO add the Graph Structure here
108 data HyperdataPhylo = HyperdataPhylo { hyperdataPhylo_Preferences :: Maybe Text
109 } deriving (Show, Generic)
110 $(deriveJSON (unPrefix "hyperdataPhylo_") ''HyperdataPhylo)
112 -- | TODO FEATURE: Notebook saved in the node (to work with Python or Haskell)
113 data HyperdataNotebook = HyperdataNotebook { hyperdataNotebook_Preferences :: Maybe Text
114 } deriving (Show, Generic)
115 $(deriveJSON (unPrefix "hyperdataNotebook_") ''HyperdataNotebook)