Skip to content

Commit 85aef21

Browse files
committed
getCount function is completed
1 parent 59f4873 commit 85aef21

File tree

7 files changed

+172
-4
lines changed

7 files changed

+172
-4
lines changed

1.csv

+70
Large diffs are not rendered by default.

2.csv

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Purchase Date,First Name,Last Name,Name,Email,Order No,Ticket Type,Status,Last Updated Date,Bib No,phone-number,name-of-institution,technical-workshop-topic,non-technical-workshop-topic,food-preference,Ticket No,Category Name,BAR/QR code No.,Checked In,Mobile No
2+
2023-02-26,Ashwin,S Kumar,Ashwin S Kumar,ashwnskmr@gmail.com,KK921KP-EFBIJGG-230226-151344-1361,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-26 15:15:18,0,7012413590,Model Engineering College,Code a Product using AI,Growth strategies for Bootstrapped startups,Veg,539,Student,KX435039IA,,
3+
2023-02-25,Sana,Salim A,Sana Salim A,sanasalima241@gmail.com,KK921KP-EFBIJGG-230225-180808-2317,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-25 18:51:46,0,6235332295,"Model Engineering College, Thrikkakara",Linux And Cloud Fundamentals,Pitching: The art of story telling,Non-Veg,526,Student,DM989413CA,,
4+
2023-02-22,Navaneeth,C J,Navaneeth C J,navaneethjayan123@gmail.com,KK921KP-EFBIJGG-230222-080758-186,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-22 08:27:03,0,7034897008,MEC Thrikkakara,Linux And Cloud Fundamentals,Pitching: The art of story telling,Non-Veg,498,Student,CR852017FH,,
5+
2023-02-20,Varsha,Thomas,Varsha Thomas,varshathomas364@gmail.com,KK921KP-EFBIJGG-230220-222841-846,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 22:30:17,0,7306326537,"Govt. Model Engineering College, Thrikkakara",No Code App Building,Pitching: The art of story telling,Veg,473,Student,PB309536NR,,
6+
2023-02-20,Ann Maria,Abraham,Ann Maria Abraham,annuthek@gmail.com,KK921KP-EFBIJGG-230220-205033-787,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 21:02:33,0,8086133101,Govt.Model Engineering College,Introduction To Blockchain Technologies,Growth strategies for Bootstrapped startups,Non-Veg,469,Student,XF628146GV,,
7+
2023-02-20,NEHA,C J,NEHA C J,cjneha890@gmail.com,KK921KP-EFBIJGG-230220-153327-486,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 15:36:24,0,7736055771,Model engineering college Thrikkakara,Code a Product using AI,Pitching: The art of story telling,Non-Veg,450,Student,AW994494GY,,
8+
2023-02-20,Anavadya,N Lakshmi,Anavadya N Lakshmi,anavadyanlakshmi@gmail.com,KK921KP-EFBIJGG-230220-135307-356,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 13:55:41,0,9995347107,Govt. Model Engineering College,No Code App Building,Hiring for Attitude,Non-Veg,447,Student,GT330039MZ,,
9+
2023-02-20,NORA,B VARGHESE,NORA B VARGHESE,norabv254@gmail.com,KK921KP-EFBIJGG-230220-120357-285,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 12:05:36,0,9526945813,Govt Model Engineering College Thrikkakara,Linux And Cloud Fundamentals,Hiring for Attitude,Veg,445,Student,OE364902KM,,
10+
2023-02-20,Sana,A P,Sana A P,s4sanaap@gmail.com,KK921KP-EFBIJGG-230220-115534-278,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 11:56:10,0,9497703681,Model Engineering College,Linux And Cloud Fundamentals,Hiring for Attitude,Non-Veg,444,Student,RM669308WD,,
11+
2023-02-20,Aswini,P,Aswini P,aswinipriya2004@gmail.com,KK921KP-EFBIJGG-230220-110225-230,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 11:04:00,0,8129593927,Govt. Model Engineering College,Linux And Cloud Fundamentals,Hiring for Attitude,Veg,421,Student,PY575000YA,,
12+
2023-02-20,Keerthana,J,Keerthana J,keethujrchinni@gmail.com,KK921KP-EFBIJGG-230220-104738-215,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 10:49:23,0,9400728330,Model Engineering College Thrikkakkara,Code a Product using AI,Pitching: The art of story telling,Non-Veg,419,Student,TS408743MT,,
13+
2023-02-20,DEVIKA,P,DEVIKA P,devikaa.pradeep@gmail.com,KK921KP-EFBIJGG-230220-103355-194,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-20 10:44:58,0,9037435133,"Govt.Model Engineering College, Thrikkakara",No Code App Building,Pitching: The art of story telling,Veg,416,Student,GA382629KA,,
14+
2023-02-19,Alexander,Biju Issac,Alexander Biju Issac,alexanderillam2004@gmail.com,KK921KP-EFBIJGG-230219-224642-413,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-19 22:57:23,0,7510159354,Model Engineering College Thrikkakara,Code a Product using AI,Pitching: The art of story telling,Veg,407,Student,OL878914SW,,
15+
2023-02-19,V,Devanarayan,V Devanarayan,octavius1983bc@gmail.com,KK921KP-EFBIJGG-230219-222949-402,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-19 22:37:47,0,9497414304,"Govt. Model Engineering College, Thrikkakara",Linux And Cloud Fundamentals,Growth strategies for Bootstrapped startups,Non-Veg,405,Student,US425665JA,,
16+
2023-02-19,Nefsin,Navas,Nefsin Navas,nefsinnavas2020cps@gmail.com,KK921KP-EFBIJGG-230219-173619-269,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-19 17:39:29,0,8075608946,Govt Model Engineering College,Code a Product using AI,Growth strategies for Bootstrapped startups,Non-Veg,359,Student,GK152315WF,,
17+
2023-02-18,Neehara,Prajesh,Neehara Prajesh,neeharaprajesh@gmail.com,KK921KP-EFBIJGG-230218-194045-390,Workshop- Technical and Non Technical (Student) - 25th March,completed,2023-02-18 19:43:12,0,8848904105,Model engineering college thrikkakara kochi,Introduction To Blockchain Technologies,Pitching: The art of story telling,Non-Veg,278,Student,UF737027XE,,

