pi-fluency 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -66,7 +66,7 @@ Pi Fluency counts only findings you accept. Every analyzer-classified English pr
66
66
  accepted mistake rate = accepted occurrences / English words × 1000
67
67
  ```
68
68
 
69
- Stats covers trailing 30 local calendar days. It shows accepted rate, review coverage, one-off total, recurring patterns, and trends. Pattern list is sorted by accepted occurrence count. Pattern becomes recurring after at least two accepted occurrences across retained history; one-offs remain in overall accepted totals and rate but stay out of recurring-pattern list and toolbar count.
69
+ Stats covers trailing 30 local calendar days. It shows accepted rate, review coverage, one-off total, recurring patterns, and trends. Pattern list is sorted by accepted occurrence count. Pattern becomes recurring after accepted findings appear in at least two distinct prompts across retained history; one-offs remain in overall accepted totals and rate but stay out of recurring-pattern list and toolbar count.
70
70
 
71
71
  Toolbar summarizes current activity and accepted-mistake trends:
72
72
 
@@ -186,12 +186,15 @@ export function computeFluencyAnalytics(input: AnalyticsInput): FluencyAnalytics
186
186
  && within(occurrence.localDate, start, end)).length;
187
187
  };
188
188
 
189
- const lifetimeAcceptedForGroup = (group: RuleGroup): number => occurrences.filter((occurrence) =>
190
- occurrence.decision === "accepted" && group.patternIds.has(occurrence.patternId)).length;
189
+ const acceptedPromptHashesForGroup = (group: RuleGroup): Set<string> => new Set(
190
+ occurrences
191
+ .filter((occurrence) => occurrence.decision === "accepted" && group.patternIds.has(occurrence.patternId))
192
+ .map((occurrence) => occurrence.promptHash),
193
+ );
191
194
  const recurringGroups = [...groupsByExplanation.values()].filter((group) =>
192
- lifetimeAcceptedForGroup(group) >= 2);
195
+ acceptedPromptHashesForGroup(group).size >= 2);
193
196
  const oneOffAccepted = [...groupsByExplanation.values()]
194
- .filter((group) => lifetimeAcceptedForGroup(group) === 1)
197
+ .filter((group) => acceptedPromptHashesForGroup(group).size === 1)
195
198
  .reduce((sum, group) => sum + acceptedForGroup(group, today, TREND_DAYS), 0);
196
199
 
197
200
  const rules = recurringGroups.flatMap((group): RuleAnalytics[] => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-fluency",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "English writing analytics for human-authored Pi prompts",
5
5
  "author": "Ihar Trafimovich",
6
6
  "type": "module",