Jan Mühlnikel
commited on
Commit
•
3935a4e
1
Parent(s):
b4e9c3f
initial utils
Browse files- utils/__pycache__/crs_table.cpython-310.pyc +0 -0
- utils/__pycache__/filter_modules.cpython-310.pyc +0 -0
- utils/__pycache__/navbar.cpython-310.pyc +0 -0
- utils/__pycache__/sdg_table.cpython-310.pyc +0 -0
- utils/__pycache__/similarity_table.cpython-310.pyc +0 -0
- utils/crs_table.py +49 -0
- utils/filter_modules.py +21 -0
- utils/navbar.py +50 -0
- utils/sdg_table.py +43 -0
- utils/similarity_table.py +53 -0
utils/__pycache__/crs_table.cpython-310.pyc
ADDED
Binary file (1.2 kB). View file
|
|
utils/__pycache__/filter_modules.cpython-310.pyc
ADDED
Binary file (987 Bytes). View file
|
|
utils/__pycache__/navbar.cpython-310.pyc
ADDED
Binary file (1.13 kB). View file
|
|
utils/__pycache__/sdg_table.cpython-310.pyc
ADDED
Binary file (1.18 kB). View file
|
|
utils/__pycache__/similarity_table.cpython-310.pyc
ADDED
Binary file (1.4 kB). View file
|
|
utils/crs_table.py
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def show_table(data_df):
|
4 |
+
st.write("------------------")
|
5 |
+
|
6 |
+
st.dataframe(
|
7 |
+
data_df[["title_main", "orga_abbreviation", "client", "description_main", "country", "crs_3_code", "crs_5_code"]],
|
8 |
+
use_container_width = True,
|
9 |
+
height = 35 + 35 * len(data_df),
|
10 |
+
column_config={
|
11 |
+
"orga_abbreviation": st.column_config.TextColumn(
|
12 |
+
"Organization",
|
13 |
+
help="If description not in English, description in other language provided",
|
14 |
+
disabled=True
|
15 |
+
),
|
16 |
+
"client": st.column_config.TextColumn(
|
17 |
+
"Client",
|
18 |
+
help="Client organization of customer",
|
19 |
+
disabled=True
|
20 |
+
),
|
21 |
+
"title_main": st.column_config.TextColumn(
|
22 |
+
"Title",
|
23 |
+
help="If title not in English, title in other language provided",
|
24 |
+
disabled=True
|
25 |
+
),
|
26 |
+
"description_main": st.column_config.TextColumn(
|
27 |
+
"Description",
|
28 |
+
help="If description not in English, description in other language provided",
|
29 |
+
disabled=True
|
30 |
+
),
|
31 |
+
"country": st.column_config.TextColumn(
|
32 |
+
"Country",
|
33 |
+
help="Country of project",
|
34 |
+
disabled=True
|
35 |
+
),
|
36 |
+
"crs_3_code": st.column_config.TextColumn(
|
37 |
+
"CRS 3",
|
38 |
+
help="CRS 3",
|
39 |
+
disabled=True
|
40 |
+
),
|
41 |
+
"crs_5_code": st.column_config.TextColumn(
|
42 |
+
"CRS 5",
|
43 |
+
help="CRS 5",
|
44 |
+
disabled=True
|
45 |
+
),
|
46 |
+
|
47 |
+
},
|
48 |
+
hide_index=True,
|
49 |
+
)
|
utils/filter_modules.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
def country_option(special_cases, country_names):
|
5 |
+
country_option = st.multiselect(
|
6 |
+
'Country / Countries',
|
7 |
+
special_cases + country_names,
|
8 |
+
placeholder="Select"
|
9 |
+
)
|
10 |
+
|
11 |
+
return country_option
|
12 |
+
|
13 |
+
def orga_option(special_cases, orga_names):
|
14 |
+
orga_list = special_cases + [f"{v[0]} ({k})" for k, v in orga_names.items()]
|
15 |
+
orga_option = st.multiselect(
|
16 |
+
'Development Bank / Organization',
|
17 |
+
orga_list,
|
18 |
+
placeholder="Select"
|
19 |
+
)
|
20 |
+
|
21 |
+
return orga_option
|
utils/navbar.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from streamlit_option_menu import option_menu # https://github.com/victoryhb/streamlit-option-menu
|
3 |
+
|
4 |
+
# giz-dsc colors
|
5 |
+
# orange: #e5b50d
|
6 |
+
# green: #48d47b
|
7 |
+
# blue: #0da2dc
|
8 |
+
# grey: #dadada
|
9 |
+
|
10 |
+
# giz colors https://www.giz.de/cdc/en/html/59638.html
|
11 |
+
# red: #c80f0f
|
12 |
+
# grey: #6f6f6f
|
13 |
+
# light_grey: #b2b2b2
|
14 |
+
# light_red: #eba1a3
|
15 |
+
|
16 |
+
def show_navbar():
|
17 |
+
st.markdown("<h1 style='color: red;'>THIS APP IS WORK IN PROGRESS ...</h1>", unsafe_allow_html=True)
|
18 |
+
|
19 |
+
navbar = option_menu(None, ["Home", "Sector Matches", 'Similarity Matches'],
|
20 |
+
icons=['house', 'list-task', "list-task", 'list-task'],
|
21 |
+
menu_icon="cast", default_index=0, orientation="horizontal",
|
22 |
+
styles={
|
23 |
+
"container": {
|
24 |
+
"padding": "0!important",
|
25 |
+
"background-color": "#F0F0F0"
|
26 |
+
},
|
27 |
+
"icon": {
|
28 |
+
"color": "#c80f0f",
|
29 |
+
"font-size": "25px"
|
30 |
+
},
|
31 |
+
"nav-link": {
|
32 |
+
"font-size": "25px",
|
33 |
+
"text-align": "left",
|
34 |
+
"margin":"0px",
|
35 |
+
"--hover-color": "#b2b2b2"
|
36 |
+
},
|
37 |
+
"nav-link-selected": {
|
38 |
+
"background-color": "#F0F0F0"
|
39 |
+
},
|
40 |
+
"nav-link-text": {
|
41 |
+
"color": "#333333"
|
42 |
+
},
|
43 |
+
|
44 |
+
"icon-active": {
|
45 |
+
"color": "#dadada"
|
46 |
+
}
|
47 |
+
}
|
48 |
+
)
|
49 |
+
|
50 |
+
return navbar
|
utils/sdg_table.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def show_table(data_df):
|
4 |
+
st.write("------------------")
|
5 |
+
|
6 |
+
st.dataframe(
|
7 |
+
data_df[["title_main", "orga_abbreviation", "client", "description_main", "country", "sgd_pred_code"]],
|
8 |
+
use_container_width = True,
|
9 |
+
height = 35 + 35 * len(data_df),
|
10 |
+
column_config={
|
11 |
+
"orga_abbreviation": st.column_config.TextColumn(
|
12 |
+
"Organization",
|
13 |
+
help="If description not in English, description in other language provided",
|
14 |
+
disabled=True
|
15 |
+
),
|
16 |
+
"client": st.column_config.TextColumn(
|
17 |
+
"Client",
|
18 |
+
help="Client organization of customer",
|
19 |
+
disabled=True
|
20 |
+
),
|
21 |
+
"title_main": st.column_config.TextColumn(
|
22 |
+
"Title",
|
23 |
+
help="If title not in English, title in other language provided",
|
24 |
+
disabled=True
|
25 |
+
),
|
26 |
+
"description_main": st.column_config.TextColumn(
|
27 |
+
"Description",
|
28 |
+
help="If description not in English, description in other language provided",
|
29 |
+
disabled=True
|
30 |
+
),
|
31 |
+
"country": st.column_config.TextColumn(
|
32 |
+
"Country",
|
33 |
+
help="Country of project",
|
34 |
+
disabled=True
|
35 |
+
),
|
36 |
+
"sgd_pred_code": st.column_config.TextColumn(
|
37 |
+
"SDG Prediction",
|
38 |
+
help="Prediction of SDG's",
|
39 |
+
disabled=True
|
40 |
+
),
|
41 |
+
},
|
42 |
+
hide_index=True,
|
43 |
+
)
|
utils/similarity_table.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def show_table(data_df, similarities:list):
|
4 |
+
st.write("------------------")
|
5 |
+
|
6 |
+
st.dataframe(
|
7 |
+
data_df[["title_main", "orga_abbreviation", "client", "description_main", "country", "sgd_pred_code", "crs_3_code", "crs_5_code", "similarity"]],
|
8 |
+
use_container_width = True,
|
9 |
+
height = 35 + 35 * len(data_df),
|
10 |
+
column_config={
|
11 |
+
"orga_abbreviation": st.column_config.TextColumn(
|
12 |
+
"Organization",
|
13 |
+
help="If description not in English, description in other language provided",
|
14 |
+
disabled=True
|
15 |
+
),
|
16 |
+
"client": st.column_config.TextColumn(
|
17 |
+
"Client",
|
18 |
+
help="Client organization of customer",
|
19 |
+
disabled=True
|
20 |
+
),
|
21 |
+
"title_main": st.column_config.TextColumn(
|
22 |
+
"Title",
|
23 |
+
help="If title not in English, title in other language provided",
|
24 |
+
disabled=True
|
25 |
+
),
|
26 |
+
"description_main": st.column_config.TextColumn(
|
27 |
+
"Description",
|
28 |
+
help="If description not in English, description in other language provided",
|
29 |
+
disabled=True
|
30 |
+
),
|
31 |
+
"country": st.column_config.TextColumn(
|
32 |
+
"Country",
|
33 |
+
help="Country of project",
|
34 |
+
disabled=True
|
35 |
+
),
|
36 |
+
"sgd_pred_code": st.column_config.TextColumn(
|
37 |
+
"SDG Prediction",
|
38 |
+
help="Prediction of SDG's",
|
39 |
+
disabled=True
|
40 |
+
),
|
41 |
+
"crs_3_code": st.column_config.TextColumn(
|
42 |
+
"CRS 3",
|
43 |
+
help="CRS 3 code given by organization",
|
44 |
+
disabled=True
|
45 |
+
),
|
46 |
+
"crs_5_code": st.column_config.TextColumn(
|
47 |
+
"CRS 5",
|
48 |
+
help="CRS 5 code given by organization",
|
49 |
+
disabled=True
|
50 |
+
),
|
51 |
+
},
|
52 |
+
hide_index=True,
|
53 |
+
)
|