venky180 commited on
Commit
568a81d
1 Parent(s): 633f72a

Upload 2 files

Browse files
Files changed (2) hide show
  1. analysis_dashboard.csv +25 -0
  2. app.py +90 -0
analysis_dashboard.csv ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ,charge,status,race_distribution_dict
2
+ 0,11351,filed,"{'Hispanic': 1547, 'Black or African American': 674, 'White': 274, '': 23, 'Unknown/Other': 22, 'Chinese': 16, 'Filipino': 16, 'Pacific Islander': 9, 'Other Asian': 7, 'Vietnamese': 5, 'Native American': 3, 'Korean': 3, 'Laotian': 2, 'Cambodian': 2, 'Japanese': 1}"
3
+ 1,11351,booked,"{'Hispanic': 1918, 'Black or African American': 754, 'White': 329, '': 49, 'Unknown/Other': 35, 'Filipino': 19, 'Chinese': 17, 'Pacific Islander': 9, 'Other Asian': 9, 'Native American': 6, 'Vietnamese': 5, 'Laotian': 3, 'Cambodian': 3, 'Korean': 2, 'Japanese': 1}"
4
+ 2,11351,convicted,"{'Hispanic': 494, 'Black or African American': 355, 'White': 136, 'Chinese': 9, 'Filipino': 8, 'Unknown/Other': 7, '': 4, 'Pacific Islander': 4, 'Korean': 3, 'Vietnamese': 3, 'Laotian': 2, 'Japanese': 1, 'Native American': 1, 'Other Asian': 1}"
5
+ 3,11351,1385 PC - Guilty Plea to Other Charge,"{'Hispanic': 307, 'Black or African American': 71, 'White': 40, '': 2, 'Vietnamese': 1, 'Unknown/Other': 1, 'Filipino': 1}"
6
+ 4,11351.5,filed,"{'Hispanic': 1216, 'Black or African American': 334, 'White': 128, '': 15, 'Unknown/Other': 12, 'Filipino': 8, 'Vietnamese': 5, 'Pacific Islander': 4, 'Chinese': 3, 'Laotian': 2, 'Japanese': 1, 'Native American': 1}"
7
+ 5,11351.5,booked,"{'Hispanic': 1469, 'Black or African American': 364, 'White': 153, '': 26, 'Unknown/Other': 20, 'Filipino': 8, 'Vietnamese': 5, 'Chinese': 4, 'Pacific Islander': 4, 'Native American': 3, 'Laotian': 3, 'Japanese': 1}"
8
+ 6,11351.5,convicted,"{'Hispanic': 390, 'Black or African American': 174, 'White': 62, 'Filipino': 6, 'Unknown/Other': 4, 'Vietnamese': 3, '': 2, 'Laotian': 2, 'Japanese': 1, 'Pacific Islander': 1}"
9
+ 7,11351.5,1385 PC - Guilty Plea to Other Charge,"{'Hispanic': 247, 'Black or African American': 35, 'White': 25, 'Vietnamese': 1, 'Unknown/Other': 1, 'Filipino': 1, '': 1}"
10
+ 8,11352,filed,"{'Hispanic': 794, 'Black or African American': 273, 'White': 71, '': 18, 'Unknown/Other': 16, 'Chinese': 7, 'Filipino': 5, 'Pacific Islander': 4, 'Other Asian': 4, 'Vietnamese': 2, 'Japanese': 1, 'Korean': 1, 'Cambodian': 1}"
11
+ 9,11352,booked,"{'Hispanic': 1019, 'Black or African American': 320, 'White': 99, '': 36, 'Unknown/Other': 26, 'Chinese': 11, 'Filipino': 8, 'Other Asian': 5, 'Pacific Islander': 4, 'Japanese': 1, 'Vietnamese': 1, 'Korean': 1, 'Cambodian': 1, 'Laotian': 1}"
12
+ 10,11352,convicted,"{'Hispanic': 288, 'Black or African American': 131, 'White': 33, 'Unknown/Other': 6, '': 3, 'Filipino': 3, 'Chinese': 2, 'Japanese': 1, 'Pacific Islander': 1, 'Vietnamese': 1, 'Other Asian': 1, 'Korean': 1}"
13
+ 11,11352,1385 PC - Guilty Plea to Other Charge,"{'Hispanic': 137, 'Black or African American': 22, 'White': 9, 'Vietnamese': 1, 'Unknown/Other': 1, '': 1}"
14
+ 12,11375,filed,"{'Black or African American': 239, 'Hispanic': 64, 'White': 57, 'Chinese': 10, 'Filipino': 4, 'Pacific Islander': 3, 'Other Asian': 3, '': 2, 'Unknown/Other': 2, 'Korean': 1}"
15
+ 13,11375,booked,"{'Black or African American': 210, 'Hispanic': 77, 'White': 56, 'Chinese': 7, '': 5, 'Unknown/Other': 4, 'Other Asian': 3, 'Filipino': 3, 'Pacific Islander': 2, 'Korean': 1, 'Middle Eastern': 1}"
16
+ 14,11375,convicted,"{'Black or African American': 109, 'White': 29, 'Hispanic': 20, 'Chinese': 4, 'Pacific Islander': 2, 'Unknown/Other': 2, 'Filipino': 2, '': 1}"
17
+ 15,11375,1385 PC - Guilty Plea to Other Charge,"{'Black or African American': 30, 'Hispanic': 7, 'White': 4, 'Korean': 1}"
18
+ 16,11378,filed,"{'Hispanic': 956, 'White': 412, 'Black or African American': 365, 'Filipino': 37, 'Pacific Islander': 14, 'Chinese': 13, 'Other Asian': 13, 'Unknown/Other': 12, '': 7, 'Vietnamese': 6, 'Cambodian': 4, 'Korean': 3, 'Native American': 2, 'Indian': 1}"
19
+ 17,11378,booked,"{'Hispanic': 1195, 'White': 493, 'Black or African American': 414, 'Filipino': 43, '': 31, 'Unknown/Other': 21, 'Pacific Islander': 15, 'Chinese': 14, 'Other Asian': 11, 'Vietnamese': 6, 'Native American': 5, 'Cambodian': 5, 'Korean': 4, 'Indian': 1, 'Laotian': 1}"
20
+ 18,11378,convicted,"{'Hispanic': 304, 'White': 205, 'Black or African American': 190, 'Filipino': 20, 'Pacific Islander': 10, 'Chinese': 6, 'Unknown/Other': 5, 'Other Asian': 5, 'Korean': 3, 'Cambodian': 3, '': 1, 'Vietnamese': 1}"
21
+ 19,11378,1385 PC - Guilty Plea to Other Charge,"{'Hispanic': 180, 'White': 48, 'Black or African American': 38, 'Filipino': 3, 'Pacific Islander': 1, 'Vietnamese': 1, '': 1, 'Other Asian': 1}"
22
+ 20,11351|11351.5|11352|11375|11378,filed,"{'Hispanic': 1905, 'Black or African American': 900, 'White': 528, 'Filipino': 44, '': 43, 'Unknown/Other': 31, 'Chinese': 26, 'Pacific Islander': 22, 'Other Asian': 18, 'Vietnamese': 10, 'Cambodian': 6, 'Korean': 5, 'Native American': 3, 'Laotian': 2, 'Japanese': 1, 'Indian': 1}"
23
+ 21,11351|11351.5|11352|11375|11378,booked,"{'Hispanic': 2360, 'Black or African American': 1024, 'White': 641, '': 105, 'Filipino': 52, 'Unknown/Other': 45, 'Chinese': 29, 'Pacific Islander': 23, 'Other Asian': 18, 'Vietnamese': 10, 'Cambodian': 7, 'Native American': 7, 'Korean': 6, 'Laotian': 3, 'Japanese': 1, 'Indian': 1, 'Middle Eastern': 1}"
24
+ 22,11351|11351.5|11352|11375|11378,convicted,"{'Hispanic': 630, 'Black or African American': 458, 'White': 251, 'Filipino': 23, 'Pacific Islander': 14, 'Chinese': 13, 'Unknown/Other': 10, '': 7, 'Other Asian': 6, 'Korean': 4, 'Vietnamese': 3, 'Cambodian': 3, 'Laotian': 2, 'Japanese': 1, 'Native American': 1}"
25
+ 23,11351|11351.5|11352|11375|11378,1385 PC - Guilty Plea to Other Charge,"{'Hispanic': 367, 'Black or African American': 89, 'White': 65, '': 4, 'Filipino': 3, 'Vietnamese': 2, 'Pacific Islander': 1, 'Unknown/Other': 1, 'Other Asian': 1, 'Korean': 1}"
app.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import inspect
2
+ import textwrap
3
+
4
+ import streamlit as st
5
+
6
+ from demo_echarts import ST_DEMOS
7
+ from demo_pyecharts import ST_PY_DEMOS
8
+ from streamlit_echarts import JsCode
9
+ from streamlit_echarts import st_echarts
10
+ import pandas as pd
11
+ import folium
12
+ from streamlit_folium import st_folium, folium_static
13
+ import json
14
+ from branca.colormap import LinearColormap
15
+ import random
16
+ import os.path
17
+ import requests
18
+ import geopandas
19
+ import branca
20
+ import ast
21
+
22
+
23
+
24
+
25
+
26
+ def main():
27
+ st.title("California Racial Justice Act")
28
+
29
+ st.divider()
30
+
31
+ with st.sidebar:
32
+ toggle = ("11351","11351.5","11352","11375","11378")
33
+
34
+ ch = st.selectbox(
35
+ label="Select Type",
36
+ options=toggle,
37
+ )
38
+ status_options = ('filed','booked','convicted','1385 PC - Guilty Plea to Other Charge')
39
+ stage = st.selectbox(
40
+ label="Select stage",
41
+ options=status_options,
42
+ )
43
+
44
+
45
+ df = pd.read_csv("analysis_dashboard.csv")
46
+ df["race_distribution_dict"] = df["race_distribution_dict"].apply(lambda x: ast.literal_eval(x))
47
+ fil = df[(df['status'] == stage) & (df['charge'] == ch)]
48
+ st.markdown("Selected Charge - **"+ch+"**")
49
+ options = {
50
+ "tooltip": {"trigger": "item", "axisPointer": {"type": "shadow"}, "order" : "valueDesc"},
51
+ "legend": {"type" : "plain", "top" : 2,
52
+ "textStyle": {"fontSize" : 18, 'color' : 'white' }
53
+ },
54
+ "grid": {"left": "3%", "right": "4%", "bottom": "3%", "containLabel": True},
55
+ "xAxis": {},
56
+ "yAxis": {
57
+ "axisLabel" : {
58
+ "fontWeight" : "bolder",
59
+ "fontSize" : 18,
60
+ "color": "white"
61
+ },
62
+ "data": list(fil["race_distribution_dict"].iloc[0].keys())
63
+ },
64
+
65
+
66
+ "series": [
67
+ {
68
+ "name": "Annual Eligible Caseload",
69
+ "type": "bar",
70
+ "stack": "total",
71
+ "label": {
72
+ "show": True,
73
+ "position" : "center",
74
+ "color" : "white"
75
+ },
76
+ "data": list(fil["race_distribution_dict"].iloc[0].values()),
77
+ },
78
+
79
+ ],
80
+ }
81
+ st_echarts(options=options, height="500px")
82
+
83
+
84
+
85
+ if __name__ == "__main__":
86
+ st.set_page_config(
87
+ page_title="RJA", page_icon=":chart_with_upwards_trend:"
88
+ )
89
+ main()
90
+