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