react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
256 lines (233 loc) • 9.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.EuropeanHealthInsuranceCardRecognizerConfiguration = exports.EuropeanHealthInsuranceCardRecognitionResult = void 0;
var _JsonSerializationTypes = require("../utils/json/JsonSerializationTypes");
var _utils = require("../utils/utils");
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from core/schemas/EuropeanHealthInsuranceCardTypes.yaml
/**
The result of the health insurance card recognition.
*/
class EuropeanHealthInsuranceCardRecognitionResult extends _utils.PartiallyConstructible {
/**
Health insurance card fields.
*/
/**
Recognition status.
Default is FAILED_DETECTION
*/
status = 'FAILED_DETECTION';
/** @param source {@displayType `DeepPartial<EuropeanHealthInsuranceCardRecognitionResult>`} */
constructor(source = {}) {
super();
if (source.fields !== undefined) {
this.fields = source.fields.map(it => {
return new EuropeanHealthInsuranceCardRecognitionResult.Field(it);
});
} else {
throw new Error('fields must be present in constructor argument');
}
if (source.status !== undefined) {
this.status = source.status;
}
}
serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) {
return {
fields: this.fields.map(it => {
return it.serialize(config);
}),
status: this.status
};
}
}
exports.EuropeanHealthInsuranceCardRecognitionResult = EuropeanHealthInsuranceCardRecognitionResult;
(function (_EuropeanHealthInsuranceCardRecognitionResult) {
/**
Card recognition status.
- `SUCCESS`:
Detection successful. The fields array is filled with all of the extracted data. All validatable fields have passed validation.
- `FAILED_DETECTION`:
No document found or the document doesn't look like the back of an EHIC.
- `INCOMPLETE_VALIDATION`:
A potential EHIC was found but one or more fields failed validation.
*/
const RecognitionStatusValues = _EuropeanHealthInsuranceCardRecognitionResult.RecognitionStatusValues = ['SUCCESS', 'FAILED_DETECTION', 'INCOMPLETE_VALIDATION'];
class Field extends _utils.PartiallyConstructible {
/**
Health insurance card field type.
*/
/**
Recognized value.
*/
/**
Recognition confidence.
*/
/**
Field validation status.
Default is NOT_VALIDATED
*/
validationStatus = 'NOT_VALIDATED';
/** @param source {@displayType `DeepPartial<Field>`} */
constructor(source = {}) {
super();
if (source.type !== undefined) {
this.type = source.type;
} else {
throw new Error('type must be present in constructor argument');
}
if (source.value !== undefined) {
this.value = source.value;
} else {
throw new Error('value must be present in constructor argument');
}
if (source.confidence !== undefined) {
this.confidence = source.confidence;
} else {
throw new Error('confidence must be present in constructor argument');
}
if (source.validationStatus !== undefined) {
this.validationStatus = source.validationStatus;
}
}
serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) {
return {
type: this.type,
value: this.value,
confidence: this.confidence,
validationStatus: this.validationStatus
};
}
}
_EuropeanHealthInsuranceCardRecognitionResult.Field = Field;
(function (_Field) {
/**
Health insurance card field validation status.
- `NOT_VALIDATED`:
Field shouldn't be validated.
- `FAILURE`:
Field is not valid.
- `SUCCESS`:
Field is valid.
- `CONFIRMED`:
Field is valid and confirmed across multiple frames.
*/
const ValidationStatusValues = _Field.ValidationStatusValues = ['NOT_VALIDATED', 'FAILURE', 'SUCCESS', 'CONFIRMED'];
/**
Health insurance card field type.
- `SURNAME`:
Surname.
- `GIVEN_NAME`:
Given name.
- `DATE_OF_BIRTH`:
Date of birth.
- `PERSONAL_IDENTIFICATION_NUMBER`:
Personal identification number.
- `INSTITUTION_NUMBER`:
Institution number.
- `INSTITUTION_NAME`:
Institution name.
- `CARD_NUMBER`:
Card number.
- `CARD_EXPIRATION_DATE`:
Card expiration date.
- `COUNTRY`:
Country.
*/
const FieldTypeValues = _Field.FieldTypeValues = ['SURNAME', 'GIVEN_NAME', 'DATE_OF_BIRTH', 'PERSONAL_IDENTIFICATION_NUMBER', 'INSTITUTION_NUMBER', 'INSTITUTION_NAME', 'CARD_NUMBER', 'CARD_EXPIRATION_DATE', 'COUNTRY'];
})(Field || (Field = _EuropeanHealthInsuranceCardRecognitionResult.Field || (_EuropeanHealthInsuranceCardRecognitionResult.Field = {})));
})(EuropeanHealthInsuranceCardRecognitionResult || (exports.EuropeanHealthInsuranceCardRecognitionResult = EuropeanHealthInsuranceCardRecognitionResult = {}));
/**
Configuration for the European health insurance card (EHIC) recognizer.
*/
class EuropeanHealthInsuranceCardRecognizerConfiguration extends _utils.PartiallyConstructible {
/**
List of allowed countries for the EHIC. If:
- single country: validation rules for the given country are used starting from the first
frame. If the country cannot be inferred or the inferred country doesn't
match the given country, the result of recognize() will be IncompleteValidation.
- multiple countries: the country is inferred from the card number first.
Until the country is detected, the document fields are not OCR'd and
accumulated. Once the country is inferred, the field accumulation starts
and the inferred country validation rules are applied.
If the country cannot be inferred or the inferred country doesn't match
any of the countries in the list, the result status will be IncompleteValidation.
- empty list: same as "multiple countries" with one additional detail.
If the country cannot be inferred within `maxCountryDetectionAttempts` successive frames in which the
part of the card number that stores the country code was successfully OCR'd, then the country is
inferred to be Unknown and no validation rules are applied. Field accumulation then proceeds normally.
In this case recognize() can eventually return Success and the document will have a CountryType of Unknown.
*/
allowedCountries = [];
/**
Minimum year of birth.
Default is 0
*/
minBirthYear = 0;
/**
Maximum year of birth.
Default is 2999
*/
maxBirthYear = 2999;
/**
Minimum card expiration year.
Default is 0
*/
minExpirationYear = 0;
/**
Maximum card expiration year.
Default is 2999
*/
maxExpirationYear = 2999;
/**
Maximum number of attempts before giving up on country detection. After the specified number of
attempts, the country field is considered to be unknown and validation is skipped.
This option is ignored if allowedCountries is not empty.
Default is 5
*/
maxCountryDetectionAttempts = 5;
/**
Minimum number of accumulated frames that should have equal result for a field.
Once satisfied, the corresponding field is considered to be successfully-recognized and won't be considered in the subsequent frames.
Default is 4
*/
minEqualFrameCount = 4;
/**
Maximum number of partial frame results to keep in cache while waiting to gather minEqualFrameCount equal results.
Default is 10
*/
maxAccumulatedFrameCount = 10;
/** @param source {@displayType `DeepPartial<EuropeanHealthInsuranceCardRecognizerConfiguration>`} */
constructor(source = {}) {
super();
if (source.allowedCountries !== undefined) {
this.allowedCountries = source.allowedCountries.map(it => {
return it;
});
}
if (source.minBirthYear !== undefined) {
this.minBirthYear = source.minBirthYear;
}
if (source.maxBirthYear !== undefined) {
this.maxBirthYear = source.maxBirthYear;
}
if (source.minExpirationYear !== undefined) {
this.minExpirationYear = source.minExpirationYear;
}
if (source.maxExpirationYear !== undefined) {
this.maxExpirationYear = source.maxExpirationYear;
}
if (source.maxCountryDetectionAttempts !== undefined) {
this.maxCountryDetectionAttempts = source.maxCountryDetectionAttempts;
}
if (source.minEqualFrameCount !== undefined) {
this.minEqualFrameCount = source.minEqualFrameCount;
}
if (source.maxAccumulatedFrameCount !== undefined) {
this.maxAccumulatedFrameCount = source.maxAccumulatedFrameCount;
}
}
}
exports.EuropeanHealthInsuranceCardRecognizerConfiguration = EuropeanHealthInsuranceCardRecognizerConfiguration;
//# sourceMappingURL=EuropeanHealthInsuranceCardTypes.js.map