Business Intelligence as Configuration
Project description
StreamLana
'Business Intelligence as Configuration' 🚀
Motivation
Think of Streamlit in Grafana style...
Build your BI dashboards with ease, using simple configuration files.
Demo App
Its deployed live at https://streamlana.streamlit.app/
Lets do this
- Install streamlana
pip install streamlana
- Define your pages in
hello.yaml
#hello.yaml
side_bar:
- heading: "Hello StreamLana"
pages:
- name: "Stats page"
enabled: True
config_file_path: "page_configs_demo/hello.json"
- name: "About page"
config_file_path: "page_configs_demo/about.json"
enabled: True
- Lets define page1 layout - number or rows, the widgets in each row, query powering the widget, widget settings.
Lets do 1 row with 2 widgets in it -> page_configs_demo/hello.json
{
"page_title": "Hello StreamLana",
"page_rows": [
{
"widgets_width_spec": [
0.4,0.6
],
"widgets_border": true,
"with_expander": {
"label": "2 widgets in 1st row, 40/60% width",
"expanded": true
},
"widgets_gap": "small",
"widgets_vertical_alignment": "top",
"widgets": [
{
"type": "dataframe",
"query": "SELECT avg_spend,order_date FROM (SELECT order_date, RANDOM() * 1000 AS avg_spend FROM generate_series(CURRENT_DATE - INTERVAL 30 DAY, CURRENT_DATE, INTERVAL 1 DAY) AS t(order_date)) as sub",
"config": {
"column_order": [
"avg_spend",
"order_date"
]
}
},
{
"type": "line_chart",
"query": "SELECT avg_spend,order_date FROM (SELECT order_date, RANDOM() * 1000 AS avg_spend FROM generate_series(CURRENT_DATE - INTERVAL 30 DAY, CURRENT_DATE, INTERVAL 1 DAY) AS t(order_date)) as sub",
"config": {
"x": "order_date",
"y": ["avg_spend"],
"title": "avgSpend Over Time"
}
}
]
}
]
}
- Lets define page2 layout - number or rows, the widgets in each row, query powering the widget, widget settings.
Lets keep this simple 1 widget and 1 row -> page_configs_demo/about.json
{
"page_title": "About StreamLana",
"page_rows": [
{
"widgets_width_spec": [1],
"widgets": [{"type": "title", "config": {"body": "Business Intelligence as Configuration"}}]
}
]
}
- Few lines of code for the main app ->
hello.py
# hello.py
import logging
import duckdb
from streamlana import side_bar_util
from streamlana.side_bar_util import load_side_bar_config_yaml, render_side_bar_pages
# ✅ First thing to do, set page layout of streamlit
side_bar_util.set_page_layout(layout="wide")
# logging level
logging.basicConfig(level=logging.INFO)
# ✅ Load side bar configuration from YAML file
side_bar_config = load_side_bar_config_yaml("hello.yaml")
# ✅ Create DuckDB connection (do your setup with it)
con = duckdb.connect()
# ✅ Render side bar pages based on the configuration
render_side_bar_pages(side_bar_config, con)
- Run the app
streamlit run hello.py
Widget Library
Currently, we support the following widgets:
- st.dataframe
- st.line_chart
- st.area_chart
- st.bar_chart
- st.pie_chart
- st.json
- st.title
- st.metric
- st.text
- st.markdown
- st.image
- st.map
- st.empty
- st.selectbox
- st.header
Adding new widgets is easy, just add a new widget type in the chart_helpers.py.
ex: implement 'render_<chart_name>(data:pd.DataFrame, config_dict: dict)'
data comes from the duckdb sql query u configure.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlana-0.1.2.tar.gz.
File metadata
- Download URL: streamlana-0.1.2.tar.gz
- Upload date:
- Size: 43.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.13 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1aacc9e4bedf78fbf6db7dcf0e5aeee81e7736291b32c0f5f1e806d8a1dbf27a
|
|
| MD5 |
7188e2c93e87c0e45b7d18bbe65f54b3
|
|
| BLAKE2b-256 |
de6b9382208717693f24b25381274b7fd15c7268b52c65fe896424e3d8ba9161
|
File details
Details for the file streamlana-0.1.2-py3-none-any.whl.
File metadata
- Download URL: streamlana-0.1.2-py3-none-any.whl
- Upload date:
- Size: 42.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.13 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb398bf63c51f904fb7ca8db186578e4eb503c920396ee0e9c07d1f8016e67ff
|
|
| MD5 |
c2456551da0aec9d0dc772400b296bc4
|
|
| BLAKE2b-256 |
db1d16c744430442c09f52ec7bcd334c78f86e360b551ff33c7d50a1e6e89563
|