Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
71b6f531
Verified
Commit
71b6f531
authored
Aug 25, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[phylo] hourly phylo seems to work now
At least with proper settings.
parent
59efd170
Pipeline
#7829
failed with stages
in 28 minutes and 29 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
15 deletions
+113
-15
API.purs
src/Gargantext/Components/PhyloExplorer/API.purs
+20
-0
ConfigForm.purs
...argantext/Components/PhyloExplorer/Config/ConfigForm.purs
+3
-0
JSON.purs
src/Gargantext/Components/PhyloExplorer/JSON.purs
+7
-0
Resources.js
src/Gargantext/Components/PhyloExplorer/Resources.js
+5
-1
DetailsTab.purs
...rgantext/Components/PhyloExplorer/Sidebar/DetailsTab.purs
+6
-0
Types.js
src/Gargantext/Components/PhyloExplorer/Types.js
+46
-0
Types.purs
src/Gargantext/Components/PhyloExplorer/Types.purs
+26
-14
No files found.
src/Gargantext/Components/PhyloExplorer/API.purs
View file @
71b6f531
...
@@ -93,6 +93,7 @@ data TimeUnit
...
@@ -93,6 +93,7 @@ data TimeUnit
| Month TimeUnitCriteria
| Month TimeUnitCriteria
| Week TimeUnitCriteria
| Week TimeUnitCriteria
| Day TimeUnitCriteria
| Day TimeUnitCriteria
| Hour TimeUnitCriteria
derive instance Generic TimeUnit _
derive instance Generic TimeUnit _
derive instance Eq TimeUnit
derive instance Eq TimeUnit
...
@@ -109,6 +110,7 @@ instance JSON.WriteForeign TimeUnit where
...
@@ -109,6 +110,7 @@ instance JSON.WriteForeign TimeUnit where
Month (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseMonth) o
Month (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseMonth) o
Week (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseWeek) o
Week (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseWeek) o
Day (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseDay) o
Day (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseDay) o
Hour (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseHour) o
where
where
parseEpoch =
parseEpoch =
Record.rename
Record.rename
...
@@ -175,6 +177,19 @@ instance JSON.WriteForeign TimeUnit where
...
@@ -175,6 +177,19 @@ instance JSON.WriteForeign TimeUnit where
>>> Record.insert
>>> Record.insert
(Proxy :: Proxy "tag")
(Proxy :: Proxy "tag")
"Day"
"Day"
parseHour =
Record.rename
(Proxy :: Proxy "period")
(Proxy :: Proxy "_hour_period")
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_hour_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_hour_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Hour"
data ReflexiveTimeUnit
data ReflexiveTimeUnit
= Epoch_
= Epoch_
...
@@ -182,6 +197,7 @@ data ReflexiveTimeUnit
...
@@ -182,6 +197,7 @@ data ReflexiveTimeUnit
| Month_
| Month_
| Week_
| Week_
| Day_
| Day_
| Hour_
derive instance Generic ReflexiveTimeUnit _
derive instance Generic ReflexiveTimeUnit _
derive instance Eq ReflexiveTimeUnit
derive instance Eq ReflexiveTimeUnit
...
@@ -196,6 +212,7 @@ instance Read ReflexiveTimeUnit where
...
@@ -196,6 +212,7 @@ instance Read ReflexiveTimeUnit where
"Month_" -> Just Month_
"Month_" -> Just Month_
"Week_" -> Just Week_
"Week_" -> Just Week_
"Day_" -> Just Day_
"Day_" -> Just Day_
"Hour_" -> Just Hour_
_ -> Nothing
_ -> Nothing
newtype TimeUnitCriteria = TimeUnitCriteria
newtype TimeUnitCriteria = TimeUnitCriteria
...
@@ -302,6 +319,7 @@ toReflexiveTimeUnit (Year _) = Year_
...
@@ -302,6 +319,7 @@ toReflexiveTimeUnit (Year _) = Year_
toReflexiveTimeUnit (Month _) = Month_
toReflexiveTimeUnit (Month _) = Month_
toReflexiveTimeUnit (Week _) = Week_
toReflexiveTimeUnit (Week _) = Week_
toReflexiveTimeUnit (Day _) = Day_
toReflexiveTimeUnit (Day _) = Day_
toReflexiveTimeUnit (Hour _) = Hour_
fromReflexiveTimeUnit :: ReflexiveTimeUnit -> TimeUnitCriteria -> TimeUnit
fromReflexiveTimeUnit :: ReflexiveTimeUnit -> TimeUnitCriteria -> TimeUnit
fromReflexiveTimeUnit Epoch_ c = Epoch c
fromReflexiveTimeUnit Epoch_ c = Epoch c
...
@@ -309,6 +327,7 @@ fromReflexiveTimeUnit Year_ c = Year c
...
@@ -309,6 +327,7 @@ fromReflexiveTimeUnit Year_ c = Year c
fromReflexiveTimeUnit Month_ c = Month c
fromReflexiveTimeUnit Month_ c = Month c
fromReflexiveTimeUnit Week_ c = Week c
fromReflexiveTimeUnit Week_ c = Week c
fromReflexiveTimeUnit Day_ c = Day c
fromReflexiveTimeUnit Day_ c = Day c
fromReflexiveTimeUnit Hour_ c = Hour c
extractCriteria :: TimeUnit -> TimeUnitCriteria
extractCriteria :: TimeUnit -> TimeUnitCriteria
extractCriteria (Epoch (o :: TimeUnitCriteria)) = o
extractCriteria (Epoch (o :: TimeUnitCriteria)) = o
...
@@ -316,6 +335,7 @@ extractCriteria (Year (o :: TimeUnitCriteria)) = o
...
@@ -316,6 +335,7 @@ extractCriteria (Year (o :: TimeUnitCriteria)) = o
extractCriteria (Month (o :: TimeUnitCriteria)) = o
extractCriteria (Month (o :: TimeUnitCriteria)) = o
extractCriteria (Week (o :: TimeUnitCriteria)) = o
extractCriteria (Week (o :: TimeUnitCriteria)) = o
extractCriteria (Day (o :: TimeUnitCriteria)) = o
extractCriteria (Day (o :: TimeUnitCriteria)) = o
extractCriteria (Hour (o :: TimeUnitCriteria)) = o
toReflexiveClique :: Clique -> ReflexiveClique
toReflexiveClique :: Clique -> ReflexiveClique
toReflexiveClique (FIS _) = FIS_
toReflexiveClique (FIS _) = FIS_
...
...
src/Gargantext/Components/PhyloExplorer/Config/ConfigForm.purs
View file @
71b6f531
...
@@ -195,6 +195,9 @@ component = R.hooksComponent "configForm" cpt
...
@@ -195,6 +195,9 @@ component = R.hooksComponent "configForm" cpt
, H.option
, H.option
{ value: show Day_ }
{ value: show Day_ }
[ H.text "Day" ]
[ H.text "Day" ]
, H.option
{ value: show Hour_ }
[ H.text "Hour" ]
]
]
]
]
]
]
...
...
src/Gargantext/Components/PhyloExplorer/JSON.purs
View file @
71b6f531
...
@@ -62,6 +62,8 @@ derive newtype instance JSON.ReadForeign PhyloJSON
...
@@ -62,6 +62,8 @@ derive newtype instance JSON.ReadForeign PhyloJSON
--------------------------------------------------
--------------------------------------------------
-- | This is in direct correspondence with backend's 'G.C.T.Phylo' ->
-- | 'GraphData'. It is an output of the 'dot' command.
type GraphData =
type GraphData =
( bb :: String
( bb :: String
, color :: String
, color :: String
...
@@ -361,6 +363,11 @@ data TimeUnit
...
@@ -361,6 +363,11 @@ data TimeUnit
, _day_step :: Int
, _day_step :: Int
, _day_matchingFrame :: Int
, _day_matchingFrame :: Int
}
}
| Hour
{ _hour_period :: Int
, _hour_step :: Int
, _hour_matchingFrame :: Int
}
derive instance Generic TimeUnit _
derive instance Generic TimeUnit _
derive instance Eq TimeUnit
derive instance Eq TimeUnit
...
...
src/Gargantext/Components/PhyloExplorer/Resources.js
View file @
71b6f531
...
@@ -1228,7 +1228,11 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -1228,7 +1228,11 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
.
attr
(
"height"
,
scapeCoordinates
.
h
)
.
attr
(
"height"
,
scapeCoordinates
.
h
)
/* labels */
/* labels */
if
(
groups
.
length
==
0
)
{
console
.
log
(
'groups empty, exiting'
);
return
}
var
firstDate
=
Math
.
min
(...
groups
.
map
(
g
=>
(
g
.
from
).
getFullYear
()))
var
firstDate
=
Math
.
min
(...
groups
.
map
(
g
=>
(
g
.
from
).
getFullYear
()))
var
yLabels
=
(
periods
.
map
(
p
=>
({
y
:
p
.
y
,
from
:
p
.
from
,
to
:
p
.
to
,
label
:(
p
.
from
).
getFullYear
()}))).
filter
(
p
=>
p
.
label
>=
firstDate
);
var
yLabels
=
(
periods
.
map
(
p
=>
({
y
:
p
.
y
,
from
:
p
.
from
,
to
:
p
.
to
,
label
:(
p
.
from
).
getFullYear
()}))).
filter
(
p
=>
p
.
label
>=
firstDate
);
var
xLabels
=
toXLabels
(
branches
,
groups
,
frame
[
2
]);
var
xLabels
=
toXLabels
(
branches
,
groups
,
frame
[
2
]);
...
...
src/Gargantext/Components/PhyloExplorer/Sidebar/DetailsTab.purs
View file @
71b6f531
...
@@ -173,3 +173,9 @@ detailsTimeUnit t =
...
@@ -173,3 +173,9 @@ detailsTimeUnit t =
, detailsParams _day_step "Step"
, detailsParams _day_step "Step"
, detailsParams _day_matchingFrame "Matching frame"
, detailsParams _day_matchingFrame "Matching frame"
]
]
parseTimeUnit (Hour { _hour_period, _hour_step, _hour_matchingFrame }) =
[ detailsParams "Hour" "Time unit"
, detailsParams _hour_period "Period"
, detailsParams _hour_step "Step"
, detailsParams _hour_matchingFrame "Matching frame"
]
src/Gargantext/Components/PhyloExplorer/Types.js
View file @
71b6f531
'use strict'
;
'use strict'
;
import
dayjs
from
'../../src/external-deps/dayjs.min.js'
;
/**
/**
* @name yearToDate
* @name yearToDate
* @param {string} year
* @param {string} year
...
@@ -13,6 +16,49 @@ export function yearToDate(year) {
...
@@ -13,6 +16,49 @@ export function yearToDate(year) {
return
d
;
return
d
;
}
}
/**
* @name monthToDate
* @param {string} year
* @returns {Date}
*/
export
function
monthToDate
(
month
)
{
var
d
=
dayjs
(
'0001-01-01'
);
return
d
.
add
(
month
,
'months'
).
toDate
();
}
/**
* @name weekToDate
* @param {string} year
* @returns {Date}
*/
export
function
weekToDate
(
week
)
{
// week is number of days divided by 7
var
d
=
dayjs
(
'0001-01-01'
);
return
d
.
add
(
week
*
7
,
'days'
).
toDate
();
}
/**
* @name dayToDate
* @param {string} year
* @returns {Date}
*/
export
function
dayToDate
(
days
)
{
// week is number of days divided by 7
var
d
=
dayjs
(
'0001-01-01'
);
return
d
.
add
(
days
,
'days'
).
toDate
();
}
/**
* @name hourToDate
* @param {string} year
* @returns {Date}
*/
export
function
hourToDate
(
hours
)
{
// week is number of days divided by 7
var
d
=
dayjs
(
'0001-01-01'
);
return
d
.
add
(
hours
,
'hours'
).
toDate
();
}
/**
/**
* @name stringToDate
* @name stringToDate
* @param {string} str
* @param {string} str
...
...
src/Gargantext/Components/PhyloExplorer/Types.purs
View file @
71b6f531
...
@@ -39,11 +39,17 @@ import Data.String as String
...
@@ -39,11 +39,17 @@ import Data.String as String
import Data.String.Extra (camelCase)
import Data.String.Extra (camelCase)
import Data.Tuple as Tuple
import Data.Tuple as Tuple
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Gargantext.Components.PhyloExplorer.JSON (Cluster, PhyloJSON(..), PhyloSimilarity(..), Quality(..), RawEdge(..), RawObject(..), Synchrony(..), TimeUnit)
import Debug (trace)
import Gargantext.Components.PhyloExplorer.JSON (Cluster, PhyloJSON(..), PhyloSimilarity(..), Quality(..), RawEdge(..), RawObject(..), Synchrony(..), TimeUnit(..))
import Partial.Unsafe (unsafeCrashWith)
import Simple.JSON as JSON
import Simple.JSON as JSON
-- @NOTE #219: PureScript Date or stick to JavaScript foreign?
-- @NOTE #219: PureScript Date or stick to JavaScript foreign?
foreign import yearToDate :: String -> Date.Date
foreign import yearToDate :: String -> Date.Date
foreign import monthToDate :: String -> Date.Date
foreign import weekToDate :: String -> Date.Date
foreign import dayToDate :: String -> Date.Date
foreign import hourToDate :: String -> Date.Date
foreign import stringToDate :: String -> Date.Date
foreign import stringToDate :: String -> Date.Date
foreign import utcStringToDate :: String -> Date.Date
foreign import utcStringToDate :: String -> Date.Date
...
@@ -105,9 +111,9 @@ parseToPhyloSet (PhyloJSON o@{ pd_data: Just p, pd_config: Just c }) = Just $ Ph
...
@@ -105,9 +111,9 @@ parseToPhyloSet (PhyloJSON o@{ pd_data: Just p, pd_config: Just c }) = Just $ Ph
ancestorLinks = parseAncestorLinks p.edges
ancestorLinks = parseAncestorLinks p.edges
branchLinks = parseBranchLinks p.edges
branchLinks = parseBranchLinks p.edges
branches = parseBranches p.objects
branches = parseBranches p.objects
groups = parseGroups epochTS p.objects
groups = parseGroups
c.timeUnit
epochTS p.objects
links = parseLinks p.edges
links = parseLinks p.edges
periods = parsePeriods epochTS p.objects
periods = parsePeriods
c.timeUnit
epochTS p.objects
parseToPhyloSet _ = Nothing
parseToPhyloSet _ = Nothing
----------------------------------------------------------------------
----------------------------------------------------------------------
...
@@ -217,15 +223,15 @@ derive instance Eq Period
...
@@ -217,15 +223,15 @@ derive instance Eq Period
instance Show Period where
instance Show Period where
show = genericShow
show = genericShow
parsePeriods :: Boolean -> Array RawObject -> Array Period
parsePeriods ::
TimeUnit ->
Boolean -> Array RawObject -> Array Period
parsePeriods epoch = map parse
parsePeriods
tu
epoch = map parse
>>> Array.catMaybes
>>> Array.catMaybes
where
where
parse :: RawObject -> Maybe Period
parse :: RawObject -> Maybe Period
parse (PeriodToNode o) = Just $ Period
parse (PeriodToNode o) = Just $ Period
{ from: parseNodeDate o.strFrom o.from epoch
{ from: parseNodeDate
tu
o.strFrom o.from epoch
, to: parseNodeDate o.strTo o.to epoch
, to: parseNodeDate
tu
o.strTo o.to epoch
, y: Tuple.snd $ parsePos o.pos
, y: Tuple.snd $ parsePos o.pos
}
}
parse _ = Nothing
parse _ = Nothing
...
@@ -252,8 +258,8 @@ derive instance Eq Group
...
@@ -252,8 +258,8 @@ derive instance Eq Group
instance Show Group where
instance Show Group where
show = genericShow
show = genericShow
parseGroups :: Boolean -> Array RawObject -> Array Group
parseGroups ::
TimeUnit ->
Boolean -> Array RawObject -> Array Group
parseGroups epoch = map parse
parseGroups
tu
epoch = map parse
>>> Array.catMaybes
>>> Array.catMaybes
where
where
...
@@ -261,18 +267,18 @@ parseGroups epoch = map parse
...
@@ -261,18 +267,18 @@ parseGroups epoch = map parse
parse (GroupToNode o) = Just $ Group
parse (GroupToNode o) = Just $ Group
{ bId: parseInt o.bId
{ bId: parseInt o.bId
, foundation: stringedArrayToArray' o.foundation
, foundation: stringedArrayToArray' o.foundation
, from: parseNodeDate o.strFrom o.from epoch
, from: parseNodeDate
tu
o.strFrom o.from epoch
, gId: o._gvid
, gId: o._gvid
, label: stringedArrayToArray o.lbl
, label: stringedArrayToArray o.lbl
, role: stringedArrayToArray_ o.role
, role: stringedArrayToArray_ o.role
, size: parseInt o.support
, size: parseInt o.support
, source: parseSources o.source
, source: parseSources o.source
, to: parseNodeDate o.strTo o.to epoch
, to: parseNodeDate
tu
o.strTo o.to epoch
, weight: stringedMaybeToNumber o.weight
, weight: stringedMaybeToNumber o.weight
, x: Tuple.fst $ parsePos o.pos
, x: Tuple.fst $ parsePos o.pos
, y: Tuple.snd $ parsePos o.pos
, y: Tuple.snd $ parsePos o.pos
}
}
parse
_ =
Nothing
parse
g = trace ("not a GroupToNode: " <> show g) \_ ->
Nothing
-----------------------------------------------------------
-----------------------------------------------------------
...
@@ -457,13 +463,19 @@ parseBB :: String -> Array Number
...
@@ -457,13 +463,19 @@ parseBB :: String -> Array Number
parseBB = String.split (String.Pattern ",")
parseBB = String.split (String.Pattern ",")
>>> map parseFloat
>>> map parseFloat
parseNodeDate :: Maybe String -> String -> Boolean -> Date.Date
-- | NOTE This must be in accordance with backend's 'G.C.V.P.API.Tools' -> 'toPhyloDate'
parseNodeDate :: TimeUnit -> Maybe String -> String -> Boolean -> Date.Date
-- parseNodeDate Nothing year _ = yearToDate(year)
-- parseNodeDate Nothing year _ = yearToDate(year)
-- parseNodeDate (Just str) _ true = utcStringToDate(str)
-- parseNodeDate (Just str) _ true = utcStringToDate(str)
-- parseNodeDate (Just str) _ false = stringToDate(str)
-- parseNodeDate (Just str) _ false = stringToDate(str)
-- @NOTE #219 ^ as soon as the issue regarding `Date` (< 1970) is resolved
-- @NOTE #219 ^ as soon as the issue regarding `Date` (< 1970) is resolved
-- please uncomment above lines + delete below one
-- please uncomment above lines + delete below one
parseNodeDate _ y _ = yearToDate (y)
parseNodeDate (Year _) _ s _ = yearToDate (s)
parseNodeDate (Month _) _ s _ = monthToDate (s)
parseNodeDate (Week _) _ s _ = weekToDate (s)
parseNodeDate (Day _) _ s _ = dayToDate (s)
parseNodeDate (Hour _) _ s _ = hourToDate (s)
parseNodeDate tu _ s _ = unsafeCrashWith $ "[parseNodeDate] s = " <> s <> " unsupported for time unit = " <> show tu
parsePos :: String -> Tuple.Tuple Number Number
parsePos :: String -> Tuple.Tuple Number Number
parsePos = String.split (String.Pattern ",")
parsePos = String.split (String.Pattern ",")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment