Data Visualization¶
Dashboards¶
A set of one or more questions, organized and arranged into one or more rows, that provide an at-a-glance view of related information. Dashboards can optionally contain filters
, that act upon questions
, refining it's answers.
A new dashboard should be defined as a Python module with a dashboard: Dashboard
attribute. E.g:
# $AMORA_PROJECT_PATH/dashboards/steps.py
from amora.dashboards import AcceptedValuesFilter, Dashboard, DateFilter
from examples.amora_project.models.step_count_by_source import (
how_many_data_points_where_acquired,
what_are_the_available_data_sources,
what_are_the_values_observed_on_the_iphone,
what_is_the_current_estimated_walked_distance,
what_is_the_latest_data_point,
what_is_the_total_step_count_to_date,
)
dashboard = Dashboard(
uid="1",
name="Health :: Step Analysis",
questions=[
[
what_is_the_latest_data_point,
what_is_the_current_estimated_walked_distance,
how_many_data_points_where_acquired,
],
[
what_is_the_total_step_count_to_date,
what_are_the_values_observed_on_the_iphone,
what_are_the_available_data_sources,
],
],
filters=[
DateFilter(
default="2021-01-01", title="data de inΓcio", id="start-date-filter"
),
DateFilter(default="2023-01-01", title="data fim", id="end-date-filter"),
AcceptedValuesFilter(
default="iPhone",
values=["Diogo's iPhone", "iPhone"],
title="Source device",
id="source-device-filter",
),
],
)
Source code in amora/dashboards.py
class Dashboard(BaseModel):
"""
A set of one or more questions, organized and arranged into one or more rows,
that provide an at-a-glance view of related information. Dashboards can optionally
contain `filters`, that act upon `questions`, refining it's answers.
A new dashboard should be defined as a Python module with a `dashboard: Dashboard`
attribute. E.g:
```python
# $AMORA_PROJECT_PATH/dashboards/steps.py
from amora.dashboards import AcceptedValuesFilter, Dashboard, DateFilter
from examples.amora_project.models.step_count_by_source import (
how_many_data_points_where_acquired,
what_are_the_available_data_sources,
what_are_the_values_observed_on_the_iphone,
what_is_the_current_estimated_walked_distance,
what_is_the_latest_data_point,
what_is_the_total_step_count_to_date,
)
dashboard = Dashboard(
uid="1",
name="Health :: Step Analysis",
questions=[
[
what_is_the_latest_data_point,
what_is_the_current_estimated_walked_distance,
how_many_data_points_where_acquired,
],
[
what_is_the_total_step_count_to_date,
what_are_the_values_observed_on_the_iphone,
what_are_the_available_data_sources,
],
],
filters=[
DateFilter(
default="2021-01-01", title="data de inΓcio", id="start-date-filter"
),
DateFilter(default="2023-01-01", title="data fim", id="end-date-filter"),
AcceptedValuesFilter(
default="iPhone",
values=["Diogo's iPhone", "iPhone"],
title="Source device",
id="source-device-filter",
),
],
)
```
"""
uid: DashboardUid
name: str
questions: List[List[Question]]
filters: List[Filter]
class Config:
arbitrary_types_allowed = True
Last update: 2023-11-23