zavavan commited on
Commit
34f85e7
·
verified ·
1 Parent(s): 7eb8b14

Upload dashboard.py

Browse files
Files changed (1) hide show
  1. dashboard.py +55 -105
dashboard.py CHANGED
@@ -35,7 +35,14 @@ hv.extension('bokeh')
35
 
36
  ## LOAD DATASETS
37
 
38
- dna_folder = './data'
 
 
 
 
 
 
 
39
 
40
  ## AECO topic over time html file:
41
  AECO_topics_over_time_file_path = '/assets/optimized_merged_AECO_topics_over_time_2D.html'
@@ -43,18 +50,6 @@ AECO_topics_dendogram_file_path = '/assets/topic_hierarchy_optimal_params.htm'
43
  AECO_topic_map_path = '/assets/document_datamap_ver0.html'
44
 
45
 
46
- #### full data unfiltered:
47
-
48
- dna_articles_unfiltered_eu_time_indexed_resampled = pd.read_csv(os.path.join(dna_folder, 'dna_articles_unfiltered_eu_time_indexed_resampled.tsv'),sep='\t',header=0)
49
- dna_articles_unfiltered_us_time_indexed_resampled = pd.read_csv(os.path.join(dna_folder, 'dna_articles_unfiltered_us_time_indexed_resampled.tsv'),sep='\t',header=0)
50
- dna_articles_unfiltered_eu_us_time_indexed_resampled = pd.read_csv(os.path.join(dna_folder, 'dna_articles_unfiltered_eu_us_time_indexed_resampled.tsv'),sep='\t',header=0)
51
-
52
- #### classifier filtered articles:
53
-
54
- dh_ration_df_eu = pd.read_csv(os.path.join(dna_folder, 'dh_ration_df_eu.tsv'),sep='\t',header=0)
55
- dh_ration_df_us = pd.read_csv(os.path.join(dna_folder, 'dh_ration_df_us.tsv'),sep='\t',header=0)
56
- dh_ration_df_eu_us = pd.read_csv(os.path.join(dna_folder, 'dh_ration_df_eu_us.tsv'),sep='\t',header=0)
57
-
58
  regions = ['eu', 'us', 'eu_us']
59
 
60
  sorted_ent_type_freq_map_eu=dict()
@@ -62,19 +57,19 @@ sorted_ent_type_freq_map_us=dict()
62
  sorted_ent_type_freq_map_eu_us=dict()
63
 
64
  def read_top_ent_types():
65
- reader = csv.reader(open(os.path.join(dna_folder, 'sorted_ent_type_freq_map_eu.tsv'), 'r'))
66
  for i,row in enumerate(reader):
67
  if i < 20:
68
  k, v = row
69
  sorted_ent_type_freq_map_eu[k] = int(v)
70
  del sorted_ent_type_freq_map_eu['Entity']
71
- reader = csv.reader(open(os.path.join(dna_folder, 'sorted_ent_type_freq_map_us.tsv'), 'r'))
72
  for i, row in enumerate(reader):
73
  if i < 20:
74
  k, v = row
75
  sorted_ent_type_freq_map_us[k] = int(v)
76
  del sorted_ent_type_freq_map_us['Entity']
77
- reader = csv.reader(open(os.path.join(dna_folder, 'sorted_ent_type_freq_map_eu_us.tsv'), 'r'))
78
  for i, row in enumerate(reader):
79
  if i < 20:
80
  k, v = row
