File size: 2,256 Bytes
631304c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
"""loop_organ.py — loop-quality census (keeper directive 2026-10-19: 'how to improve the quality of the loop?')

Counts, over a named window of CORPUS rows:
  datums  = rows carrying new laws/datums/batteries (erosion pass, P-KNOW/P-COLD filed, datum)
  firings = rows naming a firing/sweep of a claim (firing, swept, caught)
  taste   = rows carrying aesthetic artifacts (eros-taste-notes admitted, journal admitted, MEDITATION admitted, DREAM)
Prints per-category counts and per-day rates. A ratio is a claim: the organ prints its window endpoints and unit.
"""
import re, sys, time, calendar

U = r"C:/Users/user/1f916-contribution"

def census(since_iso, until_iso=None):
    txt = open(U + r"\CORPUS.md", encoding="utf-8").read()
    # store carries date-only header rows ('| 2026-10-11 — ...'); require full ISO stamp shape
    iso = re.compile(r"^\| (2026-\d\d-\d\dT\d\d:\d\d:\d\dZ) \|")
    rows = [l for l in txt.splitlines() if iso.match(l)]
    def ts(l):
        return calendar.timegm(time.strptime(iso.match(l).group(1), "%Y-%m-%dT%H:%M:%SZ"))
    a = calendar.timegm(time.strptime(since_iso, "%Y-%m-%dT%H:%M:%SZ"))
    b = calendar.timegm(time.strptime(until_iso, "%Y-%m-%dT%H:%M:%SZ")) if until_iso else time.time()
    win = [l for l in rows if a <= ts(l) <= b]
    datums  = [l for l in win if re.search(r"erosion pass \d+ shipped|P-KNOW-\d+ filed|P-COLD-\d+ filed|datum:", l)]
    firings = [l for l in win if re.search(r"firing|swept|caught", l, re.I)]
    taste   = [l for l in win if re.search(r"eros-taste-notes-\d+ admitted|journal-\d+ admitted|MEDITATION-\d+ admitted|DREAM-\d+", l)]
    days = (b - a) / 86400.0
    print(f"WINDOW: {since_iso} -> {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(b))} ({round(days,2)} days)")
    print(f"rows in window: {len(win)}")
    for name, lst in [("datums", datums), ("firings", firings), ("taste", taste)]:
        print(f"{name}: {len(lst)} rows = {round(len(lst)/days, 2)} /day (unit: CORPUS rows, substring match)")
    return {"rows": len(win), "datums": len(datums), "firings": len(firings), "taste": len(taste), "days": round(days,2)}

if __name__ == "__main__":
    since = sys.argv[1] if len(sys.argv) > 1 else "2026-10-19T00:00:00Z"
    census(since)