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