Jan Mühlnikel commited on
Commit
db771ef
·
1 Parent(s): cf7a437

text instead of codes as crs

Browse files
Files changed (1) hide show
  1. modules/singlematch_result_table.py +5 -16
modules/singlematch_result_table.py CHANGED
@@ -95,24 +95,13 @@ def show_single_table(selected_project_index, projects_df, result_df):
95
  st.write("No results found!")
96
  else:
97
  result_df = result_df.reset_index(drop=True)
98
-
99
- # Transformations
100
- result_df["crs_3_code_list"] = result_df['crs_3_code'].str.split(";").apply(lambda x: x[:-1] if x else [])
101
- result_df["crs_5_code_list"] = result_df['crs_5_code'].str.split(";").apply(lambda x: x[:-1] if x else [])
102
- result_df["sdg_list"] = result_df['sgd_pred_code'].apply(lambda x: [x] if pd.notna(x) else [])
103
- result_df["flag"] = result_df['country'].apply(lambda x: f"https://flagicons.lipis.dev/flags/4x3/{x[:2].lower()}.svg" if pd.notna(x) else "https://flagicons.lipis.dev/flags/4x3/xx.svg")
104
-
105
  st.dataframe(
106
- result_df[["similarity", "iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country", "flag", "sdg_list", "crs_3_code_list", "crs_5_code_list"]],
107
  use_container_width = True,
108
  height = 35 + 35 * len(result_df),
109
  column_config={
110
- "similarity": st.column_config.TextColumn(
111
- "Similarity",
112
- help="similarity to selected project",
113
- disabled=True,
114
- width="small"
115
- ),
116
  "iati_id": st.column_config.TextColumn(
117
  "IATI ID",
118
  help="IATI Project ID",
@@ -143,7 +132,7 @@ def show_single_table(selected_project_index, projects_df, result_df):
143
  disabled=True,
144
  width="large"
145
  ),
146
- "country": st.column_config.TextColumn(
147
  "Country",
148
  help="Country of project",
149
  disabled=True,
@@ -171,4 +160,4 @@ def show_single_table(selected_project_index, projects_df, result_df):
171
  ),
172
  },
173
  hide_index=True,
174
- )
 
95
  st.write("No results found!")
96
  else:
97
  result_df = result_df.reset_index(drop=True)
98
+ st.write(" ")
99
+ st.write("----------------------")
 
 
 
 
 
100
  st.dataframe(
101
+ result_df[["iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country_name", "flag", "sdg_list", "crs_3_code_list", "crs_5_code_list"]],
102
  use_container_width = True,
103
  height = 35 + 35 * len(result_df),
104
  column_config={
 
 
 
 
 
 
105
  "iati_id": st.column_config.TextColumn(
106
  "IATI ID",
107
  help="IATI Project ID",
 
132
  disabled=True,
133
  width="large"
134
  ),
135
+ "country_name": st.column_config.TextColumn(
136
  "Country",
137
  help="Country of project",
138
  disabled=True,
 
160
  ),
161
  },
162
  hide_index=True,
163
+ )