Thoth (tht) è il prodotto, PSD è il cliente. Nessun riferimento al contesto
clinico nel codice.
Rinomine:
- comando+package nsp→tht (dir nsp/→tht/, 46 import, pyproject entry point)
- gate nsp-gate.js→tht-gate.js (+ rewrite token, relayIfNspFails→relayIfThtFails)
- workspace chirone.{example,test}.yaml→tht.{example,test}.yaml (generici)
- env THOTH_→THT_ (19 var) + NSP_ stragglers (NSP_HARNESS_ROOT, NSP_SESSION)
- commenti/docstring chirone/psdwp3/policlinico neutralizzati ('the reference
implementation', 'the DWH')
Aggiunto [tool.setuptools.packages.find] include=['tht*'] (necessario: l'auto-
discovery rompeva con tht/ + workspaces/ come top-level multipli).
.env operatore aggiornato in-place (prefissi THT_, valori preservati, gitignored).
Verifica: pytest 109 passed, npm test 14 pass, tht phase meta --json OK, zero
residui nsp/THOTH_/NSP_/chirone nel package.
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from pathlib import Path
|
|
|
|
from tht.decisions import DecisionRecord
|
|
from tht.session.models import SchemaLinking
|
|
|
|
|
|
def _find_evidence_file(evidence_root: Path, evidence_id: str) -> str:
|
|
for match in evidence_root.rglob(f"{evidence_id}.md"):
|
|
return str(match)
|
|
return ""
|
|
|
|
|
|
def build_evidence_entries(
|
|
decisions: list[DecisionRecord],
|
|
linking: SchemaLinking,
|
|
evidence_root: Path,
|
|
) -> list[dict]:
|
|
"""Elenco {id, file, esito, decision_seq}: evidence citate nello schema linking
|
|
(esito 'usata') e decisioni esplicite del reviewer (accettata/scartata, che
|
|
prevalgono sul linking)."""
|
|
entries: dict[str, dict] = {}
|
|
for candidate in linking.candidates:
|
|
for evidence_id in candidate.evidence:
|
|
entries.setdefault(evidence_id, {
|
|
"id": evidence_id,
|
|
"file": _find_evidence_file(evidence_root, evidence_id),
|
|
"esito": "usata",
|
|
"decision_seq": candidate.decision_seq,
|
|
})
|
|
for d in decisions:
|
|
if d.type not in ("evidence_accepted", "evidence_rejected"):
|
|
continue
|
|
entries[d.subject] = {
|
|
"id": d.subject,
|
|
"file": _find_evidence_file(evidence_root, d.subject),
|
|
"esito": "accettata" if d.type == "evidence_accepted" else "scartata",
|
|
"decision_seq": d.seq,
|
|
}
|
|
return list(entries.values())
|