Table of Contents

Class FieldValidationStatusConverter

Namespace
ScanbotSDK.MAUI.Common
Assembly
ScanbotSDK.Shared.dll

Field validation status.

Optical character recognition (OCR) invariably introduces errors in the recognized text. There are numerous ways to verify that what has been recognized is, in fact, what was written in the document.

The best way to validate the value of a field is for it to have a known format or validation logic. For example, an IBAN number has a known format and two check digits that make it very unlikely that a value with OCR errors will pass validation. Fields with known validation rules will have a validation status of either VALID or INVALID.

Fields whose value can be inferred from other fields, or from domain knowledge (for example, the field may have the same value in every instance of this type of document), will have the status INFERRED. Inferring the value of a field is a strong validation method, provided that there are no unexpected changes to the document format.

Fields that do not have validation rules and cannot be inferred can still be validated by checking whether the same value is recognized from multiple attempts, e.g. across multiple frames of a camera stream. If the same value is recognized in multiple frames, the value is considered CONFIRMED, otherwise it will have the status NONE. This is the least strict validation method, as it does not protect from systemic OCR errors, but in practice it still provides good results for most fields.

public class FieldValidationStatusConverter : JsonConverter<FieldValidationStatus>
Inheritance
FieldValidationStatusConverter
Inherited Members

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type FieldValidationStatus.

public override FieldValidationStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

The reader.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An object that specifies serialization options to use.

Returns

FieldValidationStatus

The converted value.

Write(Utf8JsonWriter, FieldValidationStatus, JsonSerializerOptions)

Writes a specified value as JSON.

public override void Write(Utf8JsonWriter writer, FieldValidationStatus color, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter

The writer to write to.

color FieldValidationStatus
options JsonSerializerOptions

An object that specifies serialization options to use.