@@ -87,12 +82,9 @@ top_type_filtered_eu = ['DBpedia:Country', 'DBpedia:Organisation', 'DBpedia:Comp
87
  top_type_filtered_us = ['DBpedia:Organisation', 'DBpedia:Company', 'DBpedia:Disease', 'DBpedia:ChemicalSubstance', 'DBpedia:Person', 'DBpedia:Drug', 'DBpedia:Country', 'DBpedia:Region', 'DBpedia:MonoclonalAntibody', 'DBpedia:City', 'DBpedia:Biomolecule']
88
  top_type_filtered_eu_us = ['DBpedia:Organisation', 'DBpedia:Company', 'DBpedia:ChemicalSubstance', 'DBpedia:Drug', 'DBpedia:Country', 'DBpedia:Person', 'DBpedia:Disease', 'DBpedia:MonoclonalAntibody', 'DBpedia:GovernmentAgency', 'DBpedia:Biomolecule', 'DBpedia:Gene']
89
 
90
- dna_healthtech_articles_eu_time_indexed_resampled=pd.read_csv(os.path.join(dna_folder, 'dna_healthtech_articles_eu_time_indexed_resampled.tsv'),sep='\t',header=0)
91
- dna_healthtech_articles_us_time_indexed_resampled=pd.read_csv(os.path.join(dna_folder, 'dna_healthtech_articles_us_time_indexed_resampled.tsv'),sep='\t',header=0)
92
- dna_healthtech_articles_eu_us_time_indexed_resampled=pd.read_csv(os.path.join(dna_folder, 'dna_healthtech_articles_eu_us_time_indexed_resampled.tsv'),sep='\t',header=0)
93
 
94
  def read_top_ent_maps():
95
- reader = csv.reader(open(os.path.join(dna_folder, 'sorted_ent_freq_map_eu.tsv'), 'r'), delimiter='\t')
96
  for row in reader:
97
  k,v = row
98
  lista = ast.literal_eval(v)
@@ -102,7 +94,7 @@ def read_top_ent_maps():
102
  dizionario = sorted(dizionario.items(), key=lambda x: x[1], reverse=True)
103
  ent_freq_maps_eu[k]=dizionario
104
 
105
- reader = csv.reader(open(os.path.join(dna_folder, 'sorted_ent_freq_map_us.tsv'), 'r'), delimiter='\t')
106
  for row in reader:
107
  k, v = row
108
  lista = ast.literal_eval(v)
@@ -112,7 +104,7 @@ def read_top_ent_maps():
112
  dizionario = sorted(dizionario.items(), key=lambda x: x[1], reverse=True)
113
  ent_freq_maps_us[k] = dizionario
114
 
115
- reader = csv.reader(open(os.path.join(dna_folder, 'sorted_ent_freq_map_eu_us.tsv'), 'r'), delimiter='\t')
116
  for row in reader:
117
  k, v = row
118
  lista = ast.literal_eval(v)
@@ -131,15 +123,15 @@ read_top_ent_maps()
131
 
132
  def read_type_filtered_triples():
133
  for t in top_type_filtered_eu:
134
- df = pd.read_csv(dna_folder+'/filtered_rows/eu/'+t.replace(':','_')+'.tsv', sep=" ", header=0)
135
  df.drop(columns=['Unnamed: 0'], inplace=True)
136
  top_type_filtered_triples_eu[t]=df
137
  for t in top_type_filtered_us:
138
- df = pd.read_csv(dna_folder+'/filtered_rows/us/'+t.replace(':','_')+'.tsv', sep=" ")
139
  df.drop(columns=['Unnamed: 0'], inplace=True)
140
  top_type_filtered_triples_us[t]=df
141
  for t in top_type_filtered_eu_us:
142
- df = pd.read_csv(dna_folder+'/filtered_rows/eu_us/'+t.replace(':','_')+'.tsv', sep=" ")
143
  df.drop(columns=['Unnamed: 0'], inplace=True)
144
  top_type_filtered_triples_eu_us[t]=df
145
 
@@ -151,18 +143,25 @@ top_type_filtered_triples_eu_us = dict()
151
 
152
  read_type_filtered_triples()
153
 
154
- grouping_filtered = pd.read_csv(os.path.join(dna_folder, 'dna_relations.tsv'), sep=" ")
 
 
 
155
  ################################# CREATE CHARTS ############################
156
- def create_curve_chart():
157
- # Create the 3 line plots
158
- curve_eu = hv.Curve((dh_ration_df_eu.index, dh_ration_df_eu.ids/dna_articles_unfiltered_eu_time_indexed_resampled.ids), 'Time', 'Digital Health News Ratio',label='EU')
159
- curve_us = hv.Curve((dh_ration_df_us.index, dh_ration_df_us.ids/dna_articles_unfiltered_us_time_indexed_resampled.ids),'Time', 'Digital Health News Ratio', label='US')
160
- curve_eu_us = hv.Curve((dh_ration_df_eu_us.index, dh_ration_df_eu_us.ids/dna_articles_unfiltered_eu_us_time_indexed_resampled.ids),'Time', 'Digital Health News Ratio', label='EU-US')
161
  #Overlay the line plots
162
- overlay = curve_eu * curve_us * curve_eu_us
163
- overlay.opts(show_legend = True, legend_position='top_left', width=1200, height=600)
 
 
 
164
  return overlay
165
 
 
 
166
  macro_topics = ["Energy-Efficient Building Design for Thermal Comfort and Sustainability","Indoor Air Quality and Energy Efficiency in Low-Energy Houses","Urban Planning and Development in China\'s Cities", "Design Thinking and Sustainable Product Development", "Smart Cities and Urban Computing", "Urban Resilience and Water Management","Renewable Energy Systems: Solar PV & Building Applications","Exploring the Intersection of Traditional Heritage and Modern Steel Architecture in Historical Buildings","Green Building Assessment and Design","Landscape Design, Planning, and Research: Integrating Cultural, Ecological, and Rural Perspectives", "Noise and Acoustic Design in Urban Development","Sustainable Building Materials: Wood & 3D Printing Innovations","BIM in AEC: Trends, Challenges, and Opportunities","Urban Food Systems: Community Development and Social Sustainability in Cities","Innovative Bridge Design and Construction: Trends and Case Studies", "Cavity Flow and Heat Transfer"]
167
  macro_topics_active_subset = ["Energy-Efficient Building Design for Thermal Comfort and Sustainability","Indoor Air Quality and Energy Efficiency in Low-Energy Houses","Smart Cities and Urban Computing", "Renewable Energy Systems: Solar PV & Building Applications","BIM in AEC: Trends, Challenges, and Opportunities"]
168
 
@@ -211,56 +210,6 @@ def load_country_network(topic, **kwargs):
211
  return html_pane
212
 
213
 
214
- # Define a function to generate Curve based on selected values
215
- def generate_entity_curves(region_value, type_value, **kwargs):
216
- if region_value=='eu':
217
- top20Ents = ent_freq_maps_eu[type_value]
218
- curveList = []
219
- for ent in top20Ents:
220
- entityTriples = top_type_filtered_triples_eu[type_value][(top_type_filtered_triples_eu[type_value]['subjEntityLinks']==ent[0]) | (top_type_filtered_triples_eu[type_value]['objEntityLinks']==ent[0])]
221
- entityTriples_time_indexed = entityTriples.set_index(pd.DatetimeIndex(entityTriples['timestamp']), inplace=False)
222
- del entityTriples_time_indexed['timestamp']
223
- entityTriples_time_indexed_resampled = entityTriples_time_indexed.resample("Y").count()
224
- #print(entityTriples_time_indexed_resampled)
225
- entityTriples_time_indexed_resampled = entityTriples_time_indexed_resampled.reindex(dna_healthtech_articles_eu_time_indexed_resampled.index, fill_value=0)
226
- curve = hv.Curve((entityTriples_time_indexed_resampled.index, (entityTriples_time_indexed_resampled['doc_id']/dna_healthtech_articles_eu_time_indexed_resampled['ids'])), 'Time', 'Key Entity Occurrence', label=ent[0])
227
- curve.opts(autorange='y')
228
- #curve.opts(logy=True)
229
- curveList.append(curve)
230
- overlay = hv.Overlay(curveList)
231
- overlay.opts(legend_muted=False, legend_cols=4, show_legend = True, legend_position='top_left', fontsize={'legend':13},width=1200, height=800)
232
- return overlay
233
-
234
- elif region_value=='us':
235
- top20Ents = ent_freq_maps_us[type_value]
236
- curveList = []
237
- for ent in top20Ents:
238
- entityTriples = top_type_filtered_triples_us[type_value][(top_type_filtered_triples_us[type_value]['subjEntityLinks']==ent[0]) | (top_type_filtered_triples_us[type_value]['objEntityLinks']==ent[0])]
239
- entityTriples_time_indexed = entityTriples.set_index(pd.DatetimeIndex(entityTriples['timestamp']), inplace=False)
240
- del entityTriples_time_indexed['timestamp']
241
- entityTriples_time_indexed_resampled = entityTriples_time_indexed_resampled.reindex(dna_healthtech_articles_us_time_indexed_resampled.index, fill_value=0)
242
- curve = hv.Curve((entityTriples_time_indexed_resampled.index, (entityTriples_time_indexed_resampled['doc_id']/dna_healthtech_articles_us_time_indexed_resampled['ids'])), 'Time', 'Key Entity Occurrence', label=ent[0])
243
- curve.opts(autorange='y')
244
- curveList.append(curve)
245
- overlay = hv.Overlay(curveList)
246
- overlay.opts(legend_muted=False, legend_cols=4, show_legend = True, legend_position='top_left', fontsize={'legend':13},width=1200, height=800)
247
- return overlay
248
-
249
- elif region_value=='eu_us':
250
- top20Ents = ent_freq_maps_eu_us[type_value]
251
- curveList = []
252
- for ent in top20Ents:
253
- entityTriples = top_type_filtered_triples_eu_us[type_value][(top_type_filtered_triples_eu_us[type_value]['subjEntityLinks']==ent[0]) | (top_type_filtered_triples_eu_us[type_value]['objEntityLinks']==ent[0])]
254
- entityTriples_time_indexed = entityTriples.set_index(pd.DatetimeIndex(entityTriples['timestamp']), inplace=False)
255
- del entityTriples_time_indexed['timestamp']
256
- entityTriples_time_indexed_resampled = entityTriples_time_indexed_resampled.reindex(dna_healthtech_articles_eu_us_time_indexed_resampled.index, fill_value=0)
257
- curve = hv.Curve((entityTriples_time_indexed_resampled.index, (entityTriples_time_indexed_resampled['doc_id']/dna_healthtech_articles_eu_us_time_indexed_resampled['ids'])), 'Time', 'Key Entity Occurrence', label=ent[0])
258
- curve.opts(autorange='y')
259
- curveList.append(curve)
260
- overlay = hv.Overlay(curveList)
261
- overlay.opts(legend_muted=False, legend_cols=4, show_legend = True, legend_position='top_left', fontsize={'legend':13},width=1200, height=800)
262
- return overlay
263
-
264
 
265
  ############################# WIDGETS & CALLBACK ###########################################
266
 
@@ -321,11 +270,13 @@ def generate_radio_buttons(value):
321
 
322
  # https://tabler-icons.io/
323
  button0 = pn.widgets.Button(name="Introduction", button_type="warning", icon="file-info", styles={"width": "100%"})
324
- button1 = pn.widgets.Button(name="Topic Map", button_type="warning", icon="chart-dots-3", styles={"width": "100%"})
325
- button2 = pn.widgets.Button(name="AECO Macro Topics Hierarchy", button_type="warning", icon="file-info", styles={"width": "100%"})
326
- button3 = pn.widgets.Button(name="AECO Macro Topics Trends", button_type="warning", icon="chart-histogram", styles={"width": "100%"})
327
- button4 = pn.widgets.Button(name="Research Collaboration Networks: Institutes", button_type="warning", icon="chart-dots-3", styles={"width": "100%"})
328
- button5 = pn.widgets.Button(name="Research Collaboration Networks: Countries", button_type="warning", icon="chart-dots-3", styles={"width": "100%"})
 
 
329
 
330
  region1 = pn.widgets.RadioButtonGroup(name='### Select News Region', options=regions)
331
 
@@ -347,7 +298,6 @@ def update_radio_group(event):
347
 
348
 
349
  # bind the function to the widget(s)
350
- dmap2 = hv.DynamicMap(pn.bind(generate_entity_curves, radio_buttons_regions,radio_buttons_types))
351
  # Bind the selected value of the first RadioButtonGroup to update the second RadioButtonGroup
352
  radio_buttons_regions.param.watch(update_radio_group, 'value')
353
 
@@ -375,7 +325,7 @@ button2.on_click(lambda event: show_page("Page2"))
375
  button3.on_click(lambda event: show_page("Page3"))
376
  button4.on_click(lambda event: show_page("Page4"))
377
  button5.on_click(lambda event: show_page("Page5"))
378
- #button5.on_click(lambda event: show_page("Page5"))
379
  #button6.on_click(lambda event: show_page("Page6"))
380
 
381
 
@@ -402,9 +352,16 @@ for the 16 macro-topics automatically detected by an optimized BerTopic model an
402
  ### Research Collaboration Networks: Authors
403
  """, width=800), align="center")
404
 
 
 
 
 
 
 
405
 
406
 
407
- def CreatePage1():
 
408
  # Load the HTML content from the local file
409
  #with open(AECO_topics_over_time_file_path, 'r', encoding='utf-8') as file:
410
  # html_content = file.read()
@@ -415,7 +372,7 @@ def CreatePage1():
415
  return pn.Column(pn.pane.Markdown(" ## AECO Topic Map "), html_pane, align="center")
416
 
417
 
418
- def CreatePage2():
419
  # Load the HTML content from the local file
420
  #with open(AECO_topics_over_time_file_path, 'r', encoding='utf-8') as file:
421
  # html_content = file.read()
@@ -426,7 +383,7 @@ def CreatePage2():
426
  return pn.Column(pn.pane.Markdown(" ## AECO Macro Topics Dendogram "), html_pane, align="center")
427
 
428
 
429
- def CreatePage3():
430
  # Load the HTML content from the local file
431
  #with open(AECO_topics_over_time_file_path, 'r', encoding='utf-8') as file:
432
  # html_content = file.read()
@@ -436,7 +393,7 @@ def CreatePage3():
436
  html_pane = pn.pane.HTML(iframe_html , sizing_mode='stretch_both')
437
  return pn.Column(pn.pane.Markdown(" ## AECO Macro Topics "), html_pane, align="center")
438
 
439
- def CreatePage4():
440
  return pn.Column(
441
  macro_topics_button,
442
  pn.bind(load_institute_network, macro_topics_button),
@@ -444,7 +401,7 @@ def CreatePage4():
444
  )
445
 
446
 
447
- def CreatePage5():
448
  return pn.Column(
449
  macro_topics_button,
450
  pn.bind(load_country_network, macro_topics_button),
@@ -452,13 +409,6 @@ def CreatePage5():
452
  )
453
 
454
 
455
- def CreatePage6():
456
- return pn.Column(
457
- pn.pane.Markdown("## Entity Chord Diagrams "),
458
- pn.Row(region_radio_button, pn.bind(filter_region, region_radio_button)),
459
- align="center", )
460
-
461
-
462
  def CreatePage6():
463
  html = """<iframe src="https://app.vosviewer.com/?json=https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D16q1oLQyEeMosAgeD9UkC9hSrpzAYX_-n" width="800" height="800"></iframe>"""
464
 
@@ -478,12 +428,12 @@ mapping = {
478
  "Page2": CreatePage2(),
479
  "Page3": CreatePage3(),
480
  "Page4": CreatePage4(),
481
- "Page5": CreatePage5()
482
- #"Page6": CreatePage6()
483
  }
484
 
485
  #################### SIDEBAR LAYOUT ##########################
486
- sidebar = pn.Column(pn.pane.Markdown("## Pages"),button0,button1,button2,button3,button4,button5,
487
  #button5,
488
  #button6,
489
  styles={"width": "100%", "padding": "15px"})
 
35
 
36
  ## LOAD DATASETS
37
 
38
+ data_folder = './data'
39
+
40
+ country_name_df = pd.read_csv(os.path.join(data_folder, 'country_name_map.tsv'), header=0, sep='\t', lineterminator='\n', low_memory=False)
41
+ country_name_map = dict(zip(country_name_df.Country_Code, country_name_df.Country_Name))
42
+
43
+ total_publications_time_indexed = pd.read_csv(os.path.join(data_folder, 'total_publications_time_indexed.tsv'), header=0, sep='\t', lineterminator='\n', low_memory=False)
44
+ country_publications_time_indexed = pd.read_csv(os.path.join(data_folder, 'country_publications_time_indexed.tsv'), header=0, sep='\t', lineterminator='\n', low_memory=False)
45
+
46
 
47
  ## AECO topic over time html file:
48
  AECO_topics_over_time_file_path = '/assets/optimized_merged_AECO_topics_over_time_2D.html'
 
50
  AECO_topic_map_path = '/assets/document_datamap_ver0.html'
51
 
52
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  regions = ['eu', 'us', 'eu_us']
54
 
55
  sorted_ent_type_freq_map_eu=dict()
 
57
  sorted_ent_type_freq_map_eu_us=dict()
58
 
59
  def read_top_ent_types():
60
+ reader = csv.reader(open(os.path.join(data_folder, 'sorted_ent_type_freq_map_eu.tsv'), 'r'))
61
  for i,row in enumerate(reader):
62
  if i < 20:
63
  k, v = row
64
  sorted_ent_type_freq_map_eu[k] = int(v)
65
  del sorted_ent_type_freq_map_eu['Entity']
66
+ reader = csv.reader(open(os.path.join(data_folder, 'sorted_ent_type_freq_map_us.tsv'), 'r'))
67
  for i, row in enumerate(reader):
68
  if i < 20:
69
  k, v = row
70
  sorted_ent_type_freq_map_us[k] = int(v)
71
  del sorted_ent_type_freq_map_us['Entity']
72
+ reader = csv.reader(open(os.path.join(data_folder, 'sorted_ent_type_freq_map_eu_us.tsv'), 'r'))
73
  for i, row in enumerate(reader):
74
  if i < 20:
75
  k, v = row
 
82
  top_type_filtered_us = ['DBpedia:Organisation', 'DBpedia:Company', 'DBpedia:Disease', 'DBpedia:ChemicalSubstance', 'DBpedia:Person', 'DBpedia:Drug', 'DBpedia:Country', 'DBpedia:Region', 'DBpedia:MonoclonalAntibody', 'DBpedia:City', 'DBpedia:Biomolecule']
83
  top_type_filtered_eu_us = ['DBpedia:Organisation', 'DBpedia:Company', 'DBpedia:ChemicalSubstance', 'DBpedia:Drug', 'DBpedia:Country', 'DBpedia:Person', 'DBpedia:Disease', 'DBpedia:MonoclonalAntibody', 'DBpedia:GovernmentAgency', 'DBpedia:Biomolecule', 'DBpedia:Gene']
84
 
 
 
 
85
 
86
  def read_top_ent_maps():
87
+ reader = csv.reader(open(os.path.join(data_folder, 'sorted_ent_freq_map_eu.tsv'), 'r'), delimiter='\t')
88
  for row in reader:
89
  k,v = row
90
  lista = ast.literal_eval(v)
 
94
  dizionario = sorted(dizionario.items(), key=lambda x: x[1], reverse=True)
95
  ent_freq_maps_eu[k]=dizionario
96
 
97
+ reader = csv.reader(open(os.path.join(data_folder, 'sorted_ent_freq_map_us.tsv'), 'r'), delimiter='\t')
98
  for row in reader:
99
  k, v = row
100
  lista = ast.literal_eval(v)
 
104
  dizionario = sorted(dizionario.items(), key=lambda x: x[1], reverse=True)
105
  ent_freq_maps_us[k] = dizionario
106
 
107
+ reader = csv.reader(open(os.path.join(data_folder, 'sorted_ent_freq_map_eu_us.tsv'), 'r'), delimiter='\t')
108
  for row in reader:
109
  k, v = row
110
  lista = ast.literal_eval(v)
 
123
 
124
  def read_type_filtered_triples():
125
  for t in top_type_filtered_eu:
126
+ df = pd.read_csv(data_folder+'/filtered_rows/eu/'+t.replace(':','_')+'.tsv', sep=" ", header=0)
127
  df.drop(columns=['Unnamed: 0'], inplace=True)
128
  top_type_filtered_triples_eu[t]=df
129
  for t in top_type_filtered_us:
130
+ df = pd.read_csv(data_folder+'/filtered_rows/us/'+t.replace(':','_')+'.tsv', sep=" ")
131
  df.drop(columns=['Unnamed: 0'], inplace=True)
132
  top_type_filtered_triples_us[t]=df
133
  for t in top_type_filtered_eu_us:
134
+ df = pd.read_csv(data_folder+'/filtered_rows/eu_us/'+t.replace(':','_')+'.tsv', sep=" ")
135
  df.drop(columns=['Unnamed: 0'], inplace=True)
136
  top_type_filtered_triples_eu_us[t]=df
137
 
 
143
 
144
  read_type_filtered_triples()
145
 
146
+ grouping_filtered = pd.read_csv(os.path.join(data_folder, 'dna_relations.tsv'), sep=" ")
147
+
148
+
149
+
150
  ################################# CREATE CHARTS ############################
151
+ def create_publication_curve_chart():
152
+ total_publications_time_indexed.id = np.log1p(total_publications_time_indexed.id)
153
+ country_publications_time_indexed = country_publications_time_indexed.applymap(lambda x: np.log1p(x) if np.issubdtype(type(x), np.number) else x)
154
+ curve_total = hv.Curve((total_publications_time_indexed.index, total_publications_time_indexed.id), 'Time', 'Publication Counts (log)',label='Total')
 
155
  #Overlay the line plots
156
+ overlay = curve_total
157
+ curve_countries = []
158
+ for country in country_name_map.keys():
159
+ overlay = overlay * hv.Curve((country_publications_time_indexed.index, country_publications_time_indexed[country]), label=country_name_map[country])
160
+ overlay.opts(show_legend=True,legend_position='right', width=800, height=400 )
161
  return overlay
162
 
163
+
164
+
165
  macro_topics = ["Energy-Efficient Building Design for Thermal Comfort and Sustainability","Indoor Air Quality and Energy Efficiency in Low-Energy Houses","Urban Planning and Development in China\'s Cities", "Design Thinking and Sustainable Product Development", "Smart Cities and Urban Computing", "Urban Resilience and Water Management","Renewable Energy Systems: Solar PV & Building Applications","Exploring the Intersection of Traditional Heritage and Modern Steel Architecture in Historical Buildings","Green Building Assessment and Design","Landscape Design, Planning, and Research: Integrating Cultural, Ecological, and Rural Perspectives", "Noise and Acoustic Design in Urban Development","Sustainable Building Materials: Wood & 3D Printing Innovations","BIM in AEC: Trends, Challenges, and Opportunities","Urban Food Systems: Community Development and Social Sustainability in Cities","Innovative Bridge Design and Construction: Trends and Case Studies", "Cavity Flow and Heat Transfer"]
166
  macro_topics_active_subset = ["Energy-Efficient Building Design for Thermal Comfort and Sustainability","Indoor Air Quality and Energy Efficiency in Low-Energy Houses","Smart Cities and Urban Computing", "Renewable Energy Systems: Solar PV & Building Applications","BIM in AEC: Trends, Challenges, and Opportunities"]
167
 
 
210
  return html_pane
211
 
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
  ############################# WIDGETS & CALLBACK ###########################################
215
 
 
270
 
271
  # https://tabler-icons.io/
272
  button0 = pn.widgets.Button(name="Introduction", button_type="warning", icon="file-info", styles={"width": "100%"})
273
+ button1 = pn.widgets.Button(name="Publication Trends", button_type="warning", icon="chart-histogram", styles={"width": "100%"})
274
+ button2 = pn.widgets.Button(name="Topic Map", button_type="warning", icon="chart-dots-3", styles={"width": "100%"})
275
+ button3 = pn.widgets.Button(name="AECO Macro Topics Hierarchy", button_type="warning", icon="chart-dots-3", styles={"width": "100%"})
276
+ button4 = pn.widgets.Button(name="AECO Macro Topics Trends", button_type="warning", icon="chart-histogram", styles={"width": "100%"})
277
+ button5 = pn.widgets.Button(name="Research Collaboration Networks: Institutes", button_type="warning", icon="chart-dots-3", styles={"width": "100%"})
278
+ button6 = pn.widgets.Button(name="Research Collaboration Networks: Countries", button_type="warning", icon="chart-dots-3", styles={"width": "100%"})
279
+
280
 
281
  region1 = pn.widgets.RadioButtonGroup(name='### Select News Region', options=regions)
282
 
 
298
 
299
 
300
  # bind the function to the widget(s)
 
301
  # Bind the selected value of the first RadioButtonGroup to update the second RadioButtonGroup
302
  radio_buttons_regions.param.watch(update_radio_group, 'value')
303
 
 
325
  button3.on_click(lambda event: show_page("Page3"))
326
  button4.on_click(lambda event: show_page("Page4"))
327
  button5.on_click(lambda event: show_page("Page5"))
328
+ button6.on_click(lambda event: show_page("Page6"))
329
  #button6.on_click(lambda event: show_page("Page6"))
330
 
331
 
 
352
  ### Research Collaboration Networks: Authors
353
  """, width=800), align="center")
