NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

// Define an asynchronous function named calldropDaysSummaryPopup, which takes 'req' as a parameter.
exports.calldropDaysSummaryPopup = async (req) => {
// Initialize an empty array to store table data.
let tableData = [];
try {
// Initialize a payload object with default values.
let payload = {
date: "",
imsimsdn: "",
ueManufacturer: "",
ueModel: "",
};
// Check if 'date' is provided in the request and update the payload accordingly.
if (req.date) {
payload[
"date"
] = `where __time >= TIME_PARSE('${req.date}') - INTERVAL '5' DAY
AND __time < TIME_PARSE('${req.date}') + INTERVAL '1' DAY`;
}
// Check if 'imsi' and 'msisdn' are provided in the request and update the payload accordingly.
if (req.imsi && req.msisdn) {
payload[
"imsimsdn"
] = `and (imsi='${req.imsi}' OR msisdn='${req.msisdn}')`;
}
// Check if 'manufacturer' is provided in the request and update the payload accordingly.
if (req.manufacturer) {
payload["ueManufacturer"] = `and ueManufacturer='${req.manufacturer}'`;
}
// Check if 'model' is provided in the request and update the payload accordingly.
if (req.model) {
payload["ueModel"] = `and ueModel='${req.model}'`;
}
// Generate SQL query using the callDropDailySixDaysTablePopupDateQuery function.
let sqlQuery = callDropDailySixDaysTablePopupDateQuery(payload);
// Log the generated SQL query for debugging purposes.
console.log(sqlQuery);

// Execute the SQL query and store the result in 'tableData'.
tableData = await dbUtils.getObjectsFromDBAsync(sqlQuery);
// Check if the response is valid and update 'tableData' accordingly.
if (
tableData &&
tableData["status"] &&
tableData["status"] === 200 &&
tableData["obj"]
) {
tableData = tableData["obj"];
} else {
console.log(
`Exception In Executing getcalldroptabledata sql query:${tableData}`
);
}
} catch (error) {
// Log any errors that occur during the execution of the function.
console.log(error);
}
// Return the tableData array.
return tableData;
};

// Define an asynchronous function named RealTimeCauseCodePieChart with no parameters.
exports.RealTimeCauseCodePieChart = async () => {
// Initialize an empty object to store pie chart data.
let piechartData = {};

try {
// Populate the 'piechartData' object with pie chart data.
piechartData["pieChartData"] = {
pieData: [
{
Model: "Cause Code 1",
TotalCount: 2653,
},
{
Model: "Cause Code 2",
TotalCount: 811,
},
{
Model: "Cause Code 3",
TotalCount: 126,
},
{
Model: "Cause Code 4",
TotalCount: 86,
},
{
Model: "Cause Code 5",
TotalCount: 65,
},
{
Model: "Cause Code 6",
TotalCount: 51,
},
],
TotalCount: 3832,
};
} catch (error) {
// Log any errors that occur during the execution of the function.
console.log(error);
}
// Return the piechartData object.
return piechartData;
};
// Define an asynchronous function named RealTimeDeviceMakePieChart with no parameters.
exports.RealTimeDeviceMakePieChart = async () => {
// Initialize an empty object to store pie chart data.
let piechartData = {};

try {
// Populate the 'piechartData' object with pie chart data.
piechartData["pieChartData"] = {
pieData: [
{
Model: "APPLE",
TotalCount: 2653,
},
{
Model: "SAMSUNG",
TotalCount: 811,
},
{
Model: "MOTOROLA",
TotalCount: 126,
},
{
Model: "GOOGLE",
TotalCount: 86,
},
{
Model: "LG",
TotalCount: 65,
},
{
Model: "KYOCERA",
TotalCount: 51,
},
],
TotalCount: 3832,
};
} catch (error) {
// Log any errors that occur during the execution of the function.
console.log(error);
}
// Return the piechartData object.
return piechartData;
};
// Define an asynchronous function named RealTimeCallDropsCallGWPiechart with no parameters.
exports.RealTimeCallDropsCallGWPiechart = async () => {
// Initialize an empty object to store pie chart data.
let piechartData = {};

try {
// Populate the 'piechartData' object with pie chart data.
piechartData["pieChartData"] = {
pieData: [
{
Model: "sgw",
TotalCount: 811,
},
{
Model: "pgw",
TotalCount: 126,
},
],
TotalCount: 3832,
};
} catch (error) {
// Log any errors that occur during the execution of the function.
console.log(error);
}
// Return the piechartData object.
return piechartData;
};
// Define an asynchronous function named getRealtimeBarChartLineChartData, which takes 'req' and 'resp' parameters.
exports.getRealtimeBarChartLineChartData = async (req, resp) => {
// Initialize an empty object to store bar chart data.
let barchartData = {};

try {
// Define an array containing objects representing bar chart data.
barchartData = [
{
date: "15.33",
percent: 10,
color: "#fee9c2",
},
{
date: "15.38",
percent: 20,
color: "#fee9c2",
},
{
date: "15.43",
percent: 30,
color: "#fee9c2",
},
{
date: "15.48",
percent: 40,
color: "#fee9c2",
},
{
date: "15.53",
percent: 50,
color: "#fcd68b",
},
{
date: "15.58",
percent: 40,
color: "#fcd68b",
},
{
date: "16.03",
percent: 50,
color: "#fcd68b",
},
{
date: "16.08",
percent: 70,
color: "#fcd68b",
},
{
date: "16.12",
percent: 90,
color: "#fcd68b",
},
{
date: "16.17",
percent: 110,
color: "#fcd68b",
},
{
date: "16.22",
percent: 130,
color: "#fcd68b",
},
{
date: "16.27",
percent: 150,
color: "#f9bd41",
},
{
date: "16.27",
percent: 160,
color: "#f9bd41",
},
{
date: "16.27",
percent: 170,
color: "#f9bd41",
},
{
date: "16.27",
percent: 180,
color: "#f9bd41",
},
{
date: "16.27",
percent: 190,
color: "#f9bd41",
},
{
date: "16.27",
percent: 200,
color: "#f9bd41",
},
{
date: "16.27",
percent: 210,
color: "#f9bd41",
},
];
} catch (error) {
// Log any errors that occur during the execution of the function.
console.log(error);
}
// Return the barchartData array.
return barchartData;
};

// Define an asynchronous function named getRealtimeCount, which takes 'req' and 'resp' parameters.
exports.getRealtimeCount = async (req, resp) => {
// Initialize an empty object to store count data.
let countData = {};
try {
// Set default values for countData (DateTime, Count, and Percent).
countData.dateTime = "16-03-pm 03/02/2023";
countData.count = 260;
count.percent = "0.69%";
} catch (error) {
// Log any errors that occur during the execution of the function.
console.log(error);
}
// Return the countData object.
return countData;
};
// Define an asynchronous function named getOutageLocation, which takes a 'req' parameter.
exports.getOutageLocation = async (req) => {
// Initialize an empty array to store the result.
let enodeBLoc = [];
try {
// Destructure properties from the 'req' object.
let { callDropValue, percentage, date, Lookback } = { ...req };
// percentage =
// percentage[0] && percentage[0]["value"] ? percentage[0]["value"] : "";
// If 'Lookback' is provided, subtract 1; otherwise, set it to 6.
Lookback = Lookback ? Lookback - 1 : 6;

// Initialize a payload object with default values.
let payload = {
date: "",
callDropValue: "",
Lookback: `outage_3 as "Outage Count"`,
percentage: percentage,
};
// Choose the appropriate 'Lookback' value based on the provided 'req.Lookback'.
if (req.Lookback == 3) {
payload["Lookback"] = `outage_3 as "Outage Count"`;
} else if (req.Lookback == 5) {
payload["Lookback"] = `outage_5 as "Outage Count"`;
} else if (req.Lookback == 7) {
payload["Lookback"] = `outage_7 as "Outage Count"`;
} else {
payload["Lookback"] = `outage_1 as "Outage Count"`;
}

// Set the 'date' property in the payload based on the provided 'date'.
if (date) {
payload["date"] = `WHERE __time in (TIME_PARSE('${date}'))`;
} else {
// If 'date' is not provided, use the maximum timestamp from "impacted_usr_v1".
payload[
"date"
] = `WHERE __time in ((SELECT MAX(__time) from "impacted_usr_v1" LIMIT 1))`;
}

// Set the 'callDropValue' property in the payload based on the provided 'callDropValue'.
if (callDropValue) {
payload.callDropValue = `AND "Call Drops">=${callDropValue}`;
}

// Generate SQL query using the callDropDailyOutageMapQuery function.
let sql = callDropDailyOutageMapQuery(payload);

// Log the generated SQL query for debugging purposes.
console.log("sql", sql);

// Execute the SQL query and store the result in 'enodeBLoc'.
enodeBLoc = await dbUtils.getObjectsFromDBAsync(sql);
} catch (error) {
// Log any errors that occur during the execution of the function.
console.log(error);
}
// Return the result (enodeBLoc) of the asynchronous operation.
return enodeBLoc;
};
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.