正文
获取原文件references/document-structure-contract.md
D004 turns a de-identified narrative surface into a structure-preserving document object.
Required distinctions
- Document classification answers what kind of document this appears to be.
- Section segmentation answers where named document sections begin and end.
- Clinical fact extraction is out of scope. D004 must not convert section text into diagnoses, symptoms, medications, labs, or procedures.
Offset contract
All offsets are zero-based Python character offsets into the exact full_text stored in the same StructuredDocument JSON.
For each section:
heading_start,heading_enddelimit the detected heading span when a heading exists.content_start,content_enddelimit the exact content slice.text == full_text[content_start:content_end].- Sections must not overlap.
- Unknown/front matter is retained rather than discarded.
Section provenance
Every section carries:
- source reference
- document id
- canonical section label
- original heading label when present
- detection method
- confidence
- offsets
This allows D005 to cite a clinical fact back to an exact section/span.
Review semantics
auto_structured means the deterministic structure is mechanically coherent; it does not mean clinically correct.
needs_review is required when, for example:
- D003 marked the source
sanitized_review_requiredand no approval exists - document type is unknown
- no recognized section headings were found
- only a small fraction of content is under recognized clinical sections
- contradictory/ambiguous header structure is detected
blocked means D004 was not allowed to read/process the source.