functions/getCount.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const fs = require('fs');
2+
const csv = require('csv-parser');
3+
4+
const getCount = () => {
5+
const filePaths = ['1.csv', '2.csv'];
6+
const filterColumns = ['technical-workshop-topic', 'non-technical-workshop-topic'];
7+
8+
const columnCounts = {};
9+
filterColumns.forEach((column) => {
10+
columnCounts[column] = {};
11+
});
12+
13+
return new Promise((resolve, reject) => {
14+
let count = 0;
15+
filePaths.forEach((filePath) => {
16+
fs.createReadStream(filePath)
17+
.pipe(csv())
18+
.on('data', (row) => {
19+
filterColumns.forEach((column) => {
20+
const value = row[column];
21+
if (!columnCounts[column][value]) {
22+
columnCounts[column][value] = 0;
23+
}
24+
columnCounts[column][value]++;
25+
});
26+
})
27+
.on('end', () => {
28+
count++;
29+
if (count === filePaths.length) {
30+
resolve(columnCounts);
31+
}
32+
})
33+
.on('error', (err) => {
34+
reject(err);
35+
});
36+
});
37+
});
38+
};
39+
40+
module.exports = getCount;

functions/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ const getName = require("./getName");
33
const getTime = require("./getTime");
44
const getTodo = require("./getTodo");
55
const getExplara = require("./explaraProxy");
6+
const getCount = require("./getCount");
67

78
module.exports = {
89
echo,
910
getName,
1011
getTodo,
1112
getTime,
12-
getExplara
13+
getExplara,
14+
getCount
1315
};

index.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const express = require("express");
2-
const { echo, getTime, getName, getTodo, getExplara } = require("./functions");
2+
const { echo, getTime, getName, getTodo, getExplara,getCount } = require("./functions");
33

44
const app = express();
55

@@ -37,11 +37,19 @@ app.get("/explara", async (_, res) => {
3737
res.send(data);
3838
});
3939

40+
app.get("/count", async (_, res) => {
41+
const data = await getCount();
42+
res.send(data);
43+
});
44+
45+
4046
app.get("/", (_, res) => {
4147
console.log("yo");
4248
res.send({ working: "yes bro", status: "Alive and kicking" });
4349
});
4450

51+
52+
4553
if (process.env.isDev) {
4654
app.listen(5000, () => console.log("listening on port 5000"));
4755
}

package-lock.json

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"start": "isDev=true node index.js",
8-
"dev": "isDev=true nodemon index.js"
7+
"start": " node index.js",
8+
"dev": " nodemon index.js"
99
},
1010
"keywords": [
1111
"lambda functions",
@@ -17,6 +17,8 @@
1717
"dependencies": {
1818
"@sparticuz/chromium": "^111.0.0",
1919
"axios": "^1.3.4",
20+
"csv-parse": "^5.3.6",
21+
"csv-parser": "^3.0.0",
2022
"dotenv": "^16.0.3",
2123
"express": "^4.18.2",
2224
"puppeteer": "^19.7.2",

0 commit comments

Comments
 (0)