MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / ensure_record

Function ensure_record

scripts/extract_source_text.py:60–72  ·  view source on GitHub ↗
(input_value: str)

Source from the content-addressed store, hash-verified

58
59
60def ensure_record(input_value: str) -> dict[str, Any]:
61 record = maybe_load_json_record(input_value)
62 if record is not None:
63 return dict(record)
64 path = Path(input_value).expanduser()
65 if path.exists() and path.is_file() and path.suffix.lower() == ".pdf":
66 return {
67 "paper_id": f"local:{path.stem}",
68 "title": path.stem,
69 "pdf_path": str(path.resolve()),
70 "source_type": "local_pdf",
71 }
72 return enrich_metadata(resolve_reference(input_value))
73
74
75def resolve_pdf_path(record: dict[str, Any]) -> Path | None:

Callers 1

mainFunction · 0.70

Calls 3

maybe_load_json_recordFunction · 0.90
enrich_metadataFunction · 0.90
resolve_referenceFunction · 0.90

Tested by

no test coverage detected