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

Function get_behavior_logs

skills/storage-helper/scripts/db_ops.py:1122–1133  ·  view source on GitHub ↗

Get behavior logs for a date range

(user_id: str, start_date: str, end_date: str)

Source from the content-addressed store, hash-verified

1120def get_doc_engagement_stats(user_id: str, days: int = 7) -> Dict[str, Any]:
1121 """
1122 Aggregate lightweight doc engagement proxies.
1123 """
1124 since_timestamp = (datetime.now() - timedelta(days=max(1, int(days)))).isoformat(sep=" ")
1125 conn = get_connection()
1126 cursor = conn.cursor()
1127 cursor.execute(
1128 """
1129 SELECT action, action_type, metadata, timestamp
1130 FROM behavior_logs
1131 WHERE user_id = ?
1132 AND timestamp >= ?
1133 AND (
1134 (action = 'opened_report' AND action_type = 'doc_open')
1135 OR (action = 'doc_dwell_proxy' AND action_type = 'doc_engagement')
1136 )

Callers 2

generate_weekly_reportFunction · 0.85

Calls 5

cursorMethod · 0.80
get_connectionFunction · 0.70
executeMethod · 0.45
fetchallMethod · 0.45
closeMethod · 0.45

Tested by 1