Commit 6f561707 by luoqi

docs(sync/jvs-dw): 更正"5 试点诊所"旧注释 → 全瑞尔按 DW 全量(逻辑无改)

摄入刻意不限诊所:cohort 无诊所过滤;consult/return_visit 用
`org IN (SELECT DISTINCT organization_id FROM fact_emr_treatment_out)`
= EMR 出现的所有诊所(2026-07 实测 64 家,非 5 家)。原"5 试点"注释误导,
易被当作 scope 越权 bug —— 全部改成"全瑞尔/随 DW 全量";头部 5 家 id 保留作参考,
非过滤白名单。纯注释,一行逻辑未动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
parent c1659544
Pipeline #3357 failed in 0 seconds
# consult — PAC 咨询主体(fact_consult_out → consultation_record)
# 一次咨询/初诊事件;potential_cure=患者意向(主观意愿,非诊断)。5 试点诊所内
# 一次咨询/初诊事件;potential_cure=患者意向(主观意愿,非诊断)。范围随 DW 全量(全瑞尔)
canonical: consultation
emits:
......@@ -16,7 +16,7 @@ field_mapping:
externalId: consult_external_id
# 无 updated_date → 用 appointment_date 作幂等键(同 consult 同日再拉 → dedup;编辑漏更新见 follow-up)
updatedAt: appointment_date
patientExternalId: patient_id # = patient_register_id(SQL alias;5 诊所内 = patient_id)
patientExternalId: patient_id # = patient_register_id(SQL alias;试点期实测 94.4% = patient_id)
clinicId: organization_id
occurredAt: appointment_date
intentRaw: potential_cure # Python list 串 ['种植','洁牙'] → parser 解析意向
......
# patient_return_visit — 诊所回访任务记录(展示用,5 试点)
# patient_return_visit — 诊所回访任务记录(展示用,全瑞尔)
#
# 消费 sql_source.fact_returnvisit_out(已 customer_id→patient_id + org∈5试点过滤)。
# 消费 sql_source.fact_returnvisit_out(已 customer_id→patient_id + org∈EMR 全部诊所过滤,随 DW 全量)。
# upsert 资源(无 emits,同 patient/relation):落 PatientReturnVisit 表,不进 transaction/fact、不进召回。
canonical: patient_return_visit
......
# JVS DW Cold Import Manifest(v2.3 — 单 host 多 tenant per-row 路由)
#
# 数据源:阿里云 ClickHouse(集团 DW ADS 出口层)
# 试点 5 诊所(双 brand 同一 manifest 跑完):
# 瑞尔(tenant=ruier)
# 7d49539c7573490387c03e6496ff1a6c 杭州大厦诊所
# dad2f04a120947e2b82b41cbd108f3f4 杭州高德诊所
# 66701845dd2342e19f9e9f576c4ffe9c 北京朝阳公园诊所
# 瑞泰(tenant=ruitai)
# c18cadf2d3cd4adda5527debd41356eb 通善口腔学前街医院
# e83d432a38bb4f6284713b36db4e7497 上海世纪公园
# 诊所范围:【不限定 —— 按 DW 全量】。cohort = fact_client_out 里所有有就诊记录的患者
# (WHERE last_visit_time IS NOT NULL,无诊所过滤);患者进池后其在任意诊所的记录全摄。
# → 实际诊所数随 DW 而变(2026-07 实测 64 家瑞尔/瑞泰诊所,非 5 家)。这是刻意的:DW 给多少摄多少。
# 下面 5 家是最初试点(数据量最大的主力诊所,仅作参考,非过滤白名单):
# 瑞尔(tenant=ruier) 7d49539c…杭州大厦 / dad2f04a…杭州高德 / 66701845…北京朝阳公园
# 瑞泰(tenant=ruitai) c18cadf2…通善口腔学前街 / e83d432a…上海世纪公园
#
# ─────────────────────────────────────────────────────────────
# 架构纪律(v2.2 — yaml 单方案改造,apps/pac-docs/content/docs/architecture/data-ingestion.mdx §五)
......@@ -227,8 +225,9 @@ sql_source:
) s2
WHERE tooth != ''
# ── 诊所回访任务(fact_returnvisit_out)→ patient_return_visit upsert(展示用,5 试点)──
# customer_id AS patient_id(让 cohort 过滤生效);WHERE org ∈ 5 试点(= EMR 表的 org)→ 只摄 5 家。
# ── 诊所回访任务(fact_returnvisit_out)→ patient_return_visit upsert(展示用)──
# customer_id AS patient_id(让 cohort 过滤生效);WHERE org ∈ EMR 表出现的所有诊所
# (随 DW 全量,当前 64 家,非 5 家)—— 与核心数据同范围。
# 非召回信号,详情页"回访记录"块展示(常规/术后/咨询回访)。
fact_returnvisit_out: |
SELECT id, customer_id AS patient_id, brand, organization_id, task_date,
......@@ -237,8 +236,9 @@ sql_source:
FROM dw_group.fact_returnvisit_out
WHERE organization_id IN (SELECT DISTINCT organization_id FROM dw_group.fact_emr_treatment_out)
# ── 咨询主体(fact_consult_out)→ consultation_record(意向源,5 试点)──
# patient_register_id = patient_id(5 诊所内 94.4% 命中;CH 允许 WHERE 引用别名,同 returnvisit)。
# ── 咨询主体(fact_consult_out)→ consultation_record(意向源)──
# patient_register_id = patient_id(试点期实测 94.4% 命中;CH 允许 WHERE 引用别名,同 returnvisit)。
# 范围同 returnvisit:org ∈ EMR 表出现的所有诊所(随 DW 全量,非 5 家)。
# SQL 朴素(只 SELECT 列 + WHERE 过滤,CSV 双源等价);consult_external_id 由 transforms.derive 拼(I 段)。
# 无 updated_date/无 id → external_id=(patient,appo,date);不入 per_query(无 cursor)→ 每轮全量按
# org+patient 过滤再拉(幂等 upsert,同 returnvisit)。potential_cure=患者意向(主观,非诊断,不进召回)。
......@@ -873,7 +873,7 @@ transforms:
parts: ['${patient_id}', '|ref|', '${recommend_id}']
# ── H. fact_returnvisit_out:治疗项 大类(treatment_items)·子项(treatment_items_two)合一 ──
# host 把治疗项拆成两列(大类「外科」+ 子项「简单拔牙」),实测 5 试点两列总是成对(只填一列=0)。
# host 把治疗项拆成两列(大类「外科」+ 子项「简单拔牙」),试点期实测两列总是成对(只填一列=0)。
# 回访是纯展示,PAC 只存一个可读字段 treatmentItems —— "两列"的 host 怪癖在此合并,PAC schema 不变。
- kind: derive
input: fact_returnvisit_out
......@@ -900,8 +900,8 @@ transforms:
assemblers:
- { file: assemblers/patient.yaml }
- { file: assemblers/patient_relation.yaml } # 联系人/亲属边(referee → PatientRelation upsert)
- { file: assemblers/patient_return_visit.yaml } # 诊所回访(展示用,5 试点 → PatientReturnVisit upsert)
- { file: assemblers/consult.yaml } # 咨询主体(意向源,5 试点 → consultation_record)
- { file: assemblers/patient_return_visit.yaml } # 诊所回访(展示用,全瑞尔 → PatientReturnVisit upsert)
- { file: assemblers/consult.yaml } # 咨询主体(意向源,全瑞尔 → consultation_record)
- { file: assemblers/encounter.yaml }
- { file: assemblers/appointment.yaml }
- { file: assemblers/diagnosis.yaml }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment