Jan Mühlnikel commited on
Commit
6b796a5
1 Parent(s): 5ae70f9

adjusted mulimatch result tabel with metrics

Browse files
Files changed (1) hide show
  1. modules/multimatch_result_table.py +86 -67
modules/multimatch_result_table.py CHANGED
@@ -40,80 +40,99 @@ def show_multi_table(p1_df, p2_df):
40
  row_from_p1["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
41
  row_from_p2["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
42
 
43
- print(row_from_p1["flag"].item())
44
 
45
  # Correctly append rows to match_df
46
- st.subheader(f"#{actual_ind}")
47
- st.caption(f"Similarity: {round(row_from_p1['similarity'].item(), 4) * 100}%")
48
  match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True)
49
 
50
 
51
 
52
  #AgGrid(match_df)
53
 
54
- st.dataframe(
55
- match_df[["iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country_name", "flag", "sdg_list", "crs_3_code_list", "crs_5_code_list"]],
56
- use_container_width = True,
57
- height = 35 + 35 * len(match_df),
58
- column_config={
59
- "iati_id": st.column_config.TextColumn(
60
- "IATI ID",
61
- help="IATI Project ID",
62
- disabled=True,
63
- width="small"
64
- ),
65
- "orga_abbreviation": st.column_config.TextColumn(
66
- "Organization",
67
- help="If description not in English, description in other language provided",
68
- disabled=True,
69
- width="small"
70
- ),
71
- "client": st.column_config.TextColumn(
72
- "Client",
73
- help="Client organization of customer",
74
- disabled=True,
75
- width="small"
76
- ),
77
- "title_main": st.column_config.TextColumn(
78
- "Title",
79
- help="If title not in English, title in other language provided",
80
- disabled=True,
81
- width="large"
82
- ),
83
- "description_main": st.column_config.TextColumn(
84
- "Description",
85
- help="If description not in English, description in other language provided",
86
- disabled=True,
87
- width="large"
88
- ),
89
- "country_name": st.column_config.TextColumn(
90
- "Country",
91
- help="Country of project",
92
- disabled=True,
93
- width="small"
94
- ),
95
- "flag": st.column_config.ImageColumn(
96
- "Flag",
97
- help="country flag",
98
- width="small"
99
- ),
100
- "sdg_list": st.column_config.ListColumn(
101
- "SDG Prediction",
102
- help="Prediction of SDG's",
103
- width="small"
104
- ),
105
- "crs_3_code_list": st.column_config.ListColumn(
106
- "CRS 3",
107
- help="CRS 3 code given by organization",
108
- width="small"
109
- ),
110
- "crs_5_code_list": st.column_config.ListColumn(
111
- "CRS 5",
112
- help="CRS 5 code given by organization",
113
- width="small"
114
- ),
115
- },
116
- hide_index=True,
117
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  st.write("------------------")
 
40
  row_from_p1["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
41
  row_from_p2["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
42
 
43
+ #print(row_from_p1["flag"].item())
44
 
45
  # Correctly append rows to match_df
46
+ #st.subheader(f"#{actual_ind}")
47
+ #st.caption(f"Similarity: {round(row_from_p1['similarity'].item(), 4) * 100}%")
48
  match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True)
49
 
50
 
51
 
52
  #AgGrid(match_df)
53
 
54
+ col1, col2 = st.columns([1, 12])
55
+ with col1:
56
+
57
+ # remove arrow from standart st.metric()
58
+ st.write(
59
+ """
60
+ <style>
61
+ [data-testid="stMetricDelta"] svg {
62
+ display: none;
63
+ }
64
+ </style>
65
+ """,
66
+ unsafe_allow_html=True,
67
+ )
68
+
69
+ st.metric(label="Match", value=f"{actual_ind}", delta=f"~ {str(round(row_from_p1['similarity'].item(), 5) * 100)[:4]} %")
70
+
71
+ with col2:
72
+ st.write(" ")
73
+ st.dataframe(
74
+ match_df[["iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country_name", "flag", "sdg_list", "crs_3_code_list", "crs_5_code_list"]],
75
+ use_container_width = True,
76
+ height = 35 + 35 * len(match_df),
77
+ column_config={
78
+ "iati_id": st.column_config.TextColumn(
79
+ "IATI ID",
80
+ help="IATI Project ID",
81
+ disabled=True,
82
+ width="small"
83
+ ),
84
+ "orga_abbreviation": st.column_config.TextColumn(
85
+ "Organization",
86
+ help="If description not in English, description in other language provided",
87
+ disabled=True,
88
+ width="small"
89
+ ),
90
+ "client": st.column_config.TextColumn(
91
+ "Client",
92
+ help="Client organization of customer",
93
+ disabled=True,
94
+ width="small"
95
+ ),
96
+ "title_main": st.column_config.TextColumn(
97
+ "Title",
98
+ help="If title not in English, title in other language provided",
99
+ disabled=True,
100
+ width="large"
101
+ ),
102
+ "description_main": st.column_config.TextColumn(
103
+ "Description",
104
+ help="If description not in English, description in other language provided",
105
+ disabled=True,
106
+ width="large"
107
+ ),
108
+ "country_name": st.column_config.TextColumn(
109
+ "Country",
110
+ help="Country of project",
111
+ disabled=True,
112
+ width="small"
113
+ ),
114
+ "flag": st.column_config.ImageColumn(
115
+ "Flag",
116
+ help="country flag",
117
+ width="small"
118
+ ),
119
+ "sdg_list": st.column_config.ListColumn(
120
+ "SDG Prediction",
121
+ help="Prediction of SDG's",
122
+ width="small"
123
+ ),
124
+ "crs_3_code_list": st.column_config.ListColumn(
125
+ "CRS 3",
126
+ help="CRS 3 code given by organization",
127
+ width="small"
128
+ ),
129
+ "crs_5_code_list": st.column_config.ListColumn(
130
+ "CRS 5",
131
+ help="CRS 5 code given by organization",
132
+ width="small"
133
+ ),
134
+ },
135
+ hide_index=True,
136
+ )
137
 
138
  st.write("------------------")