Commit b7409d1b authored by Quentin Lobbé's avatar Quentin Lobbé

add the Metrics and the Filters

parent f5ebe987
......@@ -199,13 +199,14 @@ data PairTo = Childs | Parents
-- | PhyloView | --
data EdgeType = Ascendant | Descendant | Complete deriving (Show)
data Filiation = Ascendant | Descendant | Complete deriving (Show)
data EdgeType = PeriodEdge | LevelEdge deriving (Show)
data PhyloView = PhyloView
{ _phylo_viewParam :: PhyloParam
, _phylo_viewLabel :: Text
, _phylo_viewDescription :: Text
, _phylo_viewEdgeType :: EdgeType
, _phylo_viewFiliation :: Filiation
, _phylo_viewMeta :: Map Text Double
, _phylo_viewBranches :: [PhyloBranch]
, _phylo_viewNodes :: [PhyloNode]
......@@ -223,12 +224,14 @@ data PhyloBranch = PhyloBranch
data PhyloEdge = PhyloEdge
{ _phylo_edgeSource :: PhyloGroupId
, _phylo_edgeTarget :: PhyloGroupId
, _phylo_edgeType :: EdgeType
, _phylo_edgeWeight :: Weight
} deriving (Show)
data PhyloNode = PhyloNode
{ _phylo_nodeId :: PhyloGroupId
, _phylo_nodeBranchId :: Maybe PhyloBranchId
, _phylo_nodeLabel :: Text
, _phylo_nodeNgramsIdx :: [Int]
, _phylo_nodeNgrams :: Maybe [Ngrams]
......@@ -239,7 +242,7 @@ data PhyloNode = PhyloNode
-- | PhyloQuery | --
data Filter = LonelyBranchFilter
data Filter = LonelyBranch
data Metric = BranchAge
data Tagger = BranchLabelFreq | GroupLabelCooc | GroupDynamics
......@@ -247,16 +250,13 @@ data Tagger = BranchLabelFreq | GroupLabelCooc | GroupDynamics
data Sort = ByBranchAge
data Order = Asc | Desc
data QueryParam = Qp1 Int | Qp2 Text | Qp3 Bool deriving (Eq, Ord)
data DisplayMode = Flat | Nested
-- | A query filter seen as : prefix && ((filter params)(clause))
data QueryFilter = QueryFilter
{ _query_filter :: Filter
, _query_params :: [QueryParam]
, _query_clause :: (QueryParam -> Bool)
, _query_params :: [Double]
}
......@@ -264,8 +264,8 @@ data QueryFilter = QueryFilter
data PhyloQuery = PhyloQuery
{ _query_lvl :: Level
-- Does the PhyloGraph contain ascendant, descendant or both (filiation) edges ?
, _query_edgeType :: EdgeType
-- Does the PhyloGraph contain ascendant, descendant or a complete Filiation ?
, _query_filiation :: Filiation
-- Does the PhyloGraph contain some levelChilds ? How deep must it go ?
, _query_childs :: Bool
......@@ -300,6 +300,10 @@ makeLenses ''PhyloLevel
makeLenses ''PhyloPeriod
makeLenses ''PhyloView
makeLenses ''PhyloQuery
makeLenses ''PhyloBranch
makeLenses ''PhyloNode
makeLenses ''PhyloEdge
makeLenses ''QueryFilter
-- | JSON instances
$(deriveJSON (unPrefix "_phylo_" ) ''Phylo )
......
This diff is collapsed.
......@@ -140,7 +140,7 @@ getGroupBranchId = _phylo_groupBranchId
-- | To get the PhyloGroups Childs of a PhyloGroup
getGroupChilds :: PhyloGroup -> Phylo -> [PhyloGroup]
getGroupChilds g p = getGroupsFromIds (map fst $ _phylo_groupPeriodChilds g) p
getGroupChilds g p = getGroupsFromIds (getGroupPeriodChildsId g) p
-- | To get the id of a PhyloGroup
......@@ -158,14 +158,24 @@ getGroupLevel :: PhyloGroup -> Int
getGroupLevel = snd . fst . getGroupId
-- | To get the level child pointers of a PhyloGroup
getGroupLevelChilds :: PhyloGroup -> [Pointer]
getGroupLevelChilds = _phylo_groupLevelChilds
-- | To get the PhyloGroups Level Childs Ids of a PhyloGroup
getGroupLevelChildsId :: PhyloGroup -> [PhyloGroupId]
getGroupLevelChildsId g = map fst $ _phylo_groupLevelChilds g
getGroupLevelChildsId g = map fst $ getGroupLevelChilds g
-- | To get the level parent pointers of a PhyloGroup
getGroupLevelParents :: PhyloGroup -> [Pointer]
getGroupLevelParents = _phylo_groupLevelParents
-- | To get the PhyloGroups Level Parents Ids of a PhyloGroup
getGroupLevelParentsId :: PhyloGroup -> [PhyloGroupId]
getGroupLevelParentsId g = map fst $ _phylo_groupLevelParents g
getGroupLevelParentsId g = map fst $ getGroupLevelParents g
-- | To get the Ngrams of a PhyloGroup
......@@ -180,7 +190,7 @@ getGroupPairs g p = (getGroupChilds g p) ++ (getGroupParents g p)
-- | To get the PhyloGroups Parents of a PhyloGroup
getGroupParents :: PhyloGroup -> Phylo -> [PhyloGroup]
getGroupParents g p = getGroupsFromIds (map fst $ _phylo_groupPeriodParents g) p
getGroupParents g p = getGroupsFromIds (getGroupPeriodParentsId g) p
-- | To get the period out of the id of a PhyloGroup
......@@ -188,6 +198,26 @@ getGroupPeriod :: PhyloGroup -> (Date,Date)
getGroupPeriod = fst . fst . getGroupId
-- | To get the period child pointers of a PhyloGroup
getGroupPeriodChilds :: PhyloGroup -> [Pointer]
getGroupPeriodChilds = _phylo_groupPeriodChilds
-- | To get the PhyloGroups Period Parents Ids of a PhyloGroup
getGroupPeriodChildsId :: PhyloGroup -> [PhyloGroupId]
getGroupPeriodChildsId g = map fst $ getGroupPeriodChilds g
-- | To get the period parent pointers of a PhyloGroup
getGroupPeriodParents :: PhyloGroup -> [Pointer]
getGroupPeriodParents = _phylo_groupPeriodParents
-- | To get the PhyloGroups Period Parents Ids of a PhyloGroup
getGroupPeriodParentsId :: PhyloGroup -> [PhyloGroupId]
getGroupPeriodParentsId g = map fst $ getGroupPeriodParents g
-- | To get all the PhyloGroup of a Phylo
getGroups :: Phylo -> [PhyloGroup]
getGroups = view ( phylo_periods
......
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