UNPKG

mindee

Version:

Mindee Client Library for Node.js

107 lines (106 loc) 4.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthcareCardV1Document = void 0; const common_1 = require("../../../parsing/common"); const healthcareCardV1Copay_1 = require("./healthcareCardV1Copay"); const standard_1 = require("../../../parsing/standard"); /** * Healthcare Card API version 1.3 document data. */ class HealthcareCardV1Document { constructor(rawPrediction, pageId) { /** Copayments for covered services. */ this.copays = []; /** The list of dependents covered by the healthcare plan. */ this.dependents = []; this.companyName = new standard_1.StringField({ prediction: rawPrediction["company_name"], pageId: pageId, }); rawPrediction["copays"] && rawPrediction["copays"].map((itemPrediction) => this.copays.push(new healthcareCardV1Copay_1.HealthcareCardV1Copay({ prediction: itemPrediction, pageId: pageId, }))); rawPrediction["dependents"] && rawPrediction["dependents"].map((itemPrediction) => this.dependents.push(new standard_1.StringField({ prediction: itemPrediction, pageId: pageId, }))); this.enrollmentDate = new standard_1.DateField({ prediction: rawPrediction["enrollment_date"], pageId: pageId, }); this.groupNumber = new standard_1.StringField({ prediction: rawPrediction["group_number"], pageId: pageId, }); this.issuer80840 = new standard_1.StringField({ prediction: rawPrediction["issuer_80840"], pageId: pageId, }); this.memberId = new standard_1.StringField({ prediction: rawPrediction["member_id"], pageId: pageId, }); this.memberName = new standard_1.StringField({ prediction: rawPrediction["member_name"], pageId: pageId, }); this.payerId = new standard_1.StringField({ prediction: rawPrediction["payer_id"], pageId: pageId, }); this.planName = new standard_1.StringField({ prediction: rawPrediction["plan_name"], pageId: pageId, }); this.rxBin = new standard_1.StringField({ prediction: rawPrediction["rx_bin"], pageId: pageId, }); this.rxGrp = new standard_1.StringField({ prediction: rawPrediction["rx_grp"], pageId: pageId, }); this.rxId = new standard_1.StringField({ prediction: rawPrediction["rx_id"], pageId: pageId, }); this.rxPcn = new standard_1.StringField({ prediction: rawPrediction["rx_pcn"], pageId: pageId, }); } /** * Default string representation. */ toString() { const dependents = this.dependents.join("\n "); let copaysSummary = ""; if (this.copays && this.copays.length > 0) { const copaysColSizes = [14, 22]; copaysSummary += "\n" + (0, common_1.lineSeparator)(copaysColSizes, "-") + "\n "; copaysSummary += "| Service Fees "; copaysSummary += "| Service Name "; copaysSummary += "|\n" + (0, common_1.lineSeparator)(copaysColSizes, "="); copaysSummary += this.copays.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(copaysColSizes, "-")).join(""); } const outStr = `:Company Name: ${this.companyName} :Plan Name: ${this.planName} :Member Name: ${this.memberName} :Member ID: ${this.memberId} :Issuer 80840: ${this.issuer80840} :Dependents: ${dependents} :Group Number: ${this.groupNumber} :Payer ID: ${this.payerId} :RX BIN: ${this.rxBin} :RX ID: ${this.rxId} :RX GRP: ${this.rxGrp} :RX PCN: ${this.rxPcn} :Copays: ${copaysSummary} :Enrollment Date: ${this.enrollmentDate}`.trimEnd(); return (0, common_1.cleanOutString)(outStr); } } exports.HealthcareCardV1Document = HealthcareCardV1Document;