annotation¶
knowledge_graph.clinical.annotation
Synthetic-100 reference annotation: note preparation, two annotation passes, and the deterministic validator.
python -m knowledge_graph.clinical.annotation prepare # notes -> sources/, empty annotations/, manifest.json
python -m knowledge_graph.clinical.annotation annotate # pass 1 -> annotations/
python -m knowledge_graph.clinical.annotation review # independent pass 2 -> reviews/, the reference annotation
python -m knowledge_graph.clinical.annotation validate # offsets, labels, signatures, and evidence of reviews/
HPO links of the SYMPTOM clusters follow in knowledge_graph.clinical.hpo_annotation.
segments(text)
¶
Whole note, blocks, and colon-headed sections with character offsets (lines numbered from 1).
Source code in src/knowledge_graph/clinical/annotation.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
prepare(notes, out)
¶
sources/ with each note's text and block/section spans, empty annotations/, and manifest.json.
Source code in src/knowledge_graph/clinical/annotation.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
validate(source: dict, annotation: dict) -> list[str]
¶
Check annotation offsets, text, identifiers, labels, and relations against the source note.
Source code in src/knowledge_graph/clinical/annotation.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
response_checker(source, document, generation, output)
¶
Record the generation settings and save a response that passes annotation validation.
Source code in src/knowledge_graph/clinical/annotation.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
already_valid(output, source)
¶
Source code in src/knowledge_graph/clinical/annotation.py
215 216 217 | |
agent_pass(args)
¶
Pass 1 (annotate) or the independent pass 2 (review) for every selected note without a valid output.
Source code in src/knowledge_graph/clinical/annotation.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
selected_notes(data, note_ids)
¶
Source code in src/knowledge_graph/clinical/annotation.py
249 250 251 | |
main()
¶
Source code in src/knowledge_graph/clinical/annotation.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |