Interface AnnotationSetTriageService

All Known Implementing Classes:
AnnotationSetTriageServiceImpl

public interface AnnotationSetTriageService
Triage rulings on AnnotationSets: how much a set matters, one standing judgement per judge.

🛑 judgedBy is the curator, not the caller. Curation writes reach Gemma through the curation agent rather than from the curator's browser, so the authenticated principal on these calls is normally the agent acting on someone's behalf. Every identity here is therefore passed in explicitly and never read from the security context — resolving it from the principal would stamp every human ruling with the agent's name, make TriageJudgeKind.CURATOR unreachable, and collapse two curators' distinct judgements onto one row through the UNIQUE(annotationSet, judgedBy) key.

The REST layer decides who may claim to be whom; see the delegation gate on the triage endpoint.

  • Method Details

    • judge

      AnnotationSetTriage judge(AnnotationSet annotationSet, TriageVerdict verdict, String judgedBy, TriageJudgeKind judgeKind, @Nullable String note)
      Record or replace judgedBy's ruling on annotationSet. Idempotent per judge: a second call from the same judge updates the standing row rather than adding one.
      Parameters:
      judgedBy - the ruling identity — a username for a person, a run id for an agent. Never the transport's principal.
      judgeKind - stored rather than inferred from judgedBy, so "has a person ruled on this" does not depend on knowing every agent run id.
      note - why; the only place a TriageVerdict.WontFix says what it is declining to fix. Optional.
    • withdraw

      boolean withdraw(AnnotationSet annotationSet, String judgedBy)
      Withdraw judgedBy's ruling, returning the set to un-triaged if it was the only one.
      Returns:
      whether a row was removed
    • findBySet

      List<AnnotationSetTriage> findBySet(AnnotationSet annotationSet)
      Every ruling on one set, most recent first.
    • effectiveFor

      Optional<AnnotationSetTriage> effectiveFor(AnnotationSet annotationSet)
      The ruling that counts — the most recent — or empty when nobody has ruled.
    • effectiveForIds

      Map<Long, AnnotationSetTriage> effectiveForIds(Collection<Long> annotationSetIds)
      Batched effectiveFor(AnnotationSet). Sets with no ruling are absent from the map rather than mapped to null.
    • effectiveForInvestigationIds

      Map<Long, AnnotationSetTriage> effectiveForInvestigationIds(Collection<Long> investigationIds)
      The effective ruling for each of several datasets, keyed by dataset id — newest ruling across every annotation set the dataset owns. One round-trip for a whole page.
    • findByInvestigation

      List<AnnotationSetTriage> findByInvestigation(Investigation investigation)
      Every ruling on any set of one investigation, most recent first.
    • reviewedByHuman

      boolean reviewedByHuman(AnnotationSet annotationSet)
      Whether a person — not only a machine — has ruled on this set.
    • countByVerdict

      Map<TriageVerdict, Long> countByVerdict()
      Corpus-wide tally by verdict.