Skip to content

Commit

Permalink
fix graphy bug
Browse files Browse the repository at this point in the history
  • Loading branch information
longbinlai committed Nov 25, 2024
1 parent c239625 commit 6f3b759
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
4 changes: 2 additions & 2 deletions python/graphy/apps/demo_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,11 @@ def graphy_dataset():
download_name=zip_filename,
)

node_names = self.get_workflow_node_names(dataset_id)
# node_names = self.get_workflow_node_names(dataset_id)
graph_builder = GraphBuilder(
data_path, self.get_persist_store(dataset_id)
)
graph_builder.extract_fact_data(node_names)
graph_builder.extract_fact_data()

graph_builder.build_graph()
graph_path = os.path.join(data_path, "_graph")
Expand Down
4 changes: 3 additions & 1 deletion python/graphy/db/base_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ def get_total_data(self) -> List[str]:
visible_items = [
item
for item in items
if not item.startswith((".", "_")) and item != "navigator"
if not item.startswith((".", "_"))
and item != "navigator"
and os.path.isdir(os.path.join(self.output_folder, item))
]
return visible_items
except Exception as e:
Expand Down
22 changes: 20 additions & 2 deletions python/graphy/tests/app/demo_app_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ def test_get_workflow_config(setup_dataset):
def test_extract(setup_dataset):
response = requests.post(
f"{BASE_URL}/api/dataset/extract",
json={"dataset_id": "8547eb64-a106-5d09-8950-8a47fb9292dc", "thread_num": 1},
json={"dataset_id": DATASET_ID, "thread_num": 1},
)
print(response.json())
assert response.status_code == 200


# @pytest.mark.skip(reason="requires LLM connection")
@pytest.mark.skip(reason="requires LLM connection")
def test_get_extracted_data(setup_dataset):
response = requests.get(
f"{BASE_URL}/api/dataset/extract", params={"dataset_id": DATASET_ID}
Expand All @@ -184,6 +184,24 @@ def test_get_extracted_data(setup_dataset):
assert response.status_code == 200


@pytest.mark.skip(reason="requires LLM connection")
def test_graphy_data(setup_dataset):
response = requests.post(
f"{BASE_URL}/api/dataset/graphy", json={"dataset_id": DATASET_ID}
)
print(response)
assert response.status_code == 200


@pytest.mark.skip(reason="requires LLM connection")
def test_get_graphy_data(setup_dataset):
response = requests.get(
f"{BASE_URL}/api/dataset/graphy", params={"dataset_id": DATASET_ID}
)
print(response)
assert response.status_code == 200


def test_delete_dataset(setup_dataset):
# Clean up by deleting the dataset
response = requests.delete(f"{BASE_URL}/api/dataset/{DATASET_ID}")
Expand Down
5 changes: 2 additions & 3 deletions python/graphy/utils/data_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ def extract_fact_data(self, dimension_node_names=[]):
dimension_node_names.remove("Paper")
except ValueError:
pass # Do nothing if "Paper" is not in the list
else:
for node_name in dimension_node_names:
self._extract_dimension_data(paper_id, folder, node_name)
for node_name in dimension_node_names:
self._extract_dimension_data(paper_id, folder, node_name)
if edge_data:
for edge_name, edge_pairs in edge_data.items():
formatted_edges = [
Expand Down

0 comments on commit 6f3b759

Please sign in to comment.