354
 
355
+ def CreatePage1():
356
+ return pn.Column(
357
+ pn.pane.Markdown("## Publication Trends "),
358
+ create_publication_curve_chart(),
359
+ align="center",
360
+ )
361
 
362
 
363
+
364
+ def CreatePage2():
365
  # Load the HTML content from the local file
366
  #with open(AECO_topics_over_time_file_path, 'r', encoding='utf-8') as file:
367
  # html_content = file.read()
 
372
  return pn.Column(pn.pane.Markdown(" ## AECO Topic Map "), html_pane, align="center")
373
 
374
 
375
+ def CreatePage3():
376
  # Load the HTML content from the local file
377
  #with open(AECO_topics_over_time_file_path, 'r', encoding='utf-8') as file:
378
  # html_content = file.read()
 
383
  return pn.Column(pn.pane.Markdown(" ## AECO Macro Topics Dendogram "), html_pane, align="center")
384
 
385
 
386
+ def CreatePage4():
387
  # Load the HTML content from the local file
388
  #with open(AECO_topics_over_time_file_path, 'r', encoding='utf-8') as file:
389
  # html_content = file.read()
 
393
  html_pane = pn.pane.HTML(iframe_html , sizing_mode='stretch_both')
394
  return pn.Column(pn.pane.Markdown(" ## AECO Macro Topics "), html_pane, align="center")
395
 
396
+ def CreatePage5():
397
  return pn.Column(
398
  macro_topics_button,
399
  pn.bind(load_institute_network, macro_topics_button),
 
401
  )
402
 
403
 
404
+ def CreatePage6():
405
  return pn.Column(
406
  macro_topics_button,
407
  pn.bind(load_country_network, macro_topics_button),
 
409
  )
410
 
411
 
 
 
 
 
 
 
 
412
  def CreatePage6():
413
  html = """<iframe src="https://app.vosviewer.com/?json=https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D16q1oLQyEeMosAgeD9UkC9hSrpzAYX_-n" width="800" height="800"></iframe>"""
414
 
 
428
  "Page2": CreatePage2(),
429
  "Page3": CreatePage3(),
430
  "Page4": CreatePage4(),
431
+ "Page5": CreatePage5(),
432
+ "Page6": CreatePage6()
433
  }
434
 
435
  #################### SIDEBAR LAYOUT ##########################
436
+ sidebar = pn.Column(pn.pane.Markdown("## Pages"),button0,button1,button2,button3,button4,button5,button6,
437
  #button5,
438
  #button6,
439
  styles={"width": "100%", "padding": "15px"})