fix(rectification): downgrade yearless personality probes to tie-breakers (BUG-629)
Ask dated dasha probes first; D9/D10 and nakshatra wait until that pool is empty, score at half weight, and never eliminate. Skill 10.0.21. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
# 性格题离线命中率导出(医院记录)
|
||||
|
||||
产品负责人在有数据库权限的环境跑。执行方不能替你跑。导出给 `scripts/rectification/varga_style_calibration_report.py` 用。
|
||||
|
||||
只导出哈希后的 `case_id`。不要导出姓名、出生日期、地点、坐标、邮箱、原话、用户 ID。
|
||||
|
||||
筛选在脚本里还会再做一遍:`birth_time_source = hospital_record` 且前后不确定度都 ≤ 2 分钟。SQL 先收窄,减少体积。
|
||||
|
||||
`recorded_sign` 必须是**档案里的记录分钟**在该层的分盘星座(或月宿),不是校正后的采用分钟。星座名与选项 `sign` 用同一套中文名(例如 `天秤座`)。
|
||||
|
||||
```sql
|
||||
-- service_role / schema_owner。输出一行一个 JSON 对象,外层再包成 {"cases":[...]}。
|
||||
-- 需要 pgcrypto:encode(digest(...), 'hex')。
|
||||
|
||||
with latest_transition as (
|
||||
select distinct on (t.case_id)
|
||||
t.case_id,
|
||||
t.inference_state
|
||||
from public.agentic_rectification_inference_transitions t
|
||||
order by t.case_id, t.revision desc
|
||||
),
|
||||
hospital_cases as (
|
||||
select
|
||||
encode(digest(c.id::text, 'sha256'), 'hex') as case_id_hash,
|
||||
c.baseline_birth_snapshot->>'birth_time_source' as birth_time_source,
|
||||
to_char((c.baseline_birth_snapshot->>'reported_birth_time')::time, 'HH24:MI') as recorded_minute,
|
||||
(c.baseline_birth_snapshot->>'uncertainty_before_minutes')::int as uncertainty_before_minutes,
|
||||
(c.baseline_birth_snapshot->>'uncertainty_after_minutes')::int as uncertainty_after_minutes,
|
||||
lt.inference_state
|
||||
from public.agentic_rectification_cases c
|
||||
join latest_transition lt on lt.case_id = c.id
|
||||
where c.baseline_birth_snapshot->>'birth_time_source' = 'hospital_record'
|
||||
and coalesce((c.baseline_birth_snapshot->>'uncertainty_before_minutes')::int, 99) <= 2
|
||||
and coalesce((c.baseline_birth_snapshot->>'uncertainty_after_minutes')::int, 99) <= 2
|
||||
and nullif(c.baseline_birth_snapshot->>'reported_birth_time', '') is not null
|
||||
)
|
||||
select jsonb_build_object(
|
||||
'cases',
|
||||
coalesce(jsonb_agg(
|
||||
jsonb_build_object(
|
||||
'case_id_hash', h.case_id_hash,
|
||||
'birth_time_source', h.birth_time_source,
|
||||
'recorded_minute', h.recorded_minute,
|
||||
'uncertainty_before_minutes', h.uncertainty_before_minutes,
|
||||
'uncertainty_after_minutes', h.uncertainty_after_minutes,
|
||||
'answers', coalesce((
|
||||
select jsonb_agg(
|
||||
jsonb_build_object(
|
||||
'semantic_key', probe->>'semantic_key',
|
||||
'answer_class', ans->>'answer_class',
|
||||
'recorded_sign', null, -- 用记录分钟在该层的星座/月宿填上;不要用采用分钟
|
||||
'options', coalesce(probe->'style_options', '[]'::jsonb)
|
||||
)
|
||||
)
|
||||
from jsonb_array_elements(coalesce(h.inference_state->'answered_probes', '[]'::jsonb)) ans
|
||||
join jsonb_array_elements(coalesce(h.inference_state->'probes', '[]'::jsonb)) probe
|
||||
on probe->>'id' = ans->>'probe_id'
|
||||
or probe->>'semantic_key' = ans->>'semantic_key'
|
||||
where (
|
||||
probe->>'choice_kind' = 'varga_style'
|
||||
or probe->>'source' = 'nakshatra_boundary'
|
||||
)
|
||||
), '[]'::jsonb)
|
||||
)
|
||||
), '[]'::jsonb)
|
||||
) as payload
|
||||
from hospital_cases h;
|
||||
```
|
||||
|
||||
把结果存成 JSON 后:
|
||||
|
||||
```bash
|
||||
.venv/bin/python scripts/rectification/varga_style_calibration_report.py export.json
|
||||
```
|
||||
|
||||
只打印 `d9` / `d10` / `nakshatra` 的 `n` 与 `hit_rate`。命中率接近 1/3(三选一随机)时,再由产品决定是否删题。
|
||||
Reference in New Issue
Block a user