feat: document-graph — structured data ETL complement to lexical-graph#365
Open
evanerwee wants to merge 5 commits into
Open
feat: document-graph — structured data ETL complement to lexical-graph#365evanerwee wants to merge 5 commits into
evanerwee wants to merge 5 commits into
Conversation
Document-graph extends graphrag-toolkit with typed node support for structured formats (CSV, Excel, JSON, Parquet, XML). It complements lexical-graph by handling deterministic ETL while lexical-graph handles LLM-based extraction. Key features: - Schema providers (CSV, JSON, S3, Static, Glue) with auto-discovery - 20+ transformers (normalizers, field, document, filter, graph, truncators) - Cypher generation with tenant-scoped labels - Query engine for typed node retrieval - Multi-tenancy (same Neptune cluster, isolated by labels) - Hybrid integration: index structured data into lexical-graph for semantic search Coexists with lexical-graph in the same Neptune database: - lexical-graph: unstructured text → Source/Chunk/Topic/Entity - document-graph: structured data → typed nodes (__User__, __Account__, etc.) 59 tests passing. 100% docstring coverage. Sphinx docs included.
- 11 documentation pages (getting-started, lexical-graph-integration, pipeline, ingestors, schema-providers, transformers, graph-build, query-engine, multi-tenancy, examples index, API reference) - 19 tested SageMaker notebooks covering all features - Includes hybrid integration demos (document-graph + lexical-graph)
Two new packages for the graphrag-toolkit, following the existing namespace and packaging pattern (byokg-rag): document-graph: Structured data ingestion into Neptune - Schema-driven pipeline: Extract → Transform → Load → Build - Supports CSV, JSON, Parquet, Excel, XML, YAML - Tenant-scoped labels via lexical-graph's TenantId.format_label() - Batch-optimized Neptune writes (UNWIND) - Plugin system (pluggy-based extension points) - 58 unit tests passing - 24 example notebooks (standalone ETL through hybrid graph) codeproperty-graph: Delta-aware code analysis ingestion - Full Joern CPG schema (20 node types, 14+ edge types, 9 languages) - Delta comparison: skip Neptune writes when code unchanged - S3 manifest-based state tracking - from_joern() factory methods for parsing Joern exports - Built on document-graph (DRY — ~200 lines domain code) - 17 unit tests passing - 2 example notebooks Both packages: - Apache-2.0 licensed - AWS copyright headers on all source files - graphrag_toolkit namespace (shared with lexical-graph, byokg-rag) - No hardcoded account numbers, endpoints, or credentials - CI workflows (license header check + pytest matrix) - docs-site pages (Starlight/Astro MDX) - Registered in root README, examples/README, docs-site index
4 tasks
- cypher_builder.py now uses lexical-graph's TenantId.format_label()
producing backtick-quoted labels (`Label{tenant}__`) consistent
with lexical-graph's format
- Falls back to same format when lexical-graph not installed (standalone ETL)
- Stripped notebook outputs from 11a/11b examples
Addresses feedback from noel-improv on awslabs#356 item 2 (tenant model alignment).
- graph_loader.py: default batch_size 100→500 - delta_ingestor.py: accepts batch_size param, passes to GraphLoader - pyproject.toml: version 0.4.2 - Added all modules from working 0.4.1 (artifact_reader, validator, etc.) - __init__.py: full exports matching deployed wheel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
document-graphas a companion package tolexical-graph, providing deterministic schema-driven ETL of structured data (CSV, Excel, JSON, Parquet) into the same Neptune database. Addresses #356.Changes
New package (
document-graph/):graphrag_toolkit.document_graph(dist:graphrag-toolkit-document-graph)Examples (
examples/document-graph/):Alignment with Noel's Feedback (#356)
graphrag_toolkit/document_graphTenantId.format_label()Tenant Label Fix (Key Change)
cypher_builder.pypreviously produced__Label__tenant__format. Now usesTenantId.format_label()which produces`Label{tenant}__`— identical to lexical-graph. Falls back to same format when lexical-graph is not installed.Testing
Ownership Commitment
We are actively using document-graph for a client engagement and will maintain it in lockstep with lexical-graph (API changes, versioning, bug fixes).
Checklist