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

Function list_reports

deployments/desktop/shared/agents.py:2899–2943  ·  view source on GitHub ↗
(
    user_id: str = "",
    query: str = "",
    days: int = 30,
    limit: int = 80,
    exact_date: str = "",
)

Source from the content-addressed store, hash-verified

2897 "report_path": report["report_path"],
2898 "doc_url": report["doc_url"],
2899 "doc_token": report["doc_token"],
2900 "pdf_url": report["pdf_url"],
2901 "abs_url": report["abs_url"],
2902 "report_version": report["report_version"],
2903 "generation_provider": report["generation_provider"],
2904 "generation_model": report["generation_model"],
2905 "snippet": report["snippet"],
2906 }
2907
2908
2909def list_reports(
2910 user_id: str = "",
2911 query: str = "",
2912 days: int = 30,
2913 limit: int = 80,
2914 exact_date: str = "",
2915) -> Dict[str, Any]:
2916 normalized_user = str(user_id or "").strip()
2917 normalized_query = str(query or "").strip().lower()
2918 normalized_date = str(exact_date or "").strip()
2919 max_age_days = max(1, int(days or 30))
2920 max_items = max(1, int(limit or 80))
2921 cutoff = datetime.now() - timedelta(days=max_age_days)
2922
2923 reports = []
2924 for report in _all_report_records():
2925 report_dt = datetime.fromtimestamp(report["_sort_ts"])
2926 if normalized_date:
2927 report_date = str(report.get("saved_at") or report.get("updated_at") or "")[:10]
2928 if report_date != normalized_date:
2929 continue
2930 elif report_dt < cutoff:
2931 continue
2932 if normalized_user and report["user_id"] != normalized_user:
2933 continue
2934 haystack = " ".join(
2935 [
2936 str(report.get("title") or ""),
2937 str(report.get("user_id") or ""),
2938 str(report.get("arxiv_id") or ""),
2939 str(report.get("snippet") or ""),
2940 str(report.get("report_path") or ""),
2941 ]
2942 ).lower()
2943 if normalized_query and normalized_query not in haystack:
2944 continue
2945 reports.append(_report_summary_payload(report))
2946 if len(reports) >= max_items:

Callers 1

export_dataFunction · 0.85

Calls 6

_all_report_recordsFunction · 0.85
_report_summary_payloadFunction · 0.85
_display_pathFunction · 0.85
_reading_report_dirsFunction · 0.85
nowMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected