# put streamlit code here as needed import streamlit as st import pandas as pd import altair as alt DATA_URL = "https://raw.githubusercontent.com/UIUC-iSchool-DataViz/is445_data/main/building_inventory.csv" df = pd.read_csv(DATA_URL) st.title("Building Inventory Analysis") st.text("This Streamlit app provides visual insights into the building inventory dataset.\n" "The dataset includes details about buildings such as their type, location, and structure.\n" "Below are two visualizations highlighting key features of the data.") # Visualization 1: Distribution of Building Types st.header("Distribution of Buildings by County") chart1 = alt.Chart(df).mark_bar().encode( x=alt.X('County:O', sort='-y', title='County'), y=alt.Y('count():Q', title='Number of Buildings'), color=alt.Color('County:N', legend=None) ).properties( width=600, height=400, title="Distribution of Buildings by County" ) st.altair_chart(chart1, use_container_width=True) st.write(""" This bar chart shows the distribution of buildings across various counties. The visualization shows the county with most buildings in descending order. Cook county has the most number of buildings followed by Jackson and Randolph county. The color scheme distinguishes each county. If more time were available, I would add interactivity to allow users to filter by other variables, such as acquisition year, square footage and total floors. """) # Visualization 2: Building Age vs. Building Type st.header("Building Status by County") grouped_bar_chart = alt.Chart(df).mark_bar().encode( x=alt.X('County:O', title='County', sort=alt.EncodingSortField(field='count()', order='descending')), y=alt.Y('count():Q', title='Number of Buildings'), color=alt.Color('Bldg Status:N', title='Building Status'), tooltip=['County', 'Bldg Status', 'count()'] ).properties( width=600, height=400, title="Building Status Distribution by County" ).configure_axisX(labelAngle=-45) st.altair_chart(grouped_bar_chart, use_container_width=True) st.write(""" This grouped bar chart shows the number of buildings for each status across different counties. Each county has three bars, representing the different statuses ('In Use', 'In Progress', 'Abandon'). The color coding allows for quick comparison of building statuses within each county, showing which counties have a larger number of buildings 'In Use' or 'Abandoned'. With more time, I would add interactivity to filter by specific counties or statuses for a deeper analysis. """) # Run this app on HuggingFace Spaces and make sure it is public