make-mp-data 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/default.js +1 -1
- package/index.js +20 -12
- package/package.json +1 -1
package/default.js
CHANGED
package/index.js
CHANGED
|
@@ -53,7 +53,7 @@ if (suppliedConfig) {
|
|
|
53
53
|
config = require(path.resolve(suppliedConfig));
|
|
54
54
|
} else {
|
|
55
55
|
console.log(`... using default configuration ...\n`);
|
|
56
|
-
config = require(
|
|
56
|
+
config = require("./default.js");
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
//override config with cli params
|
|
@@ -115,7 +115,7 @@ async function main(config) {
|
|
|
115
115
|
const firstEvents = events.filter((e) => e.isFirstEvent);
|
|
116
116
|
const eventData = [];
|
|
117
117
|
const userProfilesData = [];
|
|
118
|
-
|
|
118
|
+
let scdTableData = [];
|
|
119
119
|
const groupProfilesData = [];
|
|
120
120
|
const lookupTableData = [];
|
|
121
121
|
const avgEvPerUser = Math.floor(numEvents / numUsers);
|
|
@@ -158,6 +158,9 @@ async function main(config) {
|
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
+
//flatten SCD
|
|
162
|
+
scdTableData = scdTableData.flat();
|
|
163
|
+
|
|
161
164
|
console.log("\n");
|
|
162
165
|
|
|
163
166
|
// make group profiles
|
|
@@ -205,13 +208,18 @@ async function main(config) {
|
|
|
205
208
|
for (const pair of pairs) {
|
|
206
209
|
const [paths, data] = pair;
|
|
207
210
|
for (const path of paths) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
let datasetsToWrite;
|
|
212
|
+
if (data?.[0]?.["key"]) datasetsToWrite = data.map(d => d.data);
|
|
213
|
+
else datasetsToWrite = [data];
|
|
214
|
+
for (const writeData of datasetsToWrite) {
|
|
215
|
+
if (format === "csv") {
|
|
216
|
+
console.log(`writing ${path}`);
|
|
217
|
+
const csv = Papa.unparse(writeData, {});
|
|
218
|
+
await touch(path, csv);
|
|
219
|
+
console.log(`\tdone\n`);
|
|
220
|
+
} else {
|
|
221
|
+
await touch(path, data, true);
|
|
222
|
+
}
|
|
215
223
|
}
|
|
216
224
|
}
|
|
217
225
|
}
|
|
@@ -379,10 +387,10 @@ main(config)
|
|
|
379
387
|
groups: comma(groupSuccess || 0),
|
|
380
388
|
bytes: bytesHuman(bytes || 0)
|
|
381
389
|
};
|
|
382
|
-
console.table(stats);
|
|
390
|
+
if (bytes > 0) console.table(stats);
|
|
383
391
|
console.log(`\nfiles written to ${folder}...`);
|
|
384
|
-
console.log("\t" + files.flat().join('\t
|
|
385
|
-
console.log(
|
|
392
|
+
console.log("\t" + files.flat().join('\n\t'));
|
|
393
|
+
console.log(`\n------------------SUMMARY------------------\n\n\n`);
|
|
386
394
|
})
|
|
387
395
|
.catch((e) => {
|
|
388
396
|
console.log(`------------------ERROR------------------`);
|