Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize Overview #34

Open
eznix86 opened this issue Jul 5, 2024 · 0 comments
Open

Customize Overview #34

eznix86 opened this issue Jul 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@eznix86
Copy link

eznix86 commented Jul 5, 2024

It would be nice if could have the ability to have customized overview instead of the default one. A possible implementation can be a yaml or json file containing data on how to query and description. Example:

overview:
  title: "Analytics Dashboard"
  layout:
    - title: "Summary"
      total_users:
        type: "number"
        title: "Total Users"
        value: "{{ queries.total_users }}"
        previous_value: "{{ queries.previous_total_users }}"
        description: "The total number of users"
        icon: "user"
      growth_rate:
        type: "percentage"
        title: "Growth Rate"
        value: "{{ queries.growth_rate }}"
        previous_value: "{{ queries.previous_growth_rate }}"
        description: "The growth rate compared to last month"
        icon: "chart-line"
      active_users:
        type: "number"
        title: "Active Users"
        value: "{{ queries.active_users }}"
        previous_value: "{{ queries.previous_active_users }}"
        description: "Number of active users"
        icon: "user-check"

    - title: "Analytics"
      users_by_age:
        type: "chart"
        title: "Users by Age"
        x_axis: "Age"
        y_axis: "Number of Users"
        data: "{{ queries.users_by_age }}"
        description: "Distribution of users by age"
        chart_type: "bar"
      population_by_year:
        type: "chart"
        title: "Population by Year"
        x_axis: "Year"
        y_axis: "Population"
        data: "{{ queries.population_by_year }}"
        description: "Population trends over the years"
        chart_type: "line"

    - title: "Tables"
      first_5_last_items:
        type: "list"
        title: "First 5 Last Items"
        items: "{{ queries.first_5_last_items }}"
        description: "List of the first 5 last items"
        icon: "list"
      top_10_loyal_users:
        type: "list"
        title: "Top 10 Loyal Users"
        items: "{{ queries.top_10_loyal_users }}"
        description: "List of the top 10 loyal users"
        icon: "star"
          
queries:
  total_users: "SELECT COUNT(*) FROM users"
  previous_total_users: "SELECT COUNT(*) FROM users WHERE created_at < '2023-06-01'"
  growth_rate: "SELECT (COUNT(*) - previous_total_users) / previous_total_users * 100 FROM users"
  previous_growth_rate: "SELECT (COUNT(*) - (SELECT COUNT(*) FROM users WHERE created_at < '2023-05-01')) / (SELECT COUNT(*) FROM users WHERE created_at < '2023-05-01') * 100 FROM users"
  active_users: "SELECT COUNT(*) FROM users WHERE last_login > NOW() - INTERVAL '30 days'"
  previous_active_users: "SELECT COUNT(*) FROM users WHERE last_login > NOW() - INTERVAL '60 days' AND last_login <= NOW() - INTERVAL '30 days'"
  users_by_age: "SELECT age, COUNT(*) as count FROM users GROUP BY age"
  population_by_year: "SELECT year, population FROM population_data ORDER BY year"
  first_5_last_items: "SELECT * FROM items ORDER BY created_at DESC LIMIT 5"
  top_10_loyal_users: "SELECT user_id, loyalty_score FROM users ORDER BY loyalty_score DESC LIMIT 10"
@frectonz frectonz added the enhancement New feature or request label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants