id
int64
0
1.29M
original_id
stringlengths
32
32
swhid
stringlengths
100
170
sha1
stringlengths
40
40
repo_name
stringlengths
2
45
repo_group
stringclasses
12 values
filepath
stringlengths
5
153
name
stringlengths
1
14.9k
type
stringclasses
3 values
code
stringlengths
7
2.12M
15,300
4812ed41bfa57a2e30371cdfb4016adf
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=15-17/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputInstrumentName
function
get inputInstrumentName() { return $('input[data-id="instrument-name-modify"]'); }
15,301
97cee78d1bb7cdf9bedff66569be0b74
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=31-33/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputOwner
function
get inputOwner() { return $('div[data-id="owner"]'); }
15,302
a902fd34231639e42bb33d3c9c74193a
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=35-37/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputEmail
function
get inputEmail() { return $('input[data-id="email"]'); }
15,303
07a66ef6f609d56eea1b6e563e7c7ef1
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=39-41/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputPurpose
function
get inputPurpose() { return $('div[data-id="purpose"]'); }
15,304
8fd32ef7fe58f25548ff53e4b457611e
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=43-45/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputContextualAttributes
function
get inputContextualAttributes() { return $('section[data-id="contextual-attributes"] input'); }
15,305
dc419015bbd1227e65f69baf4191e7ce
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=47-49/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputSampleUnit
function
get inputSampleUnit() { return $('div[data-id="sample-unit"]'); }
15,306
edf0a95f9730e859abcd8781780bd5ab
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=63-65/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputRiskLevel
function
get inputRiskLevel() { return $('section[data-id="risk-level"] input'); }
15,307
1ef64eb501fdd95f77d5dbb631cf0b6b
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=67-69/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::btnSubmit
function
get btnSubmit() { return $('button[data-id="modify-submit"]'); }
15,308
833549f67c509da3ee63e462b526ab76
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=71-113/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::fill
function
async fill(description, task, email, contextualattributes, durationamount, startdate, review, riskLevel) { await this.inputFunction.click(); // Select an existing instrument to be modified await this.inputInstrumentName.click(); const nextInstrument = this.inputInstrumentName.parentElem...
15,309
aadf894eb5e4d4cce91cc8a49d54bada
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=115-117/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::submit
function
async submit() { await this.btnSubmit.click(); }
15,310
d792af09be5932170c4a36c63b8ccadf
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=51-53/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputDurationAmount
function
get inputDurationAmount() { return $('input[data-id="duration-amount"]'); }
15,311
ef1758ccc68b5d690369fec3d48fbb24
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=119-124/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::open
function
/** * overwrite specific options to adapt it to page object */ open() { return super.open('launch'); }
15,312
bdc3f91dceac73094f0f3c1137457edc
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=59-61/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputSecurityLegalReview
function
get inputSecurityLegalReview() { return $('input[data-id="security-legal-review"]'); }
15,313
d80ebf8511039e78214fcb8cbcc081ed
swh:1:cnt:c72e0ffe174baaba6530cdd54ab94fdfcc9c6112;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=55-57/
d714179f7605f9be90294dfc0bb763c3ae00a6a3
test-kitchen
analytics
frontend/test/pageobjects/modify.page.js
ModifyPage::inputStartDate
function
get inputStartDate() { return $('input[data-id="start-date"]'); }
15,314
0a73fac569c11f16a6045584aabb8449
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-115/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage
type
/** * sub page containing specific selectors and methods for a specific page */ class NewPage extends Page { /** * define selectors using getter methods */ get inputInstrumentName() { return $('input[data-id="instrument-name-new"]'); } get inputDescription() { return $('text...
15,315
eba6d4bee78484d740fdd1388ef7f2ef
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-13/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputInstrumentName
function
/** * define selectors using getter methods */ get inputInstrumentName() { return $('input[data-id="instrument-name-new"]'); }
15,316
8e70120ad52cb2d89831b134cfac4f07
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=15-17/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputDescription
function
get inputDescription() { return $('textarea[data-id="description"]'); }
15,317
18a002e4fa75a7d1aa6e8e4d67846e84
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=23-25/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputPhabTicket
function
get inputPhabTicket() { return $('input[data-id="task"]'); }
15,318
97cee78d1bb7cdf9bedff66569be0b74
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=27-29/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputOwner
function
get inputOwner() { return $('div[data-id="owner"]'); }
15,319
7c0d4fe8ec694ab8677984a5b09f55a5
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=19-21/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputSchemaType
function
get inputSchemaType() { return $('input[name="radio-group-schema-type"][value="web"]'); }
15,320
a902fd34231639e42bb33d3c9c74193a
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=31-33/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputEmail
function
get inputEmail() { return $('input[data-id="email"]'); }
15,321
07a66ef6f609d56eea1b6e563e7c7ef1
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=35-37/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputPurpose
function
get inputPurpose() { return $('div[data-id="purpose"]'); }
15,322
8fd32ef7fe58f25548ff53e4b457611e
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=39-41/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputContextualAttributes
function
get inputContextualAttributes() { return $('section[data-id="contextual-attributes"] input'); }
15,323
dc419015bbd1227e65f69baf4191e7ce
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=43-45/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputSampleUnit
function
get inputSampleUnit() { return $('div[data-id="sample-unit"]'); }
15,324
d792af09be5932170c4a36c63b8ccadf
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=47-49/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputDurationAmount
function
get inputDurationAmount() { return $('input[data-id="duration-amount"]'); }
15,325
13d7256560d567e6ccabe9c39aa36486
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=63-65/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::btnSubmit
function
get btnSubmit() { return $('button[data-id="launch-submit"]'); }
15,326
aadf894eb5e4d4cce91cc8a49d54bada
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=105-107/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::submit
function
async submit() { await this.btnSubmit.click(); }
15,327
ef1758ccc68b5d690369fec3d48fbb24
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=109-114/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::open
function
/** * overwrite specific options to adapt it to page object */ open() { return super.open('launch'); }
15,328
d80ebf8511039e78214fcb8cbcc081ed
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=51-53/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputStartDate
function
get inputStartDate() { return $('input[data-id="start-date"]'); }
15,329
edf0a95f9730e859abcd8781780bd5ab
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=59-61/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputRiskLevel
function
get inputRiskLevel() { return $('section[data-id="risk-level"] input'); }
15,330
bdc3f91dceac73094f0f3c1137457edc
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=55-57/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::inputSecurityLegalReview
function
get inputSecurityLegalReview() { return $('input[data-id="security-legal-review"]'); }
15,331
a369f90d76c9c8a86593ae428c419622
swh:1:cnt:214e8e658e91b714ae302b969b0bba09be93c8f0;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=67-103/
4cb4d5587f83fa1d4c7b3adc7ee5e226d7b0d43c
test-kitchen
analytics
frontend/test/pageobjects/new.page.js
NewPage::fill
function
async fill(instrumentname, description, task, email, contextualattributes, durationamount, startdate, review, riskLevel) { await this.inputInstrumentName.setValue(instrumentname); await this.inputDescription.setValue(description); await this.inputSchemaType.click(); await this.inputPhabT...
15,332
91f965ddff4614bf1a46d77ef1879569
swh:1:cnt:d7b45aa47c5b8a19950628a31a6c11b9d631a574;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=7-16/
23e231318fcc712d9f90174aa28c0d9d66a4fda7
test-kitchen
analytics
frontend/test/pageobjects/page.js
Page
type
class Page { /** * Opens a sub page of the page * * @param path path of the sub page (e.g. /path/to/page.html) */ open(path) { return browser.url(`http://localhost/${ path }`); } }
15,333
e3a4952134a77070c3c4f6561fe833bb
swh:1:cnt:d7b45aa47c5b8a19950628a31a6c11b9d631a574;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-15/
23e231318fcc712d9f90174aa28c0d9d66a4fda7
test-kitchen
analytics
frontend/test/pageobjects/page.js
Page::open
function
/** * Opens a sub page of the page * * @param path path of the sub page (e.g. /path/to/page.html) */ open(path) { return browser.url(`http://localhost/${ path }`); }
15,334
f6afd355810c7c99d12889447ea2ba66
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-45/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage
type
/** * sub page containing specific selectors and methods for a specific page */ class ReadPage extends Page { /** * define selectors using getter methods */ get description() { return $('div[data-id="description"]'); } get task() { return $('div[data-id="task"]'); } ...
15,335
fbaaa6f774b408f9e0c52d72d8773269
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-13/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::description
function
/** * define selectors using getter methods */ get description() { return $('div[data-id="description"]'); }
15,336
3ed32f72a105a9a38fe968aee5854f3c
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=15-17/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::task
function
get task() { return $('div[data-id="task"]'); }
15,337
08eafccea0db875598845d7c8464f752
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=19-21/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::email
function
get email() { return $('div[data-id="email"]'); }
15,338
3e8da2dcf05e30bf2e09d1976f5a1ef8
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=23-25/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::contextualAttributes
function
get contextualAttributes() { return $('div[data-id="contextual-attributes"]'); }
15,339
920f2d6e544649423cf040b4f1220a67
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=27-29/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::sampleUnit
function
get sampleUnit() { return $('div[data-id="sample-unit"]'); }
15,340
c63c9441f65cc6c8382db6c0ee6f53b3
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=31-33/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::securityLegalReview
function
get securityLegalReview() { return $('div[data-id="security-legal-review"]'); }
15,341
1ef8ff40e385fc8128608993163a63d2
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=35-37/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::riskLevel
function
get riskLevel() { return $('div[data-id="risk-level"]'); }
15,342
4a794678da3341003c8b3a7bb5b9e897
swh:1:cnt:cfc1e29189687034cc7299a96047eaba29983f5f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=39-44/
4bb3b395f44a3b5d710c0ff09074ecf850c17394
test-kitchen
analytics
frontend/test/pageobjects/read.page.js
ReadPage::open
function
/** * overwrite specific options to adapt it to page object */ open() { return super.open('read/test-instrument'); }
15,343
d0271c97b8fd5e21cabf42c8f975b1d3
swh:1:cnt:cf8d97b63ef4850fca02426e15d91bfb8c79a48f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=3-74/
7444b9d7a0ca59fb0ae37dc916784007a055a5c3
test-kitchen
analytics
models/Experiment.js
Experiment
type
class Experiment { /** * @param {string} source * @param {string} name * @param {string} slug * @param {number} phaseIndex * @param {Date} utcStartDate * @param {Date} utcEndDate * @param {string} userIdentifierType * @param {Object<string,Object<string,number>>} trafficSpli...
15,344
42cb907c687959f8a2c4de8213441b43
swh:1:cnt:cf8d97b63ef4850fca02426e15d91bfb8c79a48f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=5-44/
7444b9d7a0ca59fb0ae37dc916784007a055a5c3
test-kitchen
analytics
models/Experiment.js
Experiment::constructor
function
/** * @param {string} source * @param {string} name * @param {string} slug * @param {number} phaseIndex * @param {Date} utcStartDate * @param {Date} utcEndDate * @param {string} userIdentifierType * @param {Object<string,Object<string,number>>} trafficSplits * @param {string...
15,345
33634d107ae85879d40ce9bba348447f
swh:1:cnt:cf8d97b63ef4850fca02426e15d91bfb8c79a48f;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=46-73/
7444b9d7a0ca59fb0ae37dc916784007a055a5c3
test-kitchen
analytics
models/Experiment.js
Experiment::getVersion
function
/** * Gets the internal version of the experiment. * * Currently, the JS SDK uses this to invalidate the client-side exposure event cache. In the * future, we could use this to track experiment config propagation through the system. * * @return {string} * * @private */ g...
15,346
c38ca7390c13767c8f100debe5db1aff
swh:1:cnt:c93ccfc27dd39445c6e14ea9f4ae6f627a6ee240;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-6/
43b5abfe7d08cafc78bc425c4965b13328ce9515
test-kitchen
analytics
service/contextualAttributesService.js
setDb
function
function setDb(knex) { db = knex; }
15,347
c38ca7390c13767c8f100debe5db1aff
swh:1:cnt:adb6aa0d0e77885cf41f8779a3ffdda004e537d4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-10/
13d922179f309bd1f34033a808d915b7a3ee90c3
test-kitchen
analytics
service/experimentConfigurationService.js
setDb
function
function setDb(knex) { db = knex; }
15,348
23e37f0067c009b1abbdfbb37484ee9b
swh:1:cnt:adb6aa0d0e77885cf41f8779a3ffdda004e537d4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=21-62/
13d922179f309bd1f34033a808d915b7a3ee90c3
test-kitchen
analytics
service/experimentConfigurationService.js
adaptGb
function
function adaptGb(gbData) { return gbData.experiments.map((exp) => { const phases = exp.phases || []; const currentPhase = phases[phases.length - 1] || {}; const variations = exp.variations || []; const coverage = currentPhase.coverage || 1; const customFields = exp.customFiel...
15,349
5e1702968f38bccfdff84e49dd406c7d
swh:1:cnt:adb6aa0d0e77885cf41f8779a3ffdda004e537d4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=92-107/
13d922179f309bd1f34033a808d915b7a3ee90c3
test-kitchen
analytics
service/experimentConfigurationService.js
toExperimentsRecord
function
function toExperimentsRecord(experiment) { return { name: experiment.name, slug: experiment.slug, phase_index: experiment.phaseIndex, utc_start_dt: experiment.utcStartDate, utc_end_dt: experiment.utcEndDate || null, user_identifier_type: experiment.userIdentifierType ...
15,350
ff7c29a0a7db8738a83f4d97e8fc0b66
swh:1:cnt:adb6aa0d0e77885cf41f8779a3ffdda004e537d4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=12-19/
13d922179f309bd1f34033a808d915b7a3ee90c3
test-kitchen
analytics
service/experimentConfigurationService.js
validate
function
function validate(data) { if (!data || typeof data !== 'object') { throw new Error('GrowthBook response is not an object'); } if (!Array.isArray(data.experiments)) { throw new Error('GrowthBook response missing experiments array'); } }
15,351
3eefef00a1fafe56c1423df930cbb01b
swh:1:cnt:adb6aa0d0e77885cf41f8779a3ffdda004e537d4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=64-90/
13d922179f309bd1f34033a808d915b7a3ee90c3
test-kitchen
analytics
service/experimentConfigurationService.js
loadTkExperiments
function
async function loadTkExperiments() { const dbExperiments = await db('instruments') .select([ 'id', 'slug', 'name', 'utc_start_dt', 'utc_end_dt', 'sample_unit', 'sample_rate', 'variants', 'stream_name', 'schema_title' ]) .where('type', 'A/B test...
15,352
da1af64e95c49be97a13b767b70de022
swh:1:cnt:adb6aa0d0e77885cf41f8779a3ffdda004e537d4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=109-120/
13d922179f309bd1f34033a808d915b7a3ee90c3
test-kitchen
analytics
service/experimentConfigurationService.js
store
function
async function store(data) { if (data.length === 0) { // Leave existing DB records untouched — an empty result is likely transient // and stale data is preferable to wiping the table. logger.info('Experiment configuration store skipped (no experiments)'); return; } const rec...
15,353
2d6ae6ab088c9852e6df1f870056cfc7
swh:1:cnt:adb6aa0d0e77885cf41f8779a3ffdda004e537d4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=122-137/
13d922179f309bd1f34033a808d915b7a3ee90c3
test-kitchen
analytics
service/experimentConfigurationService.js
process
function
async function process(gbData) { validate(gbData); const gbExperiments = adaptGb(gbData); let tkExperiments; try { tkExperiments = await loadTkExperiments(); } catch (error) { throw new Error(`load — ${ error.message }`); } const stitched = stitchExperiments(tkExperiments, gb...
15,354
c38ca7390c13767c8f100debe5db1aff
swh:1:cnt:cacbeaf1f6e039efa38343fbc73addd4b4de980b;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-10/
9b61c62930f18927d230c8cf83d41854f0f63012
test-kitchen
analytics
service/experimentService.js
setDb
function
function setDb(knex) { db = knex; }
15,355
532d3117d045b60c89ba5703c9e4244f
swh:1:cnt:cacbeaf1f6e039efa38343fbc73addd4b4de980b;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=152-180/
9b61c62930f18927d230c8cf83d41854f0f63012
test-kitchen
analytics
service/experimentService.js
findAllExperimentsNew
function
async function findAllExperimentsNew() { const contextualAttributes = await findAllContextualAttributes(); const rows = await db() .select( 'name', 'slug', 'utc_start_dt', 'utc_end_dt', 'sample_unit', 'sample_rate', 'var...
15,356
7fa8fea5b4a077cd6678ba69afa4f12f
swh:1:cnt:cacbeaf1f6e039efa38343fbc73addd4b4de980b;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=116-150/
9b61c62930f18927d230c8cf83d41854f0f63012
test-kitchen
analytics
service/experimentService.js
findAllContextualAttributes
function
async function findAllContextualAttributes() { const rows = await db() .select({ 'instruments.slug': 'slug', 'contextual_attributes.contextual_attribute_name': 'contextual_attribute' }) .from('instruments') .join( 'instrument_contextual_attribute_l...
15,357
354b0d16fd560e49cb1a407e5a9b0451
swh:1:cnt:efb2a334a57158a945a7a8ed6f6a5d416644306b;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=1-16/
2f9e890b09dd499b0c320c64e1fc7c5d447e594c
test-kitchen
analytics
service/experimentStitcher.js
stitch
function
/** * Merges validated experiments from GrowthBook and TKUI into a single set. * * When both sources define an experiment with the same slug, the GrowthBook * version is included and the TKUI version is excluded. Output is sorted by * slug for stability across repeated calls with identical input. * * @param {Exp...
15,358
773a1d24f95d7541ba2762ca845c1240
swh:1:cnt:9fac53c37a95d30b7f5d026aa29013494841f3c2;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-32/
19065336acbbdc504a70ab6de229b08061acc909
test-kitchen
analytics
service/growthBookClient.js
fetchExperiments
function
async function fetchExperiments() { const { api_url: apiUrl, api_key: apiKey, timeout_ms: timeoutMs } = config.growthbook; async function fetchPage(offset) { const response = await axios.get(apiUrl, { headers: { Authorization: `Bearer ${ apiKey }` }, ...
15,359
5b7fb58ee5c97b35836ef1deef27a7c3
swh:1:cnt:9fac53c37a95d30b7f5d026aa29013494841f3c2;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=11-18/
19065336acbbdc504a70ab6de229b08061acc909
test-kitchen
analytics
service/growthBookClient.js
fetchExperiments::fetchPage
function
async function fetchPage(offset) { const response = await axios.get(apiUrl, { headers: { Authorization: `Bearer ${ apiKey }` }, timeout: timeoutMs, params: { status: 'running', limit: 100, offset } }); return response.data; }
15,360
7bd9c6ed137f2e072c0b6872ff419fd9
swh:1:cnt:76ebee5e7c41b98737a04b692977271b5192bea2;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-28/
42c2bddc5d3323a5ee4ddfef493aea9f0f21d589
test-kitchen
analytics
service/growthBookPoller.js
poll
function
async function poll() { if (running) { return; } running = true; try { let data; try { data = await fetchExperiments(); } catch (error) { throw new Error(`fetch — ${ error.message }`); } await processConfig(data); logger.inf...
15,361
0ddd7e596933ecd963879e0490a9275a
swh:1:cnt:76ebee5e7c41b98737a04b692977271b5192bea2;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=58-65/
42c2bddc5d3323a5ee4ddfef493aea9f0f21d589
test-kitchen
analytics
service/growthBookPoller.js
stop
function
function stop() { if (intervalId !== null) { clearInterval(intervalId); intervalId = null; running = false; logger.info('GrowthBook poller stopped'); } }
15,362
15af8f2501a458272113a7e43dccb6d7
swh:1:cnt:76ebee5e7c41b98737a04b692977271b5192bea2;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=30-44/
42c2bddc5d3323a5ee4ddfef493aea9f0f21d589
test-kitchen
analytics
service/growthBookPoller.js
isGrowthBookConfigured
function
function isGrowthBookConfigured() { if (!config.growthbook?.run_poller) { logger.warn('GrowthBook poller disabled (run_poller is not set)'); return false; } if (!config.growthbook.api_url) { logger.warn('GrowthBook API URL missing — poller disabled'); return false; } ...
15,363
2c68aefae1597ace55827af1c103828d
swh:1:cnt:76ebee5e7c41b98737a04b692977271b5192bea2;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=46-56/
42c2bddc5d3323a5ee4ddfef493aea9f0f21d589
test-kitchen
analytics
service/growthBookPoller.js
start
function
function start() { if (!isGrowthBookConfigured()) { return; } if (intervalId !== null) { return; } poll(); intervalId = setInterval(poll, config.growthbook.poll_interval_ms); logger.info(`GrowthBook poller started (interval: ${ config.growthbook.poll_interval_ms }ms)`); }
15,364
c38ca7390c13767c8f100debe5db1aff
swh:1:cnt:8f04b3ff4fb5379ded022facf5ee8d6aa9c67624;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=12-14/
b6d9c9e86407b17115f1fec7259eef96a29c6521
test-kitchen
analytics
service/instrumentService.js
setDb
function
function setDb(knex) { db = knex; }
15,365
c38ca7390c13767c8f100debe5db1aff
swh:1:cnt:6df91ec4d12394f806f738e41eb147a14c534542;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-6/
bc6130d978029a76c9bccad8941e3e566a0ef55c
test-kitchen
analytics
service/nameSlugService.js
setDb
function
function setDb(knex) { db = knex; }
15,366
c38ca7390c13767c8f100debe5db1aff
swh:1:cnt:a0469d336c0eee169c0b688b0db803c847d134ed;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-6/
18ffebe8d853da1eaf4009ca271ddb684a61465c
test-kitchen
analytics
service/okrService.js
setDb
function
function setDb(knex) { db = knex; }
15,367
439d2ca993531b8c254cb644b2166340
swh:1:cnt:4c4b6c067f6e6d3fa50842a44c896bae3a4d51c4;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=13-20/
202d7f8e5c02b2c9d63b7c8c24db3a76e080aa1f
test-kitchen
analytics
service/serviceRegistry.js
setDbForAllServices
function
function setDbForAllServices(db) { instrumentService.setDb(db); experimentService.setDb(db); nameSlugService.setDb(db); okrService.setDb(db); contextualAttributesService.setDb(db); experimentConfigurationService.setDb(db); }
15,368
4d6d8291ec3ecbc6816c59fec9ff1fb2
swh:1:cnt:c094dfb21058a4c073d0ebda95b0ac1567636d52;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=7-15/
934d460b1c085461c0936c958fbd583057c0c192
test-kitchen
analytics
test/testUtil.js
prepareRequest
function
// Prepare the request to be used within the unit tests function prepareRequest() { const request = httpMocks.createRequest(); request.app = {}; request.app.logger = logger; request.app.conf = {}; return request; }
15,369
00b68dfe2f8e0c84b3a14cdba1d33082
swh:1:cnt:c094dfb21058a4c073d0ebda95b0ac1567636d52;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=17-27/
934d460b1c085461c0936c958fbd583057c0c192
test-kitchen
analytics
test/testUtil.js
getFutureStartOrEndDate
function
/** * Returns a date as in the future as days given as parameter * * @param {number} daysInTheFuture days in the future for the desired date * @return {string} the date in the future according to the format "YYYY-MM-DD HH:MM:SS.000" */ function getFutureStartOrEndDate(daysInTheFuture) { const futureDate = new ...
15,370
b6a15488b4e2cd31b991ae90b8ab3166
swh:1:cnt:b1d3f27bb73e29ed0ceb69fbd3e457dae02d9f0a;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=13-26/
b727a62ca6fe9895f2d59c2603b85198dcdd2cca
test-kitchen
analytics
test/api/testDb/database.js
createTestDb
function
async function createTestDb() { const db = knex({ client: 'better-sqlite3', connection: { filename: ':memory:' }, useNullAsDefault: true }); await createTables(db); await insertTestData(db); return db; }
15,371
957b15e3f645380076966a7d1e801773
swh:1:cnt:b1d3f27bb73e29ed0ceb69fbd3e457dae02d9f0a;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=75-81/
b727a62ca6fe9895f2d59c2603b85198dcdd2cca
test-kitchen
analytics
test/api/testDb/database.js
insertTestData
function
async function insertTestData(db) { await db('instruments').insert(testDbInstruments); await db('contextual_attributes').insert(testDbContextualAttributes); await db('instrument_contextual_attribute_lookup').insert(testDbInstrumentsContextualAttributes); await db('instrument_contextual_attribute_lookup'...
15,372
0368ba97cf695c7c7925a8daeff5604a
swh:1:cnt:b1d3f27bb73e29ed0ceb69fbd3e457dae02d9f0a;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=28-73/
b727a62ca6fe9895f2d59c2603b85198dcdd2cca
test-kitchen
analytics
test/api/testDb/database.js
createTables
function
async function createTables(db) { await db.schema.createTable('instruments', function (table) { table.increments('id'); table.string('name'); table.string('slug'); table.string('description'); table.string('creator'); table.string('owner'); table.json('purpose...
15,373
784326e6eb42da5bf8b6633758ccf31c
swh:1:cnt:7497f768fcfb753ad7dd1b08c31e8a5d8fb2d469;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=21-28/
796f4c9bb68a109f339b3d0aa818ac74d6cea1e0
test-kitchen
analytics
test/integration/instruments.test.js
futureWindow
function
function futureWindow({ startDays = 2, endDays = 10 } = {}) { const start = getFutureStartOrEndDate(startDays); const end = getFutureStartOrEndDate(endDays); return { utc_start_dt: start, utc_end_dt: end }; }
15,374
fcea6a3793e98f7ee1fb5f7b712d6f1b
swh:1:cnt:e336d98956b516531ee01a53e9ab0b4786ab5605;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=37-62/
c36042f4785c866ee70def0e53b60be6a108d6d7
test-kitchen
analytics
test/unit/experimentConfigurationService.test.js
makeGbExp
function
function makeGbExp(overrides = {}) { return { trackingKey: 'test-exp', name: 'Test Experiment', description: 'A test experiment', owner: 'test-owner', hashAttribute: 'mw-user', status: 'running', phases: [ { dateStarted: '2024-01-01...
15,375
42758f9f24cfa11d614e8e3876431473
swh:1:cnt:e336d98956b516531ee01a53e9ab0b4786ab5605;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=64-80/
c36042f4785c866ee70def0e53b60be6a108d6d7
test-kitchen
analytics
test/unit/experimentConfigurationService.test.js
makeMockDb
function
function makeMockDb(rows = []) { const mockMerge = jest.fn().mockResolvedValue(); const mockOnConflict = jest.fn().mockReturnValue({ merge: mockMerge }); const mockInsert = jest.fn().mockReturnValue({ onConflict: mockOnConflict }); const mockWhere2 = jest.fn().mockResolvedValue(rows); const mockWher...
15,376
21c74fd543e95bef0df7af9d5901f225
swh:1:cnt:31f5cf46156b99a974b7a28ec3bc0c268b573e72;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-7/
36557ca5e5335914001813660692d24783af89cd
test-kitchen
analytics
test/unit/experimentStitcher.test.js
makeExp
function
// Minimal stand-ins — the stitcher only cares about slug and source. function makeExp(slug, source) { return { slug, source }; }
15,377
cdb95077658636a48b5fee3bc5e72e21
swh:1:cnt:a90291ea3a9617b7291ef3782dd498aa10a3946d;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=90-95/
bee6895320a5fb6f47d6b82bc36bb648d293da85
test-kitchen
analytics
test/unit/experimentUtil.test.js
makeRow
function
function makeRow(sampleRate, variants) { return { sample_rate: JSON.stringify(sampleRate), variants: JSON.stringify(variants) }; }
15,378
7d66a2d89fd655d1b691925f423d031d
swh:1:cnt:4e1fbcd69d6cd989f737ca74f09e0c28ed5dbae8;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=4-17/
5c9ec18af8ada043ce3f9095385d5ccf673d87cb
test-kitchen
analytics
util/actionApi.js
findStreams
function
// Get stream configuration from Action API to return an array // with all the stream names and schema titles async function findStreams() { const API_REQUEST = config.listeners.action_api_basepath + '/w/api.php?action=streamconfigs&format=json&formatversion=2&all_settings=1' + '&constraints=destina...
15,379
c71e8b524d3ebbeb4cdc573f9822674a
swh:1:cnt:4e1fbcd69d6cd989f737ca74f09e0c28ed5dbae8;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=34-43/
5c9ec18af8ada043ce3f9095385d5ccf673d87cb
test-kitchen
analytics
util/actionApi.js
parseDomains
function
function parseDomains(data) { return Object.entries(data.sitematrix).reduce((domains, [key, value]) => { // eslint-disable es-x/no-optional-chaining, es-x/no-nullish-coalescing-operators (key === 'specials' ? value : value?.site ?? []).forEach((item) => { domains[item.dbname] = item.url....
15,380
91f39ddeb641277c84678a5c5555c0b9
swh:1:cnt:4e1fbcd69d6cd989f737ca74f09e0c28ed5dbae8;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=19-32/
5c9ec18af8ada043ce3f9095385d5ccf673d87cb
test-kitchen
analytics
util/actionApi.js
parseStreams
function
function parseStreams(data) { const rawStreams = data.streams; const streams = []; for (const streamName in rawStreams) { const newStream = { name: streamName, schema_title: rawStreams[streamName].schema_title }; streams.push(newStream); } return str...
15,381
ed722a37619de12059169ed0ff06483c
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=8-25/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getProgress
function
function getProgress(startDate, endDate) { const start = new Date(startDate).getTime(); const end = new Date(endDate).getTime(); const now = new Date(Date.now()).getTime(); if (now < start) { return 0; } if (now > end) { return 1; } const total = end - start; const ...
15,382
97a2a99ef4681ca75c9f19cc8c47ba3b
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=34-46/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
formatSimpleDate
function
/** * Formats the given date according to the format 'YYYY-MM-DD' * * @param {Date} date The given date * @return {string} The formatted date */ function formatSimpleDate(date) { date = new Date(date); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); cons...
15,383
3d3199f765cc61073235c67900c255f0
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=61-76/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getCurrentUTCDateTime
function
/** * Gets the current date-time according to the format YYYY-MM-DD HH:mm:ss UTC * and the deployment time * * @return {string} The formatted datetime */ function getCurrentUTCDateTime() { const date = new Date(); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0...
15,384
1d437580f90ee68027e4049cc44c1df5
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=48-59/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getSimpleDate
function
/** * Formats the given date according to the format 'YYYY-MM-DD' * * @param {String} date The given date * @return {string} The formatted date */ function getSimpleDate(date) { const year = date.slice(0, 4); const month = date.slice(5, 7); const day = date.slice(8, 10); return `${ year }-${ month ...
15,385
a814f025bc04d138780d6be4c19edd42
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=27-32/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
convertTimestampToMySQLDatetime
function
function convertTimestampToMySQLDatetime(timestamp) { const date = new Date(timestamp); const isoString = date.toISOString(); const mysqlDatetime = isoString.slice(0, 19).replace('T', ' '); return mysqlDatetime; }
15,386
43ed5133f00a36dd8c1ef279a5fbf149
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=78-87/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getDeploymentDateTime
function
/** * Formats the given date and time according to the format YYYY-MM-DD HH:mm:ss * with the deployment time * * @param {String} date The given date * @return {string} The formatted datetime */ function getDeploymentDateTime(date) { return getSimpleDate(date) + ' ' + DEPLOYMENT_TIMESTAMP; }
15,387
47db5a8a61cd999085626b99714f89c1
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=89-100/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getUTCDate
function
/** * Gets a UTC representation of the give timestamp set to the deployment time * * @param timestamp the given timestamp * @return {UTCDate} */ function getUTCDate(timestamp) { const utcDate = new UTCDate(timestamp); utcDate.setUTCHours(DEPLOYMENT_HOUR, DEPLOYMENT_MINUTES, 0, 0); return utcDate; }
15,388
f1707156bd2b8eefb4dda0f26e3d5f3b
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=102-106/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
formatDateISO8601MinusMilliseconds
function
function formatDateISO8601MinusMilliseconds(date) { // to ensure that dates are `Date`. This way `date` can be also a string date = new Date(date); return date.toISOString().replace(/\.\d{3}Z$/, 'Z'); }
15,389
c72c63594373520e8f7d01b99daae320
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=108-119/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getHoursBetweenToday
function
/** * Gets how many hours are between today and the given date * * @param date * @return {number} */ function getHoursBetweenToday(date) { const today = new UTCDate(); const startDate = getUTCDate(date); return (startDate - today) / 3600000; }
15,390
8e0e9f2de8f57e8b66d3b9cd1efb6b67
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=121-141/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getNextDeploymentWindowDate
function
/** * Gets the start date and time of the next experiment deployment window. * * @return {Date} */ function getNextDeploymentWindowDate() { const result = new Date(); const h = result.getUTCHours(); const m = result.getUTCMinutes(); if ( h > DEPLOYMENT_HOUR || (h === DEPLOYMENT_HOUR...
15,391
5cc52909a2a893f537a78ab4dcf033ba
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=145-165/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
updateDBRowDateRange
function
/** * Updates the start and end of the DB row. * * Calculates the length of the instrument/experiment from the original start and end dates, and * then sets the start date to the new start and the end date accordingly. * * @param {Object} row * @param {Date} newStartDate */ function updateDBRowDateRange(row, ne...
15,392
dc3e6947bee13f397639835b1e44fa80
swh:1:cnt:676586e07ca44d41346dc5c727ea6e46b1f30154;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=167-189/
1697552509c9a1a09648c6b06222ce3f5708e875
test-kitchen
analytics
util/dateUtil.js
getDefaultEndDate
function
/** * Calculates the default end date for instruments. * * If the curent month is before July, the default end date is July 1st, of the following year. * If the current month is after July, the default end date is July 1st, in two years time. * * @return {string} The formatted datetime */ function getDefaultEndD...
15,393
6154179d263e23207e3968eb974ccd44
swh:1:cnt:b527eff5845d56060d4c72c6658a074d1cdec72a;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=17-21/
05a43158a5e644af94cd0adfa07fec2934bab626
test-kitchen
analytics
util/experimentsRegistered.js
parseRegisteredExperiments
function
// Get an array of names of registered experiments. function parseRegisteredExperiments(data) { const parsed = yaml.load(data); return parsed.map((entry) => entry.enrolled); }
15,394
2c601b6d1469e08e9884768833851ae7
swh:1:cnt:e77827037cba67238e3016f086e78818656e02c1;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=6-38/
dfddebbca35d1232d0ad501f4d8cc506a70cbf0f
test-kitchen
analytics
util/experimentUtil.js
validateParameters
function
function validateParameters(params) { const format = params.format; const authority = params.authority; if (typeof format !== 'undefined' && format !== 'config' && format !== 'analytics') { throw new ApiError(400, 'format must either be config or analytics'); } if (format === 'config' && ...
15,395
de53248ef2c2543f48e61ce59bdc8cf9
swh:1:cnt:e77827037cba67238e3016f086e78818656e02c1;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=55-65/
dfddebbca35d1232d0ad501f4d8cc506a70cbf0f
test-kitchen
analytics
util/experimentUtil.js
formatMediaWiki
function
function formatMediaWiki(experiments) { return experiments.map(({ slug, utc_start_dt, utc_end_dt, sample_rate, variants }) => { return { name: slug, start: formatDateISO8601MinusMilliseconds(utc_start_dt), end: formatDateISO8601MinusMilliseconds(utc_end_dt), s...
15,396
f85081596228107cd131c07ecb99d93d
swh:1:cnt:e77827037cba67238e3016f086e78818656e02c1;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=67-81/
dfddebbca35d1232d0ad501f4d8cc506a70cbf0f
test-kitchen
analytics
util/experimentUtil.js
formatAnalytics
function
function formatAnalytics(experiments) { return experiments.map(( { name, slug, utc_start_dt, utc_end_dt, description, sample_unit, variants }) => { return { name: name, machine_readable_name: slug, // Only add if optional description is not empty or null ...
15,397
4a68635fac712e5e55fa8e02f37ba510
swh:1:cnt:e77827037cba67238e3016f086e78818656e02c1;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=40-53/
dfddebbca35d1232d0ad501f4d8cc506a70cbf0f
test-kitchen
analytics
util/experimentUtil.js
formatVarnish
function
function formatVarnish(experiments, domains) { return experiments.map(({ slug, utc_start_dt, utc_end_dt, sample_unit, sample_rate, variants }) => { return { name: slug, start: formatDateISO8601MinusMilliseconds(utc_start_dt), end: formatDateISO8601MinusMilliseconds(utc_en...
15,398
fa0b67c322af8d0006a3b85cb19f2787
swh:1:cnt:e77827037cba67238e3016f086e78818656e02c1;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=83-97/
dfddebbca35d1232d0ad501f4d8cc506a70cbf0f
test-kitchen
analytics
util/experimentUtil.js
formatBase
function
function formatBase(experiments) { return experiments.map(({ slug, utc_start_dt, utc_end_dt, sample_rate, sample_unit, variants, stream_name, contextual_attributes }) => { return { name: slug, start: formatDateISO8601MinusMilliseconds(utc_start_dt), end: formatDat...
15,399
f918f4c3230989a0978cff4f0c4945f4
swh:1:cnt:e77827037cba67238e3016f086e78818656e02c1;origin=https://gitlab.wikimedia.org/repos/data-engineering/test-kitchen.git;lines=99-113/
dfddebbca35d1232d0ad501f4d8cc506a70cbf0f
test-kitchen
analytics
util/experimentUtil.js
transformSampleRateForVarnishResponse
function
function transformSampleRateForVarnishResponse(sampleRate, variants, wikiDomains) { const dbSampleRate = JSON.parse(sampleRate); const groups = JSON.parse(variants); const groupNames = groups.map((item) => item.slug); return Object.entries(dbSampleRate) .reduce((acc, [sampleSize, wikis]) => { ...