ppsingh commited on
Commit
87f10eb
1 Parent(s): 75d8a9c

Update appStore/tapp_display.py

Browse files
Files changed (1) hide show
  1. appStore/tapp_display.py +18 -19
appStore/tapp_display.py CHANGED
@@ -33,6 +33,11 @@ def targets():
33
  df = df[df.TargetLabel==True].reset_index(drop=True)
34
  df['keep'] = True
35
  df.drop(columns = ['ActionLabel','PolicyLabel','PlansLabel'], inplace=True)
 
 
 
 
 
36
  st.session_state['target_hits'] = df
37
  st.session_state['netzero'] = netzero_placeholder
38
 
@@ -65,14 +70,7 @@ def target_display():
65
  st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
66
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
67
  #st.write('----------------')
68
-
69
-
70
 
71
- cols = list(hits.columns)
72
- sector_cols = list(set(cols) - {'TargetLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
73
- sector_cols.sort()
74
- hits['Sector'] = hits.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
75
- hits['Sub-Target'] = hits.apply(lambda x: [col for col in ['GHGLabel','NetzeroLabel','NonGHGLabel'] if x[col] == True ],axis=1)
76
  st.session_state['target_hits'] = hits[['keep','text','Sector','Sub-Target','page','MitigationLabel','AdaptationLabel']]
77
  placeholder= []
78
  for col in sector_cols:
@@ -97,6 +95,10 @@ def actions():
97
  df = df[df.ActionLabel==True].reset_index(drop=True)
98
  df['keep'] = True
99
  df.drop(columns = ['TargetLabel','PolicyLabel','PlansLabel','GHGLabel','NetzeroLabel','NonGHGLabel'], inplace=True)
 
 
 
 
100
  st.session_state['action_hits'] = df
101
 
102
  def action_display():
@@ -121,10 +123,7 @@ def action_display():
121
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
122
  #st.write('----------------')
123
  #st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Action Related Paragraphs Count </h4>", unsafe_allow_html=True)
124
- cols = list(hits.columns)
125
- sector_cols = list(set(cols) - {'ActionLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
126
- sector_cols.sort()
127
- hits['Sector'] = hits.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
128
  st.session_state['action_hits'] = hits[['text','page','keep','Sector','MitigationLabel','AdaptationLabel',]]
129
  #hits['Sub-Target'] = hits.apply(lambda x: [col for col in ['GHGLabel','NetzeroLabel','NonGHGLabel'] if x[col] == True ],axis=1)
130
  placeholder= []
@@ -149,6 +148,10 @@ def policy():
149
  df = df[df.PolicyLabel==True].reset_index(drop=True)
150
  df['keep'] = True
151
  df.drop(columns = ['TargetLabel','ActionLabel','PlansLabel','GHGLabel','NetzeroLabel','NonGHGLabel'], inplace=True)
 
 
 
 
152
  st.session_state['policy_hits'] = df
153
 
154
  def policy_display():
@@ -173,10 +176,6 @@ def policy_display():
173
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
174
  #st.write('----------------')
175
 
176
- cols = list(hits.columns)
177
- sector_cols = list(set(cols) - {'PolicyLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
178
- sector_cols.sort()
179
- hits['Sector'] = hits.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
180
  st.session_state['policy_hits'] = hits[['text','page','keep','Sector','MitigationLabel','AdaptationLabel']]
181
  placeholder= []
182
  for col in sector_cols:
@@ -197,6 +196,10 @@ def plans():
197
  df = df[df.PlansLabel==True].reset_index(drop=True)
198
  df['keep'] = True
199
  df.drop(columns = ['TargetLabel','PolicyLabel','ActionLabel','GHGLabel','NetzeroLabel','NonGHGLabel'], inplace=True)
 
 
 
 
200
  st.session_state['plan_hits'] = df
201
 
202
  def plans_display():
@@ -221,10 +224,6 @@ def plans_display():
221
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
222
  #st.write('----------------')
223
 
224
- cols = list(hits.columns)
225
- sector_cols = list(set(cols) - {'PlansLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
226
- sector_cols.sort()
227
- hits['Sector'] = hits.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
228
  st.session_state['plan_hits'] = hits[['text','page','keep','Sector','MitigationLabel','AdaptationLabel']]
229
  placeholder= []
230
  for col in sector_cols:
 
33
  df = df[df.TargetLabel==True].reset_index(drop=True)
34
  df['keep'] = True
35
  df.drop(columns = ['ActionLabel','PolicyLabel','PlansLabel'], inplace=True)
36
+ cols = list(df.columns)
37
+ sector_cols = list(set(cols) - {'TargetLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
38
+ sector_cols.sort()
39
+ df['Sector'] = df.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
40
+ df['Sub-Target'] = df.apply(lambda x: [col for col in ['GHGLabel','NetzeroLabel','NonGHGLabel'] if x[col] == True ],axis=1)
41
  st.session_state['target_hits'] = df
42
  st.session_state['netzero'] = netzero_placeholder
43
 
 
70
  st.write('**NonGHG Target Related Paragraphs**: `{}`'.format(count_nonghg))
71
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
72
  #st.write('----------------')
 
 
73
 
 
 
 
 
 
74
  st.session_state['target_hits'] = hits[['keep','text','Sector','Sub-Target','page','MitigationLabel','AdaptationLabel']]
75
  placeholder= []
76
  for col in sector_cols:
 
95
  df = df[df.ActionLabel==True].reset_index(drop=True)
96
  df['keep'] = True
97
  df.drop(columns = ['TargetLabel','PolicyLabel','PlansLabel','GHGLabel','NetzeroLabel','NonGHGLabel'], inplace=True)
98
+ cols = list(df.columns)
99
+ sector_cols = list(set(cols) - {'ActionLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
100
+ sector_cols.sort()
101
+ df['Sector'] = df.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
102
  st.session_state['action_hits'] = df
103
 
104
  def action_display():
 
123
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
124
  #st.write('----------------')
125
  #st.markdown("<h4 style='text-align: left; color: black;'> Sectoral Action Related Paragraphs Count </h4>", unsafe_allow_html=True)
126
+
 
 
 
127
  st.session_state['action_hits'] = hits[['text','page','keep','Sector','MitigationLabel','AdaptationLabel',]]
128
  #hits['Sub-Target'] = hits.apply(lambda x: [col for col in ['GHGLabel','NetzeroLabel','NonGHGLabel'] if x[col] == True ],axis=1)
129
  placeholder= []
 
148
  df = df[df.PolicyLabel==True].reset_index(drop=True)
149
  df['keep'] = True
150
  df.drop(columns = ['TargetLabel','ActionLabel','PlansLabel','GHGLabel','NetzeroLabel','NonGHGLabel'], inplace=True)
151
+ cols = list(df.columns)
152
+ sector_cols = list(set(cols) - {'PolicyLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
153
+ sector_cols.sort()
154
+ df['Sector'] = df.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
155
  st.session_state['policy_hits'] = df
156
 
157
  def policy_display():
 
176
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
177
  #st.write('----------------')
178
 
 
 
 
 
179
  st.session_state['policy_hits'] = hits[['text','page','keep','Sector','MitigationLabel','AdaptationLabel']]
180
  placeholder= []
181
  for col in sector_cols:
 
196
  df = df[df.PlansLabel==True].reset_index(drop=True)
197
  df['keep'] = True
198
  df.drop(columns = ['TargetLabel','PolicyLabel','ActionLabel','GHGLabel','NetzeroLabel','NonGHGLabel'], inplace=True)
199
+ cols = list(df.columns)
200
+ sector_cols = list(set(cols) - {'PlansLabel','MitigationLabel','AdaptationLabel','GHGLabel','NetzeroLabel','NonGHGLabel','text','keep','page'})
201
+ sector_cols.sort()
202
+ df['Sector'] = df.apply(lambda x: [col for col in sector_cols if x[col] == True],axis=1)
203
  st.session_state['plan_hits'] = df
204
 
205
  def plans_display():
 
224
  st.write('**Adaptation Related Paragraphs**: `{}`'.format(count_adaptation))
225
  #st.write('----------------')
226
 
 
 
 
 
227
  st.session_state['plan_hits'] = hits[['text','page','keep','Sector','MitigationLabel','AdaptationLabel']]
228
  placeholder= []
229
  for col in sector_cols: