ralate2 commited on
Commit
df2b5a3
·
verified ·
1 Parent(s): 016797c

Upload 3 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Illinois_Entire_Data_Insights_Final_v2.csv filter=lfs diff=lfs merge=lfs -text
Illinois_Entire_Data_Insights_Final_v2.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0575adb9b5378333ea6165aed84a71464f64837d7e5e5ecdb3b67d411ab6eed8
3
+ size 85904918
app.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import plotly.graph_objects as go
4
+ import matplotlib.pyplot as plt
5
+ import seaborn as sns
6
+ #trial
7
+ # Set Streamlit page config
8
+ st.set_page_config(page_title="Legislative Visualizations", layout="wide")
9
+
10
+ st.title("Legislative Bill Analysis Dashboard")
11
+
12
+ # Upload dataset
13
+ uploaded_file = st.file_uploader("Illinois_Entire_Data_Insights_Final_v2.csv", type=["csv", "xlsx"])
14
+
15
+ if uploaded_file:
16
+ # Load dataset
17
+ if uploaded_file.name.endswith('.csv'):
18
+ df = pd.read_csv(uploaded_file)
19
+ else:
20
+ df = pd.read_excel(uploaded_file)
21
+
22
+ st.success("File uploaded and read successfully!")
23
+
24
+ # Sankey Diagram
25
+ st.header("🔗 Sankey Diagram: Intent → Stance → Beneficiaries")
26
+ sankey_df = df[['intent_standardized', 'stance_standardized', 'intended_beneficiaries_standardized']].dropna()
27
+
28
+ if not sankey_df.empty:
29
+ labels = list(pd.unique(sankey_df['intent_standardized'].tolist() +
30
+ sankey_df['stance_standardized'].tolist() +
31
+ sankey_df['intended_beneficiaries_standardized'].tolist()))
32
+ label_map = {label: i for i, label in enumerate(labels)}
33
+
34
+ intent_stance = sankey_df.groupby(['intent_standardized', 'stance_standardized']).size().reset_index(name='count')
35
+ stance_beneficiary = sankey_df.groupby(['stance_standardized', 'intended_beneficiaries_standardized']).size().reset_index(name='count')
36
+
37
+ source = intent_stance['intent_standardized'].map(label_map).tolist() + stance_beneficiary['stance_standardized'].map(label_map).tolist()
38
+ target = intent_stance['stance_standardized'].map(label_map).tolist() + stance_beneficiary['intended_beneficiaries_standardized'].map(label_map).tolist()
39
+ value = intent_stance['count'].tolist() + stance_beneficiary['count'].tolist()
40
+
41
+ fig_sankey = go.Figure(data=[go.Sankey(
42
+ node=dict(pad=15, thickness=20, line=dict(color="black", width=0.5), label=labels),
43
+ link=dict(source=source, target=target, value=value)
44
+ )])
45
+ fig_sankey.update_layout(title_text="Sankey: Intent → Stance → Beneficiary", font_size=12)
46
+
47
+ st.plotly_chart(fig_sankey, use_container_width=True)
48
+ else:
49
+ st.warning("Sankey input columns contain only null values or are missing.")
50
+
51
+ # Heatmap
52
+ st.header("🧯 Heatmap: Category vs Policy Impact Area")
53
+ heat_df = df[['category_&_subcategory_standardized', 'policy_impact_areas_standardized']].dropna()
54
+
55
+ if not heat_df.empty:
56
+ heat = heat_df.pivot_table(index='category_&_subcategory_standardized',
57
+ columns='policy_impact_areas_standardized',
58
+ aggfunc=len,
59
+ fill_value=0)
60
+
61
+ plt.figure(figsize=(14, 8))
62
+ sns.heatmap(heat, cmap='coolwarm', annot=False)
63
+ plt.title("Heatmap: Category vs Policy Impact Area")
64
+ plt.xlabel("Policy Impact Area")
65
+ plt.ylabel("Category")
66
+ plt.tight_layout()
67
+
68
+ st.pyplot(plt)
69
+ else:
70
+ st.warning("Heatmap input columns contain only null values or are missing.")
71
+ else:
72
+ st.info("Please upload a dataset file to view the visualizations.")
requirements.txt CHANGED
@@ -1,3 +1,76 @@
1
- altair
2
- pandas
3
- streamlit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==5.5.0
2
+ asttokens==3.0.0
3
+ attrs==24.2.0
4
+ blinker==1.9.0
5
+ branca==0.8.0
6
+ cachetools==5.5.0
7
+ certifi==2024.8.30
8
+ charset-normalizer==3.4.0
9
+ click==8.1.7
10
+ comm==0.2.2
11
+ contourpy==1.3.1
12
+ cycler==0.12.1
13
+ debugpy==1.8.9
14
+ decorator==5.1.1
15
+ executing==2.1.0
16
+ folium==0.18.0
17
+ fonttools==4.55.1
18
+ gitdb==4.0.11
19
+ GitPython==3.1.43
20
+ idna==3.10
21
+ ipykernel==6.29.5
22
+ ipython==8.30.0
23
+ jedi==0.19.2
24
+ Jinja2==3.1.4
25
+ jsonschema==4.23.0
26
+ jsonschema-specifications==2024.10.1
27
+ jupyter_client==8.6.3
28
+ jupyter_core==5.7.2
29
+ kiwisolver==1.4.7
30
+ markdown-it-py==3.0.0
31
+ MarkupSafe==3.0.2
32
+ matplotlib==3.9.3
33
+ matplotlib-inline==0.1.7
34
+ mdurl==0.1.2
35
+ narwhals==1.15.2
36
+ nest-asyncio==1.6.0
37
+ numpy==2.1.3
38
+ packaging==24.2
39
+ pandas==2.2.3
40
+ parso==0.8.4
41
+ pexpect==4.9.0
42
+ pillow==11.0.0
43
+ platformdirs==4.3.6
44
+ plotly==5.24.1
45
+ prompt_toolkit==3.0.48
46
+ protobuf==5.29.1
47
+ psutil==6.1.0
48
+ ptyprocess==0.7.0
49
+ pure_eval==0.2.3
50
+ pyarrow==18.1.0
51
+ pydeck==0.9.1
52
+ Pygments==2.18.0
53
+ pyparsing==3.2.0
54
+ python-dateutil==2.9.0.post0
55
+ pytz==2024.2
56
+ pyzmq==26.2.0
57
+ referencing==0.35.1
58
+ requests==2.32.3
59
+ rich==13.9.4
60
+ rpds-py==0.22.3
61
+ seaborn==0.13.2
62
+ six==1.17.0
63
+ smmap==5.0.1
64
+ stack-data==0.6.3
65
+ streamlit==1.40.2
66
+ streamlit_folium==0.23.2
67
+ tenacity==9.0.0
68
+ toml==0.10.2
69
+ tornado==6.4.2
70
+ traitlets==5.14.3
71
+ typing_extensions==4.12.2
72
+ tzdata==2024.2
73
+ urllib3==2.2.3
74
+ watchdog==6.0.0
75
+ wcwidth==0.2.13
76
+ xyzservices==2024.9.0