|
| 1 | +DESCRIPTION > |
| 2 | + - `ai_code_tracker_copy.pipe` materializes AI-assisted commit counts into `ai_code_tracker_ds`. |
| 3 | + - Runs daily (after commits copy) reading from `ai_code_tracker_commits_ds` (only commits, not all 1B+ activities). |
| 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 - simple count, no string scanning |
| 13 | + |
| 14 | +SQL > |
| 15 | + SELECT toStartOfMonth(timestamp) AS monthStart, '__total__' AS toolKey, count() AS commitCount |
| 16 | + FROM ai_code_tracker_commits_ds |
| 17 | + GROUP BY monthStart |
| 18 | + |
| 19 | +NODE ai_code_tracker_copy_prefilter |
| 20 | +DESCRIPTION > |
| 21 | + Fast pre-filter: only keep commits containing ANY AI keyword. |
| 22 | + multiSearchAnyCaseInsensitive does a single pass instead of dozens of separate checks. |
| 23 | + |
| 24 | +SQL > |
| 25 | + SELECT toStartOfMonth(timestamp) AS monthStart, title, body, attributes |
| 26 | + FROM ai_code_tracker_commits_ds |
| 27 | + WHERE |
| 28 | + multiSearchAnyCaseInsensitive( |
| 29 | + title, |
| 30 | + [ |
| 31 | + 'copilot', |
| 32 | + 'chatgpt', |
| 33 | + 'claude', |
| 34 | + 'cursor', |
| 35 | + 'codewhisperer', |
| 36 | + 'gemini', |
| 37 | + 'codeium', |
| 38 | + 'aider', |
| 39 | + 'devin', |
| 40 | + 'tabnine', |
| 41 | + 'ai-generated', |
| 42 | + 'ai generated' |
| 43 | + ] |
| 44 | + ) |
| 45 | + != 0 |
| 46 | + OR multiSearchAnyCaseInsensitive( |
| 47 | + body, |
| 48 | + [ |
| 49 | + 'copilot', |
| 50 | + 'chatgpt', |
| 51 | + 'claude', |
| 52 | + 'cursor', |
| 53 | + 'codewhisperer', |
| 54 | + 'gemini', |
| 55 | + 'codeium', |
| 56 | + 'aider', |
| 57 | + 'devin', |
| 58 | + 'tabnine', |
| 59 | + 'ai-generated', |
| 60 | + 'ai generated', |
| 61 | + 'co-authored-by' |
| 62 | + ] |
| 63 | + ) |
| 64 | + != 0 |
| 65 | + OR multiSearchAnyCaseInsensitive(attributes, ['copilot', 'ai-generated']) != 0 |
| 66 | + |
| 67 | +NODE ai_code_tracker_copy_classify |
| 68 | +DESCRIPTION > |
| 69 | + Classify pre-filtered commits by AI tool |
| 70 | + |
| 71 | +SQL > |
| 72 | + SELECT |
| 73 | + monthStart, |
| 74 | + multiIf( |
| 75 | + positionCaseInsensitive(title, 'github copilot') > 0 |
| 76 | + OR ( |
| 77 | + positionCaseInsensitive(body, 'co-authored-by') > 0 |
| 78 | + AND positionCaseInsensitive(body, 'copilot') > 0 |
| 79 | + ) |
| 80 | + OR positionCaseInsensitive(attributes, 'copilot') > 0, |
| 81 | + 'github-copilot', |
| 82 | + positionCaseInsensitive(title, 'cursor') > 0 OR positionCaseInsensitive(body, 'cursor') > 0, |
| 83 | + 'cursor', |
| 84 | + positionCaseInsensitive(title, 'claude') > 0 OR positionCaseInsensitive(body, 'claude') > 0, |
| 85 | + 'claude', |
| 86 | + positionCaseInsensitive(title, 'chatgpt') > 0 |
| 87 | + OR positionCaseInsensitive(body, 'chatgpt') > 0, |
| 88 | + 'chatgpt', |
| 89 | + positionCaseInsensitive(title, 'codewhisperer') > 0 |
| 90 | + OR positionCaseInsensitive(body, 'codewhisperer') > 0, |
| 91 | + 'codewhisperer', |
| 92 | + positionCaseInsensitive(title, 'gemini') > 0 OR positionCaseInsensitive(body, 'gemini') > 0, |
| 93 | + 'gemini', |
| 94 | + positionCaseInsensitive(title, 'codeium') > 0 |
| 95 | + OR positionCaseInsensitive(body, 'codeium') > 0, |
| 96 | + 'codeium', |
| 97 | + positionCaseInsensitive(title, 'copilot') > 0 |
| 98 | + OR positionCaseInsensitive(body, 'copilot') > 0, |
| 99 | + 'github-copilot', |
| 100 | + positionCaseInsensitive(title, 'aider') > 0 OR positionCaseInsensitive(body, 'aider') > 0, |
| 101 | + 'aider', |
| 102 | + positionCaseInsensitive(title, 'devin') > 0 OR positionCaseInsensitive(body, 'devin') > 0, |
| 103 | + 'devin', |
| 104 | + positionCaseInsensitive(title, 'tabnine') > 0 |
| 105 | + OR positionCaseInsensitive(body, 'tabnine') > 0, |
| 106 | + 'tabnine', |
| 107 | + positionCaseInsensitive(title, 'ai-generated') > 0 |
| 108 | + OR positionCaseInsensitive(title, 'ai generated') > 0 |
| 109 | + OR positionCaseInsensitive(body, 'ai-generated') > 0 |
| 110 | + OR positionCaseInsensitive(body, 'ai generated') > 0 |
| 111 | + OR positionCaseInsensitive(attributes, 'ai-generated') > 0 |
| 112 | + OR ( |
| 113 | + positionCaseInsensitive(body, 'co-authored-by') > 0 |
| 114 | + AND positionCaseInsensitive(body, 'bot') > 0 |
| 115 | + ), |
| 116 | + 'other', |
| 117 | + '__none__' |
| 118 | + ) AS toolKey |
| 119 | + FROM ai_code_tracker_copy_prefilter |
| 120 | + |
| 121 | +NODE ai_code_tracker_copy_by_tool |
| 122 | +DESCRIPTION > |
| 123 | + Aggregate AI commits by month and tool |
| 124 | + |
| 125 | +SQL > |
| 126 | + SELECT monthStart, toolKey, count() AS commitCount |
| 127 | + FROM ai_code_tracker_copy_classify |
| 128 | + WHERE toolKey != '__none__' |
| 129 | + GROUP BY monthStart, toolKey |
| 130 | + |
| 131 | +NODE ai_code_tracker_copy_result |
| 132 | +DESCRIPTION > |
| 133 | + Union AI tool counts and total counts |
| 134 | + |
| 135 | +SQL > |
| 136 | + SELECT monthStart, toolKey, commitCount |
| 137 | + FROM ai_code_tracker_copy_by_tool |
| 138 | + UNION ALL |
| 139 | + SELECT monthStart, toolKey, commitCount |
| 140 | + FROM ai_code_tracker_copy_totals |
| 141 | + |
| 142 | +TYPE COPY |
| 143 | +TARGET_DATASOURCE ai_code_tracker_ds |
| 144 | +COPY_MODE replace |
| 145 | +COPY_SCHEDULE 0 3 * * * |
0 commit comments