data¶
knowledge_graph.clinical.data
Synthetic-100 notes, the 80/10/10 split, and input segmentation.
note(note_id)
¶
Source note (text and reference segments) and its reviewed annotation.
Source code in src/knowledge_graph/clinical/data.py
14 15 16 | |
note_ids()
¶
Source code in src/knowledge_graph/clinical/data.py
19 20 | |
split(seed=42)
¶
Note-level 80/10/10 split of the manifest, shared by every fine-tuned model.
Source code in src/knowledge_graph/clinical/data.py
23 24 25 26 27 | |
documents(ids=None)
¶
Notes with their reference mentions for exact-span NER scoring, in manifest order.
Source code in src/knowledge_graph/clinical/data.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
segmenter()
¶
Source code in src/knowledge_graph/clinical/data.py
56 57 58 59 60 61 | |
token_pieces(nlp, text, begin, end, limit)
¶
Source code in src/knowledge_graph/clinical/data.py
64 65 66 67 68 69 70 71 72 73 74 | |
sentence_segments(nlp, text)
¶
Source code in src/knowledge_graph/clinical/data.py
77 78 79 80 81 82 | |
pack_sentences(nlp, text, sentences, limit)
¶
Pack whole sentences up to the token limit; a longer sentence is split at token boundaries.
Source code in src/knowledge_graph/clinical/data.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
cap_segments(nlp, text, sources, limit)
¶
Source code in src/knowledge_graph/clinical/data.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
segments(nlp, text, reference, condition)
¶
Model inputs of one condition: fixed token budgets, sentences, or reference blocks/sections (512-token cap).
Source code in src/knowledge_graph/clinical/data.py
134 135 136 137 138 139 140 141 | |
keep_best(table, key, row)
¶
Keep the highest-scoring row per key (first seen wins ties).
Source code in src/knowledge_graph/clinical/data.py
144 145 146 147 | |
deduplicate(rows)
¶
One prediction per document span and concept ID, keeping the highest score (1.0 when a model gives none).
Source code in src/knowledge_graph/clinical/data.py
150 151 152 153 154 155 156 157 158 159 160 | |
reference_map(annotation)
¶
Reference entity IDs by exact span and by exact typed span.
Source code in src/knowledge_graph/clinical/data.py
163 164 165 166 167 168 169 170 | |
align(begin, end, kind, spans, typed)
¶
Reference entity of an exact predicted span (typed match first); unmatched spans keep their own ID.
Source code in src/knowledge_graph/clinical/data.py
173 174 175 176 177 178 | |