hemsby commited on
Commit
5845d01
·
1 Parent(s): ad509bd

feat: proper centered header — client/brand/country/category title, logo left, legend right

Browse files
Files changed (1) hide show
  1. build_network.py +15 -9
build_network.py CHANGED
@@ -204,6 +204,10 @@ def generate_network_html(network_data, threshold, max_l1_nodes,
204
  # --- HTML template ---
205
  html = _build_html_template(
206
  chart_title=chart_title,
 
 
 
 
207
  all_nodes=all_nodes,
208
  all_edges=all_edges,
209
  driver_list=driver_list,
@@ -229,7 +233,8 @@ def generate_network_html(network_data, threshold, max_l1_nodes,
229
  return html, stats, filename
230
 
231
 
232
- def _build_html_template(*, chart_title, all_nodes, all_edges, driver_list,
 
233
  threshold, attribute_count, reward_drivers, nonreward_drivers,
234
  corr_count, avg_corr, max_corr):
235
  """Build the standalone HTML string. Separated for readability."""
@@ -245,11 +250,12 @@ def _build_html_template(*, chart_title, all_nodes, all_edges, driver_list,
245
  * {{ box-sizing: border-box; margin: 0; padding: 0; }}
246
  body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8f9fa; color: #333; }}
247
 
248
- .header {{ background: #fff; border-bottom: 1px solid #e0e0e0; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }}
249
- .header-left {{ display: flex; align-items: center; gap: 16px; }}
250
- .header-left h1 {{ font-size: 18px; font-weight: 600; color: #1a1a1a; }}
251
- .header-left .subtitle {{ font-size: 13px; color: #888; margin-top: 2px; }}
252
  .decode-logo {{ height: 22px; width: auto; }}
 
 
 
253
 
254
  .legend-bar {{ display: flex; align-items: center; gap: 16px; }}
255
  .legend-item {{ display: flex; align-items: center; gap: 5px; font-size: 12px; color: #666; }}
@@ -485,10 +491,10 @@ document.addEventListener('DOMContentLoaded', function() {{
485
  <div class="header">
486
  <div class="header-left">
487
  <svg class="decode-logo" viewBox="0 0 160 21" xmlns="http://www.w3.org/2000/svg"><path d="M0,0.69 L0,19.5 L10.2,19.5 C15.83,19.5 19.72,16.02 19.72,9.81 C19.72,2.8 14.52,0.69 10.2,0.69 L0,0.69 Z M3.78,4.47 L10.2,4.47 C13.14,4.47 15.94,5.59 15.94,10.02 C15.94,13.84 13.51,15.72 10.2,15.72 L3.78,15.72 L3.78,4.47 Z M28.69,0.69 L28.69,19.5 L45.82,19.5 L45.82,15.72 L32.46,15.72 L32.46,11.66 L41.98,11.66 L41.98,7.88 L32.46,7.88 L32.46,4.47 L45.39,4.47 L45.39,0.69 L28.69,0.69 Z M73.57,3.67 C71.57,2.25 68.92,0.11 64.05,0.11 C58.82,0.11 52.72,3.45 52.72,10.1 C52.72,16.63 57.95,20.08 64.27,20.08 C67.18,20.08 71.24,19.1 73.89,17.14 L72.19,13.65 C70.63,14.85 67.65,16.31 64.31,16.31 C58.9,16.31 56.5,13 56.5,10.21 C56.5,7.16 59.22,3.89 63.87,3.89 C67.54,3.89 70.12,5.96 71.35,6.97 L73.57,3.67 Z M92.96,20.08 C100.33,20.08 104.5,15.36 104.5,10.1 C104.5,4.79 100.4,0.11 92.96,0.11 C85.55,0.11 81.41,4.83 81.41,10.1 C81.41,15.36 85.59,20.08 92.96,20.08 Z M92.96,16.31 C88.27,16.31 85.19,13.36 85.19,10.1 C85.19,6.86 88.27,3.89 92.96,3.89 C97.64,3.89 100.73,6.83 100.73,10.1 C100.73,13.36 97.64,16.31 92.96,16.31 Z M113.94,0.69 L113.94,19.5 L124.15,19.5 C129.78,19.5 133.66,16.02 133.66,9.81 C133.66,2.8 128.47,0.69 124.15,0.69 L113.94,0.69 Z M117.72,4.47 L124.15,4.47 C127.09,4.47 129.88,5.59 129.88,10.02 C129.88,13.84 127.45,15.72 124.15,15.72 L117.72,15.72 L117.72,4.47 Z M142.63,0.69 L142.63,19.5 L159.77,19.5 L159.77,15.72 L146.41,15.72 L146.41,11.66 L155.93,11.66 L155.93,7.88 L146.41,7.88 L146.41,4.47 L159.33,4.47 L159.33,0.69 L142.63,0.69 Z" fill="#1a1a1a"/></svg>
488
- <div>
489
- <h1>{chart_title}</h1>
490
- <div class="subtitle">Association Network</div>
491
- </div>
492
  </div>
493
  <div class="legend-bar">
494
  <div class="legend-item"><div class="legend-dot reward"></div> Emotional</div>
 
204
  # --- HTML template ---
205
  html = _build_html_template(
206
  chart_title=chart_title,
207
+ client_name=client_name,
208
+ country_name=country_name,
209
+ brand_name=brand_name,
210
+ category_name=category_name,
211
  all_nodes=all_nodes,
212
  all_edges=all_edges,
213
  driver_list=driver_list,
 
233
  return html, stats, filename
234
 
235
 
236
+ def _build_html_template(*, chart_title, client_name, country_name, brand_name,
237
+ category_name, all_nodes, all_edges, driver_list,
238
  threshold, attribute_count, reward_drivers, nonreward_drivers,
239
  corr_count, avg_corr, max_corr):
240
  """Build the standalone HTML string. Separated for readability."""
 
250
  * {{ box-sizing: border-box; margin: 0; padding: 0; }}
251
  body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8f9fa; color: #333; }}
252
 
253
+ .header {{ background: #fff; border-bottom: 1px solid #e0e0e0; padding: 12px 24px; display: flex; align-items: center; gap: 12px; }}
254
+ .header-left {{ flex-shrink: 0; }}
 
 
255
  .decode-logo {{ height: 22px; width: auto; }}
256
+ .header-center {{ flex: 1; text-align: center; }}
257
+ .header-center h1 {{ font-size: 17px; font-weight: 600; color: #1a1a1a; }}
258
+ .header-center .subtitle {{ font-size: 12px; color: #888; margin-top: 1px; }}
259
 
260
  .legend-bar {{ display: flex; align-items: center; gap: 16px; }}
261
  .legend-item {{ display: flex; align-items: center; gap: 5px; font-size: 12px; color: #666; }}
 
491
  <div class="header">
492
  <div class="header-left">
493
  <svg class="decode-logo" viewBox="0 0 160 21" xmlns="http://www.w3.org/2000/svg"><path d="M0,0.69 L0,19.5 L10.2,19.5 C15.83,19.5 19.72,16.02 19.72,9.81 C19.72,2.8 14.52,0.69 10.2,0.69 L0,0.69 Z M3.78,4.47 L10.2,4.47 C13.14,4.47 15.94,5.59 15.94,10.02 C15.94,13.84 13.51,15.72 10.2,15.72 L3.78,15.72 L3.78,4.47 Z M28.69,0.69 L28.69,19.5 L45.82,19.5 L45.82,15.72 L32.46,15.72 L32.46,11.66 L41.98,11.66 L41.98,7.88 L32.46,7.88 L32.46,4.47 L45.39,4.47 L45.39,0.69 L28.69,0.69 Z M73.57,3.67 C71.57,2.25 68.92,0.11 64.05,0.11 C58.82,0.11 52.72,3.45 52.72,10.1 C52.72,16.63 57.95,20.08 64.27,20.08 C67.18,20.08 71.24,19.1 73.89,17.14 L72.19,13.65 C70.63,14.85 67.65,16.31 64.31,16.31 C58.9,16.31 56.5,13 56.5,10.21 C56.5,7.16 59.22,3.89 63.87,3.89 C67.54,3.89 70.12,5.96 71.35,6.97 L73.57,3.67 Z M92.96,20.08 C100.33,20.08 104.5,15.36 104.5,10.1 C104.5,4.79 100.4,0.11 92.96,0.11 C85.55,0.11 81.41,4.83 81.41,10.1 C81.41,15.36 85.59,20.08 92.96,20.08 Z M92.96,16.31 C88.27,16.31 85.19,13.36 85.19,10.1 C85.19,6.86 88.27,3.89 92.96,3.89 C97.64,3.89 100.73,6.83 100.73,10.1 C100.73,13.36 97.64,16.31 92.96,16.31 Z M113.94,0.69 L113.94,19.5 L124.15,19.5 C129.78,19.5 133.66,16.02 133.66,9.81 C133.66,2.8 128.47,0.69 124.15,0.69 L113.94,0.69 Z M117.72,4.47 L124.15,4.47 C127.09,4.47 129.88,5.59 129.88,10.02 C129.88,13.84 127.45,15.72 124.15,15.72 L117.72,15.72 L117.72,4.47 Z M142.63,0.69 L142.63,19.5 L159.77,19.5 L159.77,15.72 L146.41,15.72 L146.41,11.66 L155.93,11.66 L155.93,7.88 L146.41,7.88 L146.41,4.47 L159.33,4.47 L159.33,0.69 L142.63,0.69 Z" fill="#1a1a1a"/></svg>
494
+ </div>
495
+ <div class="header-center">
496
+ <h1>{client_name} &middot; {brand_name} &middot; {country_name} &middot; {category_name}</h1>
497
+ <div class="subtitle">Association Network</div>
498
  </div>
499
  <div class="legend-bar">
500
  <div class="legend-item"><div class="legend-dot reward"></div> Emotional</div>