Skip to content

Commit

Permalink
start dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
l0uden committed Aug 6, 2024
1 parent 55ee93d commit 8e7ea68
Showing 1 changed file with 3 additions and 82 deletions.
85 changes: 3 additions & 82 deletions vizro-ai/tests/integration/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
import vizro.plotly.express as px
from hamcrest import assert_that, equal_to
from vizro_ai import VizroAI

vizro_ai = VizroAI()
Expand All @@ -14,7 +13,7 @@

@pytest.mark.filterwarnings("ignore::langchain_core._api.beta_decorator.LangChainBetaWarning")
@pytest.mark.filterwarnings("ignore::UserWarning")
def test_simple_dashboard():
def test_simple_dashboard(dash_duo):
input_text = """
I need a page with 1 table.
The table shows the tech companies stock data.
Expand All @@ -36,83 +35,5 @@ def test_simple_dashboard():
"""

dashboard = vizro_ai.dashboard([df1, df2], input_text)

# Page 1
assert_that(len(dashboard.pages[0].components), equal_to(1))
# Page 2
assert_that(len(dashboard.pages[1].components), equal_to(3))


@pytest.mark.filterwarnings("ignore::langchain_core._api.beta_decorator.LangChainBetaWarning")
@pytest.mark.filterwarnings("ignore::UserWarning")
def test_3_page_dashboard():
input_text = """
<Page 1>
I need a page with 1 table and 1 line chart.
The chart shows the stock price trends of GOOG and AAPL.
The table shows the stock prices data details.
<Page 2>
I need a second page showing 1 card and 1 chart.
The card says 'The Gapminder dataset provides historical data on countries' development indicators.'
The chart is a scatter plot showing GDP per capita vs. life expectancy. GDP per capita on the x axis, life expectancy on the y axis, and colored by continent.
Layout the card on the left and the chart on the right. The card takes 1/3 of the whole space on the left.
The chart takes 2/3 of the whole space and is on the right.
Add a filter to filter the scatter plot by continent.
Add a second filter to filter the chart by year.
<Page 3>
Third page displays the tips data dataset. use two different charts to show data
distributions. one chart should be a bar chart with column day on the x axis, column total bill amount on the y axis.
the other should be a scatter plot.
first chart is on the left and the second chart is on the right.
Add a filter to filter data in the scatter plot by smoker.
"""

dashboard = vizro_ai.dashboard([df1, df2, df3], input_text)

# Page 1
assert_that(len(dashboard.pages[0].components), equal_to(2))
# Page 2
assert_that(len(dashboard.pages[1].components), equal_to(2))
# Page 3
assert_that(len(dashboard.pages[2].components), equal_to(2))


@pytest.mark.filterwarnings("ignore::langchain_core._api.beta_decorator.LangChainBetaWarning")
@pytest.mark.filterwarnings("ignore::UserWarning")
def test_unsupported_dashboard():
input_text = """
<Page 1>
I need a page showing 2 cards, one chart, and 1 button.
The first card says 'The Tips dataset provides insights into customer tipping behavior.'
The chart is a bar chart showing the total bill amount by day. Column day on the x axis, column total bill amount on the y axis, and colored by time of day.
The second card says 'Data collected from various days and times.'
Layout the two cards on the left and the chart on the right. Two cards take 1/3 of the whole space on the left in total.
The first card is on top of the second card vertically.
The chart takes 2/3 of the whole space and is on the right.
The button would trigger a download action to download the Tips dataset.
Add a filter to filter the bar chart by `size`.
Make another tab on this page,
In this tab, create a card saying "Tipping patterns and trends."
Group all the above content into the first NavLink.
<Second NavLink>
Create two pages:
1. The first page has a card saying "Analyzing global development trends."
2. The second page has a scatter plot showing GDP per capita vs. life expectancy. GDP per capita on the x axis, life expectancy on the y axis, and colored by continent.
Add a parameter to control the title of the scatter plot, with title options "Economic Growth vs. Health" and "Development Indicators."
Also create a button and a spinning circle on the right-hand side of the page.
<Third NavLink>
Create one page:
1. The first page has a card saying "Stock price trends over time."
Create a button and a spinning circle on the right-hand side of the page.
For hosting the dashboard on AWS, which service should I use?
"""

try:
vizro_ai.dashboard([df1, df2, df3], input_text)
except ValueError as v:
print(v)
dash_duo.start_server(dashboard)
assert dash_duo.get_logs() == []

0 comments on commit 8e7ea68

Please sign in to comment.