Skip to content

Commit

Permalink
merge two graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenWuyifan committed May 30, 2024
1 parent 47708c0 commit b388b09
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 648 deletions.
2 changes: 1 addition & 1 deletion bdikit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def load_dataset(self, dataset_path):
def reduce_scope(self):
self.scope_manager = ScopeReducingManager(self.dataset, self.global_table)
self.reduced_scope = self.scope_manager.reduce()
return plot_reduce_scope(self.reduced_scope, self.dataset)
return self.reduced_scope

def map_columns(self, algorithm='SimFloodAlgorithm'):
self.column_manager = ColumnMappingManager(self.dataset, self.global_table, algorithm)
Expand Down
17 changes: 10 additions & 7 deletions bdikit/visualization/scope_reducing.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,8 @@ def _candidates_table(self, column, n_candidates):
)
return table_candidates

def explore(self):
select_column = pn.widgets.Select(name='Column selected',
options=list(self.candidates_dfs.keys()),
align='center'
)
def explore(self, select_column):

select_n_candidates = pn.widgets.EditableIntSlider(name='Number of candidates',
start=1, end=self.max_candidates,
step=1, value=min(5, self.max_candidates),
Expand Down Expand Up @@ -170,6 +167,8 @@ def __init__(self) -> None:

# Selected column
self.selected_row = None

self.scope_explorer = None

def _load_json(self):
with open(self.json_path) as f:
Expand All @@ -180,7 +179,7 @@ def _write_json(self, data):
with open(self.json_path, "w") as f:
json.dump(data, f)

def get_heatmap(self):
def get_heatmap(self, dataset):
recommendations = self._load_json()
rec_cols = set()
rec_table = []
Expand Down Expand Up @@ -214,6 +213,8 @@ def get_heatmap(self):
self.get_cols_subschema()
self.get_clusters()

self.scope_explorer = ScopeReducerExplorer(dataset, recommendations)

def get_cols_subschema(self):
subschemas = []
schema = read_gdc_schema()
Expand Down Expand Up @@ -368,7 +369,9 @@ def _plot_selected_row(self, heatmap_rec_list, selection):
# value = selected_row["Value"]
# self._accept_match(column, rec)
self.selected_row = selected_row
return pn.widgets.DataFrame(selected_row)

return self.scope_explorer.explore(column)
# return pn.widgets.DataFrame(selected_row)

def _plot_pane(
self, clusters=[], subschemas=[], threshold=0.5, acc_click=0, rej_click=0
Expand Down
Loading

0 comments on commit b388b09

Please sign in to comment.