Class AnnotationSetTriage
- All Implemented Interfaces:
Identifiable
AnnotationSet matters.
A row per judgement, not a column per judge. Columns on
AnnotationSet would hard-code the set of judges into the schema —
agent and curator today, a second-opinion reviewer or an external
collaborator tomorrow, each one a migration. Rows make the judge data, and
they answer questions columns cannot: has any human ever ruled on this, do
two curators disagree, which agent build gets overruled most.
One standing judgement per judge —
UNIQUE(annotationSet, judgedBy), upserted when a judge changes their
mind. The question is what a judge currently thinks, not an append-only log
of every time they toggled. Drop the constraint if the toggle history ever
becomes the point.
The effective verdict is the most recent judgement —
effective(Collection). Deliberately not "curator outranks agent":
a curator ruling after the agent already wins by recency, and when two
curators disagree the later one wins, which is the same answer the rest of
this workflow gives to contention. judgeKind still records who, so
ranking by role stays possible without re-deciding it here.
There is no stored "pending": an un-triaged set has no row. See
TriageVerdict.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<AnnotationSetTriage> effective(Collection<AnnotationSetTriage> judgements) The most recent ruling amongjudgements, or empty when nobody has ruled.booleanBy id once both sides have one, otherwise by the business key.getNote()inthashCode()Constant, deliberately.static booleanreviewedByHuman(Collection<AnnotationSetTriage> judgements) voidsetAnnotationSet(AnnotationSet annotationSet) voidsetJudgedAt(Date judgedAt) voidsetJudgedBy(String judgedBy) voidsetJudgeKind(TriageJudgeKind judgeKind) voidvoidsetVerdict(TriageVerdict verdict) Methods inherited from class AbstractIdentifiable
getId, setId, toString
-
Constructor Details
-
AnnotationSetTriage
public AnnotationSetTriage()
-
-
Method Details
-
effective
public static Optional<AnnotationSetTriage> effective(@Nullable Collection<AnnotationSetTriage> judgements) The most recent ruling amongjudgements, or empty when nobody has ruled.Ties on
judgedAtbreak on id, so two judgements written in the same millisecond still resolve to one answer rather than to whichever the collection happened to yield first. -
reviewedByHuman
- Returns:
- whether a person has ruled on this set — the distinction between a reviewed set and one only a machine has seen.
-
getAnnotationSet
-
setAnnotationSet
-
getVerdict
-
setVerdict
-
getJudgedBy
-
setJudgedBy
-
getJudgeKind
-
setJudgeKind
-
getJudgedAt
-
setJudgedAt
-
getNote
-
setNote
-
hashCode
public int hashCode()Constant, deliberately.The business key here is
(annotationSet, judgedBy), and hashing it would mean hashingannotationSet— aLAZYproxy whosehashCode()can force initialization outside a session. An id-based hash is worse still: the id flips from null to a value on persist, so a judgement added to aHashSetwhile transient ends up in the wrong bucket andcontains()then answers false for an element that is in the set.The cost is that one bucket degrades to a linear scan. A set carries a handful of judgements — one per judge — so that is not measurable here.
- Specified by:
hashCodein classAbstractIdentifiable
-
equals
By id once both sides have one, otherwise by the business key. The annotation set is compared by id rather than by object so a lazy proxy on either side does not have to be initialized to answer.- Specified by:
equalsin classAbstractIdentifiable
-