Gathering detailed insights and metrics for tabulation-query-builder
Gathering detailed insights and metrics for tabulation-query-builder
Gathering detailed insights and metrics for tabulation-query-builder
Gathering detailed insights and metrics for tabulation-query-builder
npm install tabulation-query-builder
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
31 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Mar 12, 2017
Latest Version
0.0.16
Package Id
tabulation-query-builder@0.0.16
Size
47.49 kB
NPM Version
5.0.3
Node Version
8.1.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
33
Easy tabulation with generated SQL.
When I come up with a hypothesis, I want to confirm it soon. And based on that, if you come up with the next hypothesis, I'd like to confirm it soon too. I think that what is important is the speed of this cycle. Responsive analytical methods lead to efficient learning on your marketing.
In order to know the user, I think that it is necessary to analyze the user's behavior history. At that time, you will prepare two axes and analyze user's behavior from different indicaters. Due to this operation called Tabulation, we used Excel, introduced BI tools, or wrote SQL every time. Since I was troublesome to do whichever, I created a module that generates SQL from several input items.
Generate SQL for analyzing with some inputs.
1const tqb = new TabulationQueryBuilder();
2
3tqb.setTable('payment_logs');
4
5/**
6*
7* Matching
8* We narrow down the logs matching the conditions
9* by specifying the period and user ID.
10*
11* e.g) Term range
12*
13*/
14
15tqb.setMatching({
16 field: 'timestamp',
17 range: ['2017-01-01 00:00:00', '2017-01-03 23:59:59']
18});
19
20/**
21*
22* Indexing
23* At first, indexing for aggregating
24*
25* e.g) Calculate total payment for each target field
26*
27*/
28
29tqb.setIndexing({
30 field: 'price',
31 method: 'sum',
32 interval: 300
33});
34
35/**
36*
37* Aggregating
38* Aggregate using by indexing values
39*
40* e.g) Count users by total payment ranges
41*
42*/
43
44tqb.setAggregating({
45 field: 'user_id',
46 method: 'count'
47});
48
49const query = tqb.build();
1SELECT COUNT(`user_id`) AS "value", FLOOR(`indexed_value_0` / 300) AS "category" FROM (SELECT SUM(`indexed_value_0`) AS "indexed_value_0", `user_id` FROM (SELECT price AS "indexed_value_0", user_id FROM payment_logs WHERE ("2017-01-01 00:00:00" <= timestamp AND timestamp <= "2017-01-03 23:59:59")) `matching_table` GROUP BY `user_id`) `indexing_table` GROUP BY FLOOR(`indexed_value_0` / 300)
1mysql> select * from payment_logs; 2+----+---------+-------+---------------------+ 3| id | user_id | price | timestamp | 4+----+---------+-------+---------------------+ 5| 1 | 1 | 100 | 2017-01-01 12:00:00 | 6| 2 | 2 | 200 | 2017-01-01 12:00:00 | 7| 3 | 1 | 300 | 2017-01-02 12:00:00 | 8| 4 | 4 | 10 | 2017-01-02 15:00:00 | 9| 5 | 4 | 50 | 2017-01-02 16:00:00 | 10| 6 | 4 | 100 | 2017-01-03 18:00:00 | 11| 7 | 5 | 1000 | 2017-01-04 19:00:00 | 12| 8 | 1 | 500 | 2017-01-04 10:00:00 | 13| 9 | 1 | 600 | 2017-01-05 11:00:00 | 14| 10 | 3 | 800 | 2017-01-06 12:00:00 | 15| 11 | 1 | 100 | 2017-01-06 13:00:00 | 16+----+---------+-------+---------------------+ 1711 rows in set (0.06 sec) 18 19mysql> SELECT COUNT(user_id) AS "value", FLOOR(indexed_value / 300) AS "category" FROM (SELECT SUM(price) AS "indexed_value", user_id FROM (SELECT price, user_id FROM payment_logs WHERE ("2017-01-01 00:00:00" <= timestamp AND timestamp <= "2017-01-03 23:59:59")) `matching_table` GROUP BY user_id) `indexing_table` GROUP BY FLOOR(indexed_value / 300); 20+-------+----------+ 21| value | category | 22+-------+----------+ 23| 2 | 0 | 24| 1 | 1 | 25+-------+----------+ 262 rows in set (0.01 sec)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
81 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More