docs: elaborate README with sources, schema, ingestion pipeline, namespace breakdown, and library hyperlinks
Browse files
README.md
CHANGED
|
@@ -1,59 +1,234 @@
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
- en
|
|
|
|
| 4 |
tags:
|
| 5 |
- rag
|
| 6 |
- retrieval
|
| 7 |
- technical-docs
|
| 8 |
- programming
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
size_categories:
|
| 10 |
- 100K<n<1M
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# depthapi_technical_corpus
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
## Ingestion
|
| 20 |
|
| 21 |
-
The corpus was assembled from multiple upstream source types and normalized through a reproducible local pipeline backed by Supabase.
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
- [
|
| 26 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
## Schema
|
| 29 |
|
| 30 |
-
Each
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
-
|
| 33 |
-
- `source`
|
| 34 |
-
- `source_url`
|
| 35 |
-
- `upstream_license`
|
| 36 |
-
- `document_id`
|
| 37 |
-
- `chunk_index`
|
| 38 |
-
- `retrieved_at`
|
| 39 |
-
- `chunker_version`
|
| 40 |
-
- `content_hash`
|
| 41 |
-
- `content`
|
| 42 |
|
| 43 |
## Usage
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
```python
|
| 46 |
from datasets import load_dataset
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
```
|
| 52 |
|
| 53 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
|
| 57 |
## Licensing
|
| 58 |
|
| 59 |
-
This is a mixed-license dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
+
license: other
|
| 5 |
tags:
|
| 6 |
- rag
|
| 7 |
- retrieval
|
| 8 |
- technical-docs
|
| 9 |
- programming
|
| 10 |
+
- code
|
| 11 |
+
- computer-science
|
| 12 |
+
- embeddings
|
| 13 |
+
- chunked
|
| 14 |
size_categories:
|
| 15 |
- 100K<n<1M
|
| 16 |
+
pretty_name: DepthAPI Technical Corpus
|
| 17 |
+
dataset_info:
|
| 18 |
+
features:
|
| 19 |
+
- name: chunk_id
|
| 20 |
+
dtype: string
|
| 21 |
+
- name: source_name
|
| 22 |
+
dtype: string
|
| 23 |
+
- name: source_url
|
| 24 |
+
dtype: string
|
| 25 |
+
- name: namespace
|
| 26 |
+
dtype: string
|
| 27 |
+
- name: upstream_license
|
| 28 |
+
dtype: string
|
| 29 |
+
- name: document_id
|
| 30 |
+
dtype: string
|
| 31 |
+
- name: chunk_index
|
| 32 |
+
dtype: int64
|
| 33 |
+
- name: content_hash
|
| 34 |
+
dtype: string
|
| 35 |
+
- name: content
|
| 36 |
+
dtype: string
|
| 37 |
+
- name: token_count
|
| 38 |
+
dtype: int64
|
| 39 |
+
- name: chunker_version
|
| 40 |
+
dtype: string
|
| 41 |
+
- name: retrieved_at
|
| 42 |
+
dtype: string
|
| 43 |
+
splits:
|
| 44 |
+
- name: train
|
| 45 |
+
num_examples: 260954
|
| 46 |
---
|
| 47 |
|
| 48 |
# depthapi_technical_corpus
|
| 49 |
|
| 50 |
+
**260,954 chunks** of curated technical knowledge, purpose-built for hybrid RAG systems, embedding benchmarks, reranker evaluation, and coding agent retrieval experiments.
|
| 51 |
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## Overview
|
| 55 |
+
|
| 56 |
+
`depthapi_technical_corpus` is a mixed-license retrieval corpus assembled from technical books, engineering documentation, system design references, coding interview prep material, and post-mortem writeups. It is the backing knowledge store for the [DepthAPI](https://github.com/sanjeevafk/depthapi) hybrid RAG pipeline.
|
| 57 |
+
|
| 58 |
+
The corpus is organized into **namespaces** that map to distinct retrieval modes, allowing downstream systems to scope queries to relevant knowledge domains.
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## Data Sources
|
| 63 |
+
|
| 64 |
+
| Source | Type | Namespace | License |
|
| 65 |
+
|--------|------|-----------|---------|
|
| 66 |
+
| Deep Learning with Python (Chollet) | Book | `default` | Manning fair-use |
|
| 67 |
+
| Designing Data-Intensive Applications (Kleppmann) | Book | `default` | O'Reilly fair-use |
|
| 68 |
+
| System Design resources | Docs / Markdown | `default` | Mixed / CC |
|
| 69 |
+
| CPython Documentation | Official Docs | `default` | PSF-2.0 |
|
| 70 |
+
| Engineering post-mortems | Blog / Web | `default` | CC-BY / Mixed |
|
| 71 |
+
| [Coding Interview University – Cheat Sheets](https://github.com/jwasham/coding-interview-university) | PDF Cheat Sheets | `cs_fundamentals_knowledgeset` | CC BY-SA 4.0 |
|
| 72 |
+
|
| 73 |
+
> ⚠️ This is a **mixed-license dataset**. Downstream users must inspect the `upstream_license` field and `SOURCES_MANIFEST.yaml` before redistribution or commercial use.
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## Namespaces
|
| 78 |
+
|
| 79 |
+
Namespaces act as logical partitions for routing retrieval queries. Each namespace is designed for a different knowledge vertical:
|
| 80 |
+
|
| 81 |
+
| Namespace | Purpose | Approx. Chunks |
|
| 82 |
+
|-----------|---------|----------------|
|
| 83 |
+
| `default` | General ML, systems, engineering, and coding knowledge | ~259,800 |
|
| 84 |
+
| `cs_fundamentals_knowledgeset` | CS fundamentals — DS&A, Big-O, OOP, STL, OS, design patterns | ~1,145 |
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
|
| 88 |
+
## Ingestion Pipeline
|
| 89 |
|
| 90 |
+
The corpus was assembled from multiple upstream source types and normalized through a reproducible local pipeline backed by [Supabase](https://supabase.com) with pgvector.
|
| 91 |
|
| 92 |
+
### Tools Used
|
| 93 |
+
|
| 94 |
+
- **[Scrapling](https://github.com/D4Vinci/Scrapling)** — Stealth web crawler used for live documentation scraping and structured HTML extraction. Handles anti-bot mechanisms and extracts clean text from technical documentation sites.
|
| 95 |
+
- **[opendataloader-pdf](https://github.com/opendataloader-project/opendataloader-pdf)** — PDF-to-Markdown conversion library used for extracting content from book-like and document-style PDF sources. Outputs clean Markdown blocks with layout awareness.
|
| 96 |
+
|
| 97 |
+
### Processing Steps
|
| 98 |
+
|
| 99 |
+
1. **Extraction** — Raw content pulled from upstream sources via Scrapling (web) or `opendataloader_pdf.convert()` (PDF).
|
| 100 |
+
2. **Noise filtering** — OCR artifacts, page numbers, and garbled text filtered via regex heuristics before chunking.
|
| 101 |
+
3. **Chunking** — Text split semantically via `BaseIngestor.split_text_semantic(chunk_size=800)` with configurable overlap.
|
| 102 |
+
4. **Deduplication** — SHA-256 content hash (`content_hash`) deduplication. Duplicate chunks are skipped on upsert.
|
| 103 |
+
5. **Validation** — Minimum token count and quality threshold enforced before persistence.
|
| 104 |
+
6. **Persistence** — Chunks stored in local Supabase `knowledge_chunks` table with full metadata columns.
|
| 105 |
+
7. **Embedding backfill** — Dense embeddings computed via `BAAI/bge-base-en-v1.5` (768-dim) and stored in the `embedding` pgvector column.
|
| 106 |
+
8. **Export** — Parquet shards generated via `scripts/release/export_to_hf.py` and published to this repository.
|
| 107 |
+
|
| 108 |
+
---
|
| 109 |
|
| 110 |
## Schema
|
| 111 |
|
| 112 |
+
Each row in the dataset represents one chunk:
|
| 113 |
+
|
| 114 |
+
| Field | Type | Description |
|
| 115 |
+
|-------|------|-------------|
|
| 116 |
+
| `chunk_id` | `string` | UUID primary key |
|
| 117 |
+
| `source_name` | `string` | Human-readable source title (e.g. `"Deep Learning with Python"`) |
|
| 118 |
+
| `source_url` | `string` | Canonical upstream URL for the source document |
|
| 119 |
+
| `namespace` | `string` | Retrieval namespace / knowledge domain |
|
| 120 |
+
| `upstream_license` | `string` | SPDX license identifier or description |
|
| 121 |
+
| `document_id` | `string` | Groups all chunks belonging to the same source document |
|
| 122 |
+
| `chunk_index` | `int` | Ordinal position of chunk within its document |
|
| 123 |
+
| `content_hash` | `string` | SHA-256 of chunk content — used for deduplication |
|
| 124 |
+
| `content` | `string` | The raw chunk text |
|
| 125 |
+
| `token_count` | `int` | Approximate token count (cl100k_base tokenizer) |
|
| 126 |
+
| `chunker_version` | `string` | Version tag of the chunker that produced this chunk |
|
| 127 |
+
| `retrieved_at` | `string` | ISO-8601 timestamp of when the chunk was ingested |
|
| 128 |
|
| 129 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
## Usage
|
| 132 |
|
| 133 |
+
### Load the full dataset
|
| 134 |
+
|
| 135 |
+
```python
|
| 136 |
+
from datasets import load_dataset
|
| 137 |
+
|
| 138 |
+
ds = load_dataset("sanjeevafk/depthapi_technical_corpus", split="train")
|
| 139 |
+
print(ds[0])
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### Stream for large-scale use
|
| 143 |
+
|
| 144 |
+
```python
|
| 145 |
+
from datasets import load_dataset
|
| 146 |
+
|
| 147 |
+
ds = load_dataset(
|
| 148 |
+
"sanjeevafk/depthapi_technical_corpus",
|
| 149 |
+
split="train",
|
| 150 |
+
streaming=True,
|
| 151 |
+
)
|
| 152 |
+
for row in ds.take(5):
|
| 153 |
+
print(row["source_name"], "|", row["namespace"], "|", row["content"][:120])
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
### Filter by namespace
|
| 157 |
+
|
| 158 |
```python
|
| 159 |
from datasets import load_dataset
|
| 160 |
|
| 161 |
+
ds = load_dataset("sanjeevafk/depthapi_technical_corpus", split="train")
|
| 162 |
+
|
| 163 |
+
# Get only CS fundamentals chunks (Coding Interview University cheat sheets)
|
| 164 |
+
cs_chunks = ds.filter(lambda x: x["namespace"] == "cs_fundamentals_knowledgeset")
|
| 165 |
+
print(f"CS fundamentals chunks: {len(cs_chunks)}")
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
### Filter by source
|
| 169 |
+
|
| 170 |
+
```python
|
| 171 |
+
ciu_chunks = ds.filter(
|
| 172 |
+
lambda x: "Coding Interview University" in (x["source_name"] or "")
|
| 173 |
+
)
|
| 174 |
```
|
| 175 |
|
| 176 |
+
### Build a simple BM25 retriever
|
| 177 |
+
|
| 178 |
+
```python
|
| 179 |
+
from datasets import load_dataset
|
| 180 |
+
from rank_bm25 import BM25Okapi
|
| 181 |
+
|
| 182 |
+
ds = load_dataset("sanjeevafk/depthapi_technical_corpus", split="train")
|
| 183 |
+
corpus = [row["content"] for row in ds]
|
| 184 |
+
tokenized = [doc.split() for doc in corpus]
|
| 185 |
+
bm25 = BM25Okapi(tokenized)
|
| 186 |
+
|
| 187 |
+
results = bm25.get_top_n("binary search tree time complexity", corpus, n=5)
|
| 188 |
+
for r in results:
|
| 189 |
+
print(r[:200])
|
| 190 |
+
```
|
| 191 |
|
| 192 |
+
---
|
| 193 |
|
| 194 |
## Licensing
|
| 195 |
|
| 196 |
+
This is a **mixed-license dataset**. Each chunk carries its own `upstream_license` value. Downstream users are responsible for verifying license compatibility before use.
|
| 197 |
+
|
| 198 |
+
| License | Sources |
|
| 199 |
+
|---------|---------|
|
| 200 |
+
| `CC BY-SA 4.0` | Coding Interview University (CIU) cheat sheets |
|
| 201 |
+
| `PSF-2.0` | CPython documentation |
|
| 202 |
+
| Manning fair-use | Deep Learning with Python, DDIA |
|
| 203 |
+
| Mixed / Unknown | Engineering blogs, post-mortems |
|
| 204 |
+
|
| 205 |
+
See `SOURCES_MANIFEST.yaml` (included in this repository) for full per-source provenance.
|
| 206 |
+
|
| 207 |
+
---
|
| 208 |
+
|
| 209 |
+
## Export Workflow
|
| 210 |
+
|
| 211 |
+
This dataset is published from the [DepthAPI](https://github.com/sanjeevafk/depthapi) pipeline using `scripts/release/export_to_hf.py`.
|
| 212 |
+
|
| 213 |
+
**Incremental update** (recommended after new ingestion runs):
|
| 214 |
+
```bash
|
| 215 |
+
python scripts/release/export_to_hf.py \
|
| 216 |
+
--hf-repo-id "sanjeevafk/depthapi_technical_corpus" \
|
| 217 |
+
--append \
|
| 218 |
+
--commit-message "Add <source> chunks"
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
**Full rebuild** (replaces all shards — use after major corpus restructuring):
|
| 222 |
+
```bash
|
| 223 |
+
python scripts/release/export_to_hf.py \
|
| 224 |
+
--hf-repo-id "sanjeevafk/depthapi_technical_corpus" \
|
| 225 |
+
--force-rebuild
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
A watermark is saved after each export to `data/hf_export/last_export_watermark.json`. The `--append` mode reads this to push only net-new chunks.
|
| 229 |
+
|
| 230 |
+
---
|
| 231 |
+
|
| 232 |
+
## Citation
|
| 233 |
+
|
| 234 |
+
If you use this dataset, please cite the upstream sources where applicable. The corpus is provided as-is for research and development use.
|