-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pandas as pd | ||
import streamlit as st | ||
from lib.client import client | ||
from lib.supa import Building | ||
|
||
st.set_page_config(layout="wide", page_title="MIT Decarbonization") | ||
|
||
@st.cache_data | ||
def get_all_buildings(): | ||
df = pd.DataFrame(client.table("Building").select("*").execute().data).set_index('id') | ||
# create csv bytes | ||
csv = df.to_csv().encode() | ||
return df, csv | ||
|
||
def render_title(): | ||
st.title("MIT Decarbonization") | ||
|
||
def render_buildings(): | ||
st.header("Buildings") | ||
all_buildings, all_buildings_csv = get_all_buildings() | ||
st.download_button("Download all buildings", all_buildings_csv, "buildings_metadata.csv", "Download all buildings", use_container_width=True, type="primary") | ||
building_id = st.selectbox('Building', all_buildings.index, format_func=lambda x: all_buildings.loc[x, 'name'], help='Select a building to view its data') | ||
building = all_buildings.loc[building_id] | ||
st.dataframe(building) | ||
|
||
|
||
render_title() | ||
st.divider() | ||
render_buildings() | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-r requirements/base-requirements.txt | ||
-r requirements/fe-requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pydantic | ||
pandera | ||
pydantic_settings | ||
pandera | ||
supabase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
streamlit |