正文
获取原文件references/schema-linkage-contract.md
SchemaLinkageProfile is D002's aggregate-only structural description of a medical-data package.
Sensitivity
The output is still restricted_local because table/column names and aggregate counts may reveal internal hospital system structure. It intentionally contains no sampled patient values.
Table object
Key fields:
table_ref: D002-local stable reference. Virtual tables may usefile_ref#sheet,file_ref#sqlite_table, orfile_ref#FHIRResourceType.source_ref: original D001 file reference.source_format: CSV/TSV/JSON/JSONL/XLSX/SQLite/FHIR JSON.profile_status:complete | partial | skipped | error.rows_profiled: number of rows whose values contributed to statistics.row_count_observed: count observed by the profiler. When capped, it is the observed lower bound, not necessarily total rows.row_count_complete: whether the observed count is a complete total.columns: aggregate column profiles.primary_key_candidates: single-column keys supported by observed uniqueness/null statistics.composite_key_candidates: small plausible key combinations.inferred_grain: structural grain hypothesis with confidence and rationale.risks: table-local structural issues.
Column profile
A column profile may include:
- name
- normalized name
- inferred type
- non-null/null counts and rates
- distinct count/rate where safe
- identifier role
- PHI-risk flag
- time-field candidate flag
- key suitability
No examples, top_values, min_string, max_string, or raw sample value fields are permitted.
Relationship object
A relationship is empirical unless constraint_source says a database FK was actually observed.
Coverage is based on tokenized distinct identifiers:
left_coverage = overlap / distinct_leftright_coverage = overlap / distinct_right
Cardinality is inferred from uniqueness on each side:
1:11:NN:1N:M_or_ambiguous
The result is a candidate relationship, not a clinical assertion.
Linkage graph
linkage_graph summarizes structural anchors:
- patient anchors
- encounter anchors
- specimen/order anchors
- disconnected tables
It must preserve ambiguity instead of forcing a single root.