martinkorelic commited on
Commit
216f5d8
·
verified ·
1 Parent(s): e5c7c37

Update README: remove extraction pipeline details, focus on IPS NER validation

Browse files
Files changed (1) hide show
  1. README.md +29 -47
README.md CHANGED
@@ -13,7 +13,6 @@ tags:
13
  - information-extraction
14
  - synthetic
15
  - icd10
16
- - pdf-understanding
17
  - clinical-ips
18
  pretty_name: SynthIPS
19
  size_categories:
@@ -28,21 +27,13 @@ configs:
28
  data_files: data/patient_summary/*.parquet
29
  ---
30
 
31
- # SynthIPS — Synthetic IPS Validation Dataset
32
 
33
- A small validation dataset of **10 synthetic patients** across **29 PDF clinical encounters**,
34
- annotated for the three core entity types of the **International Patient Summary (IPS)** standard:
35
- **Condition**, **Medication**, and **Lab**.
36
 
37
- The [International Patient Summary (IPS)](https://www.hl7.org/fhir/uv/ips/) is an HL7 FHIR standard
38
- for a minimal, specialty-agnostic health record designed for cross-border and cross-system care continuity.
39
- SynthIPS is built around its three primary clinical sections — problems, medications, and lab results —
40
- and provides realistic PDF documents with ground-truth annotations aligned to IPS entity types,
41
- ICD-10 condition codes, ATC medication codes, and LOINC lab identifiers.
42
 
43
- Documents include structured blocks (problem lists, medication tables, lab grids) alongside free-text
44
- narrative sections and deliberate distractor spans (negated / ruled-out entities), reflecting the
45
- mixed layout of real clinical encounter PDFs.
46
 
47
  | Stat | Value |
48
  |------|-------|
@@ -51,7 +42,7 @@ mixed layout of real clinical encounter PDFs.
51
  | GT spans | 171 (86 Condition · 85 Medication) |
52
  | Distractor spans | 14 |
53
  | Structured lab analytes | 446 (35 unique, 100% LOINC coverage) |
54
- | OCR layout chunks | 815 (111 contain GT entities) |
55
  | Encounter types | initial\_consult · follow\_up · specialist\_letter · acute\_visit · lab\_review |
56
  | Patient profiles | minimal · typical · complex (controls entity density) |
57
 
@@ -63,8 +54,8 @@ All configs share `doc_id` (e.g. `"patient_01/encounter_01"`) and `patient_id` a
63
 
64
  | Config | Rows | Primary use |
65
  |--------|------|-------------|
66
- | `documents` *(default)* | 29 | Full archive — PDF viewer, markdown text, all GT annotations |
67
- | `chunks` | 815 | NER evaluation — one row per OCR layout region with inline entity annotations |
68
  | `patient_summary` | 10 | Patient-level overview — aggregated GT spans, labs, encounter list |
69
 
70
  ### How configs relate
@@ -93,10 +84,10 @@ for chunk in chunks:
93
  continue
94
  for e in entities:
95
  span = chunk["markdown_text"][e["start"]:e["end"]]
96
- print(chunk["layout_task"], f"p{chunk['page_number']}",
97
  e["label"], repr(span), "|", e["kg_id"])
98
 
99
- # ── Full-document NER (join chunks → documents for full markdown) ─────────
100
  docs = load_dataset("betterInnovation/SynthIPS", "documents", split="test")
101
  doc = docs[0]
102
 
@@ -119,7 +110,7 @@ patients = load_dataset("betterInnovation/SynthIPS", "patient_summary", split="t
119
  for p in patients:
120
  print(p["patient_id"], p["profile"],
121
  p["n_encounters"], "encounters")
122
- print(" encounter types:", list(p["encounter_kinds"])) # real Arrow list
123
  ```
124
 
125
  ---
@@ -135,7 +126,7 @@ One row per encounter. The default config. PDF renders natively in the HF Data V
135
  | `doc_id` | string | `"patient_01/encounter_01"` — join key |
136
  | `patient_id` | string | `"patient_01"` — join key |
137
  | `pdf_bytes` | Pdf | Raw PDF (~70 KB, 3 pages). Renders as page viewer in HF Data Viewer. |
138
- | `markdown_text` | string | Full PDF extracted as markdown — header, problem list, medication table, lab grid, narrative, signatures. `start`/`end` offsets in `gt_spans` point here. |
139
  | `patient_name` | string | |
140
  | `patient_profile` | string | `minimal / typical / complex` |
141
  | `patient_sex` | string | `"M"` / `"F"` |
@@ -155,24 +146,22 @@ One row per encounter. The default config. PDF renders natively in the HF Data V
155
 
156
  ### `chunks` config — 815 rows
157
 
158
- One row per PP-DocLayout region (text paragraph or table block) extracted from the PDF.
159
- `markdown_text` here is the chunk's own slice of the full document markdown.
160
- Join on `doc_id → documents` for the complete document context.
161
 
162
  | Column | Type | Description |
163
  |--------|------|-------------|
164
  | `doc_id` | string | Join key → `documents` |
165
  | `patient_id` | string | |
166
- | `markdown_text` | string | This chunk's extracted text. `start`/`end` in `gt_entities` are offsets into this field. |
167
  | `encounter_id` | string | |
168
  | `encounter_kind` | string | |
169
  | `patient_profile` | string | |
170
- | `chunk_id` | string | `"p1_r3"` — page + region index |
171
- | `page_number` | int | PDF page (1-indexed) |
172
  | `chunk_order` | int | Reading order within the encounter |
173
- | `layout_task` | string | `"text"` or `"table"` |
174
- | `gt_entities` | string (JSON) | GT entities in this chunk — `start`/`end` into `markdown_text` |
175
- | `distractor_entities` | string (JSON) | Distractor spans in this chunk |
176
 
177
  ### `patient_summary` config — 10 rows
178
 
@@ -188,8 +177,8 @@ One row per patient. Cross-encounter data pre-aggregated.
188
  | `anchor_icd10` | string | Primary diagnoses |
189
  | `clinical_hook` | string | One-line clinical summary |
190
  | `n_encounters` | int | |
191
- | `encounter_ids` | list[string] | Arrow native list — no `json.loads` needed |
192
- | `encounter_kinds` | list[string] | Arrow native list |
193
  | `all_gt_spans` | string (JSON) | All GT spans across all encounters — filter by `label` for Condition / Medication |
194
  | `all_distractors` | string (JSON) | All distractor spans |
195
  | `all_labs` | string (JSON) | All structured lab analytes across all encounters |
@@ -204,7 +193,7 @@ Applies to `gt_spans` / `distractor_spans` (documents) and `gt_entities` / `dist
204
  |-------|------|-------------|
205
  | `surface` | str | Exact mention text as it appears in the document (may be abbreviation: `"HTN"`, `"T2DM"`) |
206
  | `label` | str | IPS type: `Condition` or `Medication` |
207
- | `start` | int | Start char offset into `markdown_text` (document-level in `documents`, chunk-level in `chunks`) |
208
  | `end` | int | End char offset into `markdown_text` |
209
  | `kg_id` | str | ICD-10 code (Condition) or ATC code (Medication) |
210
  | `canonical` | str | Normalised entity name — use for normalisation scoring |
@@ -212,7 +201,7 @@ Applies to `gt_spans` / `distractor_spans` (documents) and `gt_entities` / `dist
212
 
213
  **Offset guarantee:**
214
  `markdown_text[start:end]` matches `surface` after whitespace normalisation.
215
- PDF line-wrapping may insert `\n` between words — normalise with `re.sub(r'\s+', ' ', span)` before comparing.
216
 
217
  **Distractors** share the same schema. They are contextually plausible entities that appear in the narrative but are *not* part of the patient's confirmed record (negated diagnoses, family history mentions, hypothetical treatments). A model that extracts them is producing false positives.
218
 
@@ -224,6 +213,7 @@ PDF line-wrapping may insert `\n` between words — normalise with `re.sub(r'\s+
224
 
225
  ```python
226
  import json
 
227
  from nervaluate import Evaluator
228
 
229
  chunks = load_dataset("betterInnovation/SynthIPS", "chunks", split="test")
@@ -324,27 +314,19 @@ SynthIPS covers the three primary sections of the **IPS standard**:
324
  Entity names in `canonical` follow the IPS-preferred normalised form.
325
  Abbreviations and synonyms (e.g. `"HTN"`, `"T2DM"`) are preserved in `surface` exactly as they appear in the document.
326
 
327
- ### Text surface
328
 
329
- `markdown_text` is the full PDF extracted via a layout-aware OCR pipeline and rendered as
330
- markdown: institution header, patient demographics, problem list, medication table, lab grid,
331
- narrative sections (HPI, social history, examination, assessment & plan), and signatures.
332
 
333
- All `start`/`end` offsets in entity spans point into `markdown_text`.
334
- In `chunks`, `markdown_text` is the chunk's own slice of this content.
335
- PDF line-wrapping may insert `\n` between words — normalise with `re.sub(r'\s+', ' ', span)`.
336
 
337
  ### Distractor design
338
 
339
- Each encounter includes 0–1 deliberate trap spans: clinically plausible entities that appear
340
- in the narrative but are negated, belong to family history, are ruled out, or are hypothetical.
341
- Examples: *"no evidence of X"*, *"father had X"*, *"we will consider X if..."*.
342
- These measure whether a model extracts *only* confirmed, patient-present entities.
343
 
344
  ### Reproducibility
345
 
346
- Every encounter PDF is deterministic given its `layout_seed`. Re-running the composer
347
- with the same source files produces byte-identical PDFs and GT JSONs.
348
 
349
  ---
350
 
@@ -352,7 +334,7 @@ with the same source files produces byte-identical PDFs and GT JSONs.
352
 
353
  ```bibtex
354
  @dataset{synthips2026,
355
- title = {SynthIPS: Synthetic Clinical NER Benchmark},
356
  author = {Better Care},
357
  year = {2026},
358
  url = {https://huggingface.co/datasets/betterInnovation/SynthIPS},
 
13
  - information-extraction
14
  - synthetic
15
  - icd10
 
16
  - clinical-ips
17
  pretty_name: SynthIPS
18
  size_categories:
 
27
  data_files: data/patient_summary/*.parquet
28
  ---
29
 
30
+ # SynthIPS — Synthetic IPS NER Validation Dataset
31
 
32
+ A validation dataset of **10 synthetic patients** across **29 clinical encounters**, annotated for the three core entity types of the **International Patient Summary (IPS)** standard: **Condition**, **Medication**, and **Lab**.
 
 
33
 
34
+ The [International Patient Summary (IPS)](https://www.hl7.org/fhir/uv/ips/) is an HL7 FHIR standard for a minimal, specialty-agnostic health record designed for cross-border and cross-system care continuity. SynthIPS is built around its three primary clinical sections — problems, medications, and lab results — and provides realistic clinical documents with ground-truth annotations aligned to IPS entity types, ICD-10 condition codes, ATC medication codes, and LOINC lab identifiers.
 
 
 
 
35
 
36
+ Documents include structured blocks (problem lists, medication tables, lab grids) alongside free-text narrative sections and deliberate distractor spans (negated / ruled-out entities), reflecting the mixed layout of real clinical encounter documents.
 
 
37
 
38
  | Stat | Value |
39
  |------|-------|
 
42
  | GT spans | 171 (86 Condition · 85 Medication) |
43
  | Distractor spans | 14 |
44
  | Structured lab analytes | 446 (35 unique, 100% LOINC coverage) |
45
+ | Text segments | 815 (111 contain GT entities) |
46
  | Encounter types | initial\_consult · follow\_up · specialist\_letter · acute\_visit · lab\_review |
47
  | Patient profiles | minimal · typical · complex (controls entity density) |
48
 
 
54
 
55
  | Config | Rows | Primary use |
56
  |--------|------|-------------|
57
+ | `documents` *(default)* | 29 | Full archive — document text, PDF, all GT annotations |
58
+ | `chunks` | 815 | NER evaluation — one row per document segment with inline entity annotations |
59
  | `patient_summary` | 10 | Patient-level overview — aggregated GT spans, labs, encounter list |
60
 
61
  ### How configs relate
 
84
  continue
85
  for e in entities:
86
  span = chunk["markdown_text"][e["start"]:e["end"]]
87
+ print(chunk["segment_type"], f"p{chunk['page_number']}",
88
  e["label"], repr(span), "|", e["kg_id"])
89
 
90
+ # ── Full-document NER (join chunks → documents for full text) ─────────────
91
  docs = load_dataset("betterInnovation/SynthIPS", "documents", split="test")
92
  doc = docs[0]
93
 
 
110
  for p in patients:
111
  print(p["patient_id"], p["profile"],
112
  p["n_encounters"], "encounters")
113
+ print(" encounter types:", list(p["encounter_kinds"])) # native Arrow list
114
  ```
115
 
116
  ---
 
126
  | `doc_id` | string | `"patient_01/encounter_01"` — join key |
127
  | `patient_id` | string | `"patient_01"` — join key |
128
  | `pdf_bytes` | Pdf | Raw PDF (~70 KB, 3 pages). Renders as page viewer in HF Data Viewer. |
129
+ | `markdown_text` | string | Full document text as markdown — header, problem list, medication table, lab grid, narrative, signatures. `start`/`end` offsets in `gt_spans` point here. |
130
  | `patient_name` | string | |
131
  | `patient_profile` | string | `minimal / typical / complex` |
132
  | `patient_sex` | string | `"M"` / `"F"` |
 
146
 
147
  ### `chunks` config — 815 rows
148
 
149
+ One row per document segment. `markdown_text` here is the segment's own slice of the full document text. Join on `doc_id → documents` for complete document context.
 
 
150
 
151
  | Column | Type | Description |
152
  |--------|------|-------------|
153
  | `doc_id` | string | Join key → `documents` |
154
  | `patient_id` | string | |
155
+ | `markdown_text` | string | This segment's text. `start`/`end` in `gt_entities` are offsets into this field. |
156
  | `encounter_id` | string | |
157
  | `encounter_kind` | string | |
158
  | `patient_profile` | string | |
159
+ | `chunk_id` | string | Segment identifier within the encounter |
160
+ | `page_number` | int | Document page (1-indexed) |
161
  | `chunk_order` | int | Reading order within the encounter |
162
+ | `segment_type` | string | `"text"` or `"table"` |
163
+ | `gt_entities` | string (JSON) | GT entities in this segment — `start`/`end` into `markdown_text` |
164
+ | `distractor_entities` | string (JSON) | Distractor spans in this segment |
165
 
166
  ### `patient_summary` config — 10 rows
167
 
 
177
  | `anchor_icd10` | string | Primary diagnoses |
178
  | `clinical_hook` | string | One-line clinical summary |
179
  | `n_encounters` | int | |
180
+ | `encounter_ids` | list[string] | Native Arrow list — no `json.loads` needed |
181
+ | `encounter_kinds` | list[string] | Native Arrow list |
182
  | `all_gt_spans` | string (JSON) | All GT spans across all encounters — filter by `label` for Condition / Medication |
183
  | `all_distractors` | string (JSON) | All distractor spans |
184
  | `all_labs` | string (JSON) | All structured lab analytes across all encounters |
 
193
  |-------|------|-------------|
194
  | `surface` | str | Exact mention text as it appears in the document (may be abbreviation: `"HTN"`, `"T2DM"`) |
195
  | `label` | str | IPS type: `Condition` or `Medication` |
196
+ | `start` | int | Start char offset into `markdown_text` (document-level in `documents`, segment-level in `chunks`) |
197
  | `end` | int | End char offset into `markdown_text` |
198
  | `kg_id` | str | ICD-10 code (Condition) or ATC code (Medication) |
199
  | `canonical` | str | Normalised entity name — use for normalisation scoring |
 
201
 
202
  **Offset guarantee:**
203
  `markdown_text[start:end]` matches `surface` after whitespace normalisation.
204
+ Line-wrapping may insert `\n` between words — normalise with `re.sub(r'\s+', ' ', span)` before comparing.
205
 
206
  **Distractors** share the same schema. They are contextually plausible entities that appear in the narrative but are *not* part of the patient's confirmed record (negated diagnoses, family history mentions, hypothetical treatments). A model that extracts them is producing false positives.
207
 
 
213
 
214
  ```python
215
  import json
216
+ from datasets import load_dataset
217
  from nervaluate import Evaluator
218
 
219
  chunks = load_dataset("betterInnovation/SynthIPS", "chunks", split="test")
 
314
  Entity names in `canonical` follow the IPS-preferred normalised form.
315
  Abbreviations and synonyms (e.g. `"HTN"`, `"T2DM"`) are preserved in `surface` exactly as they appear in the document.
316
 
317
+ ### Document structure
318
 
319
+ Each encounter document contains several distinct sections: institution header, patient demographics, structured problem list, medication table, structured lab grid, and free-text narrative sections (HPI, social history, clinical examination, assessment & plan). This mixed structure — combining tabular and narrative content — reflects the layout of real clinical encounter documents and is a deliberate challenge for NER models.
 
 
320
 
321
+ `markdown_text` preserves this structure as formatted markdown. All `start`/`end` offsets in entity spans point into `markdown_text`.
 
 
322
 
323
  ### Distractor design
324
 
325
+ Each encounter includes 0–1 deliberate trap spans: clinically plausible entities that appear in the narrative but are negated, belong to family history, are ruled out, or are hypothetical. Examples: *"no evidence of X"*, *"father had X"*, *"we will consider X if..."*. These measure whether a model extracts *only* confirmed, patient-present entities.
 
 
 
326
 
327
  ### Reproducibility
328
 
329
+ Every encounter document is deterministic given its `layout_seed`. Re-running the composer with the same source files produces byte-identical documents and GT annotations.
 
330
 
331
  ---
332
 
 
334
 
335
  ```bibtex
336
  @dataset{synthips2026,
337
+ title = {SynthIPS: Synthetic IPS NER Validation Dataset},
338
  author = {Better Care},
339
  year = {2026},
340
  url = {https://huggingface.co/datasets/betterInnovation/SynthIPS},