From 733c0967c2c49d83dfc282808a75fee68580d283 Mon Sep 17 00:00:00 2001 From: null Date: Fri, 19 Jun 2026 00:50:23 -0500 Subject: [PATCH] fix: Q2 grammar quality pass on emotional_intimacy, parenting, stress questions + app.db rebuild --- app/src/main/assets/database/app.db | Bin 1880064 -> 1880064 bytes seed/fix_question_quality_q2.py | 162 +++++++++++++++++++++++++ seed/questions/emotional_intimacy.json | 20 +-- seed/questions/parenting.json | 4 +- seed/questions/physical_intimacy.json | 2 +- seed/questions/stress.json | 52 ++++---- seed/validate_question_variety.py | 34 ++++++ 7 files changed, 235 insertions(+), 39 deletions(-) create mode 100644 seed/fix_question_quality_q2.py diff --git a/app/src/main/assets/database/app.db b/app/src/main/assets/database/app.db index a7c71251daa060f4a5ef7781621a75c975819a0a..1b170aee90079374be2b91c0d46adf40a4e91795 100644 GIT binary patch delta 2610 zcma)83v5&8750Cxeb4XLwM||)hU7Xlq(FffNJ0{zw7?3CN6I=FL+N7T3vuJvsUHd1 z$|F~rqE#^hg>oiATj-><6DuT}#@)2irJ@XIy9uZ|D%uX(F_0)L38di>9y_+lL})iH z(kDkZ|NYMSzw@2X*>Wzr@|hdH;8na7;%b-$})d#{XRdkwN-n@PTAKW{s4eb2DX z(rbQ`cfe1jb*Aqb7l=-Fx64%*;+kFij-#^Ogs=3m8RHY-fEta({o#NTZ%~zWsy`Z2 z+9C<1-XD#&Db3Mfi$AVn%@LM^=a^u@Ti01O7WcCkxWQnkC8Ej{Q6V1dXXRXzwdM2( z(vRlMEL+v!k1J8tAB!cT{&2mjv_=x4fYP9bnw8cDHB2=lF?G0#5?0kfOsS7FsY;?5 zUFE`9yfcbwo*iT^Ty>ST*nHYD;-BqfX3u)`zQ*$L+EwOueS-v*slv+4d&z5TlVs7B z%9SxZU>6jeHo$T`VLuhgRL@jxibPeVAre+&==zA|;{mun7f3Dpx{su2pSW=>m` zYB>=3PrqtYBp!@}{h|AvH~AY?r9MR65KWB4R6|OGKN`T#Pm+AZSd6E?W^Lfn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ode 100644 index 00000000..1e93f64c --- /dev/null +++ b/seed/fix_question_quality_q2.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python3 +""" +Q2 - fix remaining template grammar errors and abstract filler. + +Edits BOTH the source JSON files and the shipped asset DB (data only, schema +untouched). build_db.py is NOT run. One-off migration kept for traceability. +""" +from __future__ import annotations + +import json +import sqlite3 +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +QUESTIONS_DIR = ROOT / "seed" / "questions" +DB_PATH = ROOT / "app" / "src" / "main" / "assets" / "database" / "app.db" + +REWRITES = { + # Emotional intimacy: replace placeholder-ish phrasing with more natural language. + "emotional_intimacy_076": "What would help me understand the fears you carry privately?", + "emotional_intimacy_077": "When do those private fears make closeness feel harder?", + "emotional_intimacy_078": "What would help you share those private fears more honestly?", + "emotional_intimacy_079": "How can I respond to those fears in a way that feels safe instead of fixing you?", + "emotional_intimacy_080": "What reassurance would help when those fears come up?", + "emotional_intimacy_081": "What do you want me to notice about needs you usually keep private?", + "emotional_intimacy_082": "When do private emotional needs make closeness feel harder?", + "emotional_intimacy_083": "What would help you name those needs more honestly?", + "emotional_intimacy_084": "How can I respond to those private needs in a way that feels safe instead of fixing you?", + "emotional_intimacy_085": "What reassurance would help when those private needs come up?", + + # Subject/verb agreement. + "parenting_093": "How do in-laws and family expectations affect how close you feel to me?", + "parenting_138": "How does needing extra support affect how close you feel to me?", + "physical_intimacy_013": "When do warm greetings help you feel connected to me?", + "stress_121": "When do coping habits make you feel distant from me?", + "stress_141": "When do stress recovery routines make you feel distant from me?", + + # Stress prompts: replace abstract or plural + singular generated wording. + "stress_020": "What should we avoid doing when asking for help feels hard?", + "stress_025": "What should we avoid doing when low-energy days pile up?", + "stress_035": "What should we avoid doing when unexpected problems pile up?", + "stress_045": "What should we avoid doing when busy weeks feel intense?", + "stress_050": "What should we avoid doing when one of us needs support?", + "stress_065": "What should we avoid doing when health worries feel heavy?", + "stress_070": "What should we avoid doing when burnout signs are showing?", + "stress_075": "What should we avoid doing when we are resetting after stress?", + "stress_154": "Which kind of help can feel like too much when asking for help is hard?", + "stress_157": "When unexpected problems pile up, what usually helps first?", + "stress_159": "How should we handle a serious talk when busy weeks feel intense?", + "stress_160": "Which kind of support can feel like too much when you need to feel supported?", + "stress_163": "When health worries feel heavy, what usually helps first?", + "stress_165": "How should we handle a serious talk when we are resetting after stress?", + "stress_177": "How should we handle a serious talk when one of us feels alone in stress?", + "stress_197": "What should we protect when unexpected problems pile up?", + "stress_200": "Which supports help when one of us needs to feel supported?", + "stress_204": "Which supports help when burnout signs are showing?", + "stress_205": "What should we protect when we are resetting after stress?", + "stress_223": "How well do we talk when health worries feel heavy?", + "stress_239": "When asking for help feels hard, what helps more?", + "stress_242": "When unexpected problems pile up, what helps more?", + "stress_245": "When one of us needs support, what helps more?", + "stress_248": "When health worries feel heavy, what helps more?", +} + +BAD_SNIPPETS = ( + "deeper fears", + "deep fears", + "emotional needs you hide", + "needs you hide", + "of you you protect", + "does in-laws", + "does special needs", + "does warm greetings", + "does coping habits", + "does stress recovery routines", + "asking for help is high", + "low energy days is high", + "unexpected problems is high", + "busy weeks is high", + "feeling supported is high", + "feeling alone in stress is high", + "health worries is high", + "burnout signs is high", + "resetting after stress is high", + "asking for help is present", + "feeling supported is present", + "unexpected problems shows up", + "health worries shows up", +) + + +def migrate_json() -> int: + changed = 0 + remaining_ids = set(REWRITES) + for path in sorted(QUESTIONS_DIR.glob("*.json")): + with path.open() as f: + data = json.load(f) + + file_changed = False + for q in data.get("questions", []): + qid = q.get("id") + if qid in REWRITES: + q["text"] = REWRITES[qid] + remaining_ids.discard(qid) + changed += 1 + file_changed = True + + if file_changed: + with path.open("w") as f: + json.dump(data, f, indent=2, ensure_ascii=False) + f.write("\n") + + if remaining_ids: + raise RuntimeError(f"Missing JSON ids: {sorted(remaining_ids)}") + return changed + + +def migrate_db() -> int: + con = sqlite3.connect(DB_PATH) + try: + cur = con.cursor() + changed = 0 + for qid, text in sorted(REWRITES.items()): + cur.execute("UPDATE question SET text=? WHERE id=?", (text, qid)) + changed += cur.rowcount + con.commit() + return changed + finally: + con.close() + + +def bad_rows() -> list[tuple[str, str]]: + where = " OR ".join("LOWER(text) LIKE ?" for _ in BAD_SNIPPETS) + params = [f"%{snippet.lower()}%" for snippet in BAD_SNIPPETS] + con = sqlite3.connect(DB_PATH) + try: + return con.execute( + f"SELECT id, text FROM question WHERE status='active' AND ({where}) ORDER BY id", + params, + ).fetchall() + finally: + con.close() + + +if __name__ == "__main__": + json_changed = migrate_json() + db_changed = migrate_db() + + con = sqlite3.connect(DB_PATH) + try: + room_hash = con.execute("SELECT identity_hash FROM room_master_table").fetchone()[0] + finally: + con.close() + + bad = bad_rows() + print(f"JSON rows changed: {json_changed}") + print(f"DB rows changed: {db_changed}") + print(f"Room hash: {room_hash}") + if bad: + print(f"WARNING - still-bad rows: {bad}") + else: + print("Verified: 0 Q2 bad snippets remaining") diff --git a/seed/questions/emotional_intimacy.json b/seed/questions/emotional_intimacy.json index 6124e3c2..7fdfdb5b 100644 --- a/seed/questions/emotional_intimacy.json +++ b/seed/questions/emotional_intimacy.json @@ -1303,7 +1303,7 @@ "id": "emotional_intimacy_076", "category_id": "emotional_intimacy", "type": "written", - "text": "What would help me see your deep fears with more care?", + "text": "What would help me understand the fears you carry privately?", "depth": 4, "access": "premium", "tags": [ @@ -1320,7 +1320,7 @@ "id": "emotional_intimacy_077", "category_id": "emotional_intimacy", "type": "written", - "text": "When do your deep fears affect how close you feel to me?", + "text": "When do those private fears make closeness feel harder?", "depth": 5, "access": "premium", "tags": [ @@ -1337,7 +1337,7 @@ "id": "emotional_intimacy_078", "category_id": "emotional_intimacy", "type": "written", - "text": "What would help you share more honestly about your deep fears?", + "text": "What would help you share those private fears more honestly?", "depth": 5, "access": "premium", "tags": [ @@ -1354,7 +1354,7 @@ "id": "emotional_intimacy_079", "category_id": "emotional_intimacy", "type": "written", - "text": "How can I respond to your deep fears in a way that feels safe instead of fixing you?", + "text": "How can I respond to those fears in a way that feels safe instead of fixing you?", "depth": 5, "access": "premium", "tags": [ @@ -1371,7 +1371,7 @@ "id": "emotional_intimacy_080", "category_id": "emotional_intimacy", "type": "written", - "text": "What is one boundary or reassurance that would help with your deep fears?", + "text": "What reassurance would help when those fears come up?", "depth": 5, "access": "premium", "tags": [ @@ -1388,7 +1388,7 @@ "id": "emotional_intimacy_081", "category_id": "emotional_intimacy", "type": "written", - "text": "What do you want me to notice about the emotional needs you hide?", + "text": "What do you want me to notice about needs you usually keep private?", "depth": 4, "access": "premium", "tags": [ @@ -1405,7 +1405,7 @@ "id": "emotional_intimacy_082", "category_id": "emotional_intimacy", "type": "written", - "text": "When do the emotional needs you hide affect how close you feel to me?", + "text": "When do private emotional needs make closeness feel harder?", "depth": 5, "access": "premium", "tags": [ @@ -1422,7 +1422,7 @@ "id": "emotional_intimacy_083", "category_id": "emotional_intimacy", "type": "written", - "text": "What would help you share more honestly about the emotional needs you hide?", + "text": "What would help you name those needs more honestly?", "depth": 5, "access": "premium", "tags": [ @@ -1439,7 +1439,7 @@ "id": "emotional_intimacy_084", "category_id": "emotional_intimacy", "type": "written", - "text": "How can I respond to the emotional needs you hide in a way that feels safe instead of fixing you?", + "text": "How can I respond to those private needs in a way that feels safe instead of fixing you?", "depth": 5, "access": "premium", "tags": [ @@ -1456,7 +1456,7 @@ "id": "emotional_intimacy_085", "category_id": "emotional_intimacy", "type": "written", - "text": "What is one boundary or reassurance that would help with the emotional needs you hide?", + "text": "What reassurance would help when those private needs come up?", "depth": 5, "access": "premium", "tags": [ diff --git a/seed/questions/parenting.json b/seed/questions/parenting.json index b81bfbac..b1737232 100644 --- a/seed/questions/parenting.json +++ b/seed/questions/parenting.json @@ -1592,7 +1592,7 @@ "id": "parenting_093", "category_id": "parenting", "type": "written", - "text": "How does in-laws and family expectations affect how close you feel to me?", + "text": "How do in-laws and family expectations affect how close you feel to me?", "depth": 5, "access": "premium", "tags": [ @@ -2357,7 +2357,7 @@ "id": "parenting_138", "category_id": "parenting", "type": "written", - "text": "How does special needs or extra support affect how close you feel to me?", + "text": "How does needing extra support affect how close you feel to me?", "depth": 5, "access": "premium", "tags": [ diff --git a/seed/questions/physical_intimacy.json b/seed/questions/physical_intimacy.json index 99fc4970..301c34ee 100644 --- a/seed/questions/physical_intimacy.json +++ b/seed/questions/physical_intimacy.json @@ -232,7 +232,7 @@ "id": "physical_intimacy_013", "category_id": "physical_intimacy", "type": "written", - "text": "When does warm greetings help you feel connected to me?", + "text": "When do warm greetings help you feel connected to me?", "depth": 2, "access": "free", "tags": [ diff --git a/seed/questions/stress.json b/seed/questions/stress.json index 6c0844e5..19770279 100644 --- a/seed/questions/stress.json +++ b/seed/questions/stress.json @@ -351,7 +351,7 @@ "id": "stress_020", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when asking for help is high?", + "text": "What should we avoid doing when asking for help feels hard?", "depth": 3, "access": "free", "tags": [ @@ -436,7 +436,7 @@ "id": "stress_025", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when low energy days is high?", + "text": "What should we avoid doing when low-energy days pile up?", "depth": 3, "access": "free", "tags": [ @@ -606,7 +606,7 @@ "id": "stress_035", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when unexpected problems is high?", + "text": "What should we avoid doing when unexpected problems pile up?", "depth": 3, "access": "free", "tags": [ @@ -776,7 +776,7 @@ "id": "stress_045", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when busy weeks is high?", + "text": "What should we avoid doing when busy weeks feel intense?", "depth": 3, "access": "free", "tags": [ @@ -861,7 +861,7 @@ "id": "stress_050", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when feeling supported is high?", + "text": "What should we avoid doing when one of us needs support?", "depth": 3, "access": "free", "tags": [ @@ -1116,7 +1116,7 @@ "id": "stress_065", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when health worries is high?", + "text": "What should we avoid doing when health worries feel heavy?", "depth": 3, "access": "free", "tags": [ @@ -1201,7 +1201,7 @@ "id": "stress_070", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when burnout signs is high?", + "text": "What should we avoid doing when burnout signs are showing?", "depth": 3, "access": "free", "tags": [ @@ -1286,7 +1286,7 @@ "id": "stress_075", "category_id": "stress", "type": "written", - "text": "What should we avoid doing when resetting after stress is high?", + "text": "What should we avoid doing when we are resetting after stress?", "depth": 3, "access": "free", "tags": [ @@ -2068,7 +2068,7 @@ "id": "stress_121", "category_id": "stress", "type": "written", - "text": "When does coping habits make you feel distant from me?", + "text": "When do coping habits make you feel distant from me?", "depth": 4, "access": "premium", "tags": [ @@ -2408,7 +2408,7 @@ "id": "stress_141", "category_id": "stress", "type": "written", - "text": "When does stress recovery routines make you feel distant from me?", + "text": "When do stress recovery routines make you feel distant from me?", "depth": 4, "access": "premium", "tags": [ @@ -2668,7 +2668,7 @@ "id": "stress_154", "category_id": "stress", "type": "single_choice", - "text": "What do you need me to do less when asking for help is present?", + "text": "Which kind of help can feel like too much when asking for help is hard?", "depth": 3, "access": "premium", "tags": [ @@ -2758,7 +2758,7 @@ "id": "stress_157", "category_id": "stress", "type": "single_choice", - "text": "When unexpected problems shows up, what usually helps first?", + "text": "When unexpected problems pile up, what usually helps first?", "depth": 3, "access": "premium", "tags": [ @@ -2818,7 +2818,7 @@ "id": "stress_159", "category_id": "stress", "type": "single_choice", - "text": "How should we handle a serious talk when busy weeks is high?", + "text": "How should we handle a serious talk when busy weeks feel intense?", "depth": 2, "access": "premium", "tags": [ @@ -2848,7 +2848,7 @@ "id": "stress_160", "category_id": "stress", "type": "single_choice", - "text": "What do you need me to do less when feeling supported is present?", + "text": "Which kind of support can feel like too much when you need to feel supported?", "depth": 3, "access": "premium", "tags": [ @@ -2938,7 +2938,7 @@ "id": "stress_163", "category_id": "stress", "type": "single_choice", - "text": "When health worries shows up, what usually helps first?", + "text": "When health worries feel heavy, what usually helps first?", "depth": 2, "access": "premium", "tags": [ @@ -2998,7 +2998,7 @@ "id": "stress_165", "category_id": "stress", "type": "single_choice", - "text": "How should we handle a serious talk when resetting after stress is high?", + "text": "How should we handle a serious talk when we are resetting after stress?", "depth": 3, "access": "premium", "tags": [ @@ -3358,7 +3358,7 @@ "id": "stress_177", "category_id": "stress", "type": "single_choice", - "text": "How should we handle a serious talk when feeling alone in stress is high?", + "text": "How should we handle a serious talk when one of us feels alone in stress?", "depth": 3, "access": "premium", "tags": [ @@ -3682,7 +3682,7 @@ "id": "stress_197", "category_id": "stress", "type": "multi_choice", - "text": "What should we protect when unexpected problems is high?", + "text": "What should we protect when unexpected problems pile up?", "depth": 4, "access": "premium", "tags": [ @@ -3784,7 +3784,7 @@ "id": "stress_200", "category_id": "stress", "type": "multi_choice", - "text": "Which supports help when feeling supported is high?", + "text": "Which supports help when one of us needs to feel supported?", "depth": 4, "access": "premium", "tags": [ @@ -3920,7 +3920,7 @@ "id": "stress_204", "category_id": "stress", "type": "multi_choice", - "text": "Which supports help when burnout signs is high?", + "text": "Which supports help when burnout signs are showing?", "depth": 3, "access": "premium", "tags": [ @@ -3954,7 +3954,7 @@ "id": "stress_205", "category_id": "stress", "type": "multi_choice", - "text": "What should we protect when resetting after stress is high?", + "text": "What should we protect when we are resetting after stress?", "depth": 4, "access": "premium", "tags": [ @@ -4386,7 +4386,7 @@ "id": "stress_223", "category_id": "stress", "type": "scale", - "text": "How well do we talk when health worries is high?", + "text": "How well do we talk when health worries feel heavy?", "depth": 2, "access": "premium", "tags": [ @@ -4699,7 +4699,7 @@ "id": "stress_239", "category_id": "stress", "type": "this_or_that", - "text": "When asking for help is high, what helps more?", + "text": "When asking for help feels hard, what helps more?", "depth": 3, "access": "premium", "tags": [ @@ -4765,7 +4765,7 @@ "id": "stress_242", "category_id": "stress", "type": "this_or_that", - "text": "When unexpected problems is high, what helps more?", + "text": "When unexpected problems pile up, what helps more?", "depth": 3, "access": "premium", "tags": [ @@ -4831,7 +4831,7 @@ "id": "stress_245", "category_id": "stress", "type": "this_or_that", - "text": "When feeling supported is high, what helps more?", + "text": "When one of us needs support, what helps more?", "depth": 3, "access": "premium", "tags": [ @@ -4897,7 +4897,7 @@ "id": "stress_248", "category_id": "stress", "type": "this_or_that", - "text": "When health worries is high, what helps more?", + "text": "When health worries feel heavy, what helps more?", "depth": 3, "access": "premium", "tags": [ diff --git a/seed/validate_question_variety.py b/seed/validate_question_variety.py index c638ef5c..a4960888 100644 --- a/seed/validate_question_variety.py +++ b/seed/validate_question_variety.py @@ -30,6 +30,32 @@ TEMPLATE_STEMS = ( "what do you need from me when", ) +SUSPECT_GRAMMAR_PATTERNS = ( + ( + "placeholder phrase", + re.compile(r"\b(deeper fears|deep fears|emotional needs you hide|needs you hide|of you you protect)\b"), + ), + ( + "subject/verb agreement", + re.compile(r"\bdoes (in-laws|special needs|warm greetings|coping habits|stress recovery routines)\b"), + ), + ( + "abstract stress intensity", + re.compile( + r"\b(asking for help|low energy days|unexpected problems|busy weeks|feeling supported|" + r"feeling alone in stress|health worries|burnout signs|resetting after stress) is high\b" + ), + ), + ( + "abstract stress presence", + re.compile(r"\b(asking for help|feeling supported) is present\b"), + ), + ( + "plural shows up", + re.compile(r"\b(unexpected problems|health worries) shows up\b"), + ), +) + @dataclass(frozen=True) class QuestionRecord: @@ -109,6 +135,14 @@ def validate_records(records: list[QuestionRecord], label: str) -> list[str]: sample_ids = ", ".join(record.id for record in items[:8]) errors.append(f" sample ids: {sample_ids}") + for name, pattern in SUSPECT_GRAMMAR_PATTERNS: + matches = [record for record in records if pattern.search(record.text.lower())] + if matches: + ids = ", ".join(record.id for record in matches[:8]) + if len(matches) > 8: + ids += ", ..." + errors.append(f"{label}: {len(matches)} suspect {name} rows ({ids})") + return errors