mbs-importer-jps
Advanced tools
Comparing version 1.2.1 to 1.2.2
import { AbstractJob, JobConfig } from "server-socket-framework-jps"; | ||
import { Db } from 'mongodb'; | ||
import { DatabaseAvailableListener } from "mongo-access-jps"; | ||
export declare class MBSXMLImporter extends AbstractJob implements DatabaseAvailableListener { | ||
export declare class MBSXMLImporter extends AbstractJob { | ||
private static _instance; | ||
@@ -11,3 +9,2 @@ private readonly importPath; | ||
private fileName; | ||
private db; | ||
constructor(); | ||
@@ -17,7 +14,5 @@ static getInstance(): MBSXMLImporter; | ||
private handleCompleted; | ||
importWithConnection(fileName: string, db: Db): Promise<number>; | ||
import(fileName: string): void; | ||
databaseConnected(db: Db): void; | ||
import(fileName: string): Promise<number>; | ||
executeJob(runId: string): void; | ||
getConfig(): JobConfig; | ||
} |
@@ -126,75 +126,84 @@ "use strict"; | ||
}); | ||
const derivedItems = []; | ||
processedItems.forEach((item) => { | ||
if (item.isDerived) | ||
derivedItems.push(item); | ||
}); | ||
// DataSourceController.getInstance().deleteAll(this.collection).then((result) => { | ||
// DataSourceController.getInstance().insertMany(this.collection,processedItems).then((result) => { | ||
// now we need to calculate the derived values | ||
// DataSourceController.getInstance().find(this.collection,{isDerived: true}).then((derivedItems) => { | ||
/* | ||
compute the derived fee | ||
the derived fee has the form "The fee for item d, plus $dd.dd divided by the number of patients seen, up to a maximum of six patients. For seven or more patients - the fee for item x plus $dd.dd per patient" OR | ||
"An amount equal to $dd.dd, plus $dd.dd divided by the number of patients seen, up to a maximum of six patients. For sever or more patients - an amount equal to $dd.dd plus $dd.dd per patient." | ||
*/ | ||
const regex1 = /The fee for item (\d+), plus \$(\d*\.\d+) divided by the number of patients seen, up to a maximum of six patients\.\sFor seven or more patients - the fee for item (\d+) plus \$(\d*\.\d+) per patient/; | ||
const regex2 = /An amount equal to \$(\d+\.\d+), plus \$(\d+\.\d+) divided by the number of patients seen, up to a maximum of six patients\.\sFor seven or more patients - an amount equal to \$(\d*\.\d+) plus \$(\d*\.\d+) per patient/; | ||
const regex3 = /The fee for item (\d+) plus for each field in excess of 1, an amount of \$(\d+\.\d+)/; | ||
const regex4 = /The fee for item (\d+) plus \$(\d+\.\d+) for each additional 15 minutes or part thereof beyond the first hour of attendance by the medical practitioner/; | ||
derivedItems.forEach((item) => { | ||
let matches = item.derivedFeeDescription.match(regex1); | ||
if (matches) { | ||
let baseFee = 0; | ||
const itemNumberAsBaseFee = matches[1]; | ||
const additionalForUpToSixPatients = converters.floatConverter(matches[2]); | ||
const additionalForSevenOrMorePatients = converters.floatConverter(matches[4]); | ||
// find the base fee | ||
const foundIndex = processedItems.findIndex((processedItem) => processedItem._id === itemNumberAsBaseFee); | ||
if (foundIndex >= 0) { | ||
baseFee = processedItems[foundIndex].scheduleFee; | ||
} | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additionalForUpToSixPatients; | ||
item.additionalFeeMaxPatientNumber = 6; | ||
item.additionalFeePerPatientOverMaxNumber = additionalForSevenOrMorePatients; | ||
} | ||
matches = item.derivedFeeDescription.match(regex2); | ||
if (matches) { | ||
const baseFee = converters.floatConverter(matches[1]); | ||
const additionalForUpToSixPatients = converters.floatConverter(matches[2]); | ||
const additionalForSevenOrMorePatients = converters.floatConverter(matches[4]); | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additionalForUpToSixPatients; | ||
item.additionalFeeMaxPatientNumber = 6; | ||
item.additionalFeePerPatientOverMaxNumber = additionalForSevenOrMorePatients; | ||
} | ||
matches = item.derivedFeeDescription.match(regex3); | ||
if (matches) { | ||
let baseFee = 0; | ||
const itemNumberAsBaseFee = matches[1]; | ||
const additional = converters.floatConverter(matches[2]); | ||
// find the base fee | ||
const foundIndex = processedItems.findIndex((processedItem) => processedItem._id === itemNumberAsBaseFee); | ||
if (foundIndex >= 0) { | ||
baseFee = processedItems[foundIndex].scheduleFee; | ||
} | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additional; | ||
item.additionalFeeMaxPatientNumber = -1; | ||
} | ||
matches = item.derivedFeeDescription.match(regex4); | ||
if (matches) { | ||
let baseFee = 0; | ||
const itemNumberAsBaseFee = matches[1]; | ||
const additional = converters.floatConverter(matches[2]); | ||
// find the base fee | ||
const foundIndex = processedItems.findIndex((processedItem) => processedItem._id === itemNumberAsBaseFee); | ||
if (foundIndex >= 0) { | ||
baseFee = processedItems[foundIndex].scheduleFee; | ||
} | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additional; | ||
item.additionalFeeMaxPatientNumber = -1; | ||
} | ||
//DataSourceController.getInstance().replaceOne(this.collection, item); | ||
}); | ||
// }) | ||
// }); | ||
// }); | ||
data_source_controller_1.DataSourceController.getInstance().deleteAll(this.collection).then((result) => { | ||
data_source_controller_1.DataSourceController.getInstance().insertMany(this.collection, processedItems).then((result) => { | ||
// now we need to calculate the derived values | ||
data_source_controller_1.DataSourceController.getInstance().find(this.collection, { isDerived: true }).then((derivedItems) => { | ||
/* | ||
compute the derived fee | ||
the derived fee has the form "The fee for item d, plus $dd.dd divided by the number of patients seen, up to a maximum of six patients. For seven or more patients - the fee for item x plus $dd.dd per patient" OR | ||
"An amount equal to $dd.dd, plus $dd.dd divided by the number of patients seen, up to a maximum of six patients. For sever or more patients - an amount equal to $dd.dd plus $dd.dd per patient." | ||
*/ | ||
const regex1 = /The fee for item (\d+), plus \$(\d*\.\d+) divided by the number of patients seen, up to a maximum of six patients\.\sFor seven or more patients - the fee for item (\d+) plus \$(\d*\.\d+) per patient/; | ||
const regex2 = /An amount equal to \$(\d+\.\d+), plus \$(\d+\.\d+) divided by the number of patients seen, up to a maximum of six patients\.\sFor seven or more patients - an amount equal to \$(\d*\.\d+) plus \$(\d*\.\d+) per patient/; | ||
const regex3 = /The fee for item (\d+) plus for each field in excess of 1, an amount of \$(\d+\.\d+)/; | ||
const regex4 = /The fee for item (\d+) plus \$(\d+\.\d+) for each additional 15 minutes or part thereof beyond the first hour of attendance by the medical practitioner/; | ||
derivedItems.forEach((item) => { | ||
let matches = item.derivedFeeDescription.match(regex1); | ||
if (matches) { | ||
let baseFee = 0; | ||
const itemNumberAsBaseFee = matches[1]; | ||
const additionalForUpToSixPatients = converters.floatConverter(matches[2]); | ||
const additionalForSevenOrMorePatients = converters.floatConverter(matches[4]); | ||
// find the base fee | ||
const foundIndex = processedItems.findIndex((processedItem) => processedItem._id === itemNumberAsBaseFee); | ||
if (foundIndex >= 0) { | ||
baseFee = processedItems[foundIndex].scheduleFee; | ||
} | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additionalForUpToSixPatients; | ||
item.additionalFeeMaxPatientNumber = 6; | ||
item.additionalFeePerPatientOverMaxNumber = additionalForSevenOrMorePatients; | ||
} | ||
matches = item.derivedFeeDescription.match(regex2); | ||
if (matches) { | ||
const baseFee = converters.floatConverter(matches[1]); | ||
const additionalForUpToSixPatients = converters.floatConverter(matches[2]); | ||
const additionalForSevenOrMorePatients = converters.floatConverter(matches[4]); | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additionalForUpToSixPatients; | ||
item.additionalFeeMaxPatientNumber = 6; | ||
item.additionalFeePerPatientOverMaxNumber = additionalForSevenOrMorePatients; | ||
} | ||
matches = item.derivedFeeDescription.match(regex3); | ||
if (matches) { | ||
let baseFee = 0; | ||
const itemNumberAsBaseFee = matches[1]; | ||
const additional = converters.floatConverter(matches[2]); | ||
// find the base fee | ||
const foundIndex = processedItems.findIndex((processedItem) => processedItem._id === itemNumberAsBaseFee); | ||
if (foundIndex >= 0) { | ||
baseFee = processedItems[foundIndex].scheduleFee; | ||
} | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additional; | ||
item.additionalFeeMaxPatientNumber = -1; | ||
} | ||
matches = item.derivedFeeDescription.match(regex4); | ||
if (matches) { | ||
let baseFee = 0; | ||
const itemNumberAsBaseFee = matches[1]; | ||
const additional = converters.floatConverter(matches[2]); | ||
// find the base fee | ||
const foundIndex = processedItems.findIndex((processedItem) => processedItem._id === itemNumberAsBaseFee); | ||
if (foundIndex >= 0) { | ||
baseFee = processedItems[foundIndex].scheduleFee; | ||
} | ||
item.scheduleFee = baseFee; | ||
item.additionalFee = additional; | ||
item.additionalFeeMaxPatientNumber = -1; | ||
} | ||
data_source_controller_1.DataSourceController.getInstance().replaceOne(this.collection, item); | ||
}); | ||
resolve(processedItems.length); | ||
}); | ||
resolve(processedItems.length); | ||
}); | ||
@@ -201,0 +210,0 @@ }); |
{ | ||
"name": "mbs-importer-jps", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A patient management web application", | ||
@@ -5,0 +5,0 @@ "main": "dist/MBSXMLImporter.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33186
13
379
6