Skip to content

Commit

Permalink
added some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Myer authored and Jonathan Myer committed Jun 22, 2022
1 parent d380e2b commit d6eee2f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 42 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const db= require("../../connectivity/general/connectors/dbConnections/postgresq
const queryBuilder = require('../../general/datatier/reusableQueries');
const express = require("express");
const router = express.Router();
const datasattributesGenerator = require("../../builders/buildDataAttributes");
const dataattributesGenerator = require("../../builders/buildDataAttributes");
const fs = require("fs");

router.get("/addresses", async(req, res) => {
Expand All @@ -12,19 +12,15 @@ router.get("/addresses", async(req, res) => {
//DOC TYPE = ADT
const table = req.query.table;
const limit = req.query.limit || 1000;

db.query(queryBuilder.getDataFromTable(table, limit), (err, rows, fields)=>{
if(err) throw err;
const results = datasattributesGenerator.generateAddress_Record_US(rows.rows)
res.json(results)
})
const results = await dataattributesGenerator.generateAddress_Record_US(limit)
res.json(results)

});

router.get("/phone-numbers", async(req, res) => {
const number_of_phone_numbers = parseInt(req.query.count) || 1000;
const country = req.query.country || "US";
const results = datasattributesGenerator.generateUSPhoneNumbers(number_of_phone_numbers, country)
const results = dataattributesGenerator.generateUSPhoneNumbers(number_of_phone_numbers, country)
res.json(results)

});
Expand Down
2 changes: 1 addition & 1 deletion DataTier-APIs/Node-APIs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dotenv.config({path: `${__dirname}/.env`})
// Global Variable for usage in platform
global.__basedir = __dirname;

var port = process.env.PORT || 3001;
var port = process.env.PORT || 3002;
//need to invoke config functions to store all configuration necessary in memory at start up or refresh
app.use(function (req, res, next) {
/*var err = new Error('Not Found');
Expand Down
13 changes: 3 additions & 10 deletions DataTier-APIs/Node-APIs/builders/buildDataAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,8 @@ module.exports = {
sqlQueryLastNames = `select lastname from dataexisting_namelast order by random() limit ${rows};`
console.log(sqlQueryLastNames)
// Process Query for Random Last Names
//lastnames = await db.RecordSpecificResponse(sqlQueryLastNames)
/*
lastnames = dbQueries.getDataFromTable("dataexisting_namelast",rows).then(resp => {
resp.forEach(data => {
randomLastNames.push(data.rows)
})
})*/
// console.log(rows)
lastnames = await db.RecordSpecificResponse(sqlQueryLastNames)
console.log(lastnames.rows)
const minLocationNumber = 1
const maxLocationNumber = 9999
//console.log(Math.floor(result))
Expand All @@ -114,8 +108,7 @@ module.exports = {
}
return address_templates[random_index]
}

rows.forEach(row => {
lastnames.rows.forEach(row => {
const random_index = Math.floor(Math.random() * (maxLocationNumber - minLocationNumber) + minLocationNumber);
fullstreetaddress.push(random_street_template(row.lastname, random_index))
})
Expand Down
40 changes: 20 additions & 20 deletions DataTier-APIs/Node-APIs/builders/buildmsgHL7.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
* messagetype is combination of MessageType^TriggerEvent
* SendingApp
* SendingFacility
* USState
* USstate
*/

/*
Expand Down Expand Up @@ -57,19 +57,19 @@ module.exports = {
const eventtype = messagetype.split("^")[1]
const set_id = "1"
//DATAGENERATED_ACCOUNTNUMBERS
const patientid =row.AccountNumberValue
const patientid =row.accountnumbervalue
//DATAGENERATED_ACCOUNTNUMBERS
const patientid_list = row.AccountNumberValue
const patientid_list = row.accountnumbervalue
//DATAEXISTING_NAMEFIRST => RANDOMIZED
const firstname = row.FirstName
const firstname = row.firstname
//RANDOMIZE LETTER
const middlename = random_letter
//DATAEXISTING_NAMELAST => RANDOMIZED
const lastname = row.LastName
const lastname = row.lastname
//CONCAT ALL THREE
const fullname = `${firstname}^${middlename}^${lastname}^^^`
//CONCAT DATAEXISTING_ADDRESS AND ZIPCODEUS
const fullpatientaddress = `${row.AddressStreet}^^${row.City}^${row.State}^${row.ZipCode}^USA^^^${row.State}`
//CONCAT DATAEXISTING_ADDRESS AND zipcodeUS
const fullpatientaddress = `${row.addressstreet}^^${row.city}^${row.state}^${row.zipcode}^USA^^^${row.state}`
//LEAVE BLANK
const allergy_type_code = ""
//LEAVE AS IS
Expand All @@ -79,30 +79,30 @@ module.exports = {
//RANDOMIZE
const alternative_patientid = Math.floor(1000 + Math.random() * 9000)
//DATAEXISTING_LASTNNAME =>RANDOMIZE
const mothers_maiden_name = rows[random_number].LastName
//DATAGENERETED_DATEOFBIRTH AGE >10
const date = new Date(row.DateOfBirth)
const mothers_maiden_name = rows[random_number].lastname
//DATAGENERETED_dateofbirth AGE >10
const date = new Date(row.dateofbirth)
const dt_birth = moment(date).format("yyyyMMDD")
//DATAEXISTING_FIRSTNAME/LASTNAME
//DATAEXISTING_firstname/lastname
const gender = row.Gender
//DATAEXISTING_REF
const ethnic_group = "B"
//HARDCODE TO USA
const country_code = "USA"
//CONCAT DATAEXISTING_AREACODE + DATAEXISTING_PHONENUMBER =>RANDOMIZE
const home_phone = `${row.AreaCodeValue}-${row.PhoneNumberValue}`
const home_phone = `${row.areacodevalue}-${row.phonenumbervalue}`
//CONCAT DATAEXISTING_AREACODE + DATAEXISTING_PHONENUMBER =>RANDOMIZE
const business_phone = `${row.AreaCodeValue}-${rows[random_number].PhoneNumberValue}`
const business_phone = `${row.areacodevalue}-${rows[random_number].phonenumbervalue}`
//REFDATA_CODETERMS_APPLICATION
const primary_lang ="EN"
//REFDATA
const marital_status = "SA"
//REFDATA
const religion = "NA"
//DATAGENERATED_ACCOUNTNUMBERS
const patient_acct_num = row.AccountNumberValue
const patient_acct_num = row.accountnumbervalue
//DATAGENERATED_SOCIALSECURITYNUMBER
const ssn = row.SocialSecurityNumberValue
const ssn = row.socialsecuritynumbervalue
//DATAGENERATED_DRIVERLICENSES
const drivers_license_num = row.DLN
//REFDATA
Expand All @@ -115,12 +115,12 @@ module.exports = {
const preadmit_num = ""
//BLANK
const prior_patient_loc = ""
//1434567516^LASTNAME^PHYSICIANFIRST
//1434567516^lastname^PHYSICIANFIRST
const ID6 = Math.floor(100000 + Math.random() * 900000)
const attending_physician =`{${ID6}^${rows[random_number].LastName}^${rows[random_number].FirstName}}`
const referring_physcian = `{${ID6}^${rows[random_number].LastName}^${rows[random_number].FirstName}}`
const consulting_physcian = `{${ID6}^${rows[random_number].LastName}^${rows[random_number].FirstName}}`
const admitting_doctor = `{${ID6}^${rows[random_number].LastName}^${rows[random_number].FirstName}}`
const attending_physician =`${ID6}^${rows[random_number].lastname}^${rows[random_number].firstname}`
const referring_physcian = `${ID6}^${rows[random_number].lastname}^${rows[random_number].firstname}`
const consulting_physcian = `${ID6}^${rows[random_number].lastname}^${rows[random_number].firstname}`
const admitting_doctor = `${ID6}^${rows[random_number].lastname}^${rows[random_number].firstname}`
//REFDATA
const hospital_service = "SURG"
//REFDATA
Expand Down
5 changes: 3 additions & 2 deletions DataTier-APIs/Node-APIs/generatedata-dataattributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ if(dataattributeName=='address-us')
}
auditEventMessage ="Invoking Data Generator for "+ runCount+" US based addresses"
console.log(auditEventMessage)
addressDtl = buildDataAttributes.generateAddress_Record_US(runCount)
dataOutputting.processDataOutput(addressDtl, methodName);
buildDataAttributes.generateAddress_Record_US(runCount).then(resp=>{
dataOutputting.processDataOutput(resp, methodName);
})
}
if(dataattributeName=='bankaccounts')
{
Expand Down
1 change: 1 addition & 0 deletions DataTier-APIs/Node-APIs/industrystds-test.industrystds

Large diffs are not rendered by default.

0 comments on commit d6eee2f

Please sign in to comment.