Update appStore/iki_sheets.py
Browse files- appStore/iki_sheets.py +38 -0
appStore/iki_sheets.py
CHANGED
@@ -186,4 +186,42 @@ def mitigation_display():
|
|
186 |
st.dataframe(hits[['keep','text','Parameter','page','Type']])
|
187 |
else:
|
188 |
st.info("🤔 No Tranport Mitigation paragraph found")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
|
|
186 |
st.dataframe(hits[['keep','text','Parameter','page','Type']])
|
187 |
else:
|
188 |
st.info("🤔 No Tranport Mitigation paragraph found")
|
189 |
+
|
190 |
+
|
191 |
+
def adaptation():
|
192 |
+
if 'key1' in st.session_state:
|
193 |
+
df = st.session_state['key1'].copy()
|
194 |
+
df = np.where((df.ActionLabel==True) | (df.PolicyLabel==True) | (df.PlansLabel==True))
|
195 |
+
df = df.reset_index(drop=True)
|
196 |
+
df = df[(df.AdaptationLabel == True)&(df.Transport == True)].reset_index(drop=True)
|
197 |
+
non_target = ['Action','Policy','Plans']
|
198 |
+
df['Type'] = df.apply(lambda x: [i for i in non_target if x[i+'Label']==True],axis=1)
|
199 |
+
df['keep'] = True
|
200 |
+
st.session_state['adaptation_hits'] = df
|
201 |
+
|
202 |
+
def mitigation_display():
|
203 |
+
if 'key1' in st.session_state:
|
204 |
+
st.caption(""" **{}** is splitted into **{}** paragraphs/text chunks."""\
|
205 |
+
.format(os.path.basename(st.session_state['filename']),
|
206 |
+
len(st.session_state['key0'])))
|
207 |
+
|
208 |
+
hits = st.session_state['mitigation_hits']
|
209 |
+
if len(hits) !=0:
|
210 |
+
# collecting some statistics
|
211 |
+
count_adaptation = sum(hits['AdaptationLabel'] == True)
|
212 |
+
count_action = sum(hits['ActionLabel'] == True)
|
213 |
+
count_policy = sum(hits['PolicyLabel'] == True)
|
214 |
+
count_plans = sum(hits['PlansLabel'] == True)
|
215 |
+
|
216 |
+
c1, c2 = st.columns([1,1])
|
217 |
+
with c1:
|
218 |
+
st.write('**Adaptation Paragraphs**: `{}`'.format(count_adaptation))
|
219 |
+
st.write('**Transport Action Related Paragraphs**: `{}`'.format(count_action))
|
220 |
+
with c2:
|
221 |
+
st.write('**Transport Policy Related Paragraphs**: `{}`'.format(count_policy))
|
222 |
+
st.write('**Transport Plans Related Paragraphs**: `{}`'.format(count_plans))
|
223 |
+
st.write('----------------')
|
224 |
+
st.dataframe(hits[['keep','text','Parameter','page','Type']])
|
225 |
+
else:
|
226 |
+
st.info("🤔 No Tranport Adaptation paragraph found")
|
227 |
|