capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
449 lines (431 loc) • 14.5 kB
JavaScript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from core/schemas/MedicalCertificateTypes.yaml
import { DocumentDetectionResult } from '../document_scanner/DocumentScannerTypes';
import { ImageRef } from '../imageRef/image';
import { ToJsonConfiguration } from '../utils/json/JsonSerializationTypes';
import { PartiallyConstructible } from '../utils/utils';
/**
Parameters for the medical certificate scanning. The scanner supports
Form 1 (Arbeitsunfähigkeitsbescheinigung) and
Form 21a (Ärztliche Bescheinigung für den Bezug von Krankengeld bei Erkrankung eines Kindes)
from the KBV (Kassenärztliche Bundesvereinigung) list of forms.
*/
export class MedicalCertificateScanningParameters extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<MedicalCertificateScanningParameters>`} */
constructor(source = {}) {
super();
/**
Document will be detected and cropped before recognition.
If false, a cropped image of a document is assumed.
Default is true
*/
this.shouldCropDocument = true;
/**
All data in the patient info box will be extracted.
If false, the patient info box is ignored.
Default is true
*/
this.recognizePatientInfoBox = true;
/**
Some forms are printed with an extra barcode that encodes the same information as the document.
Reading the barcode is more reliable than OCR and is recommended when possible.
If false, the barcode will not be scanned.
Default is true
*/
this.recognizeBarcode = true;
/**
If true, cropped document image will be extracted and returned.
Default is false
*/
this.extractCroppedImage = false;
/**
If true, the image is sharpened before processing.
Default is false
*/
this.preprocessInput = false;
if (source.shouldCropDocument !== undefined) {
this.shouldCropDocument = source.shouldCropDocument;
}
if (source.recognizePatientInfoBox !== undefined) {
this.recognizePatientInfoBox = source.recognizePatientInfoBox;
}
if (source.recognizeBarcode !== undefined) {
this.recognizeBarcode = source.recognizeBarcode;
}
if (source.extractCroppedImage !== undefined) {
this.extractCroppedImage = source.extractCroppedImage;
}
if (source.preprocessInput !== undefined) {
this.preprocessInput = source.preprocessInput;
}
}
}
export const MedicalCertificateCheckBoxTypeValues = [
'UNKNOWN',
'WORK_ACCIDENT',
'ASSIGNED_TO_ACCIDENT_INSURANCE_DOCTOR',
'INITIAL_CERTIFICATE',
'RENEWED_CERTIFICATE',
'INSURED_PAY_CASE',
'FINAL_CERTIFICATE',
'REQUIRES_CARE_YES',
'REQUIRES_CARE_NO',
'ACCIDENT_YES',
'ACCIDENT_NO',
'OTHER_ACCIDENT',
'ENTITLEMENT_TO_CONTINUED_PAYMENT_YES',
'ENTITLEMENT_TO_CONTINUED_PAYMENT_NO',
'SICK_PAY_WAS_CLAIMED_NO',
'SICK_PAY_WAS_CLAIMED_YES',
'SINGLE_PARENT_NO',
'SINGLE_PARENT_YES',
];
/**
Structure to contain full information about found box.
*/
export class MedicalCertificateCheckBox extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<MedicalCertificateCheckBox>`} */
constructor(source = {}) {
super();
/**
Box type.
Default is UNKNOWN
*/
this.type = 'UNKNOWN';
/**
True if the box is checked.
Default is false
*/
this.checked = false;
/**
Confidence of the checked/unchecked prediction.
Default is 0.0
*/
this.checkedConfidence = 0.0;
if (source.type !== undefined) {
this.type = source.type;
}
if (source.checked !== undefined) {
this.checked = source.checked;
}
if (source.checkedConfidence !== undefined) {
this.checkedConfidence = source.checkedConfidence;
}
if (source.quad !== undefined) {
this.quad = source.quad.map((it) => {
return { x: it.x, y: it.y };
});
}
else {
throw new Error('quad must be present in constructor argument');
}
}
serialize(config = new ToJsonConfiguration()) {
return {
type: this.type,
checked: this.checked,
checkedConfidence: this.checkedConfidence,
quad: this.quad.map((it) => {
return it;
}),
};
}
}
export const MedicalCertificateDateRecordTypeValues = [
'INCAPABLE_OF_WORK_SINCE',
'INCAPABLE_OF_WORK_UNTIL',
'DIAGNOSED_ON',
'DOCUMENT_DATE',
'BIRTH_DATE',
'CHILD_NEEDS_CARE_FROM',
'CHILD_NEEDS_CARE_UNTIL',
'UNDEFINED',
];
/**
Structure to contain date record information.
*/
export class MedicalCertificateDateRecord extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<MedicalCertificateDateRecord>`} */
constructor(source = {}) {
super();
/**
Validated date string.
Default is ""
*/
this.value = '';
/**
Raw date string.
Default is ""
*/
this.rawString = '';
/**
Date type.
Default is UNDEFINED
*/
this.type = 'UNDEFINED';
/**
Confidence in the recognized value.
Default is 0.0
*/
this.recognitionConfidence = 0.0;
if (source.quad !== undefined) {
this.quad = source.quad.map((it) => {
return { x: it.x, y: it.y };
});
}
else {
throw new Error('quad must be present in constructor argument');
}
if (source.value !== undefined) {
this.value = source.value;
}
if (source.rawString !== undefined) {
this.rawString = source.rawString;
}
if (source.type !== undefined) {
this.type = source.type;
}
if (source.recognitionConfidence !== undefined) {
this.recognitionConfidence = source.recognitionConfidence;
}
}
serialize(config = new ToJsonConfiguration()) {
return {
quad: this.quad.map((it) => {
return it;
}),
value: this.value,
rawString: this.rawString,
type: this.type,
recognitionConfidence: this.recognitionConfidence,
};
}
}
export const MedicalCertificatePatientInfoFieldTypeValues = [
'INSURANCE_PROVIDER',
'FIRST_NAME',
'LAST_NAME',
'ADDRESS_STRING1',
'ADDRESS_STRING2',
'DIAGNOSE',
'HEALTH_INSURANCE_NUMBER',
'INSURED_PERSON_NUMBER',
'STATUS',
'PLACE_OF_OPERATION_NUMBER',
'DOCTOR_NUMBER',
'UNDEFINED',
];
/**
Patient information field.
*/
export class MedicalCertificatePatientInfoField extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<MedicalCertificatePatientInfoField>`} */
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.recognitionConfidence !== undefined) {
this.recognitionConfidence = source.recognitionConfidence;
}
else {
throw new Error('recognitionConfidence must be present in constructor argument');
}
}
serialize(config = new ToJsonConfiguration()) {
return {
type: this.type,
value: this.value,
recognitionConfidence: this.recognitionConfidence,
};
}
}
/**
Patient information box.
*/
export class MedicalCertificatePatientInfoBox extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<MedicalCertificatePatientInfoBox>`} */
constructor(source = {}) {
super();
/**
Whether the patient info box has contents.
Default is false
*/
this.hasContents = false;
if (source.quad !== undefined) {
this.quad = source.quad.map((it) => {
return { x: it.x, y: it.y };
});
}
else {
throw new Error('quad must be present in constructor argument');
}
if (source.fields !== undefined) {
this.fields = source.fields.map((it) => {
return new MedicalCertificatePatientInfoField(it);
});
}
else {
throw new Error('fields must be present in constructor argument');
}
if (source.hasContents !== undefined) {
this.hasContents = source.hasContents;
}
}
serialize(config = new ToJsonConfiguration()) {
return {
quad: this.quad.map((it) => {
return it;
}),
fields: this.fields.map((it) => {
return it.serialize(config);
}),
hasContents: this.hasContents,
};
}
}
export const MedicalCertificateFormTypeValues = [
'UNKNOWN',
'FORM_1A',
'FORM_1B',
'FORM_1C',
'FORM_1D',
'FORM_21A',
'FORM_21A_BACK',
'FORM_1B_CUSTOM',
];
/**
The result of the medical certificate scanning.
*/
export class MedicalCertificateScanningResult extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<MedicalCertificateScanningResult>`} */
constructor(source = {}) {
super();
/**
True if scanning was successful.
Default is false
*/
this.scanningSuccessful = false;
/**
Form type.
Default is UNKNOWN
*/
this.formType = 'UNKNOWN';
/**
The number of 90-degree clockwise rotations that were applied to the original image.
The same number of counter-clockwise rotations are necessary to make the image upright again.
Default is 0
*/
this.clockwiseRotations = 0;
/**
The cropped image used for recognition.
*/
this.croppedImage = null;
/**
The scale factor used to scale the image to the recognition size.
Default is 1.0
*/
this.scaleX = 1.0;
/**
The scale factor used to scale the image to the recognition size.
Default is 1.0
*/
this.scaleY = 1.0;
this._released = false;
if (source.scanningSuccessful !== undefined) {
this.scanningSuccessful = source.scanningSuccessful;
}
if (source.patientInfoBox !== undefined) {
this.patientInfoBox = new MedicalCertificatePatientInfoBox(source.patientInfoBox);
}
else {
throw new Error('patientInfoBox must be present in constructor argument');
}
if (source.checkBoxes !== undefined) {
this.checkBoxes = source.checkBoxes.map((it) => {
return new MedicalCertificateCheckBox(it);
});
}
else {
throw new Error('checkBoxes must be present in constructor argument');
}
if (source.dates !== undefined) {
this.dates = source.dates.map((it) => {
return new MedicalCertificateDateRecord(it);
});
}
else {
throw new Error('dates must be present in constructor argument');
}
if (source.formType !== undefined) {
this.formType = source.formType;
}
if (source.clockwiseRotations !== undefined) {
this.clockwiseRotations = source.clockwiseRotations;
}
if (source.croppedImage !== undefined) {
this.croppedImage = source.croppedImage != null ? ImageRef.From(source.croppedImage) : null;
}
if (source.scaleX !== undefined) {
this.scaleX = source.scaleX;
}
if (source.scaleY !== undefined) {
this.scaleY = source.scaleY;
}
if (source.documentDetectionResult !== undefined) {
this.documentDetectionResult =
source.documentDetectionResult != null ? new DocumentDetectionResult(source.documentDetectionResult) : null;
}
else {
throw new Error('documentDetectionResult must be present in constructor argument');
}
}
async serialize(config = new ToJsonConfiguration()) {
return {
scanningSuccessful: this.scanningSuccessful,
patientInfoBox: this.patientInfoBox.serialize(config),
checkBoxes: this.checkBoxes.map((it) => {
return it.serialize(config);
}),
dates: this.dates.map((it) => {
return it.serialize(config);
}),
formType: this.formType,
clockwiseRotations: this.clockwiseRotations,
croppedImage: config.serializeImages
? this.croppedImage != null
? await this.croppedImage.serialize(config.imageSerializationMode)
: null
: undefined,
scaleX: this.scaleX,
scaleY: this.scaleY,
documentDetectionResult: this.documentDetectionResult != null ? this.documentDetectionResult.serialize(config) : null,
};
}
release() {
if (this._released) {
return;
}
{
if (this.croppedImage != null) {
this.croppedImage.release();
}
}
this._released = true;
}
async encodeImages() {
if (this.croppedImage != null) {
await this.croppedImage.encodeInPlace();
}
}
}
//# sourceMappingURL=MedicalCertificateTypes.js.map