MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / save_processed

Function save_processed

worked/example/raw/storage.py:49–62  ·  view source on GitHub ↗

Write an enriched document to storage, updating the index with keywords.

(doc: dict)

Source from the content-addressed store, hash-verified

47
48
49def save_processed(doc: dict) -> str:
50 """Write an enriched document to storage, updating the index with keywords."""
51 _ensure_storage()
52 record_id = doc.get("id") or str(uuid.uuid4())[:8]
53 path = STORAGE_DIR / f"{record_id}_processed.json"
54 path.write_text(json.dumps(doc, indent=2))
55
56 index = load_index()
57 if record_id not in index:
58 index[record_id] = {}
59 index[record_id]["keywords"] = doc.get("keywords", [])
60 index[record_id]["cross_refs"] = [r["id"] for r in doc.get("cross_refs", [])]
61 save_index(index)
62 return record_id
63
64
65def load_record(record_id: str) -> dict:

Callers 1

process_and_saveFunction · 0.90

Calls 4

_ensure_storageFunction · 0.85
load_indexFunction · 0.85
save_indexFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected