Extract reads several columns as one document; reviewers' corrections of study fields applied at the target; the site gates on ISSSTELEON's test source
This commit is contained in:
+4
-1
@@ -184,7 +184,7 @@ def run_extract(p: str, node: Extract):
|
||||
codes = _codes(node, node.patterns)
|
||||
out = []
|
||||
for row in nodes.rows(p, node.inputs[0]):
|
||||
text = row.get(node.column) or ""
|
||||
text = node.text(row)
|
||||
if use_llm:
|
||||
found = ground(_ask_llm(node, text), text)
|
||||
elif node.patterns:
|
||||
@@ -385,10 +385,13 @@ def run_target(p: str, node: Target, kinds: dict[str, str]):
|
||||
linked = {r[RECORD]: r for r in nodes.rows(p, link)}
|
||||
person = {k: r["person_id"] for k, r in linked.items()}
|
||||
model, study = catalog.model(node.entity), catalog.studies()[node.entity]
|
||||
fixed = nodes.corrections() # a reviewer's reading of a value wins over the extraction
|
||||
observations, held_rows = [], []
|
||||
for i in (i for i in node.inputs if i != link):
|
||||
for row in nodes.rows(p, i):
|
||||
values = {f: row.get(f) for f in model.model_fields if row.get(f) is not None}
|
||||
values |= {f: v for f, v in fixed.get(row[RECORD], {}).items()
|
||||
if f in model.model_fields} # fmt: skip
|
||||
held = json.loads(row.get(HELD) or "[]") + validate(node.entity, values)
|
||||
if row[RECORD] not in person:
|
||||
held.append("no identity linked to this record")
|
||||
|
||||
Reference in New Issue
Block a user