Skip to content

Commit 617e82e

Browse files
committed
add repo count notice
1 parent 845236e commit 617e82e

11 files changed

Lines changed: 12952 additions & 240495 deletions

File tree

backend/app/gexf/generated_nodes.gexf

Lines changed: 12662 additions & 1187 deletions
Large diffs are not rendered by default.

backend/app/main.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,44 @@ def finalized_node_gexf():
253253
})
254254

255255

256+
@app.route("/api/get-unique-repos", methods=["POST"])
257+
def get_unique_repos():
258+
try:
259+
data = request.get_json()
260+
topics = data.get("topics", [])
261+
if not topics:
262+
return jsonify({
263+
"success": True,
264+
"count": 0
265+
})
266+
267+
# Convert topics to lowercase for case-insensitive matching
268+
topics_lower = [t.lower() for t in topics]
269+
placeholders = ",".join(["?"] * len(topics_lower))
270+
271+
# Query to get unique repositories that have ANY of the given topics
272+
query = f"""
273+
SELECT COUNT(DISTINCT r.nameWithOwner) as count
274+
FROM repos r
275+
JOIN repo_topics t ON r.nameWithOwner = t.repo
276+
WHERE LOWER(t.topic) IN ({placeholders})
277+
"""
278+
279+
result = topic_service.con.execute(query, topics_lower).fetchone()
280+
count = result[0] if result else 0
281+
282+
return jsonify({
283+
"success": True,
284+
"count": count
285+
})
286+
except Exception as e:
287+
print(f"Error getting unique repos: {str(e)}")
288+
return jsonify({
289+
"success": False,
290+
"error": str(e)
291+
}), 500
292+
293+
256294
@app.route("/")
257295
def home():
258296
return "Hello World!"

public/arg_clusters.gexf

Lines changed: 0 additions & 2567 deletions
This file was deleted.

public/dataset.gexf

Lines changed: 0 additions & 39182 deletions
This file was deleted.

public/llm_clusters.gexf

Lines changed: 0 additions & 139497 deletions
This file was deleted.

public/lp_clusters.gexf

Lines changed: 0 additions & 24003 deletions
This file was deleted.

public/test/duckdb_create.ipynb

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,10 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
66
"id": "b637b442-3873-4c23-9159-7a4f00b98e86",
77
"metadata": {},
8-
"outputs": [
9-
{
10-
"data": {
11-
"application/vnd.jupyter.widget-view+json": {
12-
"model_id": "7a52c853f3d348a490288979f5947d6e",
13-
"version_major": 2,
14-
"version_minor": 0
15-
},
16-
"text/plain": [
17-
"FloatProgress(value=0.0, layout=Layout(width='auto'), style=ProgressStyle(bar_color='black'))"
18-
]
19-
},
20-
"metadata": {},
21-
"output_type": "display_data"
22-
},
23-
{
24-
"data": {
25-
"application/vnd.jupyter.widget-view+json": {
26-
"model_id": "2607eeec41a24eb8afec4c73143d41e9",
27-
"version_major": 2,
28-
"version_minor": 0
29-
},
30-
"text/plain": [
31-
"FloatProgress(value=0.0, layout=Layout(width='auto'), style=ProgressStyle(bar_color='black'))"
32-
]
33-
},
34-
"metadata": {},
35-
"output_type": "display_data"
36-
},
37-
{
38-
"name": "stdout",
39-
"output_type": "stream",
40-
"text": [
41-
"DuckDB database created at repos.duckdb\n"
42-
]
43-
}
44-
],
8+
"outputs": [],
459
"source": [
4610
"import duckdb\n",
4711
"import pandas as pd\n",
@@ -102,12 +66,17 @@
10266
" \"size\": lang.get(\"size\")\n",
10367
" })\n",
10468
"\n",
69+
" # Use a set to track seen topic names per repo\n",
70+
" seen_topics = set()\n",
10571
" for topic in repo.get(\"topics\", []):\n",
106-
" topics.append({\n",
107-
" \"repo\": repo_id,\n",
108-
" \"topic\": topic.get(\"name\"),\n",
109-
" \"stars\": topic.get(\"stars\")\n",
110-
" })\n",
72+
" topic_name = topic.get(\"name\")\n",
73+
" if topic_name and topic_name not in seen_topics:\n",
74+
" seen_topics.add(topic_name)\n",
75+
" topics.append({\n",
76+
" \"repo\": repo_id,\n",
77+
" \"topic\": topic_name,\n",
78+
" \"stars\": topic.get(\"stars\")\n",
79+
" })\n",
11180
"\n",
11281
"# Convert to DataFrames\n",
11382
"df_repos = pd.DataFrame(repos)\n",
@@ -129,16 +98,8 @@
12998
"\n",
13099
"con.close()\n",
131100
"\n",
132-
"print(f\"DuckDB database created at {db_path}\")\n"
101+
"print(f\"DuckDB database created at {db_path}\")"
133102
]
134-
},
135-
{
136-
"cell_type": "code",
137-
"execution_count": null,
138-
"id": "2442785a-d821-47ab-bf16-86ceab3af02b",
139-
"metadata": {},
140-
"outputs": [],
141-
"source": []
142103
}
143104
],
144105
"metadata": {

0 commit comments

Comments
 (0)