mindee
Version:
Mindee Client Library for Node.js
72 lines (71 loc) • 3.09 kB
JavaScript
"use strict";
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _HealthcareCardV1Copay_instances, _HealthcareCardV1Copay_printableValues;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HealthcareCardV1Copay = void 0;
const common_1 = require("../../../parsing/common");
/**
* Copayments for covered services.
*/
class HealthcareCardV1Copay {
constructor({ prediction = {} }) {
_HealthcareCardV1Copay_instances.add(this);
/** Confidence score */
this.confidence = 0.0;
/**
* Contains the relative vertices coordinates (points) of a polygon containing
* the field in the document.
*/
this.polygon = [];
if (prediction["service_fees"] !== undefined &&
prediction["service_fees"] !== null &&
!isNaN(prediction["service_fees"])) {
this.serviceFees = +parseFloat(prediction["service_fees"]);
}
else {
this.serviceFees = null;
}
this.serviceName = prediction["service_name"];
this.pageId = prediction["page_id"];
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
if (prediction["polygon"]) {
this.polygon = prediction.polygon;
}
}
/**
* Default string representation.
*/
toString() {
const printable = __classPrivateFieldGet(this, _HealthcareCardV1Copay_instances, "m", _HealthcareCardV1Copay_printableValues).call(this);
return ("Service Fees: " +
printable.serviceFees +
", Service Name: " +
printable.serviceName);
}
/**
* Output in a format suitable for inclusion in an rST table.
*/
toTableLine() {
const printable = __classPrivateFieldGet(this, _HealthcareCardV1Copay_instances, "m", _HealthcareCardV1Copay_printableValues).call(this);
return ("| " +
printable.serviceFees.padEnd(12) +
" | " +
printable.serviceName.padEnd(20) +
" |");
}
}
exports.HealthcareCardV1Copay = HealthcareCardV1Copay;
_HealthcareCardV1Copay_instances = new WeakSet(), _HealthcareCardV1Copay_printableValues = function _HealthcareCardV1Copay_printableValues() {
return {
serviceFees: this.serviceFees !== undefined ? (0, common_1.floatToString)(this.serviceFees) : "",
serviceName: this.serviceName ?
this.serviceName.length <= 20 ?
(0, common_1.cleanSpecialChars)(this.serviceName) :
(0, common_1.cleanSpecialChars)(this.serviceName).slice(0, 17) + "..." :
"",
};
};