From 68775856f418c2c8f0b76c46cc477c1874b847c5 Mon Sep 17 00:00:00 2001 From: Angel Marino Date: Tue, 27 Oct 2026 00:49:39 -0400 Subject: [PATCH] load: ignore CryptPad's Participant column (real export is Time, Participant, then questions) A real CryptPad Form export on 2026-10-27 had a Participant column full of "Guest", which the choice-column heuristic read as a checkbox question. Treat it as metadata like Time, and add a test with the real header shape. Co-Authored-By: Claude Fable 5.1 --- synthesize.py | 2 +- tests/test_synthesize.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/synthesize.py b/synthesize.py index f617d54..31d0616 100755 --- a/synthesize.py +++ b/synthesize.py @@ -51,7 +51,7 @@ PRICES = { KINDS = {"idea", "want", "need", "goal", "concern"} STANCES = {"for", "against", "neutral"} -META_COL_RE = re.compile(r"^(id|#|time|timestamp|date|submitted|created|author|user)\b", re.I) +META_COL_RE = re.compile(r"^(id|#|time|timestamp|date|submitted|created|author|user|participant)\b", re.I) # --------------------------------------------------------------------------- # diff --git a/tests/test_synthesize.py b/tests/test_synthesize.py index bf310d5..9e5d9e1 100644 --- a/tests/test_synthesize.py +++ b/tests/test_synthesize.py @@ -76,6 +76,19 @@ class LoadTests(unittest.TestCase): self.assertEqual(loaded["questions"], ["Ideas"]) # Timestamp dropped as meta, Notes dropped as empty self.assertEqual([r["id"] for r in loaded["responses"]], ["r01", "r02"]) + def test_cryptpad_export_meta_columns(self): + # Real CryptPad Form export (2026-10-27): Time, Participant, then the questions. + with tempfile.TemporaryDirectory() as d: + p = Path(d) / "x.csv" + p.write_text("Time,Participant,Ideas,Priorities (pick up to 3).\n" + "2026-10-27T04:38:39.152Z,Guest,Build a shared prompt library members can contribute to.,\"privacy,green energy\"\n" + "2026-10-27T04:39:01.002Z,Guest,Try office hours once a month so people meet each other.,privacy\n" + "2026-10-27T04:39:22.418Z,Guest,Publish the energy numbers somewhere members can see them.,docs and onboarding\n") + loaded = S.load_responses(p) + self.assertEqual(loaded["questions"], ["Ideas"]) + self.assertEqual(loaded["choice_questions"], ["Priorities (pick up to 3)."]) + self.assertEqual(loaded["responses"][0]["choices"]["Priorities (pick up to 3)."], ["privacy", "green energy"]) + def test_choice_heuristic_rejects_long_text(self): self.assertFalse(S.looks_like_choice_column(["a long free-text answer that goes on and on about many things"] * 5)) self.assertTrue(S.looks_like_choice_column(["privacy, green", "green", "privacy; docs", "docs"]))