# emr — 电子病历自由文本(诊断 / 治疗已拆出独立 fact,本资源只装自由文本)
# 消费 transforms 输出表 emr_rows(project keep 自由文本字段,剥离 JSON)
canonical: emr

emits:
  action: emr_submitted
  subjectType: emr
  occurredAtField: submittedAt

primary:
  table: emr_rows
  key: id
  dedup_by: id   # 炸行兜底(SQL 朴素化后理论上不再炸,留作保险)

field_mapping:
  externalId:           id
  patientExternalId:    patient_id
  clinicId:             organization_id
  submittedAt:          rq
  encounterExternalId:  registration_id
