File size: 1,804 Bytes
c5474d5
 
cd3cb84
a712e78
c5474d5
a712e78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5474d5
a712e78
 
 
 
 
 
 
 
 
 
 
 
 
 
c5474d5
 
 
a712e78
 
 
 
c5474d5
 
a712e78
c5474d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { DataResponse } from "@/types/data";

const API_BASE = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000";

export async function getData(): Promise<DataResponse> {
  try {
    // Fetch real stats from our Qdrant-backed API
    const response = await fetch(`${API_BASE}/api/stats`, {
      next: { revalidate: 60 },
      cache: 'no-store',
    });

    if (response.ok) {
      const apiStats = await response.json();
      
      // Only show the 2 REAL datasets we have in /data folder
      const datasets = [
        {
          name: "KIBA Dataset",
          type: "Drug-Target",
          count: apiStats.total_vectors?.toLocaleString() || "23,531",
          size: "94.1 MB",
          updated: new Date().toISOString().split('T')[0],
        },
        {
          name: "DAVIS Kinase",
          type: "Drug-Target",
          count: "30,056",
          size: "118.4 MB",
          updated: "2026-01-24",
        },
      ];

      const stats = {
        datasets: 2,
        molecules: `${Math.round((apiStats.total_vectors || 23531) / 1000)}K`,
        proteins: "442",
        storage: "212 MB",
      };

      return { datasets, stats };
    }
  } catch (error) {
    console.warn("Could not fetch live stats, using cached data:", error);
  }

  // Fallback - only 2 real datasets (kiba.tab and davis.tab)
  const datasets = [
    { 
      name: "KIBA Dataset", 
      type: "Drug-Target", 
      count: "23,531", 
      size: "94.1 MB", 
      updated: "2026-01-25" 
    },
    { 
      name: "DAVIS Kinase", 
      type: "Drug-Target", 
      count: "30,056", 
      size: "118.4 MB", 
      updated: "2026-01-24" 
    },
  ];

  const stats = {
    datasets: 2,
    molecules: "53.5K",
    proteins: "442",
    storage: "212 MB",
  };

  return { datasets, stats };
}