Pawtucket2 timeline doesnt work for entities
Works for objects (data = ca_objects.date ) and events (data = ca_occurrences.coverageDates),
but doesn't work for entities (data = ca_entities.lifespan) ... it just returns "error Timeline configuration has no events".
Actually, there is something funny when it does work: If I refresh a page with the timeline displayed it will never reload the timeline.......unless I purge the pawtucket temp files first....then it will reload....only once. I think this may not be related to the above issue.....but who knows.
running /develop from git.
Comments
This is still stumping me. I can NOT use lifespan as a data source in a timeline:
Unknown column 'ca_entities.lifespan' in 'order clause' ....
I am able to use it as browse category just fine:
lifespan_facet = {
type = normalizedDates,
element_code = lifespan,
normalization = decades,
minimum_date = 1600,
group_mode = none,
label_singular = _("lifespan"),
label_plural = _("lifespan"),
description = _("Find entities according to associated ca_entities.lifespan. You can normalize these dates by year, decade or century."),
},
but I can NOT use it as a timeline data source:
timeline = {
name = timeline,
icon = glyphicon-time,
data = ca_entities.lifespan,
display = {...
Hi,
I just realize that I have the same problem...
Curiously, dates for entities and places are defined with
lifespan
, while for objects it iscoverageDates
. 😄If you define metadata
coverageDates
for entities, and use it instead oflifespan
, and changeelement_code = lifespan
byelement_code = coverageDates
, the timeline will display correctly!The difference is that lifespan is an intrinsic field (an odd one?), and covereageDates is a defined metadata element.
It's a work around, and I could create a script to copy the data over, but it is a few hundred entities to modify.
It looks to me like the problem is within BaseFindEngine.php
private function _sortByIntrinsic($t_table, string $hit_table, string $intrinsic=null, string $limit_sql=null, $direction='asc') {
The function seems to assume that intrinsics are table fields....but lifespan is an oddball defines in models:
'lifespan' => array(
'FIELD_TYPE' => FT_HISTORIC_DATERANGE, 'DISPLAY_TYPE' => DT_FIELD,
'DISPLAY_WIDTH' => 40, 'DISPLAY_HEIGHT' => 1,
'IS_NULL' => true,
'DEFAULT' => '',
'ALLOW_BUNDLE_ACCESS_CHECK' => true,
'START' => 'life_sdatetime', 'END' => 'life_edatetime',
'LABEL' => _t('Lifetime'), 'DESCRIPTION' => _t('Lifetime of entity (date range)')
and it contains two table fields: life_sdatetime and life_edatetime and this is as far as my understanding goes.
Lifespan was baked into entities to model the fact that entities always have a single range of dates for their existence. Having this field non-repeatable and always there simplifies things in some cases.
The timeline was designed to be used with metadata elements, and chokes on intrinsics. You can certainly just define a metadata element and use that instead of
lifespan
. Or we can fix the timeline to handle intrinsics. If you prefer the latter please create an issue for it on GitHub.Hi Seth,
Thank you for the explanations.
If timeline could handle intrinsics as well as metadata, it would solve this problem.👍️
I will create a git issue.
In the meanwhile, my simple hack (it is a single case fix) is:
within function _sortByIntrinsic()
if ($intrinsic =="lifespan"){
$odby = "{$table}.`life_sdatetime`, {$table}.`life_edatetime`";
}else{
$odby =" {$table}.`{$intrinsic}`";
}
...
$sql = "
SELECT {$table}.{$table_pk}
FROM {$table}
INNER JOIN {$hit_table} ON {$hit_table}.row_id = {$table}.{$table_pk}
ORDER BY $odby {$direction}
{$limit_sql}
";
Thanks. We'll look at adding this at some point.