fix: Q2 grammar quality pass on emotional_intimacy, parenting, stress questions + app.db rebuild
This commit is contained in:
parent
8cfcb6d51f
commit
733c0967c2
Binary file not shown.
|
|
@ -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")
|
||||||
|
|
@ -1303,7 +1303,7 @@
|
||||||
"id": "emotional_intimacy_076",
|
"id": "emotional_intimacy_076",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 4,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1320,7 +1320,7 @@
|
||||||
"id": "emotional_intimacy_077",
|
"id": "emotional_intimacy_077",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1337,7 +1337,7 @@
|
||||||
"id": "emotional_intimacy_078",
|
"id": "emotional_intimacy_078",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1354,7 +1354,7 @@
|
||||||
"id": "emotional_intimacy_079",
|
"id": "emotional_intimacy_079",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1371,7 +1371,7 @@
|
||||||
"id": "emotional_intimacy_080",
|
"id": "emotional_intimacy_080",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1388,7 +1388,7 @@
|
||||||
"id": "emotional_intimacy_081",
|
"id": "emotional_intimacy_081",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 4,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1405,7 +1405,7 @@
|
||||||
"id": "emotional_intimacy_082",
|
"id": "emotional_intimacy_082",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1422,7 +1422,7 @@
|
||||||
"id": "emotional_intimacy_083",
|
"id": "emotional_intimacy_083",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1439,7 +1439,7 @@
|
||||||
"id": "emotional_intimacy_084",
|
"id": "emotional_intimacy_084",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1456,7 +1456,7 @@
|
||||||
"id": "emotional_intimacy_085",
|
"id": "emotional_intimacy_085",
|
||||||
"category_id": "emotional_intimacy",
|
"category_id": "emotional_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
|
||||||
|
|
@ -1592,7 +1592,7 @@
|
||||||
"id": "parenting_093",
|
"id": "parenting_093",
|
||||||
"category_id": "parenting",
|
"category_id": "parenting",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2357,7 +2357,7 @@
|
||||||
"id": "parenting_138",
|
"id": "parenting_138",
|
||||||
"category_id": "parenting",
|
"category_id": "parenting",
|
||||||
"type": "written",
|
"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,
|
"depth": 5,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@
|
||||||
"id": "physical_intimacy_013",
|
"id": "physical_intimacy_013",
|
||||||
"category_id": "physical_intimacy",
|
"category_id": "physical_intimacy",
|
||||||
"type": "written",
|
"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,
|
"depth": 2,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@
|
||||||
"id": "stress_020",
|
"id": "stress_020",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -436,7 +436,7 @@
|
||||||
"id": "stress_025",
|
"id": "stress_025",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -606,7 +606,7 @@
|
||||||
"id": "stress_035",
|
"id": "stress_035",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -776,7 +776,7 @@
|
||||||
"id": "stress_045",
|
"id": "stress_045",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -861,7 +861,7 @@
|
||||||
"id": "stress_050",
|
"id": "stress_050",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1116,7 +1116,7 @@
|
||||||
"id": "stress_065",
|
"id": "stress_065",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1201,7 +1201,7 @@
|
||||||
"id": "stress_070",
|
"id": "stress_070",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -1286,7 +1286,7 @@
|
||||||
"id": "stress_075",
|
"id": "stress_075",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 3,
|
||||||
"access": "free",
|
"access": "free",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2068,7 +2068,7 @@
|
||||||
"id": "stress_121",
|
"id": "stress_121",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 4,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2408,7 +2408,7 @@
|
||||||
"id": "stress_141",
|
"id": "stress_141",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "written",
|
"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,
|
"depth": 4,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2668,7 +2668,7 @@
|
||||||
"id": "stress_154",
|
"id": "stress_154",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "single_choice",
|
"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,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2758,7 +2758,7 @@
|
||||||
"id": "stress_157",
|
"id": "stress_157",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "single_choice",
|
"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,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2818,7 +2818,7 @@
|
||||||
"id": "stress_159",
|
"id": "stress_159",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "single_choice",
|
"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,
|
"depth": 2,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2848,7 +2848,7 @@
|
||||||
"id": "stress_160",
|
"id": "stress_160",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "single_choice",
|
"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,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2938,7 +2938,7 @@
|
||||||
"id": "stress_163",
|
"id": "stress_163",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "single_choice",
|
"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,
|
"depth": 2,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -2998,7 +2998,7 @@
|
||||||
"id": "stress_165",
|
"id": "stress_165",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "single_choice",
|
"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,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -3358,7 +3358,7 @@
|
||||||
"id": "stress_177",
|
"id": "stress_177",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "single_choice",
|
"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,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -3682,7 +3682,7 @@
|
||||||
"id": "stress_197",
|
"id": "stress_197",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "multi_choice",
|
"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,
|
"depth": 4,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -3784,7 +3784,7 @@
|
||||||
"id": "stress_200",
|
"id": "stress_200",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "multi_choice",
|
"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,
|
"depth": 4,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -3920,7 +3920,7 @@
|
||||||
"id": "stress_204",
|
"id": "stress_204",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "multi_choice",
|
"type": "multi_choice",
|
||||||
"text": "Which supports help when burnout signs is high?",
|
"text": "Which supports help when burnout signs are showing?",
|
||||||
"depth": 3,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -3954,7 +3954,7 @@
|
||||||
"id": "stress_205",
|
"id": "stress_205",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "multi_choice",
|
"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,
|
"depth": 4,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -4386,7 +4386,7 @@
|
||||||
"id": "stress_223",
|
"id": "stress_223",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "scale",
|
"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,
|
"depth": 2,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -4699,7 +4699,7 @@
|
||||||
"id": "stress_239",
|
"id": "stress_239",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "this_or_that",
|
"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,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -4765,7 +4765,7 @@
|
||||||
"id": "stress_242",
|
"id": "stress_242",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "this_or_that",
|
"type": "this_or_that",
|
||||||
"text": "When unexpected problems is high, what helps more?",
|
"text": "When unexpected problems pile up, what helps more?",
|
||||||
"depth": 3,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -4831,7 +4831,7 @@
|
||||||
"id": "stress_245",
|
"id": "stress_245",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "this_or_that",
|
"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,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
@ -4897,7 +4897,7 @@
|
||||||
"id": "stress_248",
|
"id": "stress_248",
|
||||||
"category_id": "stress",
|
"category_id": "stress",
|
||||||
"type": "this_or_that",
|
"type": "this_or_that",
|
||||||
"text": "When health worries is high, what helps more?",
|
"text": "When health worries feel heavy, what helps more?",
|
||||||
"depth": 3,
|
"depth": 3,
|
||||||
"access": "premium",
|
"access": "premium",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,32 @@ TEMPLATE_STEMS = (
|
||||||
"what do you need from me when",
|
"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)
|
@dataclass(frozen=True)
|
||||||
class QuestionRecord:
|
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])
|
sample_ids = ", ".join(record.id for record in items[:8])
|
||||||
errors.append(f" sample ids: {sample_ids}")
|
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
|
return errors
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue