nouamanetazi HF staff commited on
Commit
6a4ee5f
1 Parent(s): 951e7a1
Files changed (2) hide show
  1. app.py +16 -4
  2. src/map_utils.py +0 -2
app.py CHANGED
@@ -126,8 +126,22 @@ def show_requests(filtered_df):
126
  displayed_request = marker_request(request_type) # TODO: the marker should depend on selected_options
127
  long_lat = row["latlng"]
128
  maps_url = f"https://maps.google.com/?q={long_lat}"
 
 
 
 
 
129
  # we display all requests in popup text and use the first one for the icon/color
130
- display_text = f'<b>Request Type:</b> {request_type}<br><b>Id:</b> {row["id"]}<br><a href="{maps_url}" target="_blank" rel="noopener noreferrer"><b>Google Maps</b></a>'
 
 
 
 
 
 
 
 
 
131
  icon_name = ICON_MAPPING.get(request_type, "list")
132
  if long_lat is None:
133
  continue
@@ -398,14 +412,12 @@ show_verified_requests(verified_df)
398
 
399
  # Add legend
400
  legend_macro = get_legend_macro(show_unverified)
401
- print(legend_macro)
402
  # delete old legend
403
  for child in m.get_root()._children:
404
- pass
405
  # if child.startswith("macro_element"):
406
  # m.get_root()._children.remove(child)
407
  m.get_root().add_child(legend_macro)
408
- print(m.get_root()._children)
409
 
410
  st_folium(m, use_container_width=True, returned_objects=[], feature_group_to_add=fg, key="map")
411
 
 
126
  displayed_request = marker_request(request_type) # TODO: the marker should depend on selected_options
127
  long_lat = row["latlng"]
128
  maps_url = f"https://maps.google.com/?q={long_lat}"
129
+
130
+ douar = row[filtered_df.columns[3]]
131
+ person_in_place = row[filtered_df.columns[6]]
132
+ douar_info = row[filtered_df.columns[9]]
133
+ source = row[filtered_df.columns[10]]
134
  # we display all requests in popup text and use the first one for the icon/color
135
+ display_text = f"""
136
+ <b>Request Type:</b> {request_type}<br>
137
+ <b>Id:</b> {row["id"]}<br>
138
+ <b>Source:</b> {source}<br>
139
+ <b>Person in place:</b> {person_in_place}<br>
140
+ <b>Douar:</b> {douar}<br>
141
+ <b>Douar Info:</b> {douar_info}<br>
142
+ <a href="{maps_url}" target="_blank" rel="noopener noreferrer"><b>Google Maps</b></a>
143
+ """
144
+
145
  icon_name = ICON_MAPPING.get(request_type, "list")
146
  if long_lat is None:
147
  continue
 
412
 
413
  # Add legend
414
  legend_macro = get_legend_macro(show_unverified)
 
415
  # delete old legend
416
  for child in m.get_root()._children:
417
+ pass #TODO: fix this
418
  # if child.startswith("macro_element"):
419
  # m.get_root()._children.remove(child)
420
  m.get_root().add_child(legend_macro)
 
421
 
422
  st_folium(m, use_container_width=True, returned_objects=[], feature_group_to_add=fg, key="map")
423
 
src/map_utils.py CHANGED
@@ -112,10 +112,8 @@ template_2 = """
112
  {% endmacro %}"""
113
 
114
  def get_legend_macro(show_unverified):
115
- print("show_unverified", show_unverified)
116
  legend_macro = MacroElement()
117
  legend_macro._template = Template(template_1 + (labels_unverified_requests if show_unverified else labels_verified) + template_2)
118
- # legend_macro._template = Template(template_1 + (labels_unverified_requests) + template_2)
119
  return legend_macro
120
 
121
  __all__ = ["get_legend_macro"]
 
112
  {% endmacro %}"""
113
 
114
  def get_legend_macro(show_unverified):
 
115
  legend_macro = MacroElement()
116
  legend_macro._template = Template(template_1 + (labels_unverified_requests if show_unverified else labels_verified) + template_2)
 
117
  return legend_macro
118
 
119
  __all__ = ["get_legend_macro"]