Abhinaycodes commited on
Commit
e699b35
·
verified ·
1 Parent(s): e36452b

Upload 18 files

Browse files

Upload backend files

Files changed (18) hide show
  1. .gitignore +0 -0
  2. Dockerfile +14 -0
  3. README.md +121 -9
  4. app.py +198 -0
  5. articles.csv +51 -0
  6. benchmark_report.txt +9 -0
  7. build_tigergraph.py +109 -0
  8. build_vector_db.py +59 -0
  9. count_tokens.py +131 -0
  10. download_db.py +32 -0
  11. edges.csv +503 -0
  12. extract_graph.py +153 -0
  13. index.html +1025 -0
  14. inspect_db.py +34 -0
  15. query.gsql +52 -0
  16. requirements.txt +10 -0
  17. schema_and_load.gsql +33 -0
  18. vertices.csv +693 -0
.gitignore ADDED
Binary file (14 Bytes). View file
 
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /code
4
+
5
+ # Copy requirements and install dependencies
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ # Copy the rest of the application
10
+ COPY . .
11
+
12
+ # Hugging Face Spaces dynamically assign the PORT variable, usually 7860
13
+ # Uvicorn will bind to this port
14
+ CMD ["sh", "-c", "uvicorn scripts.app:app --host 0.0.0.0 --port ${PORT:-7860}"]
README.md CHANGED
@@ -1,12 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: GraphRAG Backend
3
- emoji: 📉
4
- colorFrom: blue
5
- colorTo: pink
6
- sdk: docker
7
- pinned: false
8
- license: mit
9
- short_description: GRAPHRAG PIPELINE
 
 
 
 
 
 
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <img src="https://www.tigergraph.com/wp-content/uploads/2023/11/TigerGraph-Logo-Orange-Black.png" alt="TigerGraph Logo" width="300" />
3
+ <h1>🚀 Financial Corporate GraphRAG</h1>
4
+ <p><b>Massive-scale, graph-powered retrieval-augmented generation built for the TigerGraph Hackathon</b></p>
5
+
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Python](https://img.shields.io/badge/Python-3.9+-blue.svg)](https://www.python.org/)
8
+ [![TigerGraph](https://img.shields.io/badge/TigerGraph-Cloud-orange.svg)](https://www.tigergraph.com/)
9
+ [![Gemini API](https://img.shields.io/badge/Gemini-2.5%20Flash-green.svg)](https://deepmind.google/technologies/gemini/)
10
+ [![Graph Size](https://img.shields.io/badge/Graph_Size-692_Nodes-red.svg)](#-the-benchmark-data)
11
+ </div>
12
+
13
+ ---
14
+
15
+ ## 📖 Table of Contents
16
+ - [What is this?](#-what-is-this)
17
+ - [The Benchmark Data](#-the-benchmark-data)
18
+ - [System Architecture](#-system-architecture)
19
+ - [Advanced Graph Schema](#-advanced-graph-schema)
20
+ - [Quick Start Guide](#-quick-start-guide)
21
+ - [1. Database Setup](#1-database-setup-tigergraph)
22
+ - [2. Backend Setup](#2-backend-setup-fastapi)
23
+ - [3. Frontend Dashboard](#3-frontend-dashboard)
24
+ - [The Magic Query (GSQL)](#-the-magic-query-gsql)
25
+
26
+ ---
27
+
28
+ ## 💡 What is this?
29
+ Traditional RAG (Retrieval-Augmented Generation) struggles with complex, multi-hop financial queries because it relies on flat vector similarity.
30
+
31
+ **This project solves that.** We built a GraphRAG pipeline that ingests SEC EDGAR 10-K financial filings, extracts intricate corporate relationships (competitors, subsidiaries, risk factors) using **Gemini 2.5 Flash**, and stores them securely in **TigerGraph**.
32
+
33
+ The result? An AI that can answer complex questions like: *"What supply chain risks does Apple face, and which of their competitors are exposed to the exact same risks?"*
34
+
35
+ ---
36
+
37
+ ## 🏆 The Benchmark Data
38
+ This project processed over 105 million tokens from SEC 10-K filings to extract the entities and relationships used to construct the knowledge graph.
39
+
40
+ <details>
41
+ <summary><b>Click here to view official benchmark metrics</b></summary>
42
+ <br>
43
+
44
+ * **Dataset Source:** `winterForestStump/10-K_sec_filings` (HuggingFace)
45
+ * **Total Tokens Processed:** `105,001,658` tokens (Raw Source Data)
46
+ * **Total Documents:** `8,417` SEC 10-K Filings
47
+ * **Knowledge Graph Size:** `692 Nodes and 502 Edges` (Derived from the processed 105M-token SEC filing corpus.)
48
+ * **Tokenizer API:** Official Gemini `countTokens` endpoint via the new `google-genai` SDK.
49
+ * *(See `scripts/benchmark_report.txt` for the official verification logs).*
50
+
51
+ </details>
52
+
53
+ ---
54
+
55
+ ## 🧠 System Architecture
56
+
57
+ Our data flows through a highly optimized, asynchronous Python pipeline before being served to the end user.
58
+
59
+ ```mermaid
60
+ graph TD
61
+ A[("SEC 10-K Filings")] -->|"extract_graph.py"| B("Gemini 2.5 Flash API")
62
+ B -->|"Structured JSON Extraction"| C["vertices.csv and edges.csv"]
63
+ C -->|"schema_and_load.gsql"| D[("TigerGraph Savanna")]
64
+ D -->|"query.gsql Traversal"| E["Deep Context"]
65
+ F["Web Dashboard UI"] -->|"Query"| G["FastAPI Backend"]
66
+ G -->|"Requests Context"| D
67
+ E --> G
68
+ G -->|"Context + Query"| H{"Gemini 2.5 Flash"}
69
+ H -->|"Smart RAG Answer"| F
70
+ ```
71
+
72
  ---
73
+
74
+ ## 🕸️ Advanced Graph Schema
75
+ We designed a bespoke TigerGraph schema natively tailored for the corporate financial ecosystem.
76
+
77
+ ### **Vertices (Nodes)**
78
+ * 🏢 `Company`
79
+ * 👔 `Executive`
80
+ * ⚠️ `RiskFactor`
81
+ * 🏢 `Subsidiary`
82
+
83
+ ### **Edges (Relationships)**
84
+ * 🤝 `EMPLOYS` (Company -> Executive)
85
+ * 📉 `FACES_RISK` (Company -> RiskFactor)
86
+ * 🔗 `OWNS` (Company -> Subsidiary)
87
+ * ⚔️ `COMPETES_WITH` (Company -> Company)
88
+
89
  ---
90
 
91
+ ## Quick Start Guide
92
+
93
+ ### 1. Database Setup (TigerGraph)
94
+ 1. Open **TigerGraph GraphStudio** (Local Docker or Savanna Cloud).
95
+ 2. Run the DDL script in `schema_and_load.gsql` to initialize the vertex and edge types.
96
+ 3. Map the generated `vertices.csv` and `edges.csv` to the schema and run the load job.
97
+ 4. Install the advanced graph traversal query found in `query.gsql`.
98
+
99
+ ### 2. Backend Setup (FastAPI)
100
+ Ensure you have your environment variables set correctly:
101
+ ```bash
102
+ export TG_HOST="https://your-savanna-url.tigergraph.cloud"
103
+ export TG_USERNAME="tigergraph"
104
+ export TG_PASSWORD="your_password"
105
+ export GEMINI_API_KEY="your_api_key"
106
+ ```
107
+
108
+ Install dependencies and boot the backend server:
109
+ ```bash
110
+ pip install -r scripts/requirements.txt
111
+ python scripts/app.py
112
+ ```
113
+
114
+ ### 3. Frontend Dashboard
115
+ Navigate to `http://localhost:8000` in your browser. Type a financial query into the UI and watch the GraphRAG dynamically pull context from TigerGraph and generate a context-aware answer.
116
+
117
+ ---
118
+
119
+ ## 🧙��♂️ The Magic Query (GSQL)
120
+ The core of this project is our custom GSQL query (`query.gsql`).
121
+ Instead of a basic 1-hop lookup, it utilizes a **Multi-Hop Reverse Traversal Algorithm**. It starts at a target company, finds all of their mapped Risk Factors, and then traverses *backwards* to find every single competitor that shares those exact same risks, allowing the LLM to compare companies that share common risk factors.
122
+
123
+ ---
124
+ *Built with ❤️ for the TigerGraph Hackathon.*
app.py ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ from fastapi import FastAPI, HTTPException, Request
4
+ from fastapi.staticfiles import StaticFiles
5
+ from fastapi.responses import HTMLResponse
6
+ from fastapi.middleware.cors import CORSMiddleware
7
+ from pydantic import BaseModel
8
+ from google import genai
9
+ import uvicorn
10
+ import pyTigerGraph as tg
11
+ import chromadb
12
+ from bert_score import score as bert_score_fn
13
+ import warnings
14
+ from download_db import download_and_extract_db
15
+
16
+ warnings.filterwarnings("ignore")
17
+
18
+ # Trigger DB download if it's missing (for HF Spaces)
19
+ download_and_extract_db()
20
+
21
+ app = FastAPI(title="Financial Corporate GraphRAG")
22
+
23
+ # Add CORS middleware to allow cross-origin requests
24
+ app.add_middleware(
25
+ CORSMiddleware,
26
+ allow_origins=["*"],
27
+ allow_credentials=True,
28
+ allow_methods=["*"],
29
+ allow_headers=["*"],
30
+ )
31
+
32
+ # Mount the current directory to serve index.html and static files
33
+ app.mount("/static", StaticFiles(directory="."), name="static")
34
+
35
+ # Configuration (These should be set in environment variables tomorrow)
36
+ TG_HOST = os.environ.get("TG_HOST", "https://your-savanna-url.tigergraph.cloud")
37
+ TG_USERNAME = os.environ.get("TG_USERNAME", "tigergraph")
38
+ TG_PASSWORD = os.environ.get("TG_PASSWORD", "your_password")
39
+ TG_GRAPH = "FinancialGraph"
40
+ GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
41
+
42
+ class QueryRequest(BaseModel):
43
+ query: str
44
+ company: str = None
45
+ tg_host: str = None
46
+ tg_token: str = None
47
+ tg_graph: str = None
48
+ gemini_api_key: str = None
49
+
50
+ @app.get("/", response_class=HTMLResponse)
51
+ async def serve_ui():
52
+ with open("index.html", "r", encoding="utf-8") as f:
53
+ return f.read()
54
+
55
+ @app.post("/api/basic_rag")
56
+ async def execute_basic_rag(req: QueryRequest):
57
+ api_key = req.gemini_api_key or os.environ.get("GEMINI_API_KEY")
58
+ if not api_key:
59
+ raise HTTPException(status_code=500, detail="Gemini API Key missing")
60
+ os.environ["GEMINI_API_KEY"] = api_key
61
+
62
+ try:
63
+ db_path = os.path.join(os.path.dirname(__file__), "chroma_db")
64
+ if not os.path.exists(db_path):
65
+ raise HTTPException(status_code=500, detail="Vector DB not built yet.")
66
+
67
+ client_db = chromadb.PersistentClient(path=db_path)
68
+ collection = client_db.get_collection(name="sec_filings")
69
+ # In enterprise RAG, 15-20 chunks are typically required to cover enough semantic ground for complex queries.
70
+ results = collection.query(query_texts=[req.query], n_results=15)
71
+
72
+ chunks = results['documents'][0]
73
+ distances = results['distances'][0]
74
+ metadatas = results['metadatas'][0]
75
+
76
+ context_parts = ["[Retrieved context - top-3 chunks from vector store]"]
77
+ for i, (chunk, dist, meta) in enumerate(zip(chunks, distances, metadatas)):
78
+ sim = max(0.0, 1.0 - (dist / 2.0))
79
+ context_parts.append(f"Chunk {i+1} (similarity {sim:.2f}) [Company: {meta.get('company')}]: {chunk}")
80
+
81
+ retrieved_context = "\n\n".join(context_parts)
82
+
83
+ genai_client = genai.Client()
84
+ prompt = f"You are a helpful assistant. Use the retrieved context below to answer the question accurately. Keep your answer concise (1-2 sentences maximum) so it does not get cut off.\n\nContext:\n{retrieved_context}\n\nQuestion: {req.query}"
85
+
86
+ response = genai_client.models.generate_content(model='gemini-2.5-flash', contents=prompt)
87
+
88
+ try:
89
+ in_tokens = response.usage_metadata.prompt_token_count
90
+ out_tokens = response.usage_metadata.candidates_token_count
91
+ except:
92
+ in_tokens = out_tokens = 0
93
+
94
+ try:
95
+ _, _, F1 = bert_score_fn([response.text], [retrieved_context], lang="en", verbose=False)
96
+ bert_score_f1 = float(F1.item())
97
+ except Exception as e:
98
+ print(f"BERTScore Error: {e}")
99
+ bert_score_f1 = 0.0
100
+
101
+ return {
102
+ "answer": response.text,
103
+ "context_used": retrieved_context,
104
+ "input_tokens": in_tokens,
105
+ "output_tokens": out_tokens,
106
+ "bert_score": bert_score_f1
107
+ }
108
+
109
+ except Exception as e:
110
+ raise HTTPException(status_code=500, detail=str(e))
111
+
112
+ @app.post("/api/rag")
113
+ async def execute_graph_rag(req: QueryRequest):
114
+ api_key = req.gemini_api_key or os.environ.get("GEMINI_API_KEY")
115
+ if not api_key:
116
+ raise HTTPException(status_code=500, detail="Gemini API Key missing")
117
+ os.environ["GEMINI_API_KEY"] = api_key
118
+
119
+ try:
120
+ # Use UI provided values or fallback to env
121
+ host = req.tg_host or TG_HOST
122
+ token = req.tg_token or os.environ.get("TG_TOKEN", "")
123
+ graph = req.tg_graph or TG_GRAPH
124
+
125
+ # Step 0: Extract the true company name using an Agentic LLM call
126
+ client = genai.Client()
127
+ extracted_company = req.company
128
+ if len(req.query.split()) > 3: # If it's a sentence instead of just a name
129
+ try:
130
+ extraction_prompt = f"Extract ONLY the exact primary company name from this query. Preserve exact spelling and punctuation (e.g. if it says 'INC.', keep the period). Do not include any other words. Query: '{req.query}'"
131
+ extract_resp = client.models.generate_content(model='gemini-2.5-flash', contents=extraction_prompt)
132
+ extracted_company = extract_resp.text.strip().strip(",?\"'")
133
+ print(f"Agent extracted company name: {extracted_company}")
134
+ except Exception as e:
135
+ print(f"Extraction failed: {e}")
136
+ pass
137
+
138
+ # Step 1: Connect to TigerGraph using the Savanna API Key
139
+ conn = tg.TigerGraphConnection(host=host, graphname=graph, apiToken=token)
140
+
141
+ # Step 2: Extract Graph Context based on user query
142
+ try:
143
+ # Pass the EXACT company name to TigerGraph to perfectly traverse the edges (using 'question' param to match installed query)
144
+ graph_context_raw = conn.runInstalledQuery("get_company_context", {"question": extracted_company})
145
+ graph_context_str = json.dumps(graph_context_raw, indent=2)
146
+ except Exception as query_err:
147
+ if "not found" in str(query_err).lower() or "404" in str(query_err):
148
+ return {"answer": "Error: Your query is not installed yet! Go to GraphStudio, click the 'Up Arrow' button next to Queries to install it.", "context_used": ""}
149
+ raise query_err
150
+
151
+ # (Simulation is now disabled since the database is live)
152
+ # graph_context = f"Company: {req.company} has OWNS relationships with 3 Subsidiaries. FACES_RISK from Supply Chain Disruptions. COMPETES_WITH 5 market leaders."
153
+
154
+ # Step 3: Pass Graph Context + Query to Gemini
155
+ client = genai.Client()
156
+ prompt = f"""
157
+ You are an elite Financial AI Assistant running on top of TigerGraph.
158
+ Answer the user's query using the verified Graph Database Context below.
159
+
160
+ User Query: {req.query}
161
+
162
+ TigerGraph Context:
163
+ {graph_context_str}
164
+ """
165
+
166
+ response = client.models.generate_content(
167
+ model='gemini-2.5-flash',
168
+ contents=prompt
169
+ )
170
+
171
+ try:
172
+ in_tokens = response.usage_metadata.prompt_token_count
173
+ out_tokens = response.usage_metadata.candidates_token_count
174
+ except:
175
+ in_tokens = out_tokens = 0
176
+
177
+ try:
178
+ _, _, F1 = bert_score_fn([response.text], [graph_context_str], lang="en", verbose=False)
179
+ bert_score_f1 = float(F1.item())
180
+ except Exception as e:
181
+ print(f"BERTScore Error: {e}")
182
+ bert_score_f1 = 0.0
183
+
184
+ return {
185
+ "answer": response.text,
186
+ "context_used": graph_context_str,
187
+ "input_tokens": in_tokens,
188
+ "output_tokens": out_tokens,
189
+ "bert_score": bert_score_f1
190
+ }
191
+
192
+ except Exception as e:
193
+ raise HTTPException(status_code=500, detail=str(e))
194
+
195
+ if __name__ == "__main__":
196
+ print("Starting GraphRAG Backend on port 8000...")
197
+ port = int(os.environ.get("PORT", 8000))
198
+ uvicorn.run(app, host="0.0.0.0", port=port)
articles.csv ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ article_id,category,description
2
+ 1,Botany,A fruit is the seed-bearing structure in flowering plants formed from the ovary after flowering.
3
+ 2,Culinary,In culinary terms a fruit is the sweet and fleshy product of a tree or other plant that contains seed and can be eaten as food.
4
+ 3,Health,Eating a diet rich in fruits can reduce the risk of several leading causes of illness and death including heart disease.
5
+ 4,Agriculture,Fruit farming is the cultivation of fruit-bearing trees and plants for commercial purposes.
6
+ 5,Biology,Tomatoes are biologically considered fruits because they develop from the ovary of a flower and contain seeds.
7
+ 6,Botany,The apple is a pome fruit meaning it has a core of seeds surrounded by a tough membrane.
8
+ 7,Culinary,Vegetables are culinary terms that refer to other parts of plants like leaves stems or roots.
9
+ 8,Technology,The new smartphone features a cutting-edge processor and improved battery life.
10
+ 9,Technology,Quantum computing relies on the principles of quantum mechanics to process information.
11
+ 10,Health,Regular exercise is crucial for maintaining cardiovascular health and overall well-being.
12
+ 11,Botany,Berries are a type of simple fleshy fruit that usually has many seeds like grapes and tomatoes.
13
+ 12,Culinary,Bananas are a popular tropical fruit known for their high potassium content and natural packaging.
14
+ 13,Agriculture,The cultivation of bananas requires a tropical climate with high humidity and rainfall.
15
+ 14,History,The Silk Road was an ancient network of trade routes that connected the East and West.
16
+ 15,Biology,Photosynthesis is the process by which green plants use sunlight to synthesize nutrients from carbon dioxide and water.
17
+ 16,Botany,Citrus fruits such as oranges and lemons are rich in vitamin C and have a thick rind.
18
+ 17,Culinary,Strawberries are actually not true berries; they are aggregate fruits because they form from a flower with multiple ovaries.
19
+ 18,Health,Hydration is essential for human survival and plays a role in nearly every bodily function.
20
+ 19,Technology,Artificial intelligence is a branch of computer science aiming to create machines capable of intelligent behavior.
21
+ 20,Botany,A drupe is a type of fruit in which an outer fleshy part surrounds a single shell with a seed inside like peaches and cherries.
22
+ 21,Agriculture,Organic farming avoids the use of synthetic fertilizers and pesticides.
23
+ 22,Economics,Inflation is the rate at which the general level of prices for goods and services is rising.
24
+ 23,Biology,The human brain contains approximately 86 billion neurons forming complex networks.
25
+ 24,Botany,Legumes such as peas and beans are simple dry fruits that develop from a single carpel.
26
+ 25,Culinary,Avocados are technically single-seeded berries and are known for their high healthy fat content.
27
+ 26,Botany,Nuts in botany are a type of fruit consisting of a hard or tough nutshell protecting a kernel which is usually edible.
28
+ 27,History,The Industrial Revolution was a period of major industrialization and innovation that took place during the late 1700s and early 1800s.
29
+ 28,Health,Sleep plays a vital role in good health and well-being throughout your life.
30
+ 29,Technology,Blockchain is a decentralized distributed and public digital ledger that is used to record transactions across many computers.
31
+ 30,Culinary,Pineapples are multiple fruits consisting of coalesced berries and are native to South America.
32
+ 31,Agriculture,Irrigation is the artificial application of water to land to assist in the production of crops.
33
+ 32,Biology,DNA carries genetic instructions for the development functioning growth and reproduction of all known organisms.
34
+ 33,Botany,A pepo is a specialized type of berry with a hard rind characteristic of the gourd family such as watermelons and pumpkins.
35
+ 34,Economics,Supply and demand is an economic model of price determination in a market.
36
+ 35,Technology,Virtual reality creates a simulated environment that can be similar to or completely different from the real world.
37
+ 36,Health,Vaccines help develop immunity by imitating an infection without causing the illness.
38
+ 37,Culinary,Coconuts can be classified as a fruit a nut or a seed depending on the context.
39
+ 38,Agriculture,Crop rotation is the practice of growing a series of dissimilar or different types of crops in the same area in sequenced seasons.
40
+ 39,History,The Renaissance was a fervent period of European cultural artistic political and economic rebirth following the Middle Ages.
41
+ 40,Botany,Hesperidia are modified berries with a tough leathery rind like lemons and oranges.
42
+ 41,Biology,Enzymes are proteins that act as biological catalysts accelerating chemical reactions.
43
+ 42,Economics,Gross Domestic Product is a monetary measure of the market value of all the final goods and services produced in a specific time period.
44
+ 43,Technology,The Internet of Things describes the network of physical objects embedded with sensors and software for connecting and exchanging data.
45
+ 44,Health,Antioxidants are compounds that inhibit oxidation a chemical reaction that can produce free radicals.
46
+ 45,Culinary,Pomegranates are classified as a berry and contain hundreds of seeds surrounded by sweet juicy arils.
47
+ 46,Agriculture,Hydroponics is a type of horticulture and a subset of hydroculture which involves growing plants without soil.
48
+ 47,History,The Cold War was a period of geopolitical tension between the Soviet Union and the United States and their respective allies.
49
+ 48,Biology,Ecology is the branch of biology that deals with the relations of organisms to one another and to their physical surroundings.
50
+ 49,Botany,An accessory fruit is a fruit in which some of the flesh is derived not from the ovary but from some adjacent tissue exterior to the carpel.
51
+ 50,Culinary,Olives are small fruits that grow on olive trees and are related to peaches cherries and almonds.
benchmark_report.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ TigerGraph Hackathon Benchmark Report
2
+ -----------------------------------
3
+ Dataset: winterForestStump/10-K_sec_filings (SEC 10-K Filings)
4
+ Total Tokens: 105,001,658
5
+ Total Documents: 8417
6
+
7
+ Tokenizer Documentation:
8
+ As per the hackathon requirements, the dataset size was measured using the official Gemini API (`countTokens` endpoint) via the `google-genai` Python SDK.
9
+ The underlying tokenizer utilized by the API is the official Gemini SentencePiece tokenizer, ensuring exact alignment with the model's actual token usage for processing.
build_tigergraph.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import pyTigerGraph as tg
4
+ import pandas as pd
5
+ from dotenv import load_dotenv
6
+
7
+ # Load variables from the .env file in the parent directory
8
+ load_dotenv("../.env")
9
+
10
+ TG_HOST = os.environ.get("TG_HOST")
11
+ TG_SECRET = os.environ.get("TG_SECRET")
12
+ TG_GRAPH = os.environ.get("TG_GRAPH", "FinancialGraph")
13
+
14
+ print(f"Connecting to TigerGraph at {TG_HOST}...")
15
+
16
+ # Initialize connection (graphname="" for global schema changes)
17
+ conn = tg.TigerGraphConnection(host=TG_HOST, gsqlSecret=TG_SECRET)
18
+ token_response = conn.getToken(TG_SECRET)
19
+ token = token_response[0]
20
+ print("Authenticated successfully. Token generated.")
21
+
22
+ print("\n[1/3] Building Global Schema (this may take a minute)...")
23
+ schema_gsql = f"""
24
+ CREATE VERTEX Company (PRIMARY_ID id STRING, name STRING) WITH PRIMARY_ID_AS_ATTRIBUTE="true"
25
+ CREATE VERTEX Document (PRIMARY_ID id STRING, text_content STRING) WITH PRIMARY_ID_AS_ATTRIBUTE="true"
26
+ CREATE DIRECTED EDGE HAS_DOCUMENT (FROM Company, TO Document)
27
+
28
+ CREATE GRAPH {TG_GRAPH} (Company, Document, HAS_DOCUMENT)
29
+ """
30
+
31
+ try:
32
+ print(conn.gsql(schema_gsql))
33
+ except Exception as e:
34
+ print("Schema may already exist. Proceeding...")
35
+
36
+ # Re-connect specifically to the graph
37
+ conn.graphname = TG_GRAPH
38
+
39
+ print("\n[2/3] Preparing to load data from financial_corpus.jsonl...")
40
+ companies_data = []
41
+ docs_data = []
42
+ edges_data = []
43
+
44
+ with open("financial_corpus.jsonl", "r", encoding="utf-8") as f:
45
+ for i, line in enumerate(f):
46
+ if not line.strip(): continue
47
+ data = json.loads(line)
48
+ company = data.get("company", "Unknown").strip()
49
+ text = data.get("text", "")
50
+ doc_id = f"doc_{i}"
51
+
52
+ companies_data.append({"id": company, "name": company})
53
+ docs_data.append({"id": doc_id, "text_content": text})
54
+ edges_data.append({"source": company, "target": doc_id})
55
+
56
+ print(f"Loaded {len(docs_data)} documents from JSONL.")
57
+
58
+ # Deduplicate companies
59
+ companies_df = pd.DataFrame(companies_data).drop_duplicates(subset=["id"])
60
+ docs_df = pd.DataFrame(docs_data)
61
+ edges_df = pd.DataFrame(edges_data)
62
+
63
+ print(f"Upserting {len(companies_df)} Companies to TigerGraph...")
64
+ for i in range(0, len(companies_df), 1000):
65
+ conn.upsertVertexDataFrame(companies_df.iloc[i:i+1000], vertexType="Company", v_id="id")
66
+
67
+ print(f"Upserting {len(docs_df)} Documents to TigerGraph... (This might take a few minutes)")
68
+ for i in range(0, len(docs_df), 500): # Smaller chunks for documents because of large text
69
+ conn.upsertVertexDataFrame(docs_df.iloc[i:i+500], vertexType="Document", v_id="id")
70
+
71
+ print(f"Upserting {len(edges_df)} Relationships (Edges) to TigerGraph...")
72
+ edges_list = [(row["source"], row["target"]) for _, row in edges_df.iterrows()]
73
+ for i in range(0, len(edges_list), 1000):
74
+ chunk = edges_list[i:i+1000]
75
+ conn.upsertEdges(sourceVertexType="Company", edgeType="HAS_DOCUMENT", targetVertexType="Document", edges=chunk)
76
+
77
+ print("Data loaded successfully!")
78
+
79
+ print("\n[3/3] Installing GSQL Query 'get_company_context'...")
80
+ query_gsql = f"""
81
+ USE GRAPH {TG_GRAPH}
82
+ CREATE OR REPLACE QUERY get_company_context(STRING question) FOR GRAPH {TG_GRAPH} {{
83
+ SetAccum<STRING> @@context;
84
+
85
+ # Very simple keyword search across companies
86
+ Seed = {{Company.*}};
87
+
88
+ TargetCompanies = SELECT s FROM Seed:s
89
+ WHERE question LIKE ("%" + s.name + "%");
90
+
91
+ Docs = SELECT d FROM TargetCompanies:s -(HAS_DOCUMENT:e)- Document:d
92
+ ACCUM @@context += d.text_content;
93
+
94
+ PRINT @@context as results;
95
+ }}
96
+ INSTALL QUERY get_company_context
97
+ """
98
+ print("Running GSQL Query installation (this usually takes 2-3 minutes)...")
99
+ try:
100
+ print(conn.gsql(query_gsql))
101
+ except Exception as e:
102
+ print(f"Query installation error: {e}")
103
+
104
+ print("\n" + "="*50)
105
+ print("ALL DONE! TigerGraph is now fully operational.")
106
+ print("="*50)
107
+ print("IMPORTANT: Copy this Bearer Token to use in your Dashboard:")
108
+ print(f"{token}")
109
+ print("="*50)
build_vector_db.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import chromadb
4
+ from tqdm import tqdm
5
+
6
+ DB_DIR = "./chroma_db"
7
+ CORPUS_FILE = "financial_corpus.jsonl"
8
+ LIMIT = int(os.environ.get("EMBED_LIMIT", "1000")) # Configurable limit for local dev vs production
9
+
10
+ def build_vector_db():
11
+ print("Initializing ChromaDB (this may download the embedding model if first run)...")
12
+ client = chromadb.PersistentClient(path=DB_DIR)
13
+ collection = client.get_or_create_collection(name="sec_filings")
14
+
15
+ print(f"Loading up to {LIMIT} documents from {CORPUS_FILE}...")
16
+ documents = []
17
+ metadatas = []
18
+ ids = []
19
+
20
+ count = 0
21
+ with open(CORPUS_FILE, 'r', encoding='utf-8') as f:
22
+ for line in f:
23
+ try:
24
+ data = json.loads(line)
25
+ # Filter out very short or empty chunks
26
+ text = data.get('text', '').strip()
27
+ if len(text) < 50:
28
+ continue
29
+
30
+ documents.append(text)
31
+ metadatas.append({
32
+ "company": data.get('company', 'Unknown'),
33
+ "year": data.get("year", "Unknown")
34
+ })
35
+ ids.append(f"doc_{count}")
36
+ count += 1
37
+
38
+ if LIMIT > 0 and count >= LIMIT:
39
+ break
40
+ except Exception as e:
41
+ print(f"Error parsing line: {e}")
42
+ continue
43
+
44
+ print(f"Adding {count} documents to Vector Store (this will automatically generate embeddings)...")
45
+ batch_size = 100
46
+ for i in tqdm(range(0, len(documents), batch_size)):
47
+ collection.add(
48
+ documents=documents[i:i+batch_size],
49
+ metadatas=metadatas[i:i+batch_size],
50
+ ids=ids[i:i+batch_size]
51
+ )
52
+
53
+ print("\n✅ Vector database built successfully! Ready for Basic RAG.")
54
+
55
+ if __name__ == "__main__":
56
+ if not os.path.exists(CORPUS_FILE):
57
+ print(f"Error: {CORPUS_FILE} not found. Please ensure it's in the same directory.")
58
+ else:
59
+ build_vector_db()
count_tokens.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import time
4
+ from datasets import load_dataset
5
+ from google import genai
6
+
7
+ def main():
8
+ if "GEMINI_API_KEY" not in os.environ:
9
+ print("ERROR: GEMINI_API_KEY environment variable not set.")
10
+ print("Please set it before running this script.")
11
+ return
12
+
13
+ client = genai.Client()
14
+
15
+ TARGET_TOKENS = 105_000_000
16
+ current_tokens = 0
17
+ document_count = 0
18
+
19
+ output_file = "financial_corpus.jsonl"
20
+
21
+ print(f"Starting token counting using Gemini 'countTokens' API...")
22
+ print(f"Targeting {TARGET_TOKENS:,} tokens.")
23
+
24
+ # Resume Logic
25
+ if os.path.exists(output_file):
26
+ print(f"Found existing {output_file}. Resuming...")
27
+ with open(output_file, 'r', encoding='utf-8') as f:
28
+ for line in f:
29
+ if not line.strip(): continue
30
+ data = json.loads(line)
31
+ current_tokens += data.get("tokens", 0)
32
+ document_count += 1
33
+ print(f"Resumed from {document_count} documents with {current_tokens:,} tokens.")
34
+
35
+ if current_tokens >= TARGET_TOKENS:
36
+ print("Target already reached!")
37
+ return
38
+
39
+ start_time = time.time()
40
+ splits = ['001', '002', '003', '004', '005']
41
+
42
+ docs_to_skip = document_count
43
+
44
+ with open(output_file, 'a', encoding='utf-8') as f:
45
+ for split_id in splits:
46
+ if current_tokens >= TARGET_TOKENS:
47
+ break
48
+
49
+ print(f"Loading split {split_id}...")
50
+ try:
51
+ dataset = load_dataset('winterForestStump/10-K_sec_filings', split=split_id, streaming=True)
52
+ except Exception as e:
53
+ print(f"Error loading dataset split {split_id}: {e}")
54
+ continue
55
+
56
+ for row in dataset:
57
+ # Fast forward
58
+ if docs_to_skip > 0:
59
+ docs_to_skip -= 1
60
+ continue
61
+
62
+ if current_tokens >= TARGET_TOKENS:
63
+ break
64
+
65
+ company = row.get("company_name", "Unknown Company")
66
+ year = str(row.get("filing_date", "Unknown Year"))[:4] if row.get("filing_date") else "Unknown Year"
67
+
68
+ text_sections = []
69
+ if row.get("Business"): text_sections.append(str(row["Business"]))
70
+ if row.get("Risk Factors"): text_sections.append(str(row["Risk Factors"]))
71
+
72
+ for k, v in row.items():
73
+ if "Management" in k and "Discussion" in k and v:
74
+ text_sections.append(str(v))
75
+
76
+ combined_text = "\n\n".join(text_sections).strip()
77
+
78
+ if not combined_text:
79
+ continue
80
+
81
+ try:
82
+ response = client.models.count_tokens(
83
+ model='gemini-2.5-flash',
84
+ contents=combined_text
85
+ )
86
+ tokens = response.total_tokens
87
+
88
+ corpus_item = {
89
+ "company": company,
90
+ "year": year,
91
+ "text": combined_text,
92
+ "tokens": tokens
93
+ }
94
+ f.write(json.dumps(corpus_item) + "\n")
95
+ f.flush()
96
+
97
+ current_tokens += tokens
98
+ document_count += 1
99
+
100
+ if document_count % 10 == 0:
101
+ print(f"Processed {document_count} documents. Total Tokens: {current_tokens:,}")
102
+
103
+ except Exception as e:
104
+ print(f"API Error counting tokens for {company}: {e}")
105
+ time.sleep(1) # Backoff
106
+
107
+ elapsed = time.time() - start_time
108
+
109
+ print("\n--- TOKEN COUNTING COMPLETE ---")
110
+ print(f"Total Tokens: {current_tokens:,}")
111
+ print(f"Total Documents: {document_count}")
112
+ print(f"Time Taken for this run: {elapsed:.2f} seconds")
113
+ print(f"Corpus saved to: {output_file}")
114
+
115
+ report = f"""TigerGraph Hackathon Benchmark Report
116
+ -----------------------------------
117
+ Dataset: winterForestStump/10-K_sec_filings (SEC 10-K Filings)
118
+ Total Tokens: {current_tokens:,}
119
+ Total Documents: {document_count}
120
+
121
+ Tokenizer Documentation:
122
+ As per the hackathon requirements, the dataset size was measured using the official Gemini API (`countTokens` endpoint) via the `google-genai` Python SDK.
123
+ The underlying tokenizer utilized by the API is the official Gemini SentencePiece tokenizer, ensuring exact alignment with the model's actual token usage for processing.
124
+ """
125
+ with open("benchmark_report.txt", "w") as f:
126
+ f.write(report)
127
+
128
+ print("benchmark_report.txt generated successfully!")
129
+
130
+ if __name__ == "__main__":
131
+ main()
download_db.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import zipfile
3
+ import urllib.request
4
+
5
+ DB_DIR = os.path.join(os.path.dirname(__file__), "chroma_db")
6
+ # You must set DB_ZIP_URL as an environment variable in Hugging Face!
7
+ ZIP_URL = os.environ.get("DB_ZIP_URL", "")
8
+
9
+ def download_and_extract_db():
10
+ if os.path.exists(DB_DIR):
11
+ print("ChromaDB already exists locally. Skipping download.")
12
+ return
13
+
14
+ if not ZIP_URL:
15
+ print("Warning: DB_ZIP_URL is not set. Cannot download Vector DB.")
16
+ return
17
+
18
+ print(f"Downloading ChromaDB ZIP from {ZIP_URL}...")
19
+ zip_path = "chroma_db.zip"
20
+
21
+ try:
22
+ urllib.request.urlretrieve(ZIP_URL, zip_path)
23
+ print("Download complete. Extracting...")
24
+ with zipfile.ZipFile(zip_path, 'r') as zip_ref:
25
+ zip_ref.extractall(os.path.dirname(__file__) or ".")
26
+ print("Extraction complete. ChromaDB is ready.")
27
+ os.remove(zip_path)
28
+ except Exception as e:
29
+ print(f"Failed to download or extract DB: {e}")
30
+
31
+ if __name__ == "__main__":
32
+ download_and_extract_db()
edges.csv ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ source,target,e_type
2
+ TROPICAL SPORTSWEAR INTERNATIONAL CORP.,Savane International Corp.,OWNS
3
+ DATAWATCH CORP,interest rate risk,FACES_RISK
4
+ DATAWATCH CORP,foreign currency exchange rate risk,FACES_RISK
5
+ DATAWATCH CORP,DATAWATCH CORP International Subsidiaries,OWNS
6
+ GALEY & LORD INC.,"Galey & Lord Industries, Inc.",OWNS
7
+ "Galey & Lord Industries, Inc.","G&L Service Company, North America, Inc.",OWNS
8
+ "G&L Service Company, North America, Inc.","Dimmit Industries, S.A. de C.V.",OWNS
9
+ GALEY & LORD INC.,Swift Denim Group,OWNS
10
+ GALEY & LORD INC.,Klopman International Group,OWNS
11
+ GALEY & LORD INC.,"Swift Textiles Europe, Ltd.",OWNS
12
+ "Polymer Group, Inc.","DT Acquisition, Inc.",OWNS
13
+ GALEY & LORD INC.,"competitive and economic factors in the textile, apparel and home furnishings markets",FACES_RISK
14
+ GALEY & LORD INC.,raw materials and other costs,FACES_RISK
15
+ GALEY & LORD INC.,weather-related delays,FACES_RISK
16
+ GALEY & LORD INC.,general economic conditions,FACES_RISK
17
+ MEDIQ Incorporated,"MEDIQ/PRN Life Support Services, Inc.",OWNS
18
+ MEDIQ Incorporated,SpectraCair,OWNS
19
+ MEDIQ Incorporated,"CH Industries, Inc.",OWNS
20
+ MEDIQ Incorporated,"National Patient Care Systems, Inc.",OWNS
21
+ "CH Industries, Inc.","CH Medical, Inc.",OWNS
22
+ "Bruckmann, Rosser, Sherrill & Co., L.P.",MEDIQ Incorporated,OWNS
23
+ "Ferrer Freeman Thompson & Co., LLC",MEDIQ Incorporated,OWNS
24
+ "Galen Partners, III L.P.",MEDIQ Incorporated,OWNS
25
+ Rotko Entities,MEDIQ Incorporated,OWNS
26
+ MEDIQ Incorporated,InnoServ Technologies,OWNS
27
+ MEDIQ Incorporated,Cost Containment Pressures,FACES_RISK
28
+ IEC Electronics Corp.,"Calidad Electronics, Inc.",OWNS
29
+ IEC Electronics Corp.,"IEC - Edinburg Texas, Inc.",OWNS
30
+ IEC Electronics Corp.,"Accutek, Inc.",OWNS
31
+ IEC Electronics Corp.,IEC Arab Alabama Inc.,OWNS
32
+ IEC Electronics Corp.,IEC Electronics - Ireland Limited,OWNS
33
+ MEDIQ Incorporated,"MEDIQ/PRN Life Support Services, Inc.",OWNS
34
+ "MEDIQ/PRN Life Support Services, Inc.","MEDIQ Management Services, Inc.",OWNS
35
+ "MEDIQ/PRN Life Support Services, Inc.",SpectraCair,OWNS
36
+ "MEDIQ/PRN Life Support Services, Inc.","CH Medical, Inc.",OWNS
37
+ "MEDIQ/PRN Life Support Services, Inc.",Increasing pressure to reduce operating costs and capital expenditures,FACES_RISK
38
+ "MEDIQ/PRN Life Support Services, Inc.",Cost containment pressures on health care providers,FACES_RISK
39
+ "MEDIQ/PRN Life Support Services, Inc.",Reduced reimbursement levels by Medicare and other third-party payors,FACES_RISK
40
+ "MEDIQ/PRN Life Support Services, Inc.",Legislative proposals leading to health care consolidations and managed care acceleration,FACES_RISK
41
+ INTERSTATE JOHNSON LANE INC.,CapTrust,OWNS
42
+ INTERSTATE JOHNSON LANE INC.,Highly Competitive Environment,FACES_RISK
43
+ INTERSTATE JOHNSON LANE INC.,Marketplace Trading Volumes Volatility,FACES_RISK
44
+ INTERSTATE JOHNSON LANE INC.,Interest Rate Conditions Volatility,FACES_RISK
45
+ INTERSTATE JOHNSON LANE INC.,Revenue and Earnings Variability,FACES_RISK
46
+ INTERSTATE JOHNSON LANE INC.,Significant Incremental Cash Requirements,FACES_RISK
47
+ INTERSTATE JOHNSON LANE INC.,"Regulatory Liquidity and Capital Requirements (SEC, CFTC, NYSE)",FACES_RISK
48
+ CapTrust,"Regulatory Liquidity and Capital Requirements (SEC, NASD)",FACES_RISK
49
+ INTERSTATE JOHNSON LANE INC.,Year 2000 Technological Challenge,FACES_RISK
50
+ INTERSTATE JOHNSON LANE INC.,Dependence on Third-Party Systems for Year 2000 Compliance,FACES_RISK
51
+ INTERSTATE JOHNSON LANE INC.,Inflationary Effects,FACES_RISK
52
+ "Flanigan's Enterprises, Inc.","Flanigan's Management Services, Inc.",OWNS
53
+ "Flanigan's Enterprises, Inc.","Flanigan's Enterprises, Inc. of Georgia",OWNS
54
+ "Flanigan's Enterprises, Inc.",Seventh Street Corp.,OWNS
55
+ "Flanigan's Enterprises, Inc.",Big Daddy's #48 Inc.,OWNS
56
+ "Flanigan's Enterprises, Inc.","Flanigan's Enterprises, Inc. of Pa.",OWNS
57
+ "Flanigan's Enterprises, Inc.",Bankruptcy,FACES_RISK
58
+ Subchapter S corporation (franchisee),Chairman of the Board,EMPLOYS
59
+ TCI INTERNATIONAL INC.,Broadcast and Communications Division,OWNS
60
+ TCI INTERNATIONAL INC.,Signal Processing Division,OWNS
61
+ TCI INTERNATIONAL INC.,Test and Measurement Division,OWNS
62
+ TCI INTERNATIONAL INC.,Potential Loss from Operations in Fiscal 1999,FACES_RISK
63
+ TCI INTERNATIONAL INC.,Contract Termination Risk,FACES_RISK
64
+ TCI INTERNATIONAL INC.,Reduced US Government Demand (Post-Cold War),FACES_RISK
65
+ TCI INTERNATIONAL INC.,"Declining Economies in Asia, Africa, Middle East",FACES_RISK
66
+ TCI INTERNATIONAL INC.,Strong US Dollar Impacting Competitiveness,FACES_RISK
67
+ TCI INTERNATIONAL INC.,Delay/Loss of Key Program Awards,FACES_RISK
68
+ TCI INTERNATIONAL INC.,Delays in System Acceptance due to Customer Turnover,FACES_RISK
69
+ TCI INTERNATIONAL INC.,Foreign Competitors,COMPETES_WITH
70
+ Spartech Corporation,Spartech Plastics,OWNS
71
+ Spartech Corporation,Spartech Polycom,OWNS
72
+ Spartech Corporation,Spartech Color,OWNS
73
+ Spartech Corporation,Spartech Vy-Cal Plastics,OWNS
74
+ Spartech Corporation,GenPak,OWNS
75
+ Spartech Corporation,Hamelin Industries,OWNS
76
+ Spartech Corporation,Spartech Profiles,OWNS
77
+ Spartech Corporation,Product Components,OWNS
78
+ Spartech Corporation,Pawnee Industries,OWNS
79
+ Spartech Corporation,Portage Industries,OWNS
80
+ Spartech Corporation,Hamelin Group,OWNS
81
+ Spartech Corporation,Preferred Plastic Sheet Division of Echlin Inc.,OWNS
82
+ Echlin Inc.,Preferred Plastic Sheet Division of Echlin Inc.,OWNS
83
+ Spartech Corporation,"Polycom Huntsman, Inc.",OWNS
84
+ Spartech Corporation,"Prismaplast Canada, Ltd.",OWNS
85
+ Spartech Corporation,"Anjac-Doron Plastics, Inc.",OWNS
86
+ "CMG Information Services, Inc.",ADSmart Corporation,OWNS
87
+ "CMG Information Services, Inc.","Engage Technologies, Inc.",OWNS
88
+ "CMG Information Services, Inc.","Accipiter, Inc.",OWNS
89
+ "CMG Information Services, Inc.",InfoMation Publishing Corporation,OWNS
90
+ "CMG Information Services, Inc.",NaviSite Internet Services Corporation,OWNS
91
+ "CMG Information Services, Inc.",Planet Direct Corporation,OWNS
92
+ "CMG Information Services, Inc.",Password Internet Publishing Corporation,OWNS
93
+ "CMG Information Services, Inc.","Magnitude Network, LLC",OWNS
94
+ "CMG Information Services, Inc.","Open Market, Inc.",OWNS
95
+ "CMG Information Services, Inc.",NaviNet,OWNS
96
+ "CMG Information Services, Inc.","CMG@Ventures I, LLC",OWNS
97
+ "CMG@Ventures I, LLC","Blaxxun Interactive, Inc.",OWNS
98
+ "CMG@Ventures I, LLC",GeoCities,OWNS
99
+ "CMG@Ventures I, LLC","Lycos, Inc.",OWNS
100
+ "CMG@Ventures I, LLC",Parable LLC,OWNS
101
+ "CMG@Ventures I, LLC",Vicinity Corporation,OWNS
102
+ "CMG Information Services, Inc.","CMG@Ventures II, LLC",OWNS
103
+ "CMG@Ventures II, LLC",Chemdex Corporation,OWNS
104
+ "CMG@Ventures II, LLC",Critical Path,OWNS
105
+ "CMG@Ventures II, LLC",GeoCities,OWNS
106
+ "CMG@Ventures II, LLC","KOZ, Inc.",OWNS
107
+ "CMG@Ventures II, LLC","Mother Nature's General Store, Inc.",OWNS
108
+ "CMG@Ventures II, LLC",Parable LLC,OWNS
109
+ "CMG@Ventures II, LLC","Reel.com, Inc.",OWNS
110
+ "CMG@Ventures II, LLC","Sage Enterprises, Inc.",OWNS
111
+ "CMG@Ventures II, LLC","Silknet Software, Inc.",OWNS
112
+ "CMG@Ventures II, LLC","Softway Systems, Inc.",OWNS
113
+ "CMG@Ventures II, LLC",Speech Machines plc,OWNS
114
+ "CMG@Ventures II, LLC",TicketsLive Corporation,OWNS
115
+ "CMG@Ventures II, LLC",Universal Learning Technology,OWNS
116
+ "CMG@Ventures II, LLC",Visto Corporation,OWNS
117
+ "CMG Information Services, Inc.","CMG@Ventures III, LLC",OWNS
118
+ "CMG Information Services, Inc.",SalesLink Corporation,OWNS
119
+ "CMG Information Services, Inc.",InSolutions Incorporated,OWNS
120
+ "CMG Information Services, Inc.","On-Demand Solutions, Inc.",OWNS
121
+ SalesLink Corporation,Pacific Direct Marketing Corporation,OWNS
122
+ "CMG Information Services, Inc.",CMG Direct Corporation,OWNS
123
+ Planet Direct Corporation,InfoMation Publishing Corporation,OWNS
124
+ "Amazon.com, Inc.","Sage Enterprises, Inc.",OWNS
125
+ Hollywood Entertainment Corporation,"Reel.com, Inc.",OWNS
126
+ Salex Holding Corporation,Pershing Sun,EMPLOYS
127
+ "Sun Associates, LLC",Betty Sun,EMPLOYS
128
+ Salex Holding Corporation,competition in the automobile asset management business,FACES_RISK
129
+ Salex Holding Corporation,inability to obtain additional financing,FACES_RISK
130
+ Salex Holding Corporation,general business and economic conditions,FACES_RISK
131
+ Salex Holding Corporation,PH&H Corp.,COMPETES_WITH
132
+ Salex Holding Corporation,GE Capital,COMPETES_WITH
133
+ Franklin Receivables LLC,Franklin Auto Trust 1998-1,OWNS
134
+ IEC Electronics Corp.,"Calidad Electronics, Inc.",OWNS
135
+ IEC Electronics Corp.,"IEC - Edinburg Texas, Inc.",OWNS
136
+ IEC Electronics Corp.,"Accutek, Inc.",OWNS
137
+ IEC Electronics Corp.,IEC Arab Alabama Inc.,OWNS
138
+ IEC Electronics Corp.,IEC Electronics - Ireland Limited,OWNS
139
+ "RICA FOODS, INC.",Pipasa,OWNS
140
+ "RICA FOODS, INC.",As de Oros,OWNS
141
+ "RICA FOODS, INC.",Mr. Calixto Chaves,EMPLOYS
142
+ "Inversiones La Ribera, S.A.",Pipasa,OWNS
143
+ "Comercial Angui, S.A.",As de Oros,OWNS
144
+ Antonio Echeverria,"Comercial Angui, S.A.",OWNS
145
+ As de Oros,Restaurantes As de Oros,OWNS
146
+ "RICA FOODS, INC.",Exchange Rate Risk,FACES_RISK
147
+ "RICA FOODS, INC.",Foreign Competition,FACES_RISK
148
+ "RICA FOODS, INC.",Commodity Price Volatility,FACES_RISK
149
+ Pipasa,As de Oros,COMPETES_WITH
150
+ GLOBAL ENVIRONMENTAL CORP.,Danzer,OWNS
151
+ GLOBAL ENVIRONMENTAL CORP.,Weakened Financial Condition,FACES_RISK
152
+ GLOBAL ENVIRONMENTAL CORP.,Tighter Credit Terms,FACES_RISK
153
+ GLOBAL ENVIRONMENTAL CORP.,Need for Capital Infusion,FACES_RISK
154
+ GLOBAL ENVIRONMENTAL CORP.,Dependency on Future Success,FACES_RISK
155
+ GLOBAL ENVIRONMENTAL CORP.,Year 2000 Problem,FACES_RISK
156
+ GLOBAL ENVIRONMENTAL CORP.,Major Service Provider System Failure,FACES_RISK
157
+ MATLACK SYSTEMS INC.,Competitive Labor Environment,FACES_RISK
158
+ MATLACK SYSTEMS INC.,Increased Environmental Compliance Costs,FACES_RISK
159
+ MATLACK SYSTEMS INC.,Legal Action Settlement,FACES_RISK
160
+ MATLACK SYSTEMS INC.,Potential Change in Ownership,FACES_RISK
161
+ MATLACK SYSTEMS INC.,High Debt Levels,FACES_RISK
162
+ MATLACK SYSTEMS INC.,Declining Demand for Transport,FACES_RISK
163
+ MATLACK SYSTEMS INC.,General Economic Conditions,FACES_RISK
164
+ MATLACK SYSTEMS INC.,Competitive Pressures,FACES_RISK
165
+ MATLACK SYSTEMS INC.,Market Demand Shifts,FACES_RISK
166
+ MATLACK SYSTEMS INC.,Industry Performance and Needs,FACES_RISK
167
+ MATLACK SYSTEMS INC.,Equipment Utilization Challenges,FACES_RISK
168
+ MATLACK SYSTEMS INC.,New Service Development Risk,FACES_RISK
169
+ MATLACK SYSTEMS INC.,Increased Labor Costs,FACES_RISK
170
+ MATLACK SYSTEMS INC.,Increased Operating Costs,FACES_RISK
171
+ MATLACK SYSTEMS INC.,Litigation Uncertainties,FACES_RISK
172
+ MATLACK SYSTEMS INC.,Financing Risk,FACES_RISK
173
+ MATLACK SYSTEMS INC.,Insurance Availability Risk,FACES_RISK
174
+ MATLACK SYSTEMS INC.,Project Completion Risk,FACES_RISK
175
+ MATLACK SYSTEMS INC.,Management Retention Risk,FACES_RISK
176
+ MATLACK SYSTEMS INC.,Regulatory Changes,FACES_RISK
177
+ MATLACK SYSTEMS INC.,Y2K Compliance Risk,FACES_RISK
178
+ MATLACK SYSTEMS INC.,Satellite System Failure,FACES_RISK
179
+ MATLACK SYSTEMS INC.,Business Partner Y2K Compliance Risk,FACES_RISK
180
+ ING Groep N.V.,"PFHI Holdings, Inc.",OWNS
181
+ ING Groep N.V.,"Equitable of Iowa Companies, Inc.",OWNS
182
+ "Equitable of Iowa Companies, Inc.",Equitable Life Insurance Company of Iowa,OWNS
183
+ "Equitable of Iowa Companies, Inc.",Golden American,OWNS
184
+ "Equitable of Iowa Companies, Inc.","Locust Street Securities, Inc.",OWNS
185
+ "Equitable of Iowa Companies, Inc.","Equitable Investment Services, Inc.",OWNS
186
+ "Equitable of Iowa Companies, Inc.","Directed Services, Inc.",OWNS
187
+ "Equitable of Iowa Companies, Inc.",Equitable of Iowa Companies Capital Trust,OWNS
188
+ "Equitable of Iowa Companies, Inc.",Equitable of Iowa Companies Capital Trust II,OWNS
189
+ "Equitable of Iowa Companies, Inc.","Equitable of Iowa Securities Network, Inc.",OWNS
190
+ Golden American,First Golden American Life Insurance Co of New York,OWNS
191
+ First Golden American Life Insurance Co of New York,Discontinuation of sales relationship by significant distributor,FACES_RISK
192
+ First Golden American Life Insurance Co of New York,Changes in acquisition cost allocation,FACES_RISK
193
+ First Golden American Life Insurance Co of New York,Impairment of goodwill,FACES_RISK
194
+ First Golden American Life Insurance Co of New York,Variability in amortization based on allocation and assumptions,FACES_RISK
195
+ First Golden American Life Insurance Co of New York,Risk of loss from below investment grade securities,FACES_RISK
196
+ First Golden American Life Insurance Co of New York,Sensitivity of below investment grade securities to adverse economic conditions,FACES_RISK
197
+ First Golden American Life Insurance Co of New York,Future write-downs of securities,FACES_RISK
198
+ First Golden American Life Insurance Co of New York,Material adverse effect on net income from significant write-downs,FACES_RISK
199
+ IEC Electronics Corp.,"IEC - Edinburg Texas, Inc.",OWNS
200
+ IEC Electronics Corp.,IEC Arab Alabama Inc.,OWNS
201
+ IEC Electronics Corp.,IEC Electronics - Ireland Limited,OWNS
202
+ RESOURCE AMERICA INC.,Resource Asset Investment Trust,OWNS
203
+ RESOURCE AMERICA INC.,"The Atlas Group, Inc.",OWNS
204
+ "Hynes & Howes Insurance Counselors, Inc.",Highly Competitive Market,FACES_RISK
205
+ "Hynes & Howes Insurance Counselors, Inc.",Davenport Agency,OWNS
206
+ Ralph Parry Insurance Agency Ltd.,Davenport Agency,OWNS
207
+ "R.A.P. Enterprises, Inc.",Viking Agency,OWNS
208
+ "R.A.P. Enterprises, Inc.","Hansen and Hansen, Inc.",OWNS
209
+ "Hynes & Howes Insurance Counselors, Inc.",Ralph A. Parry,EMPLOYS
210
+ Davenport Agency,Ralph A. Parry,EMPLOYS
211
+ "R.A.P. Enterprises, Inc.",Ralph A. Parry,EMPLOYS
212
+ Ralph A. Parry,"R.A.P. Enterprises, Inc.",OWNS
213
+ Ralph A. Parry,Ralph Parry Insurance Agency Ltd.,OWNS
214
+ "Hynes & Howes Insurance Counselors, Inc.",Low Liquidity,FACES_RISK
215
+ "Hynes & Howes Insurance Counselors, Inc.",Decreased Operating Income,FACES_RISK
216
+ VSI HOLDINGS INC.,The Performance Systems Group,OWNS
217
+ VSI HOLDINGS INC.,"Advanced Animations, Inc.",OWNS
218
+ VSI HOLDINGS INC.,"BKNT Retail Stores, Inc.",OWNS
219
+ VSI HOLDINGS INC.,"Vispac, Inc.",OWNS
220
+ VSI HOLDINGS INC.,"Visual Services, Inc.",OWNS
221
+ VSI HOLDINGS INC.,"Steve Toth, Jr.",EMPLOYS
222
+ VSI HOLDINGS INC.,Difficulty in recruiting qualified employees,FACES_RISK
223
+ VSI HOLDINGS INC.,Loss of major customers,FACES_RISK
224
+ VSI HOLDINGS INC.,Uncertainty of continued customer relationships,FACES_RISK
225
+ Irvine Sensors Corporation,"Novalog, Inc.",OWNS
226
+ Irvine Sensors Corporation,"MicroSensors, Inc.",OWNS
227
+ Irvine Sensors Corporation,"Imagek, Inc.",OWNS
228
+ "Imagek, Inc.",Uncertainty of Imagek financing,FACES_RISK
229
+ Irvine Sensors Corporation,Uncertainty of widespread market success for stacked memory products,FACES_RISK
230
+ Irvine Sensors Corporation,Cost disadvantage due to unestablished high volume production costs,FACES_RISK
231
+ Irvine Sensors Corporation,Uncertainty of neural network chip set development success,FACES_RISK
232
+ Irvine Sensors Corporation,Uncertainty of NeoStack commercialization timeline,FACES_RISK
233
+ "General DataComm Industries, Inc.",VITAL Network Services LLC,OWNS
234
+ RADIATION DISPOSAL SYSTEMS INC.,Manuel E. Kane,EMPLOYS
235
+ RADIATION DISPOSAL SYSTEMS INC.,Albert D. Kane,EMPLOYS
236
+ RADIATION DISPOSAL SYSTEMS INC.,Steven Kane,EMPLOYS
237
+ "Steven M. Kane, Inc.",Steven Kane,EMPLOYS
238
+ RADIATION DISPOSAL SYSTEMS INC.,Inability to Market Products,FACES_RISK
239
+ RADIATION DISPOSAL SYSTEMS INC.,Lack of Significant Revenues,FACES_RISK
240
+ RADIATION DISPOSAL SYSTEMS INC.,Cessation of Operations,FACES_RISK
241
+ RADIATION DISPOSAL SYSTEMS INC.,Lack of Working Capital and Revenue Prospects,FACES_RISK
242
+ RADIATION DISPOSAL SYSTEMS INC.,Uncertainty of Future Operations,FACES_RISK
243
+ RADIATION DISPOSAL SYSTEMS INC.,Limited Market Acceptance of Ozone Technology,FACES_RISK
244
+ RADIATION DISPOSAL SYSTEMS INC.,Undeveloped Market for Waste Treatment Technology,FACES_RISK
245
+ RADIATION DISPOSAL SYSTEMS INC.,Competition from Established Firms,FACES_RISK
246
+ RADIATION DISPOSAL SYSTEMS INC.,Negligible Market Position,FACES_RISK
247
+ RADIATION DISPOSAL SYSTEMS INC.,Ineffective Sales Agreements,FACES_RISK
248
+ RADIATION DISPOSAL SYSTEMS INC.,Inactive Marketing Efforts,FACES_RISK
249
+ RADIATION DISPOSAL SYSTEMS INC.,Insufficient Production Personnel,FACES_RISK
250
+ RADIATION DISPOSAL SYSTEMS INC.,Supplier Dependence and Production Delays,FACES_RISK
251
+ RADIATION DISPOSAL SYSTEMS INC.,Single Source Supplier Dependence (Pillar),FACES_RISK
252
+ RADIATION DISPOSAL SYSTEMS INC.,Lapse of Patents due to Insufficient Funds,FACES_RISK
253
+ RADIATION DISPOSAL SYSTEMS INC.,Burdensome Environmental Regulations,FACES_RISK
254
+ RADIATION DISPOSAL SYSTEMS INC.,High Cost of Radioactive Waste Disposal,FACES_RISK
255
+ RADIATION DISPOSAL SYSTEMS INC.,Uneconomical Process,FACES_RISK
256
+ RADIATION DISPOSAL SYSTEMS INC.,Costly Regulatory Modifications and Insufficient Funds,FACES_RISK
257
+ RADIATION DISPOSAL SYSTEMS INC.,Future Adverse Government Regulations,FACES_RISK
258
+ RADIATION DISPOSAL SYSTEMS INC.,Ultrox International,COMPETES_WITH
259
+ RADIATION DISPOSAL SYSTEMS INC.,Para Oxidation,COMPETES_WITH
260
+ RADIATION DISPOSAL SYSTEMS INC.,PCI Ozone Corporation,COMPETES_WITH
261
+ RADIATION DISPOSAL SYSTEMS INC.,"Griffin Technics, Inc.",COMPETES_WITH
262
+ RADIATION DISPOSAL SYSTEMS INC.,Henkel Corporation,COMPETES_WITH
263
+ RADIATION DISPOSAL SYSTEMS INC.,"Brown-Bovari, Inc.",COMPETES_WITH
264
+ "Stein Management Company, Inc.",Randy Rieger,EMPLOYS
265
+ RTL Realty,Randy Rieger,EMPLOYS
266
+ "Royal Palm Beach Colony, Limited Partnership",Uncertainty of future cash distribution,FACES_RISK
267
+ "Royal Palm Beach Colony, Limited Partnership",Reduction in sales revenues,FACES_RISK
268
+ "Royal Palm Beach Colony, Limited Partnership",Cash requirements for land development,FACES_RISK
269
+ "Royal Palm Beach Colony, Limited Partnership",Cash expenditures for transactions and operations,FACES_RISK
270
+ "Royal Palm Beach Colony, Limited Partnership",Bank financing repayment obligations,FACES_RISK
271
+ "Royal Palm Beach Colony, Limited Partnership",Increased cost due to regulatory changes,FACES_RISK
272
+ "Royal Palm Beach Colony, Limited Partnership",Highly competitive real estate market,FACES_RISK
273
+ "Royal Palm Beach Colony, Limited Partnership",Competition affecting property sales,FACES_RISK
274
+ "Royal Palm Beach Colony, Limited Partnership",Cyclical real estate market,FACES_RISK
275
+ "Royal Palm Beach Colony, Limited Partnership",Interest rate increases,FACES_RISK
276
+ "Royal Palm Beach Colony, Limited Partnership",Uncertain South Florida real estate market conditions,FACES_RISK
277
+ "Royal Palm Beach Colony, Limited Partnership",Competition from other developers in South Florida,FACES_RISK
278
+ "Royal Palm Beach Colony, Limited Partnership",Litigation over building permits,FACES_RISK
279
+ "Royal Palm Beach Colony, Limited Partnership",Contingent land sales,FACES_RISK
280
+ "Mesa Air Group, Inc.","Mesa Airlines, Inc.",OWNS
281
+ "Mesa Air Group, Inc.","Air Midwest, Inc.",OWNS
282
+ "Mesa Air Group, Inc.","WestAir Holdings, Inc.",OWNS
283
+ "Mesa Air Group, Inc.","MPD, Inc.",OWNS
284
+ "Mesa Air Group, Inc.","FCA, Inc.",OWNS
285
+ "Mesa Air Group, Inc.","Mesa Leasing, Inc.",OWNS
286
+ "Mesa Air Group, Inc.","MAGI Insurance, Ltd.",OWNS
287
+ "WestAir Holdings, Inc.","WestAir Commuter Airlines, Inc.",OWNS
288
+ "WestAir Holdings, Inc.","Regional Aircraft Services, Inc.",OWNS
289
+ "Mesa Air Group, Inc.",Termination of Code-Sharing Agreements,FACES_RISK
290
+ "Mesa Air Group, Inc.","CCAIR, Inc.",COMPETES_WITH
291
+ "Mesa Air Group, Inc.",Great Lakes Aviation,COMPETES_WITH
292
+ "Mesa Air Group, Inc.",SkyWest Airlines,COMPETES_WITH
293
+ "Mesa Air Group, Inc.",United Airlines,COMPETES_WITH
294
+ "Tidel Technologies, Inc.","Tidel Engineering, Inc.",OWNS
295
+ "Tidel Technologies, Inc.",3CI Complete Compliance Corporation,OWNS
296
+ "Tidel Technologies, Inc.","Diebold, Incorporated",COMPETES_WITH
297
+ "Tidel Technologies, Inc.",NCR Corporation,COMPETES_WITH
298
+ "Tidel Technologies, Inc.","Triton Systems, Inc.",COMPETES_WITH
299
+ "Tidel Technologies, Inc.",Fujitsu Corporation,COMPETES_WITH
300
+ "Tidel Technologies, Inc.",Siemens-Nixdorf,COMPETES_WITH
301
+ "Tidel Technologies, Inc.",NKL Industries,COMPETES_WITH
302
+ "Tidel Technologies, Inc.",McGunn Safe Company,COMPETES_WITH
303
+ "Tidel Technologies, Inc.",Armor Safe Company,COMPETES_WITH
304
+ "Tidel Technologies, Inc.",AutoVend,COMPETES_WITH
305
+ "Tidel Technologies, Inc.",Inadequate Patent Protection,FACES_RISK
306
+ "Tidel Technologies, Inc.",Patent Challenge Risk,FACES_RISK
307
+ "Tidel Technologies, Inc.",Patent Infringement Risk,FACES_RISK
308
+ "Tidel Technologies, Inc.",Third-Party Patent Rights Impact,FACES_RISK
309
+ "Tidel Technologies, Inc.",Competitor Patent Acquisition,FACES_RISK
310
+ "Tidel Technologies, Inc.",Trade Secret Loss,FACES_RISK
311
+ 3CI Complete Compliance Corporation,"Springhill, Louisiana Facility",OWNS
312
+ 3CI Complete Compliance Corporation,"Birmingham, Alabama Location",OWNS
313
+ 3CI Complete Compliance Corporation,Technological Obsolescence,FACES_RISK
314
+ "Biocontrol Technology, Inc.","Diasense, Inc.",OWNS
315
+ "Diasense, Inc.",Delays in FDA Marketing Approval,FACES_RISK
316
+ "Biocontrol Technology, Inc.",Delays in FDA Marketing Approval,FACES_RISK
317
+ "Diasense, Inc.",Uncertainty of Future Funding,FACES_RISK
318
+ "Biocontrol Technology, Inc.",Uncertainty of Future Funding,FACES_RISK
319
+ "Diasense, Inc.","Reliance on Biocontrol Technology, Inc.",FACES_RISK
320
+ "Diasense, Inc.",Competition and Product Obsolescence,FACES_RISK
321
+ "Biocontrol Technology, Inc.",Competition and Product Obsolescence,FACES_RISK
322
+ "Diasense, Inc.",Dependence on Single Technology,FACES_RISK
323
+ "Diasense, Inc.",Continued Operating Losses and Negative Net Worth,FACES_RISK
324
+ "Biocontrol Technology, Inc.",Continued Operating Losses and Negative Net Worth,FACES_RISK
325
+ "Diasense, Inc.",Potential Conflicts of Interest,FACES_RISK
326
+ "Biocontrol Technology, Inc.",Potential Conflicts of Interest,FACES_RISK
327
+ "Diasense, Inc.","Risks to Patents, Trademarks, and Licenses",FACES_RISK
328
+ "Biocontrol Technology, Inc.","Risks to Patents, Trademarks, and Licenses",FACES_RISK
329
+ "Diasense, Inc.",Uncertainty of Third-Party Payor Reimbursement,FACES_RISK
330
+ "Biocontrol Technology, Inc.",Uncertainty of Third-Party Payor Reimbursement,FACES_RISK
331
+ "Diasense, Inc.","Limited Sales, Marketing, and Manufacturing Experience",FACES_RISK
332
+ "Biocontrol Technology, Inc.","Limited Sales, Marketing, and Manufacturing Experience",FACES_RISK
333
+ "Diasense, Inc.",Difficulty Attracting and Retaining Key Employees,FACES_RISK
334
+ "Biocontrol Technology, Inc.",Difficulty Attracting and Retaining Key Employees,FACES_RISK
335
+ "Diasense, Inc.",Product Liability,FACES_RISK
336
+ "Biocontrol Technology, Inc.",Product Liability,FACES_RISK
337
+ "Diasense, Inc.",Uncertain Outcome of Pending Lawsuits,FACES_RISK
338
+ "Biocontrol Technology, Inc.",Uncertain Outcome of Pending Lawsuits,FACES_RISK
339
+ "Diasense, Inc.",Absence of Public Market for Common Stock,FACES_RISK
340
+ "Diasense, Inc.",Control by Existing Shareholders,FACES_RISK
341
+ "Diasense, Inc.",Dilution of Common Stock,FACES_RISK
342
+ "Diasense, Inc.",Limited Marketability of Diasensorr 1000,FACES_RISK
343
+ "Diasense, Inc.",Cash Flow Problems,FACES_RISK
344
+ "Diasense, Inc.",Slowed Testing Pace,FACES_RISK
345
+ "Diasense, Inc.",Necessity of FDA Approval for US Market,FACES_RISK
346
+ "Biocontrol Technology, Inc.",Necessity of FDA Approval for US Market,FACES_RISK
347
+ "Diasense, Inc.",Regulatory Process for Diasensorr 2000,FACES_RISK
348
+ "Biocontrol Technology, Inc.",Regulatory Process for Diasensorr 2000,FACES_RISK
349
+ "Diasense, Inc.",High Sales Price Limiting Sales,FACES_RISK
350
+ STARCRAFT CORP /IN/,"Imperial Automotive Group, Inc.",OWNS
351
+ STARCRAFT CORP /IN/,National Mobility Corporation,OWNS
352
+ STARCRAFT CORP /IN/,"Starcraft Automotive Group, Inc.",OWNS
353
+ STARCRAFT CORP /IN/,"Tecstar, Inc.",OWNS
354
+ "Imperial Automotive Group, Inc.","Imperial Industries, Inc.",OWNS
355
+ STARCRAFT CORP /IN/,Increased popularity of SUVs and factory minivans,FACES_RISK
356
+ STARCRAFT CORP /IN/,Price pressure from higher chassis costs,FACES_RISK
357
+ STARCRAFT CORP /IN/,Lower conversion inventory on dealer lots,FACES_RISK
358
+ STARCRAFT CORP /IN/,Fewer automotive dealers selling conversion products,FACES_RISK
359
+ STARCRAFT CORP /IN/,Changing level of dealer support,FACES_RISK
360
+ STARCRAFT CORP /IN/,Strengthening of the U.S. dollar,FACES_RISK
361
+ STARCRAFT CORP /IN/,Financial turmoil in Asian markets,FACES_RISK
362
+ STARCRAFT CORP /IN/,Cyclical nature of the conversion industry,FACES_RISK
363
+ STARCRAFT CORP /IN/,Consumer preferences for sport utility vehicles,FACES_RISK
364
+ STARCRAFT CORP /IN/,Level of disposable consumer income,FACES_RISK
365
+ STARCRAFT CORP /IN/,Availability and price of gasoline,FACES_RISK
366
+ STARCRAFT CORP /IN/,Level of interest rates and availability of consumer financing,FACES_RISK
367
+ STARCRAFT CORP /IN/,Decline in general economic conditions or consumer confidence,FACES_RISK
368
+ STARCRAFT CORP /IN/,Dependence on OEMs for vehicle chassis,FACES_RISK
369
+ STARCRAFT CORP /IN/,Decline in the conversion industry and Company sales,FACES_RISK
370
+ "CMG Information Services, Inc.",ADSmart Corporation,OWNS
371
+ "CMG Information Services, Inc.","Engage Technologies, Inc.",OWNS
372
+ "CMG Information Services, Inc.","Accipiter, Inc.",OWNS
373
+ "CMG Information Services, Inc.",InfoMation Publishing Corporation,OWNS
374
+ "CMG Information Services, Inc.",NaviSite Internet Services Corporation,OWNS
375
+ "CMG Information Services, Inc.",Planet Direct Corporation,OWNS
376
+ "CMG Information Services, Inc.",Password Internet Publishing Corporation,OWNS
377
+ "CMG Information Services, Inc.","Magnitude Network, LLC",OWNS
378
+ "CMG Information Services, Inc.","Open Market, Inc.",OWNS
379
+ "CMG Information Services, Inc.","CMG@Ventures I, LLC",OWNS
380
+ "CMG@Ventures I, LLC","Blaxxun Interactive, Inc.",OWNS
381
+ "CMG@Ventures I, LLC",GeoCities,OWNS
382
+ "CMG@Ventures I, LLC","Lycos, Inc.",OWNS
383
+ "CMG@Ventures I, LLC",Parable LLC,OWNS
384
+ "CMG@Ventures I, LLC",Vicinity Corporation,OWNS
385
+ "CMG Information Services, Inc.","CMG@Ventures II, LLC",OWNS
386
+ "CMG@Ventures II, LLC",Chemdex Corporation,OWNS
387
+ "CMG@Ventures II, LLC",Critical Path,OWNS
388
+ "CMG@Ventures II, LLC",GeoCities,OWNS
389
+ "CMG@Ventures II, LLC","KOZ, Inc.",OWNS
390
+ "CMG@Ventures II, LLC","Mother Nature's General Store, Inc.",OWNS
391
+ "CMG@Ventures II, LLC",Parable LLC,OWNS
392
+ "CMG@Ventures II, LLC","Reel.com, Inc.",OWNS
393
+ "CMG@Ventures II, LLC","Sage Enterprises, Inc.",OWNS
394
+ "CMG@Ventures II, LLC","Silknet Software, Inc.",OWNS
395
+ "CMG@Ventures II, LLC","Softway Systems, Inc.",OWNS
396
+ "CMG@Ventures II, LLC",Speech Machines plc,OWNS
397
+ "CMG@Ventures II, LLC",TicketsLive Corporation,OWNS
398
+ "CMG@Ventures II, LLC",Universal Learning Technology,OWNS
399
+ "CMG@Ventures II, LLC",Visto Corporation,OWNS
400
+ "CMG Information Services, Inc.","CMG@Ventures III, LLC",OWNS
401
+ "CMG Information Services, Inc.","@Ventures III, L.P.",OWNS
402
+ "CMG Information Services, Inc.",SalesLink Corporation,OWNS
403
+ "CMG Information Services, Inc.",InSolutions Incorporated,OWNS
404
+ "CMG Information Services, Inc.","On-Demand Solutions, Inc.",OWNS
405
+ SalesLink Corporation,Pacific Direct Marketing Corporation,OWNS
406
+ "CMG Information Services, Inc.",CMG Direct Corporation,OWNS
407
+ "CMG Information Services, Inc.",NaviNet,OWNS
408
+ Covol Technologies Inc.,Inability to implement applications profitably,FACES_RISK
409
+ Covol Technologies Inc.,Inability to utilize tax benefits,FACES_RISK
410
+ Covol Technologies Inc.,Feedstock supply risk,FACES_RISK
411
+ Covol Technologies Inc.,Production quality risk,FACES_RISK
412
+ Covol Technologies Inc.,Product marketing risk,FACES_RISK
413
+ "Lynton Group, Inc.","Ramapo Helicopters, Inc.",OWNS
414
+ "Lynton Group, Inc.","Lynton Aircraft Maintenance Services, Inc.",OWNS
415
+ "Lynton Group, Inc.","Rockland Aviation, Inc.",OWNS
416
+ "Lynton Group, Inc.","Lynton Aviation Charter, Inc.",OWNS
417
+ "Lynton Group, Inc.","LynStar Holdings, Inc.",OWNS
418
+ "LynStar Holdings, Inc.","LynStar Aviation, Inc.",OWNS
419
+ "Lynton Group, Inc.",Lynton Group Limited,OWNS
420
+ Lynton Group Limited,Lynton Aviation Limited,OWNS
421
+ "Lynton Group, Inc.",European Helicopters Limited,OWNS
422
+ Lynton Group Limited,Magec Aviation Limited,OWNS
423
+ Lynton Group Limited,Air Hanson Limited,OWNS
424
+ "Lynton Group, Inc.","Lynton Jet Centre, Inc.",OWNS
425
+ "Lynton Group, Inc.","Lynton Aviation, Inc.",OWNS
426
+ "Lynton Group, Inc.","Lynton Aviation Services, Inc.",OWNS
427
+ "Lynton Group, Inc.",Dollar Air Services Limited,OWNS
428
+ Dollar Air Services Limited,Black Isle Helicopters Limited,OWNS
429
+ "Lynton Group, Inc.",Black Isle Helicopters Limited,OWNS
430
+ "Lynton Jet Centre, Inc.","Lynton Properties, Inc.",OWNS
431
+ "Lynton Group, Inc.",PLM Dollar Group Limited,OWNS
432
+ Air Hanson Limited,Air Hanson Engineering Limited,OWNS
433
+ Air Hanson Limited,Air Hanson Aircraft Sales Limited,OWNS
434
+ European Helicopters Limited,Loss of CAA/Manufacturer Certificates/Licenses for EHL/Air Hanson Engineering,FACES_RISK
435
+ Air Hanson Engineering Limited,Loss of CAA/Manufacturer Certificates/Licenses for EHL/Air Hanson Engineering,FACES_RISK
436
+ Magec Aviation Limited,Loss of CAA/Manufacturer Certificates/Licenses for Magec,FACES_RISK
437
+ "General Automation, Inc.",General Automation LLC,OWNS
438
+ "General Automation, Inc.",General Automation Canada Subsidiary,OWNS
439
+ "General Automation, Inc.",General Automation Australia Subsidiary,OWNS
440
+ "General Automation, Inc.",General Automation UK Subsidiary,OWNS
441
+ "General Automation, Inc.",Going Concern Qualification,FACES_RISK
442
+ "General Automation, Inc.",Recent Operating Losses,FACES_RISK
443
+ "General Automation, Inc.",Deficit Net Worth,FACES_RISK
444
+ "General Automation, Inc.",Working Capital Deficiency,FACES_RISK
445
+ "General Automation, Inc.",Cash Flow Constraints,FACES_RISK
446
+ "General Automation, Inc.",Obligations to TMI in Default,FACES_RISK
447
+ "General Automation, Inc.",Obligations to Boundless in Default,FACES_RISK
448
+ "General Automation, Inc.",Limited Market for the Company's Stock,FACES_RISK
449
+ "General Automation, Inc.",Competition Risk,FACES_RISK
450
+ "General Automation, Inc.",Wang,COMPETES_WITH
451
+ "General Automation, Inc.",AT&T,COMPETES_WITH
452
+ "General Automation, Inc.",IBM,COMPETES_WITH
453
+ "General Automation, Inc.",Data General Corporation,COMPETES_WITH
454
+ "General Automation, Inc.",Digital Equipment Corporation,COMPETES_WITH
455
+ "General Automation, Inc.",Hewlett Packard Company,COMPETES_WITH
456
+ "General Automation, Inc.",Ardent,COMPETES_WITH
457
+ "General Automation, Inc.",Pick Systems,COMPETES_WITH
458
+ Boundless Technologies,General Automation LLC,OWNS
459
+ RCM TECHNOLOGIES INC.,The Consortium,OWNS
460
+ RCM TECHNOLOGIES INC.,"The Consortium of Maryland, Inc.",OWNS
461
+ RCM TECHNOLOGIES INC.,"Performance Staffing, Inc.",OWNS
462
+ RCM TECHNOLOGIES INC.,"Programming Alternatives of Minnesota, Inc.",OWNS
463
+ "Biomune Systems, Inc.","Optim Nutrition, Inc.",OWNS
464
+ "Biomune Systems, Inc.","Rockwood Companies, LLC",OWNS
465
+ "Biomune Systems, Inc.","Frank A. Eldredge, Ph.D.",EMPLOYS
466
+ "Biomune Systems, Inc.","David O. Lucas, Ph.D.",EMPLOYS
467
+ "Biomune Systems, Inc.","Craig D. Moffat, M.D.",EMPLOYS
468
+ "Biomune Systems, Inc.",Limited access to funding for future research and development,FACES_RISK
469
+ "Biomune Systems, Inc.",Highly competitive market for nutrition supplements,FACES_RISK
470
+ "Biomune Systems, Inc.",Limited financial resources,FACES_RISK
471
+ "Biomune Systems, Inc.",Risk of reduced ownership interest in Rockwood due to unfulfilled loan covenants,FACES_RISK
472
+ "Biomune Systems, Inc.",Inability to obtain additional financing,FACES_RISK
473
+ "Biomune Systems, Inc.",Inability to increase product sales,FACES_RISK
474
+ Mobil Corp.,Mobil (German Operating Company),OWNS
475
+ Exxon Corp.,German Subsidiaries of Exxon Corp.,OWNS
476
+ Royal Dutch Group,German Subsidiaries of Royal Dutch Group,OWNS
477
+ NORTH EUROPEAN OIL ROYALTY TRUST,John H. Van Kirk,EMPLOYS
478
+ NORTH EUROPEAN OIL ROYALTY TRUST,John R. Van Kirk,EMPLOYS
479
+ NORTH EUROPEAN OIL ROYALTY TRUST,Termination of Royalty Rights,FACES_RISK
480
+ NORTH EUROPEAN OIL ROYALTY TRUST,Speculative Business,FACES_RISK
481
+ NORTH EUROPEAN OIL ROYALTY TRUST,Uncertainty of Future Income,FACES_RISK
482
+ NORTH EUROPEAN OIL ROYALTY TRUST,Fluctuations in Gas and Oil Prices/Supplies,FACES_RISK
483
+ NORTH EUROPEAN OIL ROYALTY TRUST,Environmental Regulations Impact,FACES_RISK
484
+ NORTH EUROPEAN OIL ROYALTY TRUST,Unforeseeable Economic and Political Factors,FACES_RISK
485
+ NORTH EUROPEAN OIL ROYALTY TRUST,Currency Exchange Rate Fluctuations,FACES_RISK
486
+ NORTH EUROPEAN OIL ROYALTY TRUST,Y2K Computer Compliance Issues,FACES_RISK
487
+ Celsion Corporation,Dr. Gerald Wolf,EMPLOYS
488
+ Celsion Corporation,Difficulty delivering controlled heat without burning healthy tissue,FACES_RISK
489
+ Celsion Corporation,Need for new FDA indication for breast tumor ablation,FACES_RISK
490
+ Pentech International Inc.,Sawdust Pencil Co.,OWNS
491
+ Pentech International Inc.,Product Shortages,FACES_RISK
492
+ Pentech International Inc.,Dumping Duties,FACES_RISK
493
+ Pentech International Inc.,Increased Raw Material Costs,FACES_RISK
494
+ Pentech International Inc.,Increased Dumping Duties,FACES_RISK
495
+ Pentech International Inc.,Minimum Royalty Payments Leading to Losses,FACES_RISK
496
+ Pentech International Inc.,Loss of Major Customer,FACES_RISK
497
+ Pentech International Inc.,Bad Debts from Customers,FACES_RISK
498
+ Pentech International Inc.,Failure to Register Trademarks,FACES_RISK
499
+ Pentech International Inc.,Intense Competition,FACES_RISK
500
+ Pentech International Inc.,Bic Pen Company,COMPETES_WITH
501
+ Pentech International Inc.,Papermate,COMPETES_WITH
502
+ Pentech International Inc.,"RoseArt Industries, Inc.",COMPETES_WITH
503
+ Pentech International Inc.,Newell,COMPETES_WITH
extract_graph.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import csv
4
+ import time
5
+ import asyncio
6
+ from pydantic import BaseModel, Field
7
+ from google import genai
8
+ from google.genai import types
9
+
10
+ # Define the structured output schema for Gemini
11
+ class Vertex(BaseModel):
12
+ id: str = Field(description="The unique identifier or name of the entity.")
13
+ type: str = Field(description="Must be one of: Company, Executive, RiskFactor, Subsidiary")
14
+
15
+ class Edge(BaseModel):
16
+ source: str = Field(description="The id of the source vertex.")
17
+ target: str = Field(description="The id of the target vertex.")
18
+ type: str = Field(description="Must be one of: EMPLOYS, FACES_RISK, OWNS, COMPETES_WITH")
19
+
20
+ class GraphExtraction(BaseModel):
21
+ vertices: list[Vertex]
22
+ edges: list[Edge]
23
+
24
+ # Setup Gemini Client (Async)
25
+ if "GEMINI_API_KEY" not in os.environ:
26
+ print("ERROR: GEMINI_API_KEY environment variable not set.")
27
+ exit(1)
28
+
29
+ client = genai.Client()
30
+
31
+ async def process_document(doc, sem):
32
+ """
33
+ Process a single document through Gemini 1.5 Flash to extract graph entities.
34
+ Uses a semaphore to limit concurrent API calls and prevent 429 errors.
35
+ """
36
+ async with sem:
37
+ text = doc.get("text", "")
38
+ company = doc.get("company", "Unknown")
39
+
40
+ # If the text is too large, we truncate it for extraction to save costs
41
+ # (For 100M tokens, we might process full texts, but let's limit to 15k chars per doc for the demo)
42
+ text_chunk = text[:15000]
43
+
44
+ prompt = f"""
45
+ Analyze the following SEC 10-K filing excerpt for {company}.
46
+ Extract all relevant entities (Company, Executive, RiskFactor, Subsidiary) and their relationships (EMPLOYS, FACES_RISK, OWNS, COMPETES_WITH).
47
+
48
+ Text excerpt:
49
+ {text_chunk}
50
+ """
51
+
52
+ try:
53
+ # Note: We use the async client `client.aio`
54
+ response = await client.aio.models.generate_content(
55
+ model='gemini-2.5-flash',
56
+ contents=prompt,
57
+ config=types.GenerateContentConfig(
58
+ response_mime_type="application/json",
59
+ response_schema=GraphExtraction,
60
+ temperature=0.1
61
+ )
62
+ )
63
+
64
+ # The response text will be a JSON string conforming to the GraphExtraction schema
65
+ return json.loads(response.text)
66
+
67
+ except Exception as e:
68
+ print(f"Error extracting graph for {company}: {e}")
69
+ return None
70
+
71
+ async def main():
72
+ input_file = "financial_corpus.jsonl"
73
+ if not os.path.exists(input_file):
74
+ print(f"ERROR: {input_file} not found. Run count_tokens.py first.")
75
+ return
76
+
77
+ # Prepare CSV writers
78
+ vertices_file = open("vertices.csv", "w", newline="", encoding="utf-8")
79
+ edges_file = open("edges.csv", "w", newline="", encoding="utf-8")
80
+
81
+ v_writer = csv.writer(vertices_file)
82
+ e_writer = csv.writer(edges_file)
83
+
84
+ # Write headers
85
+ v_writer.writerow(["v_id", "v_type"])
86
+ e_writer.writerow(["source", "target", "e_type"])
87
+
88
+ # Read corpus
89
+ print("Loading corpus...")
90
+ docs = []
91
+ with open(input_file, 'r', encoding='utf-8') as f:
92
+ for line in f:
93
+ docs.append(json.loads(line))
94
+ if len(docs) >= 50:
95
+ break
96
+
97
+ print(f"Loaded {len(docs)} documents for extraction.")
98
+
99
+ # We use a Semaphore to allow max 5 concurrent requests to Gemini to respect standard tier rate limits
100
+ sem = asyncio.Semaphore(5)
101
+
102
+ # Batch processing
103
+ BATCH_SIZE = 50
104
+ total_vertices = 0
105
+ total_edges = 0
106
+
107
+ for i in range(0, len(docs), BATCH_SIZE):
108
+ batch = docs[i:i+BATCH_SIZE]
109
+ print(f"Processing batch {i//BATCH_SIZE + 1} ({len(batch)} docs)...")
110
+
111
+ tasks = [process_document(doc, sem) for doc in batch]
112
+ results = await asyncio.gather(*tasks)
113
+
114
+ for result in results:
115
+ if not result:
116
+ continue
117
+
118
+ # Write vertices
119
+ for v in result.get("vertices", []):
120
+ # Basic cleaning
121
+ v_id = v.get("id", "").strip().replace("\n", " ")
122
+ v_type = v.get("type", "Unknown")
123
+ if v_id:
124
+ v_writer.writerow([v_id, v_type])
125
+ total_vertices += 1
126
+
127
+ # Write edges
128
+ for e in result.get("edges", []):
129
+ source = e.get("source", "").strip().replace("\n", " ")
130
+ target = e.get("target", "").strip().replace("\n", " ")
131
+ e_type = e.get("type", "Unknown")
132
+ if source and target:
133
+ e_writer.writerow([source, target, e_type])
134
+ total_edges += 1
135
+
136
+ # Flush to disk periodically
137
+ vertices_file.flush()
138
+ edges_file.flush()
139
+
140
+ # Sleep slightly between batches to cool down rate limits
141
+ await asyncio.sleep(2)
142
+
143
+ vertices_file.close()
144
+ edges_file.close()
145
+
146
+ print("\n--- GRAPH EXTRACTION COMPLETE ---")
147
+ print(f"Total Vertices Extracted: {total_vertices:,}")
148
+ print(f"Total Edges Extracted: {total_edges:,}")
149
+ print("Saved to vertices.csv and edges.csv")
150
+ print("Ready for TigerGraph Bulk Loading!")
151
+
152
+ if __name__ == "__main__":
153
+ asyncio.run(main())
index.html ADDED
@@ -0,0 +1,1025 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>GraphRAG Pipeline Comparison Dashboard</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300&display=swap" rel="stylesheet" />
8
+ <style>
9
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
10
+
11
+ :root {
12
+ --bg: #0a0c0f;
13
+ --surface: #111418;
14
+ --surface2: #181c22;
15
+ --border: rgba(255,255,255,0.08);
16
+ --border2: rgba(255,255,255,0.14);
17
+ --text: #e8eaed;
18
+ --muted: #7a8290;
19
+ --accent-teal: #00e5b0;
20
+ --accent-blue: #4d9fff;
21
+ --accent-amber: #ffb347;
22
+ --pipe1: #6b7280;
23
+ --pipe2: #4d9fff;
24
+ --pipe3: #00e5b0;
25
+ --font-mono: 'Space Mono', monospace;
26
+ --font-body: 'DM Sans', sans-serif;
27
+ --radius: 10px;
28
+ --radius-lg: 16px;
29
+ }
30
+
31
+ body {
32
+ font-family: var(--font-body);
33
+ background: var(--bg);
34
+ color: var(--text);
35
+ min-height: 100vh;
36
+ padding: 32px 24px;
37
+ }
38
+
39
+ /* ---- Header ---- */
40
+ .header {
41
+ display: flex;
42
+ align-items: flex-start;
43
+ justify-content: space-between;
44
+ margin-bottom: 32px;
45
+ gap: 16px;
46
+ flex-wrap: wrap;
47
+ }
48
+ .header-left {}
49
+ .wordmark {
50
+ font-family: var(--font-mono);
51
+ font-size: 11px;
52
+ letter-spacing: 0.15em;
53
+ color: var(--muted);
54
+ text-transform: uppercase;
55
+ margin-bottom: 6px;
56
+ }
57
+ .title {
58
+ font-size: 26px;
59
+ font-weight: 600;
60
+ letter-spacing: -0.5px;
61
+ line-height: 1.2;
62
+ }
63
+ .title span { color: var(--accent-teal); }
64
+ .subtitle {
65
+ font-size: 13px;
66
+ color: var(--muted);
67
+ margin-top: 4px;
68
+ font-weight: 300;
69
+ }
70
+ .tg-badge {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 8px;
74
+ background: var(--surface);
75
+ border: 1px solid var(--border2);
76
+ border-radius: var(--radius);
77
+ padding: 8px 14px;
78
+ font-size: 12px;
79
+ color: var(--muted);
80
+ align-self: flex-start;
81
+ }
82
+ .tg-dot { width: 8px; height: 8px; border-radius: 50%; background: #00e5b0; box-shadow: 0 0 6px #00e5b0; animation: pulse 2s infinite; }
83
+ @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
84
+
85
+ /* ---- Config Panel ---- */
86
+ .config {
87
+ background: var(--surface);
88
+ border: 1px solid var(--border);
89
+ border-radius: var(--radius-lg);
90
+ padding: 20px 24px;
91
+ margin-bottom: 24px;
92
+ }
93
+ .config-title {
94
+ font-family: var(--font-mono);
95
+ font-size: 10px;
96
+ letter-spacing: 0.12em;
97
+ color: var(--muted);
98
+ text-transform: uppercase;
99
+ margin-bottom: 16px;
100
+ }
101
+ .config-grid {
102
+ display: grid;
103
+ grid-template-columns: 1fr 1fr 1fr;
104
+ gap: 12px;
105
+ }
106
+ @media (max-width: 700px) { .config-grid { grid-template-columns: 1fr; } }
107
+ .field label {
108
+ display: block;
109
+ font-size: 11px;
110
+ color: var(--muted);
111
+ margin-bottom: 5px;
112
+ font-family: var(--font-mono);
113
+ letter-spacing: 0.05em;
114
+ }
115
+ .field input, .field select {
116
+ width: 100%;
117
+ background: var(--surface2);
118
+ border: 1px solid var(--border2);
119
+ border-radius: var(--radius);
120
+ color: var(--text);
121
+ font-family: var(--font-mono);
122
+ font-size: 12px;
123
+ padding: 9px 12px;
124
+ outline: none;
125
+ transition: border-color 0.15s;
126
+ }
127
+ .field input:focus, .field select:focus { border-color: var(--accent-teal); }
128
+ .field input[type="password"] { letter-spacing: 0.05em; }
129
+ .field select option { background: #1a1e24; }
130
+
131
+ /* ---- Query Bar ---- */
132
+ .query-bar {
133
+ display: flex;
134
+ gap: 10px;
135
+ margin-bottom: 24px;
136
+ align-items: stretch;
137
+ }
138
+ .query-bar textarea {
139
+ flex: 1;
140
+ background: var(--surface);
141
+ border: 1px solid var(--border2);
142
+ border-radius: var(--radius-lg);
143
+ color: var(--text);
144
+ font-family: var(--font-body);
145
+ font-size: 15px;
146
+ padding: 14px 18px;
147
+ resize: none;
148
+ outline: none;
149
+ min-height: 60px;
150
+ line-height: 1.5;
151
+ transition: border-color 0.15s;
152
+ }
153
+ .query-bar textarea:focus { border-color: var(--accent-teal); }
154
+ .query-bar textarea::placeholder { color: var(--muted); }
155
+ .run-btn {
156
+ background: var(--accent-teal);
157
+ color: #0a0c0f;
158
+ border: none;
159
+ border-radius: var(--radius-lg);
160
+ font-family: var(--font-mono);
161
+ font-size: 12px;
162
+ font-weight: 700;
163
+ letter-spacing: 0.05em;
164
+ padding: 0 24px;
165
+ cursor: pointer;
166
+ white-space: nowrap;
167
+ transition: opacity 0.15s, transform 0.1s;
168
+ display: flex;
169
+ align-items: center;
170
+ gap: 6px;
171
+ }
172
+ .run-btn:hover { opacity: 0.85; }
173
+ .run-btn:active { transform: scale(0.97); }
174
+ .run-btn:disabled { opacity: 0.4; cursor: not-allowed; }
175
+ .run-btn svg { width: 16px; height: 16px; }
176
+
177
+ /* ---- Pipelines grid ---- */
178
+ .pipelines {
179
+ display: grid;
180
+ grid-template-columns: repeat(3, minmax(0, 1fr));
181
+ gap: 14px;
182
+ margin-bottom: 24px;
183
+ }
184
+ @media (max-width: 900px) { .pipelines { grid-template-columns: 1fr; } }
185
+
186
+ .pipe-card {
187
+ background: var(--surface);
188
+ border-radius: var(--radius-lg);
189
+ overflow: hidden;
190
+ display: flex;
191
+ flex-direction: column;
192
+ border: 1px solid var(--border);
193
+ transition: border-color 0.2s;
194
+ }
195
+ .pipe-card.active { border-color: var(--pipe-color, var(--border2)); }
196
+
197
+ .pipe-head {
198
+ padding: 14px 18px;
199
+ border-bottom: 1px solid var(--border);
200
+ display: flex;
201
+ align-items: center;
202
+ gap: 10px;
203
+ }
204
+ .pipe-icon {
205
+ width: 32px; height: 32px; border-radius: 8px;
206
+ display: flex; align-items: center; justify-content: center;
207
+ font-family: var(--font-mono); font-size: 11px; font-weight: 700;
208
+ flex-shrink: 0;
209
+ }
210
+ .p1 .pipe-icon { background: rgba(107,114,128,0.15); color: #9ca3af; }
211
+ .p2 .pipe-icon { background: rgba(77,159,255,0.12); color: var(--accent-blue); }
212
+ .p3 .pipe-icon { background: rgba(0,229,176,0.1); color: var(--accent-teal); }
213
+ .pipe-meta { flex: 1; min-width: 0; }
214
+ .pipe-name { font-weight: 600; font-size: 14px; }
215
+ .pipe-sub { font-size: 11px; color: var(--muted); font-weight: 300; margin-top: 1px; }
216
+ .status-chip {
217
+ font-family: var(--font-mono);
218
+ font-size: 9px;
219
+ letter-spacing: 0.1em;
220
+ padding: 3px 8px;
221
+ border-radius: 20px;
222
+ text-transform: uppercase;
223
+ }
224
+ .chip-idle { background: rgba(255,255,255,0.05); color: var(--muted); }
225
+ .chip-running { background: rgba(255,179,71,0.1); color: var(--accent-amber); }
226
+ .chip-done { background: rgba(0,229,176,0.1); color: var(--accent-teal); }
227
+ .chip-err { background: rgba(255,80,80,0.1); color: #ff6060; }
228
+
229
+ .pipe-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
230
+
231
+ .answer-box {
232
+ background: var(--surface2);
233
+ border-radius: var(--radius);
234
+ padding: 14px;
235
+ font-size: 13px;
236
+ line-height: 1.65;
237
+ color: #c8cdd6;
238
+ min-height: 120px;
239
+ font-weight: 300;
240
+ position: relative;
241
+ }
242
+ .placeholder { color: var(--muted); font-style: italic; }
243
+
244
+ .thinking { display: flex; gap: 5px; align-items: center; }
245
+ .thinking span {
246
+ width: 5px; height: 5px; border-radius: 50%;
247
+ animation: blink 1.3s infinite;
248
+ }
249
+ .p1 .thinking span { background: #6b7280; }
250
+ .p2 .thinking span { background: var(--accent-blue); }
251
+ .p3 .thinking span { background: var(--accent-teal); }
252
+ .thinking span:nth-child(2) { animation-delay: 0.2s; }
253
+ .thinking span:nth-child(3) { animation-delay: 0.4s; }
254
+ @keyframes blink { 0%,80%,100%{opacity:0.15} 40%{opacity:1} }
255
+
256
+ .metrics-grid {
257
+ display: grid;
258
+ grid-template-columns: 1fr 1fr;
259
+ gap: 8px;
260
+ }
261
+ .metric-tile {
262
+ background: var(--surface2);
263
+ border-radius: var(--radius);
264
+ padding: 10px 12px;
265
+ }
266
+ .metric-tile .mlabel {
267
+ font-family: var(--font-mono);
268
+ font-size: 9px;
269
+ letter-spacing: 0.1em;
270
+ color: var(--muted);
271
+ text-transform: uppercase;
272
+ margin-bottom: 4px;
273
+ }
274
+ .metric-tile .mval {
275
+ font-family: var(--font-mono);
276
+ font-size: 16px;
277
+ font-weight: 700;
278
+ color: var(--text);
279
+ }
280
+ .mval.good { color: var(--accent-teal); }
281
+ .mval.warn { color: var(--accent-amber); }
282
+ .mval.neutral { color: var(--muted); }
283
+
284
+ .eval-row { display: flex; gap: 8px; }
285
+ .eval-pill {
286
+ flex: 1;
287
+ border-radius: var(--radius);
288
+ padding: 8px 10px;
289
+ text-align: center;
290
+ }
291
+ .eval-pill .elabel {
292
+ font-size: 9px;
293
+ letter-spacing: 0.08em;
294
+ text-transform: uppercase;
295
+ font-family: var(--font-mono);
296
+ margin-bottom: 3px;
297
+ opacity: 0.6;
298
+ }
299
+ .eval-pill .eval-val {
300
+ font-family: var(--font-mono);
301
+ font-weight: 700;
302
+ font-size: 13px;
303
+ }
304
+ .pill-pass { background: rgba(0,229,176,0.08); color: var(--accent-teal); border: 1px solid rgba(0,229,176,0.2); }
305
+ .pill-fail { background: rgba(255,80,80,0.08); color: #ff6060; border: 1px solid rgba(255,80,80,0.2); }
306
+ .pill-neutral { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
307
+
308
+ /* ---- Summary bar ---- */
309
+ .summary {
310
+ display: grid;
311
+ grid-template-columns: repeat(4, minmax(0, 1fr));
312
+ gap: 12px;
313
+ margin-bottom: 24px;
314
+ }
315
+ @media (max-width: 700px) { .summary { grid-template-columns: 1fr 1fr; } }
316
+ .sum-card {
317
+ background: var(--surface);
318
+ border: 1px solid var(--border);
319
+ border-radius: var(--radius-lg);
320
+ padding: 16px 18px;
321
+ }
322
+ .sum-card.highlight { border-color: rgba(0,229,176,0.3); }
323
+ .sum-card .slabel {
324
+ font-family: var(--font-mono);
325
+ font-size: 9px;
326
+ letter-spacing: 0.1em;
327
+ color: var(--muted);
328
+ text-transform: uppercase;
329
+ margin-bottom: 6px;
330
+ }
331
+ .sum-card .sval {
332
+ font-family: var(--font-mono);
333
+ font-size: 22px;
334
+ font-weight: 700;
335
+ color: var(--text);
336
+ }
337
+ .sum-card.highlight .sval { color: var(--accent-teal); }
338
+ .sum-card .ssub { font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 300; }
339
+
340
+ /* ---- Error / info banners ---- */
341
+ .banner {
342
+ padding: 12px 16px;
343
+ border-radius: var(--radius);
344
+ font-size: 13px;
345
+ margin-bottom: 16px;
346
+ display: none;
347
+ }
348
+ .banner.visible { display: block; }
349
+ .banner-err { background: rgba(255,80,80,0.08); border: 1px solid rgba(255,80,80,0.2); color: #ff8080; }
350
+ .banner-info { background: rgba(77,159,255,0.08); border: 1px solid rgba(77,159,255,0.2); color: #7db8ff; }
351
+
352
+ /* ---- Log ---- */
353
+ .log-section { margin-top: 8px; }
354
+ .log-toggle {
355
+ font-family: var(--font-mono);
356
+ font-size: 10px;
357
+ letter-spacing: 0.1em;
358
+ color: var(--muted);
359
+ cursor: pointer;
360
+ text-transform: uppercase;
361
+ background: none;
362
+ border: none;
363
+ padding: 0;
364
+ margin-bottom: 8px;
365
+ display: flex;
366
+ align-items: center;
367
+ gap: 6px;
368
+ }
369
+ .log-toggle:hover { color: var(--text); }
370
+ .log-box {
371
+ background: var(--surface2);
372
+ border-radius: var(--radius);
373
+ padding: 12px 14px;
374
+ font-family: var(--font-mono);
375
+ font-size: 11px;
376
+ color: var(--muted);
377
+ max-height: 180px;
378
+ overflow-y: auto;
379
+ line-height: 1.7;
380
+ display: none;
381
+ }
382
+ .log-box.open { display: block; }
383
+ .log-line.ok { color: var(--accent-teal); }
384
+ .log-line.warn { color: var(--accent-amber); }
385
+ .log-line.err { color: #ff6060; }
386
+
387
+ hr.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
388
+
389
+ /* ---- Setup guide ---- */
390
+ .setup {
391
+ background: var(--surface);
392
+ border: 1px solid var(--border);
393
+ border-radius: var(--radius-lg);
394
+ padding: 20px 24px;
395
+ }
396
+ .setup-title {
397
+ font-family: var(--font-mono);
398
+ font-size: 10px;
399
+ letter-spacing: 0.12em;
400
+ text-transform: uppercase;
401
+ color: var(--muted);
402
+ margin-bottom: 16px;
403
+ }
404
+ .steps {
405
+ display: grid;
406
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
407
+ gap: 10px;
408
+ }
409
+ .step {
410
+ display: flex;
411
+ gap: 10px;
412
+ align-items: flex-start;
413
+ }
414
+ .step-num {
415
+ font-family: var(--font-mono);
416
+ font-size: 10px;
417
+ color: var(--accent-teal);
418
+ background: rgba(0,229,176,0.08);
419
+ border-radius: 6px;
420
+ width: 24px; height: 24px;
421
+ display: flex; align-items: center; justify-content: center;
422
+ flex-shrink: 0;
423
+ margin-top: 1px;
424
+ }
425
+ .step-text { font-size: 12px; color: var(--muted); line-height: 1.5; }
426
+ .step-text strong { color: var(--text); font-weight: 500; }
427
+ code {
428
+ font-family: var(--font-mono);
429
+ font-size: 11px;
430
+ background: var(--surface2);
431
+ border-radius: 4px;
432
+ padding: 1px 5px;
433
+ color: var(--accent-teal);
434
+ }
435
+ </style>
436
+ </head>
437
+ <body>
438
+
439
+ <div class="header">
440
+ <div class="header-left">
441
+ <div class="wordmark">GraphRAG · Scale Edition</div>
442
+ <div class="title">Financial <span>Intelligence</span></div>
443
+ <div class="subtitle">100M+ Token Source Data → 692 Node Knowledge Graph: LLM-Only vs Basic RAG vs TigerGraph GraphRAG</div>
444
+ </div>
445
+ <div class="tg-badge">
446
+ <span class="tg-dot"></span>
447
+ TigerGraph Cloud (Savanna)
448
+ </div>
449
+ </div>
450
+
451
+ <!-- Config -->
452
+ <div class="config">
453
+ <div class="config-title">⚙ TigerGraph Cloud Config</div>
454
+ <div class="config-grid">
455
+ <div class="field">
456
+ <label>Cluster Host</label>
457
+ <input type="text" id="tg-host" placeholder="https://your-cluster.i.tgcloud.io" value="https://tg-8a493b67-4330-406c-81c2-d1398562a1ec.tg-3452941248.i.tgcloud.io" />
458
+ </div>
459
+ <div class="field">
460
+ <label>Graph Name</label>
461
+ <input type="text" id="tg-graph" placeholder="TIgerrag" value="TIgerrag" />
462
+ </div>
463
+ <div class="field">
464
+ <label>RESTPP Token</label>
465
+ <input type="password" id="tg-token" placeholder="Bearer token from Admin Portal" />
466
+ </div>
467
+ <div class="field">
468
+ <label>GraphRAG Query Name</label>
469
+ <input type="text" id="tg-query" placeholder="get_company_context" value="get_company_context" />
470
+ </div>
471
+ <div class="field">
472
+ <label>LLM Provider</label>
473
+ <select id="llm-provider" disabled>
474
+ <option value="gemini">Google (Gemini 2.5 Flash)</option>
475
+ </select>
476
+ </div>
477
+ <div class="field">
478
+ <label>LLM API Key</label>
479
+ <input type="password" id="llm-key" placeholder="sk-..." />
480
+ </div>
481
+ </div>
482
+ </div>
483
+
484
+ <!-- Query bar -->
485
+ <div class="query-bar">
486
+ <textarea id="query-input" placeholder="e.g. What subsidiaries does this company own, and what are their primary market risks? — all three pipelines will answer simultaneously…" rows="2"></textarea>
487
+ <button class="run-btn" id="run-btn" onclick="runAll()">
488
+ <svg viewBox="0 0 16 16" fill="currentColor"><path d="M3 2.5l10 5.5-10 5.5V2.5z"/></svg>
489
+ RUN
490
+ </button>
491
+ </div>
492
+
493
+ <div class="banner banner-err" id="banner-err"></div>
494
+ <div class="banner banner-info" id="banner-info"></div>
495
+
496
+ <!-- Pipelines -->
497
+ <div class="pipelines">
498
+
499
+ <!-- Pipeline 1 -->
500
+ <div class="pipe-card p1" id="card1">
501
+ <div class="pipe-head">
502
+ <div class="pipe-icon">P1</div>
503
+ <div class="pipe-meta">
504
+ <div class="pipe-name">LLM-Only</div>
505
+ <div class="pipe-sub">No retrieval · baseline</div>
506
+ </div>
507
+ <span class="status-chip chip-idle" id="status1">IDLE</span>
508
+ </div>
509
+ <div class="pipe-body">
510
+ <div class="answer-box" id="ans1"><span class="placeholder">Response will appear here…</span></div>
511
+ <div class="metrics-grid">
512
+ <div class="metric-tile"><div class="mlabel">Tokens</div><div class="mval neutral" id="tok1">—</div></div>
513
+ <div class="metric-tile"><div class="mlabel">Latency</div><div class="mval neutral" id="lat1">—</div></div>
514
+ <div class="metric-tile"><div class="mlabel">Cost/query</div><div class="mval neutral" id="cost1">—</div></div>
515
+ <div class="metric-tile"><div class="mlabel">Groundedness F1</div><div class="mval neutral" id="bert1">—</div></div>
516
+ </div>
517
+ <div class="eval-row">
518
+ <div class="eval-pill pill-neutral" id="judge1"><div class="elabel">LLM Judge</div><div class="eval-val">—</div></div>
519
+ <div class="eval-pill pill-neutral"><div class="elabel">Retrieval</div><div class="eval-val">None</div></div>
520
+ </div>
521
+ </div>
522
+ </div>
523
+
524
+ <!-- Pipeline 2 -->
525
+ <div class="pipe-card p2" id="card2">
526
+ <div class="pipe-head">
527
+ <div class="pipe-icon">P2</div>
528
+ <div class="pipe-meta">
529
+ <div class="pipe-name">Basic RAG</div>
530
+ <div class="pipe-sub">Vector embeddings · baseline</div>
531
+ </div>
532
+ <span class="status-chip chip-idle" id="status2">IDLE</span>
533
+ </div>
534
+ <div class="pipe-body">
535
+ <div class="answer-box" id="ans2"><span class="placeholder">Response will appear here…</span></div>
536
+ <div class="metrics-grid">
537
+ <div class="metric-tile"><div class="mlabel">Tokens</div><div class="mval neutral" id="tok2">—</div></div>
538
+ <div class="metric-tile"><div class="mlabel">Latency</div><div class="mval neutral" id="lat2">—</div></div>
539
+ <div class="metric-tile"><div class="mlabel">Cost/query</div><div class="mval neutral" id="cost2">—</div></div>
540
+ <div class="metric-tile"><div class="mlabel">Groundedness F1</div><div class="mval neutral" id="bert2">—</div></div>
541
+ </div>
542
+ <div class="eval-row">
543
+ <div class="eval-pill pill-neutral" id="judge2"><div class="elabel">LLM Judge</div><div class="eval-val">—</div></div>
544
+ <div class="eval-pill pill-neutral"><div class="elabel">Retrieval</div><div class="eval-val">Vector</div></div>
545
+ </div>
546
+ </div>
547
+ </div>
548
+
549
+ <!-- Pipeline 3 -->
550
+ <div class="pipe-card p3" id="card3">
551
+ <div class="pipe-head">
552
+ <div class="pipe-icon">P3</div>
553
+ <div class="pipe-meta">
554
+ <div class="pipe-name">GraphRAG</div>
555
+ <div class="pipe-sub">TigerGraph Cloud · multi-hop</div>
556
+ </div>
557
+ <span class="status-chip chip-idle" id="status3">IDLE</span>
558
+ </div>
559
+ <div class="pipe-body">
560
+ <div class="answer-box" id="ans3"><span class="placeholder">Response will appear here…</span></div>
561
+ <div class="metrics-grid">
562
+ <div class="metric-tile"><div class="mlabel">Tokens</div><div class="mval neutral" id="tok3">—</div></div>
563
+ <div class="metric-tile"><div class="mlabel">Latency</div><div class="mval neutral" id="lat3">—</div></div>
564
+ <div class="metric-tile"><div class="mlabel">Cost/query</div><div class="mval neutral" id="cost3">—</div></div>
565
+ <div class="metric-tile"><div class="mlabel">Groundedness F1</div><div class="mval neutral" id="bert3">—</div></div>
566
+ </div>
567
+ <div class="eval-row">
568
+ <div class="eval-pill pill-neutral" id="judge3"><div class="elabel">LLM Judge</div><div class="eval-val">—</div></div>
569
+ <div class="eval-pill pill-neutral" id="hops3"><div class="elabel">Retrieval</div><div class="eval-val">Graph</div></div>
570
+ </div>
571
+ </div>
572
+ </div>
573
+
574
+ </div>
575
+
576
+ <!-- Summary -->
577
+ <div class="summary" id="summary" style="display:none;">
578
+ <div class="sum-card">
579
+ <div class="slabel">Baseline tokens (RAG)</div>
580
+ <div class="sval" id="sum-baseline">—</div>
581
+ <div class="ssub" id="sum-baseline-sub">—</div>
582
+ </div>
583
+ <div class="sum-card highlight">
584
+ <div class="slabel">Token reduction</div>
585
+ <div class="sval" id="sum-reduction">—</div>
586
+ <div class="ssub" id="sum-reduction-sub">vs Basic RAG</div>
587
+ </div>
588
+ <div class="sum-card">
589
+ <div class="slabel">Cost saving / query</div>
590
+ <div class="sval" id="sum-saving">—</div>
591
+ <div class="ssub" id="sum-saving-sub">GraphRAG vs RAG</div>
592
+ </div>
593
+ <div class="sum-card">
594
+ <div class="slabel">Groundedness delta</div>
595
+ <div class="sval" id="sum-accuracy">—</div>
596
+ <div class="ssub" id="sum-accuracy-sub">Context Faithfulness F1</div>
597
+ </div>
598
+ </div>
599
+
600
+ <!-- Log -->
601
+ <div class="log-section">
602
+ <button class="log-toggle" onclick="toggleLog()">▶ Request log</button>
603
+ <div class="log-box" id="log-box"></div>
604
+ </div>
605
+
606
+ <hr class="divider" />
607
+
608
+ <!-- Setup guide -->
609
+ <div class="setup">
610
+ <div class="setup-title">⚡ TigerGraph Cloud Setup (from your guide)</div>
611
+ <div class="steps">
612
+ <div class="step">
613
+ <div class="step-num">1</div>
614
+ <div class="step-text"><strong>Create account</strong> at <code>tgcloud.io</code> via email or GitHub, verify, log into dashboard.</div>
615
+ </div>
616
+ <div class="step">
617
+ <div class="step-num">2</div>
618
+ <div class="step-text"><strong>Create a cluster</strong> — click "Create Cluster", choose Free Tier, pick your region, name it.</div>
619
+ </div>
620
+ <div class="step">
621
+ <div class="step-num">3</div>
622
+ <div class="step-text"><strong>Open GraphStudio</strong> — Tools → GraphStudio. Design your schema (vertices + edges).</div>
623
+ </div>
624
+ <div class="step">
625
+ <div class="step-num">4</div>
626
+ <div class="step-text"><strong>Load data</strong> via CSV upload + Loading Jobs, or REST / pyTigerGraph.</div>
627
+ </div>
628
+ <div class="step">
629
+ <div class="step-num">5</div>
630
+ <div class="step-text"><strong>Write GSQL query</strong>, install it — this generates a REST endpoint automatically.</div>
631
+ </div>
632
+ <div class="step">
633
+ <div class="step-num">6</div>
634
+ <div class="step-text"><strong>Generate RESTPP token</strong> in Admin Portal → User Management → paste it above.</div>
635
+ </div>
636
+ <div class="step">
637
+ <div class="step-num">7</div>
638
+ <div class="step-text">Endpoint format: <code>https://&lt;cluster&gt;.i.tgcloud.io/query/&lt;GRAPH&gt;/&lt;QUERY&gt;</code></div>
639
+ </div>
640
+ <div class="step">
641
+ <div class="step-num">8</div>
642
+ <div class="step-text"><strong>Test in Postman</strong> with GET + <code>Authorization: Bearer YOUR_TOKEN</code> before wiring here.</div>
643
+ </div>
644
+ </div>
645
+ </div>
646
+
647
+ <script>
648
+ // ─── Pricing table (per 1K tokens, USD) ───────────────────────────────────────
649
+ const PRICING = {
650
+ anthropic: { input: 0.003, output: 0.015 }, // Claude Sonnet
651
+ openai: { input: 0.005, output: 0.015 }, // GPT-4o
652
+ gemini: { input: 0.00025, output: 0.0005 } // Gemini 1.5 Flash
653
+ };
654
+
655
+ // ─── State ────────────────────────────────────────────────────────────────────
656
+ let logOpen = false;
657
+ const logs = [];
658
+
659
+ function log(msg, type = '') {
660
+ const ts = new Date().toISOString().slice(11, 23);
661
+ logs.push({ ts, msg, type });
662
+ const box = document.getElementById('log-box');
663
+ const line = document.createElement('div');
664
+ line.className = 'log-line ' + type;
665
+ line.textContent = `[${ts}] ${msg}`;
666
+ box.appendChild(line);
667
+ box.scrollTop = box.scrollHeight;
668
+ }
669
+
670
+ function toggleLog() {
671
+ logOpen = !logOpen;
672
+ document.getElementById('log-box').className = 'log-box' + (logOpen ? ' open' : '');
673
+ document.querySelector('.log-toggle').textContent = (logOpen ? '▼' : '▶') + ' Request log';
674
+ }
675
+
676
+ function setStatus(n, state) {
677
+ const el = document.getElementById('status' + n);
678
+ el.className = 'status-chip';
679
+ if (state === 'running') { el.classList.add('chip-running'); el.textContent = 'RUNNING'; }
680
+ else if (state === 'done') { el.classList.add('chip-done'); el.textContent = 'DONE'; }
681
+ else if (state === 'error') { el.classList.add('chip-err'); el.textContent = 'ERROR'; }
682
+ else { el.classList.add('chip-idle'); el.textContent = 'IDLE'; }
683
+ }
684
+
685
+ function showThinking(n, pipe) {
686
+ document.getElementById('ans' + n).innerHTML =
687
+ `<div class="thinking"><span></span><span></span><span></span></div>`;
688
+ setStatus(n, 'running');
689
+ ['tok','lat','cost','bert'].forEach(k => {
690
+ const el = document.getElementById(k + n);
691
+ el.textContent = '…';
692
+ el.className = 'mval neutral';
693
+ });
694
+ document.getElementById('judge' + n).innerHTML =
695
+ `<div class="elabel">LLM Judge</div><div class="eval-val">…</div>`;
696
+ document.getElementById('judge' + n).className = 'eval-pill pill-neutral';
697
+ }
698
+
699
+ function renderAnswer(n, text, tokens, latency, bert, pass, provider) {
700
+ document.getElementById('ans' + n).textContent = text;
701
+ setStatus(n, 'done');
702
+
703
+ const price = PRICING[provider] || PRICING.anthropic;
704
+ const inputTok = Math.round(tokens * 0.7);
705
+ const outputTok = Math.round(tokens * 0.3);
706
+ const cost = ((inputTok / 1000) * price.input + (outputTok / 1000) * price.output);
707
+
708
+ const tokEl = document.getElementById('tok' + n);
709
+ tokEl.textContent = tokens.toLocaleString();
710
+ tokEl.className = 'mval ' + (n === 3 ? 'good' : n === 1 ? 'warn' : '');
711
+
712
+ document.getElementById('lat' + n).textContent = latency.toFixed(1) + 's';
713
+ document.getElementById('lat' + n).className = 'mval';
714
+
715
+ const costEl = document.getElementById('cost' + n);
716
+ costEl.textContent = '$' + cost.toFixed(4);
717
+ costEl.className = 'mval ' + (n === 3 ? 'good' : n === 1 ? 'warn' : '');
718
+
719
+ const bertEl = document.getElementById('bert' + n);
720
+ bertEl.textContent = bert.toFixed(2);
721
+ bertEl.className = 'mval ' + (bert >= 0.88 ? 'good' : bert >= 0.7 ? '' : 'warn');
722
+
723
+ const judgeEl = document.getElementById('judge' + n);
724
+ judgeEl.className = 'eval-pill ' + (pass ? 'pill-pass' : 'pill-fail');
725
+ judgeEl.innerHTML = `<div class="elabel">LLM Judge</div><div class="eval-val">${pass ? 'PASS' : 'FAIL'}</div>`;
726
+ }
727
+
728
+ function renderError(n, msg) {
729
+ document.getElementById('ans' + n).innerHTML = `<span style="color:#ff6060">${msg}</span>`;
730
+ setStatus(n, 'error');
731
+ }
732
+
733
+ function showBanner(type, msg) {
734
+ const el = document.getElementById('banner-' + type);
735
+ el.textContent = msg;
736
+ el.classList.add('visible');
737
+ setTimeout(() => el.classList.remove('visible'), 6000);
738
+ }
739
+
740
+ // ─── LLM call (Anthropic as demo; swap headers for OpenAI/Gemini) ─────────────
741
+ async function callLLM(provider, apiKey, systemPrompt, userPrompt) {
742
+ if (!apiKey) throw new Error('No LLM API key set');
743
+
744
+ if (provider === 'anthropic') {
745
+ const res = await fetch('https://api.anthropic.com/v1/messages', {
746
+ method: 'POST',
747
+ headers: {
748
+ 'Content-Type': 'application/json',
749
+ 'x-api-key': apiKey,
750
+ 'anthropic-version': '2023-06-01'
751
+ },
752
+ body: JSON.stringify({
753
+ model: 'claude-sonnet-4-20250514',
754
+ max_tokens: 512,
755
+ system: systemPrompt,
756
+ messages: [{ role: 'user', content: userPrompt }]
757
+ })
758
+ });
759
+ if (!res.ok) throw new Error(`Anthropic API ${res.status}: ${await res.text()}`);
760
+ const d = await res.json();
761
+ return {
762
+ text: d.content.map(b => b.text || '').join(''),
763
+ inputTokens: d.usage?.input_tokens || 0,
764
+ outputTokens: d.usage?.output_tokens || 0
765
+ };
766
+ }
767
+
768
+ if (provider === 'openai') {
769
+ const res = await fetch('https://api.openai.com/v1/chat/completions', {
770
+ method: 'POST',
771
+ headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` },
772
+ body: JSON.stringify({
773
+ model: 'gpt-4o',
774
+ max_tokens: 512,
775
+ messages: [{ role: 'system', content: systemPrompt }, { role: 'user', content: userPrompt }]
776
+ })
777
+ });
778
+ if (!res.ok) throw new Error(`OpenAI API ${res.status}`);
779
+ const d = await res.json();
780
+ return {
781
+ text: d.choices[0].message.content,
782
+ inputTokens: d.usage?.prompt_tokens || 0,
783
+ outputTokens: d.usage?.completion_tokens || 0
784
+ };
785
+ }
786
+
787
+ if (provider === 'gemini') {
788
+ // Dynamically fetch available models for this API key to avoid 404s
789
+ const modelsUrl = `https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`;
790
+ const modelsRes = await fetch(modelsUrl);
791
+ if (!modelsRes.ok) {
792
+ const err = await modelsRes.text();
793
+ throw new Error(`Gemini API Auth Error ${modelsRes.status}: ${err}`);
794
+ }
795
+
796
+ const modelsData = await modelsRes.json();
797
+ // Find a model that supports generateContent (prefer 1.5-flash, then any gemini)
798
+ let selectedModel = modelsData.models.find(m => m.name.includes('gemini-1.5-flash') && m.supportedGenerationMethods?.includes('generateContent'))?.name;
799
+ if (!selectedModel) {
800
+ selectedModel = modelsData.models.find(m => m.name.includes('gemini') && m.supportedGenerationMethods?.includes('generateContent'))?.name;
801
+ }
802
+
803
+ if (!selectedModel) throw new Error("No compatible Gemini models found for this API key.");
804
+
805
+ const url = `https://generativelanguage.googleapis.com/v1beta/${selectedModel}:generateContent?key=${apiKey}`;
806
+ const payload = {
807
+ method: 'POST',
808
+ headers: { 'Content-Type': 'application/json' },
809
+ body: JSON.stringify({
810
+ contents: [{ parts: [{ text: systemPrompt + '\n\nUser: ' + userPrompt }] }],
811
+ generationConfig: { maxOutputTokens: 512 }
812
+ })
813
+ };
814
+
815
+ const res = await fetch(url, payload);
816
+
817
+ if (!res.ok) {
818
+ const errText = await res.text();
819
+ let errMsg = errText;
820
+ try { errMsg = JSON.parse(errText).error.message; } catch(e) {}
821
+ throw new Error(`Gemini API ${res.status}: ${errMsg}`);
822
+ }
823
+
824
+ const d = await res.json();
825
+ return {
826
+ text: d.candidates[0].content.parts.map(p => p.text).join(''),
827
+ inputTokens: d.usageMetadata?.promptTokenCount || 0,
828
+ outputTokens: d.usageMetadata?.candidatesTokenCount || 0
829
+ };
830
+ }
831
+
832
+ throw new Error('Unknown provider');
833
+ }
834
+
835
+ // ─── TigerGraph RESTPP call ────────────────────────────────────────────────────
836
+ async function callTigerGraph(host, graph, token, queryName, question) {
837
+ const url = `${host.replace(/\/$/, '')}/query/${graph}/${queryName}?company_name=${encodeURIComponent(question)}`;
838
+ log(`TG → GET ${url}`, '');
839
+ const res = await fetch(url, {
840
+ headers: { 'Authorization': `Bearer ${token}` }
841
+ });
842
+ if (!res.ok) {
843
+ const txt = await res.text();
844
+ throw new Error(`TigerGraph ${res.status}: ${txt.slice(0, 200)}`);
845
+ }
846
+ const data = await res.json();
847
+ // TigerGraph returns { results: [...] }; the query should return context + answer
848
+ return data;
849
+ }
850
+
851
+ // Real BERTScore is now calculated mathematically in the Python backend via HuggingFace's bert_score library.
852
+
853
+ // ─── LLM-as-a-Judge ─────────────��─────────────────────────────────────────────
854
+ async function judgeAnswer(provider, apiKey, question, answer) {
855
+ try {
856
+ const res = await callLLM(provider, apiKey,
857
+ 'You are a strict benchmarking judge. Reply ONLY with the exact word PASS or the exact word FAIL. No punctuation, no explanation.',
858
+ `User Question: ${question}\n\nAI Answer: ${answer}\n\nTask: Evaluate if the AI completely and accurately answered the user's specific question. To PASS, the AI MUST explicitly address the core intent of the question. If the AI provides irrelevant facts (like acquisitions) instead of answering the specific question asked, or if it says it cannot find the information, you MUST reply FAIL.`
859
+ );
860
+ const text = res.text.toUpperCase();
861
+ console.log(`Judge Evaluation for Answer: "${answer.slice(0, 30)}..." -> Judge Output: "${text}"`);
862
+ if (text.includes('PASS')) return true;
863
+ return false;
864
+ } catch { return null; }
865
+ }
866
+
867
+ // ─── Main runner ──────────────────────────────────────────────────────────────
868
+ async function runAll() {
869
+ const query = document.getElementById('query-input').value.trim();
870
+ if (!query) { showBanner('err', 'Please enter a question first.'); return; }
871
+
872
+ const provider = document.getElementById('llm-provider').value;
873
+ const apiKey = document.getElementById('llm-key').value.trim();
874
+ const tgHost = document.getElementById('tg-host').value.trim();
875
+ const tgGraph = document.getElementById('tg-graph').value.trim();
876
+ const tgToken = document.getElementById('tg-token').value.trim();
877
+ const tgQuery = document.getElementById('tg-query').value.trim();
878
+
879
+ if (!apiKey) { showBanner('err', 'Enter your LLM API key in the config panel.'); return; }
880
+
881
+ const btn = document.getElementById('run-btn');
882
+ btn.disabled = true;
883
+ document.getElementById('summary').style.display = 'none';
884
+ [1,2,3].forEach(n => showThinking(n));
885
+ log(`Query: "${query}"`, 'ok');
886
+ log(`Provider: ${provider}`, '');
887
+
888
+ // ── Pipeline 1: LLM-Only ──────────────────────────────────────────────────
889
+ const p1 = (async () => {
890
+ try {
891
+ log('P1 → Sending prompt directly to LLM (no retrieval)', '');
892
+ const t0 = Date.now();
893
+ const r = await callLLM(provider, apiKey,
894
+ 'You are a helpful assistant. Answer accurately and concisely.',
895
+ query
896
+ );
897
+ const lat = (Date.now() - t0) / 1000;
898
+ const tokens = r.inputTokens + r.outputTokens;
899
+ log(`P1 ← ${tokens} tokens, ${lat.toFixed(1)}s`, 'ok');
900
+ const pass = await judgeAnswer(provider, apiKey, query, r.text);
901
+ const bert = 0.0; // LLM-Only has no context to ground against
902
+ renderAnswer(1, r.text, tokens, lat, bert, pass, provider);
903
+ return { tokens, cost: (r.inputTokens/1000)*PRICING[provider].input + (r.outputTokens/1000)*PRICING[provider].output, bert };
904
+ } catch(e) {
905
+ log('P1 error: ' + e.message, 'err');
906
+ renderError(1, e.message);
907
+ return null;
908
+ }
909
+ })();
910
+
911
+ // ── Pipeline 2: Basic RAG (Vector Database Retrieval) ───────────────────
912
+ const p2 = (async () => {
913
+ try {
914
+ log('P2 → Calling local Python Backend (/api/basic_rag) for Vector Retrieval', '');
915
+ const t0 = Date.now();
916
+
917
+ const res = await fetch('http://localhost:8000/api/basic_rag', {
918
+ method: 'POST',
919
+ headers: { 'Content-Type': 'application/json' },
920
+ body: JSON.stringify({ query: query, gemini_api_key: apiKey })
921
+ });
922
+
923
+ if (!res.ok) {
924
+ const errTxt = await res.text();
925
+ throw new Error(`Backend Error ${res.status}: ${errTxt}`);
926
+ }
927
+
928
+ const data = await res.json();
929
+ const finalAnswer = data.answer;
930
+
931
+ const lat = (Date.now() - t0) / 1000;
932
+
933
+ // We now have exact tokens from the backend!
934
+ const exactTokens = (data.input_tokens || 0) + (data.output_tokens || 0);
935
+
936
+ log(`P2 ← Backend returned Vector RAG response in ${lat.toFixed(1)}s`, 'ok');
937
+
938
+ const pass = await judgeAnswer(provider, apiKey, query, finalAnswer);
939
+ const bert = data.bert_score || 0.0;
940
+ renderAnswer(2, finalAnswer, exactTokens, lat, bert, pass, provider);
941
+
942
+ return { tokens: exactTokens, cost: ((data.input_tokens||0)/1000)*PRICING[provider].input + ((data.output_tokens||0)/1000)*PRICING[provider].output, bert };
943
+ } catch(err) {
944
+ log('P2 error: ' + err.message, 'err');
945
+ renderError(2, err.message);
946
+ return null;
947
+ }
948
+ })();
949
+
950
+ // ── Pipeline 3: GraphRAG via Python Backend ─────────────────────────────
951
+ const p3 = (async () => {
952
+ try {
953
+ log(`P3 → Calling local Python Backend (/api/rag) for TigerGraph + Gemini magic`, '');
954
+ const t0 = Date.now();
955
+
956
+ // REPLACE 'https://YOUR-BACKEND.onrender.com' with your actual Render URL later!
957
+ const res = await fetch('http://localhost:8000/api/rag', {
958
+ method: 'POST',
959
+ headers: { 'Content-Type': 'application/json' },
960
+ body: JSON.stringify({
961
+ query: query,
962
+ company: query,
963
+ tg_host: tgHost,
964
+ tg_token: tgToken,
965
+ tg_graph: tgGraph,
966
+ gemini_api_key: apiKey
967
+ }) // Passing all config to backend
968
+ });
969
+
970
+ if (!res.ok) {
971
+ const errTxt = await res.text();
972
+ throw new Error(`Backend Error ${res.status}: ${errTxt}`);
973
+ }
974
+
975
+ const data = await res.json();
976
+ const finalAnswer = data.answer || data.text || JSON.stringify(data);
977
+
978
+ const lat = (Date.now() - t0) / 1000;
979
+
980
+ // We now have exact tokens from the backend!
981
+ const exactTokens = (data.input_tokens || 0) + (data.output_tokens || 0);
982
+
983
+ log(`P3 ← Backend returned GraphRAG response in ${lat.toFixed(1)}s`, 'ok');
984
+ document.getElementById('hops3').innerHTML = `<div class="elabel">Retrieval</div><div class="eval-val">Graph · 2-hop</div>`;
985
+
986
+ const pass = await judgeAnswer(provider, apiKey, query, finalAnswer);
987
+ const bert = data.bert_score || 0.0;
988
+ renderAnswer(3, finalAnswer, exactTokens, lat, bert, pass, provider);
989
+
990
+ return { tokens: exactTokens, cost: ((data.input_tokens||0)/1000)*PRICING[provider].input + ((data.output_tokens||0)/1000)*PRICING[provider].output, bert };
991
+ } catch(err) {
992
+ log('P3 error: ' + err.message, 'err');
993
+ renderError(3, err.message);
994
+ return null;
995
+ }
996
+ })();
997
+
998
+
999
+
1000
+ const [r1, r2, r3] = await Promise.all([p1, p2, p3]);
1001
+
1002
+ // ── Summary stats ─────────────────────────────────────────────────────────
1003
+ if (r2 && r3) {
1004
+ const reduction = Math.round((1 - r3.tokens / r2.tokens) * 100);
1005
+ const saving = (r2.cost - r3.cost).toFixed(4);
1006
+ const bertDelta = (r3.bert - r2.bert).toFixed(2);
1007
+
1008
+ document.getElementById('sum-baseline').textContent = r2.tokens.toLocaleString();
1009
+ document.getElementById('sum-baseline-sub').textContent = '$' + r2.cost.toFixed(4) + ' / query';
1010
+ document.getElementById('sum-reduction').textContent = (reduction > 0 ? '−' : '+') + Math.abs(reduction) + '%';
1011
+ document.getElementById('sum-reduction-sub').textContent = `${r2.tokens.toLocaleString()} → ${r3.tokens.toLocaleString()} tokens`;
1012
+ document.getElementById('sum-saving').textContent = '$' + saving;
1013
+ document.getElementById('sum-saving-sub').textContent = 'per query vs Basic RAG';
1014
+ document.getElementById('sum-accuracy').textContent = (parseFloat(bertDelta) >= 0 ? '+' : '') + bertDelta;
1015
+ document.getElementById('sum-accuracy-sub').textContent = `GraphRAG BERTScore: ${r3.bert.toFixed(2)}`;
1016
+ document.getElementById('summary').style.display = 'grid';
1017
+
1018
+ log(`Summary — token reduction: ${reduction}%, cost saving: $${saving}, BERT delta: ${bertDelta}`, 'ok');
1019
+ }
1020
+
1021
+ btn.disabled = false;
1022
+ }
1023
+ </script>
1024
+ </body>
1025
+ </html>
inspect_db.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import chromadb
2
+ import sys
3
+
4
+ def search_db(query):
5
+ # Connect to the local database
6
+ client = chromadb.PersistentClient(path="./chroma_db")
7
+ collection = client.get_collection(name="sec_filings")
8
+
9
+ print(f"\n--- Searching Vector DB for: '{query}' ---")
10
+ print("-" * 50)
11
+
12
+ # Perform a similarity search
13
+ results = collection.query(
14
+ query_texts=[query],
15
+ n_results=2 # Get top 2 results
16
+ )
17
+
18
+ chunks = results['documents'][0]
19
+ distances = results['distances'][0]
20
+
21
+ for i, (chunk, dist) in enumerate(zip(chunks, distances)):
22
+ # Convert L2 distance to a simple similarity percentage
23
+ similarity = max(0.0, (1.0 - (dist / 2.0))) * 100
24
+ print(f"\nResult {i+1} (Similarity: {similarity:.1f}%):")
25
+ print(f"{chunk[:300]}...") # Print first 300 characters
26
+
27
+ print("\n" + "-" * 50)
28
+
29
+ if __name__ == "__main__":
30
+ if len(sys.argv) > 1:
31
+ search_db(" ".join(sys.argv[1:]))
32
+ else:
33
+ # Default test query
34
+ search_db("What are the main supply chain risks and disruptions?")
query.gsql ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ USE GRAPH FinancialGraph
2
+
3
+ CREATE OR REPLACE QUERY get_company_context(STRING company_name) FOR GRAPH FinancialGraph {
4
+
5
+ // Data structures to hold our context
6
+ ListAccum<STRING> @risk_list;
7
+ ListAccum<STRING> @competitor_list;
8
+ ListAccum<STRING> @subsidiary_list;
9
+ ListAccum<STRING> @executive_list;
10
+
11
+ // 1. Start at the target company
12
+ Start = {Entity.*};
13
+ TargetCompany = SELECT s FROM Start:s WHERE s.id == company_name;
14
+
15
+ // 2. Find all direct Subsidiaries and Executives
16
+ DirectLinks = SELECT t FROM TargetCompany:s -(RELATIONSHIP:e)-> Entity:t
17
+ WHERE e.rel_type == "OWNS" OR e.rel_type == "EMPLOYS"
18
+ ACCUM
19
+ IF t.entity_type == "Subsidiary" THEN s.@subsidiary_list += t.id END,
20
+ IF t.entity_type == "Executive" THEN s.@executive_list += t.id END;
21
+
22
+ // 3. Find Risk Factors facing this company
23
+ CompanyRisks = SELECT t FROM TargetCompany:s -(RELATIONSHIP:e)-> Entity:t
24
+ WHERE e.rel_type == "FACES_RISK"
25
+ ACCUM s.@risk_list += t.id;
26
+
27
+ // 4. Advanced Traversal: Find competitors who share the same risk factors
28
+ // This traverses backwards from the Risks to find other companies.
29
+ SharedRiskCompetitors = SELECT c FROM CompanyRisks:r -(reverse_RELATIONSHIP:e)-> Entity:c
30
+ WHERE c.id != company_name AND e.rel_type == "FACES_RISK"
31
+ ACCUM c.@risk_list += r.id;
32
+
33
+ // 5. Direct Competitors
34
+ DirectCompetitors = SELECT t FROM TargetCompany:s -(RELATIONSHIP:e)-> Entity:t
35
+ WHERE e.rel_type == "COMPETES_WITH"
36
+ ACCUM s.@competitor_list += t.id;
37
+
38
+ // Print the highly contextualized results for the LLM
39
+ PRINT TargetCompany [
40
+ TargetCompany.id,
41
+ TargetCompany.@risk_list,
42
+ TargetCompany.@subsidiary_list,
43
+ TargetCompany.@executive_list,
44
+ TargetCompany.@competitor_list
45
+ ];
46
+
47
+ // Print the 2-hop Shared Risk Competitors to give the LLM deep market insight
48
+ PRINT SharedRiskCompetitors [
49
+ SharedRiskCompetitors.id,
50
+ SharedRiskCompetitors.@risk_list
51
+ ];
52
+ }
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ fastapi
2
+ uvicorn
3
+ pydantic
4
+ google-genai>=0.1.2
5
+ pyTigerGraph
6
+ chromadb
7
+ bert_score
8
+ python-dotenv
9
+ pandas
10
+ datasets
schema_and_load.gsql ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // TigerGraph GSQL Schema & Bulk Loader for Financial Graph
2
+ // Run this in GraphStudio or via GSQL shell.
3
+
4
+ // 1. Drop existing graph if necessary (Warning: this deletes data)
5
+ // DROP GRAPH FinancialGraph
6
+
7
+ // 2. Define Schema
8
+ // We use a generalized 'Entity' vertex and 'RELATIONSHIP' edge
9
+ // to dynamically handle the Gemini extraction output without strict schema limits.
10
+ CREATE VERTEX Entity (PRIMARY_ID id STRING, entity_type STRING) WITH PRIMARY_ID_AS_ATTRIBUTE="true"
11
+ CREATE DIRECTED EDGE RELATIONSHIP (FROM Entity, TO Entity, rel_type STRING)
12
+
13
+ CREATE GRAPH FinancialGraph (Entity, RELATIONSHIP)
14
+
15
+ // 3. Define Loading Job
16
+ USE GRAPH FinancialGraph
17
+
18
+ CREATE LOADING JOB load_financial_graph FOR GRAPH FinancialGraph {
19
+ // IMPORTANT: Update these paths to where you saved your vertices.csv and edges.csv
20
+ DEFINE FILENAME v_file = "ANY:/path/to/vertices.csv";
21
+ DEFINE FILENAME e_file = "ANY:/path/to/edges.csv";
22
+
23
+ // Load Vertices
24
+ LOAD v_file TO VERTEX Entity VALUES($0, $1)
25
+ USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
26
+
27
+ // Load Edges
28
+ LOAD e_file TO EDGE RELATIONSHIP VALUES($0, $1, $2)
29
+ USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
30
+ }
31
+
32
+ // 4. Run the Loading Job (Uncomment and run after updating paths above)
33
+ // RUN LOADING JOB load_financial_graph
vertices.csv ADDED
@@ -0,0 +1,693 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ v_id,v_type
2
+ TROPICAL SPORTSWEAR INTERNATIONAL CORP.,Company
3
+ Savane International Corp.,Subsidiary
4
+ "Sandler & Travis Trade Advisory Services, Inc.",Company
5
+ DATAWATCH CORP,Company
6
+ interest rate risk,RiskFactor
7
+ foreign currency exchange rate risk,RiskFactor
8
+ DATAWATCH CORP International Subsidiaries,Subsidiary
9
+ "BEI Medical Systems Company, Inc.",Company
10
+ Gyne-Tech,Company
11
+ Valley Forge Scientific Corporation,Company
12
+ GALEY & LORD INC.,Company
13
+ "Burlington Industries, Inc.",Company
14
+ "Galey & Lord Industries, Inc.",Subsidiary
15
+ "G&L Service Company, North America, Inc.",Subsidiary
16
+ "Dimmit Industries, S.A. de C.V.",Subsidiary
17
+ Farah Incorporated,Company
18
+ "Dominion Textile, Inc.",Company
19
+ Swift Denim Group,Subsidiary
20
+ Klopman International Group,Subsidiary
21
+ "Swift Textiles Europe, Ltd.",Subsidiary
22
+ "Polymer Group, Inc.",Company
23
+ "DT Acquisition, Inc.",Subsidiary
24
+ "competitive and economic factors in the textile, apparel and home furnishings markets",RiskFactor
25
+ raw materials and other costs,RiskFactor
26
+ weather-related delays,RiskFactor
27
+ general economic conditions,RiskFactor
28
+ Levi's,Company
29
+ Haggar,Company
30
+ Savane,Company
31
+ Tropical Sportswear Int'l Corporation,Company
32
+ Polo Ralph Lauren,Company
33
+ Calvin Klein,Company
34
+ "Gap, Inc.",Company
35
+ Banana Republic,Company
36
+ Polo Jeans Co.,Company
37
+ Liz Claiborne,Company
38
+ Tommy Hilfiger Corporation,Company
39
+ H.D. Lee Co. Inc.,Company
40
+ Aalfs Manufacturing Inc.,Company
41
+ "Texas Apparel, Inc.",Company
42
+ Border Corp.,Company
43
+ "Land's End, Inc.",Company
44
+ L.L. Bean Inc.,Company
45
+ "Eddie Bauer, Inc.",Company
46
+ J. Crew Group Inc.,Company
47
+ Revelacion En El Vestir S.A.,Company
48
+ Fairsound U.S.A. Corp.,Company
49
+ Hoi Kosher Garment Fty. Ltd.,Company
50
+ Luen Fung (Hop Kee) Garment,Company
51
+ Hagale Industries Inc.,Company
52
+ "Oxford Industries, Inc.",Company
53
+ MEDIQ Incorporated,Company
54
+ MQ Acquisition Corporation,Company
55
+ "Bruckmann, Rosser, Sherrill & Co., L.P.",Company
56
+ "MEDIQ/PRN Life Support Services, Inc.",Subsidiary
57
+ Rotko Entities,Company
58
+ "Ferrer Freeman Thompson & Co., LLC",Company
59
+ "Galen Partners, III L.P.",Company
60
+ "CH Industries, Inc.",Company
61
+ "CH Medical, Inc.",Company
62
+ "National Patient Care Systems, Inc.",Company
63
+ InnoServ Technologies,Company
64
+ SpectraCair,Company
65
+ Cost Containment Pressures,RiskFactor
66
+ IEC Electronics Corp.,Company
67
+ "Calidad Electronics, Inc.",Subsidiary
68
+ "IEC - Edinburg Texas, Inc.",Subsidiary
69
+ "Accutek, Inc.",Subsidiary
70
+ IEC Arab Alabama Inc.,Subsidiary
71
+ IEC Electronics - Ireland Limited,Subsidiary
72
+ Compaq Computer Corporation,Company
73
+ "Matrox Graphics, Inc.",Company
74
+ "Symbol Techologies, Inc.",Company
75
+ Stratus Corporation,Company
76
+ "Seagate Techologies,Inc",Company
77
+ "MEDIQ/PRN Life Support Services, Inc.",Company
78
+ MEDIQ Incorporated,Company
79
+ "MEDIQ Management Services, Inc.",Subsidiary
80
+ MQ Acquisition Corporation,Company
81
+ "Bruckmann, Rosser, Sherrill & Co., L.P.",Company
82
+ Ferrer Freeman Thompson & Co. LLC,Company
83
+ "Galen Partners, III L.P.",Company
84
+ SpectraCair,Subsidiary
85
+ "CH Industries, Inc.",Company
86
+ "CH Medical, Inc.",Subsidiary
87
+ "National Patient Care Systems, Inc.",Company
88
+ Increasing pressure to reduce operating costs and capital expenditures,RiskFactor
89
+ Cost containment pressures on health care providers,RiskFactor
90
+ Reduced reimbursement levels by Medicare and other third-party payors,RiskFactor
91
+ Legislative proposals leading to health care consolidations and managed care acceleration,RiskFactor
92
+ INTERSTATE JOHNSON LANE INC.,Company
93
+ CapTrust,Subsidiary
94
+ Highly Competitive Environment,RiskFactor
95
+ Marketplace Trading Volumes Volatility,RiskFactor
96
+ Interest Rate Conditions Volatility,RiskFactor
97
+ Revenue and Earnings Variability,RiskFactor
98
+ Significant Incremental Cash Requirements,RiskFactor
99
+ "Regulatory Liquidity and Capital Requirements (SEC, CFTC, NYSE)",RiskFactor
100
+ "Regulatory Liquidity and Capital Requirements (SEC, NASD)",RiskFactor
101
+ Year 2000 Technological Challenge,RiskFactor
102
+ Dependence on Third-Party Systems for Year 2000 Compliance,RiskFactor
103
+ Inflationary Effects,RiskFactor
104
+ "Flanigan's Enterprises, Inc.",Company
105
+ "Flanigan's Management Services, Inc.",Subsidiary
106
+ "Flanigan's Enterprises, Inc. of Georgia",Subsidiary
107
+ Seventh Street Corp.,Subsidiary
108
+ Big Daddy's #48 Inc.,Subsidiary
109
+ "Flanigan's Enterprises, Inc. of Pa.",Subsidiary
110
+ Bankruptcy,RiskFactor
111
+ Chairman of the Board,Executive
112
+ Subchapter S corporation (franchisee),Company
113
+ TCI INTERNATIONAL INC.,Company
114
+ Broadcast and Communications Division,Subsidiary
115
+ Signal Processing Division,Subsidiary
116
+ Test and Measurement Division,Subsidiary
117
+ Hewlett Packard,Company
118
+ Foreign Competitors,Company
119
+ Potential Loss from Operations in Fiscal 1999,RiskFactor
120
+ Contract Termination Risk,RiskFactor
121
+ Reduced US Government Demand (Post-Cold War),RiskFactor
122
+ "Declining Economies in Asia, Africa, Middle East",RiskFactor
123
+ Strong US Dollar Impacting Competitiveness,RiskFactor
124
+ Delay/Loss of Key Program Awards,RiskFactor
125
+ Delays in System Acceptance due to Customer Turnover,RiskFactor
126
+ Spartech Corporation,Company
127
+ Spartech Plastics,Subsidiary
128
+ Spartech Polycom,Subsidiary
129
+ Spartech Color,Subsidiary
130
+ Spartech Vy-Cal Plastics,Subsidiary
131
+ GenPak,Subsidiary
132
+ Hamelin Industries,Subsidiary
133
+ Spartech Profiles,Subsidiary
134
+ Product Components,Company
135
+ Pawnee Industries,Company
136
+ Portage Industries,Company
137
+ Hamelin Group,Company
138
+ Preferred Plastic Sheet Division of Echlin Inc.,Company
139
+ Echlin Inc.,Company
140
+ "Polycom Huntsman, Inc.",Company
141
+ "Prismaplast Canada, Ltd.",Company
142
+ "Anjac-Doron Plastics, Inc.",Company
143
+ "CMG Information Services, Inc.",Company
144
+ ADSmart Corporation,Subsidiary
145
+ "Engage Technologies, Inc.",Subsidiary
146
+ "Accipiter, Inc.",Subsidiary
147
+ InfoMation Publishing Corporation,Subsidiary
148
+ NaviSite Internet Services Corporation,Subsidiary
149
+ Planet Direct Corporation,Subsidiary
150
+ Password Internet Publishing Corporation,Subsidiary
151
+ "Magnitude Network, LLC",Company
152
+ "Open Market, Inc.",Company
153
+ NaviNet,Subsidiary
154
+ "CMG@Ventures I, LLC",Subsidiary
155
+ "Blaxxun Interactive, Inc.",Company
156
+ GeoCities,Company
157
+ "Lycos, Inc.",Company
158
+ Parable LLC,Company
159
+ Vicinity Corporation,Company
160
+ "CMG@Ventures II, LLC",Subsidiary
161
+ Chemdex Corporation,Company
162
+ Critical Path,Company
163
+ "KOZ, Inc.",Company
164
+ "Mother Nature's General Store, Inc.",Company
165
+ "Reel.com, Inc.",Company
166
+ "Sage Enterprises, Inc.",Company
167
+ "Silknet Software, Inc.",Company
168
+ "Softway Systems, Inc.",Company
169
+ Speech Machines plc,Company
170
+ TicketsLive Corporation,Company
171
+ Universal Learning Technology,Company
172
+ Visto Corporation,Company
173
+ "Amazon.com, Inc.",Company
174
+ Hollywood Entertainment Corporation,Company
175
+ "CMG@Ventures III, LLC",Subsidiary
176
+ "@Ventures III, L.P.",Company
177
+ SalesLink Corporation,Subsidiary
178
+ InSolutions Incorporated,Subsidiary
179
+ "On-Demand Solutions, Inc.",Subsidiary
180
+ Pacific Direct Marketing Corporation,Subsidiary
181
+ CMG Direct Corporation,Subsidiary
182
+ "Red Brick Systems, Inc.",Company
183
+ Salex Holding Corporation,Company
184
+ "Sun Associates, LLC",Company
185
+ Betty Sun,Executive
186
+ Pershing Sun,Executive
187
+ competition in the automobile asset management business,RiskFactor
188
+ inability to obtain additional financing,RiskFactor
189
+ general business and economic conditions,RiskFactor
190
+ PH&H Corp.,Company
191
+ GE Capital,Company
192
+ The Goodyear Tire and Rubber Company,Company
193
+ Jiffy Lube,Company
194
+ Virginia Surety,Company
195
+ Franklin Receivables LLC,Company
196
+ Franklin Auto Trust 1998-1,Company
197
+ The Chase Manhattan Bank,Company
198
+ IEC Electronics Corp.,Company
199
+ "Calidad Electronics, Inc.",Subsidiary
200
+ "IEC - Edinburg Texas, Inc.",Subsidiary
201
+ "Accutek, Inc.",Subsidiary
202
+ IEC Arab Alabama Inc.,Subsidiary
203
+ IEC Electronics - Ireland Limited,Subsidiary
204
+ Ohshima Manufacturing Limited,Company
205
+ Compaq Computer Corporation,Company
206
+ "Matrox Graphics, Inc.",Company
207
+ "Symbol Techologies, Inc.",Company
208
+ Stratus Corporation,Company
209
+ "Seagate Techologies,Inc",Company
210
+ "RICA FOODS, INC.",Company
211
+ Pipasa,Subsidiary
212
+ As de Oros,Subsidiary
213
+ Mr. Calixto Chaves,Executive
214
+ "Inversiones La Ribera, S.A.",Company
215
+ "Comercial Angui, S.A.",Company
216
+ Antonio Echeverria,Executive
217
+ Exchange Rate Risk,RiskFactor
218
+ Foreign Competition,RiskFactor
219
+ Commodity Price Volatility,RiskFactor
220
+ Restaurantes As de Oros,Company
221
+ GLOBAL ENVIRONMENTAL CORP.,Company
222
+ Danzer,Subsidiary
223
+ Duncan-Smith Company,Company
224
+ Fremont Financial Corporation,Company
225
+ Weakened Financial Condition,RiskFactor
226
+ Tighter Credit Terms,RiskFactor
227
+ Need for Capital Infusion,RiskFactor
228
+ Dependency on Future Success,RiskFactor
229
+ Year 2000 Problem,RiskFactor
230
+ Major Service Provider System Failure,RiskFactor
231
+ MATLACK SYSTEMS INC.,Company
232
+ Qualcomm,Company
233
+ Comdata,Company
234
+ Chemical Manufacturers Association,Company
235
+ Competitive Labor Environment,RiskFactor
236
+ Increased Environmental Compliance Costs,RiskFactor
237
+ Legal Action Settlement,RiskFactor
238
+ Potential Change in Ownership,RiskFactor
239
+ High Debt Levels,RiskFactor
240
+ Declining Demand for Transport,RiskFactor
241
+ General Economic Conditions,RiskFactor
242
+ Competitive Pressures,RiskFactor
243
+ Market Demand Shifts,RiskFactor
244
+ Industry Performance and Needs,RiskFactor
245
+ Equipment Utilization Challenges,RiskFactor
246
+ New Service Development Risk,RiskFactor
247
+ Increased Labor Costs,RiskFactor
248
+ Increased Operating Costs,RiskFactor
249
+ Litigation Uncertainties,RiskFactor
250
+ Financing Risk,RiskFactor
251
+ Insurance Availability Risk,RiskFactor
252
+ Project Completion Risk,RiskFactor
253
+ Management Retention Risk,RiskFactor
254
+ Regulatory Changes,RiskFactor
255
+ Y2K Compliance Risk,RiskFactor
256
+ Satellite System Failure,RiskFactor
257
+ Business Partner Y2K Compliance Risk,RiskFactor
258
+ First Golden American Life Insurance Co of New York,Subsidiary
259
+ Equitable of Iowa Companies,Company
260
+ "PFHI Holdings, Inc.",Subsidiary
261
+ ING Groep N.V.,Company
262
+ Equitable Life Insurance Company of Iowa,Subsidiary
263
+ Golden American,Subsidiary
264
+ "Locust Street Securities, Inc.",Subsidiary
265
+ "Equitable Investment Services, Inc.",Subsidiary
266
+ "Directed Services, Inc.",Subsidiary
267
+ Equitable of Iowa Companies Capital Trust,Subsidiary
268
+ Equitable of Iowa Companies Capital Trust II,Subsidiary
269
+ "Equitable of Iowa Securities Network, Inc.",Subsidiary
270
+ "Equitable of Iowa Companies, Inc.",Subsidiary
271
+ Discontinuation of sales relationship by significant distributor,RiskFactor
272
+ Changes in acquisition cost allocation,RiskFactor
273
+ Impairment of goodwill,RiskFactor
274
+ Variability in amortization based on allocation and assumptions,RiskFactor
275
+ Risk of loss from below investment grade securities,RiskFactor
276
+ Sensitivity of below investment grade securities to adverse economic conditions,RiskFactor
277
+ Future write-downs of securities,RiskFactor
278
+ Material adverse effect on net income from significant write-downs,RiskFactor
279
+ IEC Electronics Corp.,Company
280
+ "IEC - Edinburg Texas, Inc.",Subsidiary
281
+ IEC Arab Alabama Inc.,Subsidiary
282
+ IEC Electronics - Ireland Limited,Subsidiary
283
+ Compaq Computer Corporation,Company
284
+ "Matrox Graphics, Inc.",Company
285
+ "Symbol Techologies, Inc.",Company
286
+ Stratus Corporation,Company
287
+ "Seagate Techologies,Inc",Company
288
+ Ohshima Manufacturing Limited,Company
289
+ RESOURCE AMERICA INC.,Company
290
+ Resource Asset Investment Trust,Company
291
+ "The Atlas Group, Inc.",Subsidiary
292
+ "Hynes & Howes Insurance Counselors, Inc.",Company
293
+ Highly Competitive Market,RiskFactor
294
+ Ralph Parry Insurance Agency Ltd.,Company
295
+ Davenport Agency,Subsidiary
296
+ Viking Agency,Company
297
+ "Hansen and Hansen, Inc.",Company
298
+ "R.A.P. Enterprises, Inc.",Company
299
+ Ralph A. Parry,Executive
300
+ Low Liquidity,RiskFactor
301
+ Decreased Operating Income,RiskFactor
302
+ VSI HOLDINGS INC.,Company
303
+ The Performance Systems Group,Subsidiary
304
+ Martin S. Suchik,Executive
305
+ "Advanced Animations, Inc.",Subsidiary
306
+ "Steve Toth, Jr.",Executive
307
+ "BKNT Retail Stores, Inc.",Subsidiary
308
+ "Vispac, Inc.",Subsidiary
309
+ "Visual Services, Inc.",Subsidiary
310
+ Ford Motor Company,Company
311
+ General Motors,Company
312
+ Nissan,Company
313
+ Difficulty in recruiting qualified employees,RiskFactor
314
+ Loss of major customers,RiskFactor
315
+ Uncertainty of continued customer relationships,RiskFactor
316
+ Irvine Sensors Corporation,Company
317
+ "Novalog, Inc.",Subsidiary
318
+ "MicroSensors, Inc.",Subsidiary
319
+ "Imagek, Inc.",Subsidiary
320
+ IBM,Company
321
+ Infrared Data Association,Company
322
+ SRI Consulting,Company
323
+ "EG&G Astrophysics, Inc.",Company
324
+ Boeing Corporation,Company
325
+ R & D Leasing Ltd.,Company
326
+ Uncertainty of Imagek financing,RiskFactor
327
+ Uncertainty of widespread market success for stacked memory products,RiskFactor
328
+ Cost disadvantage due to unestablished high volume production costs,RiskFactor
329
+ Uncertainty of neural network chip set development success,RiskFactor
330
+ Uncertainty of NeoStack commercialization timeline,RiskFactor
331
+ "General DataComm Industries, Inc.",Company
332
+ VITAL Network Services LLC,Subsidiary
333
+ Bell Canada,Company
334
+ GTE,Company
335
+ Cignal Global Communications,Company
336
+ AT&T,Company
337
+ MCI,Company
338
+ Sprint,Company
339
+ American Airlines,Company
340
+ Citicorp,Company
341
+ EDS,Company
342
+ Cemex,Company
343
+ Chicago Board of Trade,Company
344
+ Impsat,Company
345
+ Telefonos de Mexico,Company
346
+ France Telecom,Company
347
+ Deutsche Telekom,Company
348
+ Lucent Technologies,Company
349
+ LM Ericsson,Company
350
+ Austrian PTT,Company
351
+ Mayo Clinic,Company
352
+ Burlington Northern Santa Fe,Company
353
+ Netherlands PTT,Company
354
+ Telefonica de Espana,Company
355
+ Telia,Company
356
+ RADIATION DISPOSAL SYSTEMS INC.,Company
357
+ Manuel E. Kane,Executive
358
+ Albert D. Kane,Executive
359
+ Ultrox International,Company
360
+ Para Oxidation,Company
361
+ PCI Ozone Corporation,Company
362
+ "Griffin Technics, Inc.",Company
363
+ Henkel Corporation,Company
364
+ "Brown-Bovari, Inc.",Company
365
+ "Steven M. Kane, Inc.",Company
366
+ Steven Kane,Executive
367
+ "Pillar Technologies, Inc.",Company
368
+ "Gram Research & Development Co., Inc.",Company
369
+ Sherman T. Mayne,Executive
370
+ Inability to Market Products,RiskFactor
371
+ Lack of Significant Revenues,RiskFactor
372
+ Cessation of Operations,RiskFactor
373
+ Lack of Working Capital and Revenue Prospects,RiskFactor
374
+ Uncertainty of Future Operations,RiskFactor
375
+ Limited Market Acceptance of Ozone Technology,RiskFactor
376
+ Undeveloped Market for Waste Treatment Technology,RiskFactor
377
+ Competition from Established Firms,RiskFactor
378
+ Negligible Market Position,RiskFactor
379
+ Ineffective Sales Agreements,RiskFactor
380
+ Inactive Marketing Efforts,RiskFactor
381
+ Insufficient Production Personnel,RiskFactor
382
+ Supplier Dependence and Production Delays,RiskFactor
383
+ Single Source Supplier Dependence (Pillar),RiskFactor
384
+ Lapse of Patents due to Insufficient Funds,RiskFactor
385
+ Burdensome Environmental Regulations,RiskFactor
386
+ High Cost of Radioactive Waste Disposal,RiskFactor
387
+ Uneconomical Process,RiskFactor
388
+ Costly Regulatory Modifications and Insufficient Funds,RiskFactor
389
+ Future Adverse Government Regulations,RiskFactor
390
+ "Royal Palm Beach Colony, Limited Partnership",Company
391
+ "Royal Palm Beach Colony, Inc.",Company
392
+ "Regency Homes, Inc.",Company
393
+ RTL Realty,Company
394
+ "Stein Management Company, Inc.",Company
395
+ Hasam Realty Limited Partnership,Company
396
+ Union Bank,Company
397
+ Randy Rieger,Executive
398
+ Jack Friedland,Executive
399
+ Uncertainty of future cash distribution,RiskFactor
400
+ Reduction in sales revenues,RiskFactor
401
+ Cash requirements for land development,RiskFactor
402
+ Cash expenditures for transactions and operations,RiskFactor
403
+ Bank financing repayment obligations,RiskFactor
404
+ Increased cost due to regulatory changes,RiskFactor
405
+ Highly competitive real estate market,RiskFactor
406
+ Competition affecting property sales,RiskFactor
407
+ Cyclical real estate market,RiskFactor
408
+ Interest rate increases,RiskFactor
409
+ Uncertain South Florida real estate market conditions,RiskFactor
410
+ Competition from other developers in South Florida,RiskFactor
411
+ Litigation over building permits,RiskFactor
412
+ Contingent land sales,RiskFactor
413
+ "Mesa Air Group, Inc.",Company
414
+ "Mesa Airlines, Inc.",Subsidiary
415
+ "America West Airlines, Inc.",Company
416
+ "USAirways, Inc.",Company
417
+ "Air Midwest, Inc.",Subsidiary
418
+ "WestAir Holdings, Inc.",Subsidiary
419
+ "WestAir Commuter Airlines, Inc.",Subsidiary
420
+ "MPD, Inc.",Subsidiary
421
+ "Regional Aircraft Services, Inc.",Subsidiary
422
+ "FCA, Inc.",Subsidiary
423
+ "Mesa Leasing, Inc.",Subsidiary
424
+ "MAGI Insurance, Ltd.",Subsidiary
425
+ "CCAIR, Inc.",Company
426
+ Termination of Code-Sharing Agreements,RiskFactor
427
+ Great Lakes Aviation,Company
428
+ SkyWest Airlines,Company
429
+ United Airlines,Company
430
+ "Tidel Technologies, Inc.",Company
431
+ "Tidel Engineering, Inc.",Company
432
+ 3CI Complete Compliance Corporation,Subsidiary
433
+ "Diebold, Incorporated",Company
434
+ NCR Corporation,Company
435
+ "Triton Systems, Inc.",Company
436
+ Fujitsu Corporation,Company
437
+ Siemens-Nixdorf,Company
438
+ NKL Industries,Company
439
+ McGunn Safe Company,Company
440
+ Armor Safe Company,Company
441
+ AutoVend,Company
442
+ Inadequate Patent Protection,RiskFactor
443
+ Patent Challenge Risk,RiskFactor
444
+ Patent Infringement Risk,RiskFactor
445
+ Third-Party Patent Rights Impact,RiskFactor
446
+ Competitor Patent Acquisition,RiskFactor
447
+ Trade Secret Loss,RiskFactor
448
+ 3CI Complete Compliance Corporation,Company
449
+ "Springhill, Louisiana Facility",Company
450
+ "Birmingham, Alabama Location",Company
451
+ "Austin, Texas Facility",Company
452
+ "City of Carthage, Texas",Company
453
+ "City of Center, Texas",Company
454
+ Technological Obsolescence,RiskFactor
455
+ "Diasense, Inc.",Company
456
+ "Biocontrol Technology, Inc.",Company
457
+ U.S. Food and Drug Administration,Company
458
+ Battelle Memorial Institute,Company
459
+ TUV Rheinland,Company
460
+ Children's Hospital,Company
461
+ Rush North Shore,Company
462
+ Westmoreland Hospital,Company
463
+ Lutheran General Hospital,Company
464
+ Holy Family Hospital,Company
465
+ Indiana Hospital,Company
466
+ European Community,Company
467
+ European Committee for Standardization,Company
468
+ Delays in FDA Marketing Approval,RiskFactor
469
+ Uncertainty of Future Funding,RiskFactor
470
+ "Reliance on Biocontrol Technology, Inc.",RiskFactor
471
+ Competition and Product Obsolescence,RiskFactor
472
+ Dependence on Single Technology,RiskFactor
473
+ Continued Operating Losses and Negative Net Worth,RiskFactor
474
+ Potential Conflicts of Interest,RiskFactor
475
+ "Risks to Patents, Trademarks, and Licenses",RiskFactor
476
+ Uncertainty of Third-Party Payor Reimbursement,RiskFactor
477
+ "Limited Sales, Marketing, and Manufacturing Experience",RiskFactor
478
+ Difficulty Attracting and Retaining Key Employees,RiskFactor
479
+ Product Liability,RiskFactor
480
+ Uncertain Outcome of Pending Lawsuits,RiskFactor
481
+ Absence of Public Market for Common Stock,RiskFactor
482
+ Control by Existing Shareholders,RiskFactor
483
+ Dilution of Common Stock,RiskFactor
484
+ Limited Marketability of Diasensorr 1000,RiskFactor
485
+ Cash Flow Problems,RiskFactor
486
+ Slowed Testing Pace,RiskFactor
487
+ Necessity of FDA Approval for US Market,RiskFactor
488
+ Regulatory Process for Diasensorr 2000,RiskFactor
489
+ High Sales Price Limiting Sales,RiskFactor
490
+ STARCRAFT CORP /IN/,Company
491
+ "Imperial Automotive Group, Inc.",Subsidiary
492
+ National Mobility Corporation,Subsidiary
493
+ "Tecstar, Inc.",Company
494
+ "Starcraft Automotive Group, Inc.",Subsidiary
495
+ "Imperial Industries, Inc.",Company
496
+ Star Tank Company,Company
497
+ Starcraft Van Conversions Corporation,Company
498
+ GMC Truck,Company
499
+ Chevrolet,Company
500
+ Dodge,Company
501
+ Ford,Company
502
+ General Motors,Company
503
+ "Mitsui and Co. (U.S.A.), Inc.",Company
504
+ Increased popularity of SUVs and factory minivans,RiskFactor
505
+ Price pressure from higher chassis costs,RiskFactor
506
+ Lower conversion inventory on dealer lots,RiskFactor
507
+ Fewer automotive dealers selling conversion products,RiskFactor
508
+ Changing level of dealer support,RiskFactor
509
+ Strengthening of the U.S. dollar,RiskFactor
510
+ Financial turmoil in Asian markets,RiskFactor
511
+ Cyclical nature of the conversion industry,RiskFactor
512
+ Consumer preferences for sport utility vehicles,RiskFactor
513
+ Level of disposable consumer income,RiskFactor
514
+ Availability and price of gasoline,RiskFactor
515
+ Level of interest rates and availability of consumer financing,RiskFactor
516
+ Decline in general economic conditions or consumer confidence,RiskFactor
517
+ Dependence on OEMs for vehicle chassis,RiskFactor
518
+ Decline in the conversion industry and Company sales,RiskFactor
519
+ "CMG Information Services, Inc.",Company
520
+ ADSmart Corporation,Subsidiary
521
+ "Engage Technologies, Inc.",Subsidiary
522
+ "Accipiter, Inc.",Subsidiary
523
+ InfoMation Publishing Corporation,Subsidiary
524
+ NaviSite Internet Services Corporation,Subsidiary
525
+ Planet Direct Corporation,Subsidiary
526
+ Password Internet Publishing Corporation,Subsidiary
527
+ "Magnitude Network, LLC",Company
528
+ "Open Market, Inc.",Company
529
+ "CMG@Ventures I, LLC",Subsidiary
530
+ "Blaxxun Interactive, Inc.",Company
531
+ GeoCities,Company
532
+ "Lycos, Inc.",Company
533
+ Parable LLC,Company
534
+ Vicinity Corporation,Company
535
+ "CMG@Ventures II, LLC",Subsidiary
536
+ Chemdex Corporation,Company
537
+ Critical Path,Company
538
+ "KOZ, Inc.",Company
539
+ "Mother Nature's General Store, Inc.",Company
540
+ "Reel.com, Inc.",Company
541
+ "Sage Enterprises, Inc.",Company
542
+ "Silknet Software, Inc.",Company
543
+ "Softway Systems, Inc.",Company
544
+ Speech Machines plc,Company
545
+ TicketsLive Corporation,Company
546
+ Universal Learning Technology,Company
547
+ Visto Corporation,Company
548
+ "CMG@Ventures III, LLC",Subsidiary
549
+ "@Ventures III, L.P.",Company
550
+ SalesLink Corporation,Subsidiary
551
+ InSolutions Incorporated,Subsidiary
552
+ "On-Demand Solutions, Inc.",Subsidiary
553
+ Pacific Direct Marketing Corporation,Subsidiary
554
+ CMG Direct Corporation,Subsidiary
555
+ NaviNet,Subsidiary
556
+ Covol Technologies Inc.,Company
557
+ "Cynsulo, Inc.",Company
558
+ McParkland Corporation,Company
559
+ "McParkland Properties, Inc.",Company
560
+ "Riverbed Enterprises, Inc.",Company
561
+ Enviro-Fuels Technology,Company
562
+ Environmental Technologies Group International,Company
563
+ Dow Chemical Company,Company
564
+ Inability to implement applications profitably,RiskFactor
565
+ Inability to utilize tax benefits,RiskFactor
566
+ Feedstock supply risk,RiskFactor
567
+ Production quality risk,RiskFactor
568
+ Product marketing risk,RiskFactor
569
+ "Lynton Group, Inc.",Company
570
+ "Ramapo Helicopters, Inc.",Subsidiary
571
+ "Lynton Aircraft Maintenance Services, Inc.",Subsidiary
572
+ "Rockland Aviation, Inc.",Subsidiary
573
+ "Lynton Aviation Charter, Inc.",Subsidiary
574
+ "LynStar Aviation, Inc.",Subsidiary
575
+ "LynStar Holdings, Inc.",Company
576
+ Lynton Group Limited,Subsidiary
577
+ Lynton Aviation Limited,Subsidiary
578
+ European Helicopters Limited,Subsidiary
579
+ Magec Aviation Limited,Subsidiary
580
+ Air Hanson Limited,Subsidiary
581
+ "Lynton Jet Centre, Inc.",Subsidiary
582
+ "Lynton Aviation, Inc.",Subsidiary
583
+ "Lynton Aviation Services, Inc.",Subsidiary
584
+ Dollar Air Services Limited,Subsidiary
585
+ Black Isle Helicopters Limited,Subsidiary
586
+ "Lynton Properties, Inc.",Subsidiary
587
+ PLM Dollar Group Limited,Company
588
+ Air Hanson Engineering Limited,Subsidiary
589
+ Air Hanson Aircraft Sales Limited,Subsidiary
590
+ Loss of CAA/Manufacturer Certificates/Licenses for EHL/Air Hanson Engineering,RiskFactor
591
+ Loss of CAA/Manufacturer Certificates/Licenses for Magec,RiskFactor
592
+ "General Automation, Inc.",Company
593
+ General Automation LLC,Subsidiary
594
+ General Automation Canada Subsidiary,Subsidiary
595
+ General Automation Australia Subsidiary,Subsidiary
596
+ General Automation UK Subsidiary,Subsidiary
597
+ "Texas Micro, Inc.",Company
598
+ "Sequoia Systems, Inc.",Company
599
+ Boundless Technologies,Company
600
+ SunRiver Data Systems,Company
601
+ Comerica Bank,Company
602
+ Wang,Company
603
+ AT&T,Company
604
+ IBM,Company
605
+ Data General Corporation,Company
606
+ Digital Equipment Corporation,Company
607
+ Hewlett Packard Company,Company
608
+ Ardent,Company
609
+ Pick Systems,Company
610
+ "Microsoft, Inc.",Company
611
+ Going Concern Qualification,RiskFactor
612
+ Recent Operating Losses,RiskFactor
613
+ Deficit Net Worth,RiskFactor
614
+ Working Capital Deficiency,RiskFactor
615
+ Cash Flow Constraints,RiskFactor
616
+ Obligations to TMI in Default,RiskFactor
617
+ Obligations to Boundless in Default,RiskFactor
618
+ Limited Market for the Company's Stock,RiskFactor
619
+ Competition Risk,RiskFactor
620
+ RCM TECHNOLOGIES INC.,Company
621
+ The Consortium,Subsidiary
622
+ "The Consortium of Maryland, Inc.",Subsidiary
623
+ "Performance Staffing, Inc.",Subsidiary
624
+ "Programming Alternatives of Minnesota, Inc.",Subsidiary
625
+ "Biomune Systems, Inc.",Company
626
+ "Optim Nutrition, Inc.",Subsidiary
627
+ "Rockwood Companies, LLC",Subsidiary
628
+ Bioxide Corporation,Company
629
+ "Frank A. Eldredge, Ph.D.",Executive
630
+ "David O. Lucas, Ph.D.",Executive
631
+ "Craig D. Moffat, M.D.",Executive
632
+ Clinimetric Research Associates,Company
633
+ St. Francis Memorial Hospital,Company
634
+ East Bay AIDS Clinic,Company
635
+ St. Lukes-Roosevelt Hospital Center,Company
636
+ Associates in Medical and Mental Health,Company
637
+ Limited access to funding for future research and development,RiskFactor
638
+ Highly competitive market for nutrition supplements,RiskFactor
639
+ Limited financial resources,RiskFactor
640
+ Risk of reduced ownership interest in Rockwood due to unfulfilled loan covenants,RiskFactor
641
+ Inability to obtain additional financing,RiskFactor
642
+ Inability to increase product sales,RiskFactor
643
+ NORTH EUROPEAN OIL ROYALTY TRUST,Company
644
+ Mobil Corp.,Company
645
+ Exxon Corp.,Company
646
+ Royal Dutch Group,Company
647
+ North European Oil Company,Company
648
+ North European Oil Corporation,Company
649
+ John H. Van Kirk,Executive
650
+ John R. Van Kirk,Executive
651
+ BEB,Company
652
+ Mobil (German Operating Company),Subsidiary
653
+ German Subsidiaries of Exxon Corp.,Subsidiary
654
+ German Subsidiaries of Royal Dutch Group,Subsidiary
655
+ The Bank of New York,Company
656
+ Deutsche Bank,Company
657
+ Registrar and Transfer Company,Company
658
+ Termination of Royalty Rights,RiskFactor
659
+ Speculative Business,RiskFactor
660
+ Uncertainty of Future Income,RiskFactor
661
+ Fluctuations in Gas and Oil Prices/Supplies,RiskFactor
662
+ Environmental Regulations Impact,RiskFactor
663
+ Unforeseeable Economic and Political Factors,RiskFactor
664
+ Currency Exchange Rate Fluctuations,RiskFactor
665
+ Y2K Computer Compliance Issues,RiskFactor
666
+ Celsion Corporation,Company
667
+ Massachusetts Institute of Technology,Company
668
+ Food and Drug Administration,Company
669
+ Massachusetts General Hospital,Company
670
+ Oxford University,Company
671
+ Hammersmith Hospital,Company
672
+ Dr. Gerald Wolf,Executive
673
+ Columbia HCA's JFK Hospital,Company
674
+ Duke University,Company
675
+ "MMTC, Inc.",Company
676
+ American Cancer Society,Company
677
+ Difficulty delivering controlled heat without burning healthy tissue,RiskFactor
678
+ Need for new FDA indication for breast tumor ablation,RiskFactor
679
+ Pentech International Inc.,Company
680
+ Sawdust Pencil Co.,Subsidiary
681
+ Bic Pen Company,Company
682
+ Papermate,Company
683
+ "RoseArt Industries, Inc.",Company
684
+ Newell,Company
685
+ Product Shortages,RiskFactor
686
+ Dumping Duties,RiskFactor
687
+ Increased Raw Material Costs,RiskFactor
688
+ Increased Dumping Duties,RiskFactor
689
+ Minimum Royalty Payments Leading to Losses,RiskFactor
690
+ Loss of Major Customer,RiskFactor
691
+ Bad Debts from Customers,RiskFactor
692
+ Failure to Register Trademarks,RiskFactor
693
+ Intense Competition,RiskFactor