MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _report_record

Function _report_record

deployments/desktop/shared/agents.py:663–704  ·  view source on GitHub ↗
(path: Path)

Source from the content-addressed store, hash-verified

661
662
663def _report_record(path: Path) -> Dict[str, Any]:
664 raw = path.read_text(encoding="utf-8", errors="replace")
665 metadata, body = _extract_frontmatter(raw)
666 stat = path.stat()
667 title = str(metadata.get("title") or _report_title(body, path))
668 saved_at = str(
669 metadata.get("saved_at")
670 or metadata.get("updated_at")
671 or datetime.fromtimestamp(stat.st_mtime).replace(microsecond=0).isoformat()
672 )
673 updated_at = datetime.fromtimestamp(stat.st_mtime).replace(microsecond=0).isoformat()
674 doc_url = str(metadata.get("doc_url") or "")
675 pdf_url = str(metadata.get("pdf_url") or _first_matching_url(body, "/pdf/"))
676 abs_url = _report_abs_url(metadata, body)
677 institution = _report_institution(metadata)
678 if institution and not metadata.get("institution"):
679 metadata["institution"] = institution
680 body = _patch_report_body_institution(body, institution)
681 body = _strip_duplicate_report_heading(body, title)
682 return {
683 "report_id": _report_id(path),
684 "_path": str(path.resolve()),
685 "title": title,
686 "user_id": str(metadata.get("user_id") or "").strip(),
687 "paper_id": metadata.get("paper_id"),
688 "arxiv_id": str(metadata.get("arxiv_id") or "").strip(),
689 "saved_at": saved_at,
690 "updated_at": updated_at,
691 "report_path": _display_path(path),
692 "doc_url": doc_url,
693 "doc_token": str(metadata.get("doc_token") or "").strip(),
694 "pdf_url": pdf_url,
695 "abs_url": abs_url,
696 "institution": institution,
697 "report_version": str(metadata.get("report_version") or "").strip(),
698 "generation_provider": str(metadata.get("generation_provider") or "").strip(),
699 "generation_model": str(metadata.get("generation_model") or "").strip(),
700 "snippet": _report_snippet(body),
701 "metadata": metadata,
702 "markdown": body,
703 "_sort_ts": stat.st_mtime,
704 }
705
706
707def _is_reading_report_record(report: Dict[str, Any]) -> bool:

Callers 1

_all_report_recordsFunction · 0.85

Calls 11

_extract_frontmatterFunction · 0.85
_report_titleFunction · 0.85
_first_matching_urlFunction · 0.85
_report_abs_urlFunction · 0.85
_report_institutionFunction · 0.85
_report_idFunction · 0.85
_display_pathFunction · 0.85
_report_snippetFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected