Skip to content

Commit

Permalink
Fix the interactive dashboard (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
jteijema authored Nov 15, 2021
1 parent 97a1d1e commit 1d2b111
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
29 changes: 12 additions & 17 deletions asreviewcontrib/semantic_clustering/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,14 @@ def update_abstract(hoverData):

# Update graph with hoverData
if hoverData is not None:
hover_dict = hoverData['points'][0]
abstract_idx = hover_dict['pointIndex']
# Get abstract based on x and y values
x = hoverData['points'][0]['x']
y = hoverData['points'][0]['y']
return df[(df['x'] == x) & (df['y'] == y)
]['abstract'].values[0]

# Set variable for abstract window update
abstract = df['abstract'].iloc[abstract_idx]

# Set hoverData to None again to prevent issues with graph update
hoverData = None
else:
abstract = df['abstract'].iloc[0]

return abstract
return df['abstract'].iloc[0]

# Callback to refresh article title
@app.callback(dash.dependencies.Output("paper-title", "children"),
Expand All @@ -110,14 +106,13 @@ def update_title(hoverData):

# Update graph with hoverData
if hoverData is not None:
hover_dict = hoverData['points'][0]
title_idx = hover_dict['pointIndex']

# Set variable for paper title update
title = df['title'].iloc[title_idx]
# Get title based on x and y values
x = hoverData['points'][0]['x']
y = hoverData['points'][0]['y']
title = df[(df['x'] == x) & (df['y'] == y)
]['title'].values[0]
return title

# Set hoverData to None again to prevent issues with graph update
hoverData = None
else:
title = df['title'].iloc[0]

Expand Down
1 change: 0 additions & 1 deletion asreviewcontrib/semantic_clustering/semantic_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
# Path: asreviewcontrib\semantic_clustering\semantic_clustering.py

# Environment imports
import os
from tqdm import tqdm
import numpy as np
Expand Down

0 comments on commit 1d2b111

Please sign in to comment.