Classify source relatedness as data-quality advisories
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Package sourcerelatedness warns when item-occurrence evidence does not mention its item.
|
||||
// Package sourcerelatedness reports advisory findings when item-occurrence evidence does not mention its item.
|
||||
package sourcerelatedness
|
||||
|
||||
import (
|
||||
@@ -14,10 +14,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Key = "extract/dnd/item-occurrences/source_relatedness"
|
||||
WarningReasonCode = "item_occurrence_source_unrelated"
|
||||
OmittedReasonCode = "item_occurrence_relatedness_warnings_omitted"
|
||||
policy = "dnd.item_occurrences.source_relatedness.v1"
|
||||
Key = "extract/dnd/item-occurrences/source_relatedness"
|
||||
ReasonCode = "item_occurrence_not_near_source"
|
||||
policy = "dnd.item_occurrences.source_relatedness.v1"
|
||||
)
|
||||
|
||||
type Options struct{}
|
||||
@@ -54,14 +53,11 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
|
||||
}
|
||||
warnings = append(warnings, contracts.Warning{
|
||||
Scope: fmt.Sprintf("occurrences[%d]", index),
|
||||
ReasonCode: WarningReasonCode,
|
||||
ReasonCode: ReasonCode,
|
||||
Message: fmt.Sprintf("item occurrence name %s was not found in cited source text", diagnostics.Quote(occurrence.Name)),
|
||||
})
|
||||
}
|
||||
return contracts.ValidationResult{
|
||||
Approved: true,
|
||||
Warnings: diagnostics.LimitWarnings(warnings, "item_occurrences", OmittedReasonCode),
|
||||
}, nil
|
||||
return diagnostics.DataQualityResult(warnings)
|
||||
}
|
||||
|
||||
func Spec() pipeline.ValidatorSpec {
|
||||
|
||||
Reference in New Issue
Block a user