Commit d593b35f authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Types] Phylo

parent f31e0a3c
...@@ -39,9 +39,9 @@ import Gargantext.Core.Utils.Prefix (unPrefix) ...@@ -39,9 +39,9 @@ import Gargantext.Core.Utils.Prefix (unPrefix)
-- Duration : time Segment of the whole phylomemy in UTCTime format (start,end) -- Duration : time Segment of the whole phylomemy in UTCTime format (start,end)
-- Ngrams : list of all (possible) terms contained in the phylomemy (with their id) -- Ngrams : list of all (possible) terms contained in the phylomemy (with their id)
-- Steps : list of all steps to build the phylomemy -- Steps : list of all steps to build the phylomemy
data Phylo = Phylo { _phyloDuration :: (Start, End) data Phylo = Phylo { _phylo_Duration :: (Start, End)
, _phyloNgrams :: [Ngram] , _phylo_Ngrams :: [Ngram]
, _phyloPeriods :: [PhyloPeriod] , _phylo_Periods :: [PhyloPeriod]
} deriving (Generic) } deriving (Generic)
-- | UTCTime in seconds since UNIX epoch -- | UTCTime in seconds since UNIX epoch
...@@ -54,20 +54,20 @@ type NgramId = Int ...@@ -54,20 +54,20 @@ type NgramId = Int
-- | PhyloStep : steps of phylomemy on temporal axis -- | PhyloStep : steps of phylomemy on temporal axis
-- Period: tuple (start date, end date) of the step of the phylomemy -- Period: tuple (start date, end date) of the step of the phylomemy
-- Levels: levels of granularity -- Levels: levels of granularity
data PhyloPeriod = PhyloPeriod { _phyloPeriodId :: PhyloPeriodId data PhyloPeriod = PhyloPeriod { _phylo_PeriodId :: PhyloPeriodId
, _phyloPeriodLevels :: [PhyloLevel] , _phylo_PeriodLevels :: [PhyloLevel]
} deriving (Generic) } deriving (Generic)
type PhyloPeriodId = (Start, End) type PhyloPeriodId = (Start, End)
-- | PhyloLevel : levels of phylomemy on level axis -- | PhyloLevel : levels of phylomemy on level axis
-- Levels description: -- Levels description:
-- Level -1: Ngram equals itself (by identity) == _phyloNgrams -- Level -1: Ngram equals itself (by identity) == _phylo_Ngrams
-- Level 0: Group of synonyms (by stems + by qualitative expert meaning) -- Level 0: Group of synonyms (by stems + by qualitative expert meaning)
-- Level 1: First level of clustering -- Level 1: First level of clustering
-- Level N: Nth level of clustering -- Level N: Nth level of clustering
data PhyloLevel = PhyloLevel { _phyloLevelId :: PhyloLevelId data PhyloLevel = PhyloLevel { _phylo_LevelId :: PhyloLevelId
, _phyloLevelGroups :: [PhyloGroup] , _phylo_LevelGroups :: [PhyloGroup]
} deriving (Generic) } deriving (Generic)
type PhyloLevelId = (PhyloPeriodId, Int) type PhyloLevelId = (PhyloPeriodId, Int)
...@@ -77,15 +77,15 @@ type PhyloLevelId = (PhyloPeriodId, Int) ...@@ -77,15 +77,15 @@ type PhyloLevelId = (PhyloPeriodId, Int)
-- Ngrams: set of terms that build the group -- Ngrams: set of terms that build the group
-- Period Parents|Childs: weighted link to Parents|Childs (Temporal Period axis) -- Period Parents|Childs: weighted link to Parents|Childs (Temporal Period axis)
-- Level Parents|Childs: weighted link to Parents|Childs (Level Granularity axis) -- Level Parents|Childs: weighted link to Parents|Childs (Level Granularity axis)
data PhyloGroup = PhyloGroup { _phyloGroupId :: PhyloGroupId data PhyloGroup = PhyloGroup { _phylo_GroupId :: PhyloGroupId
, _phyloGroupLabel :: Maybe Text , _phylo_GroupLabel :: Maybe Text
, _phyloGroupNgrams :: [NgramId] , _phylo_GroupNgrams :: [NgramId]
, _phyloGroupPeriodParents :: [Edge] , _phylo_GroupPeriodParents :: [Edge]
, _phyloGroupPeriodChilds :: [Edge] , _phylo_GroupPeriodChilds :: [Edge]
, _phyloGroupLevelParents :: [Edge] , _phylo_GroupLevelParents :: [Edge]
, _phyloGroupLevelChilds :: [Edge] , _phylo_GroupLevelChilds :: [Edge]
} deriving (Generic) } deriving (Generic)
type PhyloGroupId = (PhyloLevelId, Int) type PhyloGroupId = (PhyloLevelId, Int)
...@@ -93,7 +93,7 @@ type Edge = (PhyloGroupId, Weight) ...@@ -93,7 +93,7 @@ type Edge = (PhyloGroupId, Weight)
type Weight = Double type Weight = Double
-- | JSON instances -- | JSON instances
$(deriveJSON (unPrefix "_phylo" ) ''Phylo ) $(deriveJSON (unPrefix "_phylo_" ) ''Phylo )
$(deriveJSON (unPrefix "_phyloPeriod" ) ''PhyloPeriod ) $(deriveJSON (unPrefix "_phylo_Period" ) ''PhyloPeriod )
$(deriveJSON (unPrefix "_phyloLevel" ) ''PhyloLevel ) $(deriveJSON (unPrefix "_phylo_Level" ) ''PhyloLevel )
$(deriveJSON (unPrefix "_phyloGroup" ) ''PhyloGroup ) $(deriveJSON (unPrefix "_phylo_Group" ) ''PhyloGroup )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment