ADOS-2 scoring step in the indicators cycle, run after the document import commits; EEG analysis ordered before the relation steps
This commit is contained in:
@@ -384,6 +384,23 @@ def _commit_catalog_fallback(raw_sources: list) -> list[dict]:
|
||||
return reports
|
||||
|
||||
|
||||
def _score_ados2_after(domain: str, results: list) -> None:
|
||||
"""After a commit that wrote ADOS-2 evaluations, their CSS and classification from the items just stored, so they
|
||||
exist before the recomputation (which may be queued behind a long EEG analysis). Best-effort, like the request
|
||||
for the recomputation: the rows are saved, and the cycle's `score_ados2` step scores whatever this missed."""
|
||||
if not any(r.target == "tea.Ados2" and (r.created or r.updated) for r in results):
|
||||
return
|
||||
from webapi.orchestration.eeg import live_ados2_scoring
|
||||
|
||||
scoring = live_ados2_scoring(domain)
|
||||
if scoring is None:
|
||||
return
|
||||
try:
|
||||
scoring()
|
||||
except Exception:
|
||||
log.exception("no se pudo calcular el CSS del ADOS-2 de %s", domain)
|
||||
|
||||
|
||||
@imports_bp.post("/commit")
|
||||
def commit():
|
||||
"""`{sources: [...], on_conflict: "reject"|"upsert", merge_duplicates: bool}`.
|
||||
@@ -404,6 +421,7 @@ def commit():
|
||||
import_audit.record(audit)
|
||||
recalculating = False
|
||||
if audit.domain in DOMAINS and any(r.created or r.updated for r in results):
|
||||
_score_ados2_after(audit.domain, results)
|
||||
try:
|
||||
RecomputationQueue().request_run(audit.domain)
|
||||
recalculating = True
|
||||
|
||||
Reference in New Issue
Block a user