|
| 1 | +DESCRIPTION > |
| 2 | + - `ai_code_tracker_copy.pipe` materializes AI-assisted commit counts into `ai_code_tracker_ds`. |
| 3 | + - Runs daily to scan `activities_deduplicated_ds` for commits matching AI tool patterns. |
| 4 | + - Classifies commits by AI tool based on title, body, and attributes content. |
| 5 | + - Stores monthly aggregates per tool plus total commits per month (toolKey = '__total__'). |
| 6 | + - Uses multiSearchAnyCaseInsensitive for fast single-pass pre-filtering before classification. |
| 7 | + |
| 8 | +TAGS "Report" |
| 9 | + |
| 10 | +NODE ai_code_tracker_copy_totals |
| 11 | +DESCRIPTION > |
| 12 | + Total commits per month - no LIKE scanning needed, just a simple count |
| 13 | +SQL > |
| 14 | + SELECT |
| 15 | + toStartOfMonth(a.timestamp) AS monthStart, |
| 16 | + '__total__' AS toolKey, |
| 17 | + count() AS commitCount |
| 18 | + FROM activities_deduplicated_ds a |
| 19 | + WHERE a.type = 'authored-commit' |
| 20 | + GROUP BY monthStart |
| 21 | + |
| 22 | +NODE ai_code_tracker_copy_prefilter |
| 23 | +DESCRIPTION > |
| 24 | + Fast pre-filter: only keep commits that contain ANY AI keyword in title, body, or attributes. |
| 25 | + multiSearchAnyCaseInsensitive does a single pass instead of dozens of separate LIKE checks. |
| 26 | +SQL > |
| 27 | + SELECT |
| 28 | + toStartOfMonth(a.timestamp) AS monthStart, |
| 29 | + a.title, |
| 30 | + a.body, |
| 31 | + a.attributes |
| 32 | + FROM activities_deduplicated_ds a |
| 33 | + WHERE |
| 34 | + a.type = 'authored-commit' |
| 35 | + AND ( |
| 36 | + multiSearchAnyCaseInsensitive(a.title, ['copilot', 'chatgpt', 'claude', 'cursor', 'codewhisperer', 'gemini', 'codeium', 'aider', 'devin', 'tabnine', 'ai-generated', 'ai generated']) != 0 |
| 37 | + OR multiSearchAnyCaseInsensitive(a.body, ['copilot', 'chatgpt', 'claude', 'cursor', 'codewhisperer', 'gemini', 'codeium', 'aider', 'devin', 'tabnine', 'ai-generated', 'ai generated', 'co-authored-by']) != 0 |
| 38 | + OR multiSearchAnyCaseInsensitive(a.attributes, ['copilot', 'ai-generated']) != 0 |
| 39 | + ) |
| 40 | + |
| 41 | +NODE ai_code_tracker_copy_classify |
| 42 | +DESCRIPTION > |
| 43 | + Classify pre-filtered commits by AI tool |
| 44 | +SQL > |
| 45 | + SELECT |
| 46 | + monthStart, |
| 47 | + multiIf( |
| 48 | + positionCaseInsensitive(title, 'github copilot') > 0 OR positionCaseInsensitive(body, 'co-authored-by') > 0 AND positionCaseInsensitive(body, 'copilot') > 0 OR positionCaseInsensitive(attributes, 'copilot') > 0, 'github-copilot', |
| 49 | + positionCaseInsensitive(title, 'cursor') > 0 OR positionCaseInsensitive(body, 'cursor') > 0, 'cursor', |
| 50 | + positionCaseInsensitive(title, 'claude') > 0 OR positionCaseInsensitive(body, 'claude') > 0, 'claude', |
| 51 | + positionCaseInsensitive(title, 'chatgpt') > 0 OR positionCaseInsensitive(body, 'chatgpt') > 0, 'chatgpt', |
| 52 | + positionCaseInsensitive(title, 'codewhisperer') > 0 OR positionCaseInsensitive(body, 'codewhisperer') > 0, 'codewhisperer', |
| 53 | + positionCaseInsensitive(title, 'gemini') > 0 OR positionCaseInsensitive(body, 'gemini') > 0, 'gemini', |
| 54 | + positionCaseInsensitive(title, 'codeium') > 0 OR positionCaseInsensitive(body, 'codeium') > 0, 'codeium', |
| 55 | + positionCaseInsensitive(title, 'copilot') > 0 OR positionCaseInsensitive(body, 'copilot') > 0, 'github-copilot', |
| 56 | + positionCaseInsensitive(title, 'aider') > 0 OR positionCaseInsensitive(body, 'aider') > 0, 'aider', |
| 57 | + positionCaseInsensitive(title, 'devin') > 0 OR positionCaseInsensitive(body, 'devin') > 0, 'devin', |
| 58 | + positionCaseInsensitive(title, 'tabnine') > 0 OR positionCaseInsensitive(body, 'tabnine') > 0, 'tabnine', |
| 59 | + positionCaseInsensitive(title, 'ai-generated') > 0 OR positionCaseInsensitive(title, 'ai generated') > 0 |
| 60 | + OR positionCaseInsensitive(body, 'ai-generated') > 0 OR positionCaseInsensitive(body, 'ai generated') > 0 |
| 61 | + OR positionCaseInsensitive(attributes, 'ai-generated') > 0 |
| 62 | + OR (positionCaseInsensitive(body, 'co-authored-by') > 0 AND positionCaseInsensitive(body, 'bot') > 0), 'other', |
| 63 | + '__none__' |
| 64 | + ) AS toolKey |
| 65 | + FROM ai_code_tracker_copy_prefilter |
| 66 | + |
| 67 | +NODE ai_code_tracker_copy_by_tool |
| 68 | +DESCRIPTION > |
| 69 | + Aggregate AI commits by month and tool |
| 70 | +SQL > |
| 71 | + SELECT |
| 72 | + monthStart, |
| 73 | + toolKey, |
| 74 | + count() AS commitCount |
| 75 | + FROM ai_code_tracker_copy_classify |
| 76 | + WHERE toolKey != '__none__' |
| 77 | + GROUP BY monthStart, toolKey |
| 78 | + |
| 79 | +NODE ai_code_tracker_copy_result |
| 80 | +DESCRIPTION > |
| 81 | + Union AI tool counts and total counts |
| 82 | +SQL > |
| 83 | + SELECT monthStart, toolKey, commitCount |
| 84 | + FROM ai_code_tracker_copy_by_tool |
| 85 | + UNION ALL |
| 86 | + SELECT monthStart, toolKey, commitCount |
| 87 | + FROM ai_code_tracker_copy_totals |
| 88 | + |
| 89 | +TYPE COPY |
| 90 | +TARGET_DATASOURCE ai_code_tracker_ds |
| 91 | +COPY_MODE replace |
| 92 | +COPY_SCHEDULE 0 3 * * * |
0 commit comments