MCPcopy
hub / github.com/safishamsi/graphify / save_parsed

Function save_parsed

worked/example/raw/storage.py:32–46  ·  view source on GitHub ↗

Write a parsed document to storage. Returns the assigned record ID.

(doc: dict)

Source from the content-addressed store, hash-verified

30
31
32def save_parsed(doc: dict) -> str:
33 """Write a parsed document to storage. Returns the assigned record ID."""
34 _ensure_storage()
35 record_id = str(uuid.uuid4())[:8]
36 path = STORAGE_DIR / f"{record_id}.json"
37 path.write_text(json.dumps(doc, indent=2))
38
39 index = load_index()
40 index[record_id] = {
41 "source": doc.get("source", ""),
42 "format": doc.get("format", ""),
43 "title": doc.get("title", ""),
44 }
45 save_index(index)
46 return record_id
47
48
49def save_processed(doc: dict) -> str:

Callers 1

parse_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