Purpose :
- Design for Create Experiment API's to populate,list,delete the experiment definition
- Design the experiment definition schema
- Design Data product design product to map the experiment to users/devices based on criteriato experiments
Design Flow :
Experiment
...
API :
CREATE API :
...
URL : POST /experiment/create
Input :
Sample User Criteria Input Request:
Code Block | ||||
---|---|---|---|---|
| ||||
"request": { "expId": "U1234", // Unique Id for Experiment "name": "USER_ORG", // Name for Experiment "createdBy": "User1", // Name of the user who created this experiment "description": "Experiment to get users withto orgnameexplore =page sunbird", // Short Description about the experiment "criteria": { // Criteria for the Experiment "type": "user", // Type of the Criteria "filters": { // ArrayPLEASE ofrefer Filtersthis Criterialink withfor Useruser Filtersearch field Name and List of Valuesfilters- http://docs.sunbird.org/latest/apis/userapi/#operation/Search%20User "organisations.orgName": ["sunbird"] // List of Values } }, "data" : { // Experiment Data "startDate" : "2019-08-01", // Start date of the Experiment "endDate" : "2019-08-02", // End date of the Experiment "key" : "/org/profile" , // Experiment Key } } |
Device Criteria Input Request:
Code Block | ||||
---|---|---|---|---|
| ||||
"request": {"client" : "portal" "expId": "D1234", // name of the client (app/portal/desktop) } // Unique Id for Experiment } |
Device Criteria Input Request:
Code Block | ||||
---|---|---|---|---|
| ||||
"request": { "nameexpId": "Device_STATE_APD1234", // Name for Experiment // Unique Id for Experiment "name": "Device_STATE_AP", // Name for Experiment "createdBy": "User2", // Name of the user who created this experiment "description": "Experiment to get devices with state = AndhraPradesh", // Short Description about the experiment "criteria": { // Criteria for the Experiment "type": "device", // Type of the Criteria "filters": [ { // Array of Filters "name": "state", // Namestate offield the fieldcritera "operator": "IN", // Filter Operator - Supported Filters : [IN,EQ] "value": ["Karnataka"] // List of Values }, { }, "data" : { // Experiment Data "startDatename" : "2019-08-01city", // Start date of the Experiment // city field "endDate" critera "operator": "2019-08-02IN", // End date of the Experiment Filter Operator - Supported Filters : [IN,EQ] "keyvalue" : ["3fksjfksdlfjBangalore", ] // ExperimentList Keyof Values "client" : "app" }, { // T } } |
Output :
- Process the request and save the request parameters to Experiment-Definition Cassandra Table with status "SUBMITTED"
- Response : "Experiment Submitted Sucessfully"
Experiment Definition Schema:
...
Experiment Data
- startDate - start date of the experiment
- endDate - end date of the experiment
- key/url - key or url of the experiment
- modulus - mod number of the experiment
...
criteria of the experiment
- type - Type of Criteria (user/device)
- filters - Array of Filters
...
Statistic Data
- usersMatched
- devicesMatched
Experiment Data Product :
Purpose
- To compute the user experiment mapping based on the experiment criteria and save it to elastic search
Inputs
- Experiment_Definition Cassandra Table
- Experiment Criteria Config
User Criteria Config
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "experiments": [ { "exp_id": {"name": "first_access", // device field criteria "operator": "RANGE", // Filter Operator - Supported Filters : [RANGE,LT] "value": { "start": "2019-02-10", "end": "2019-02-20" } ] }, "data" : { // Experiment Data "startDate" : "2019-08-01", // Start date of the Experiment "endDate" : "2019-08-02", // End "criteria": { date of the Experiment "typekey" : "user3fksjfksdlfj", "channel": "app/portal/desktop", Experiment Key "client" : "requestapp": { "filters": { // name of the client (app/portal/desktop) } "organisations.orgName": [ "sunbird" ], "framework.board": [ "CBSE" ] } } } } }, } |
Device Filter Criteria :
Output :
- Process the request and save the request parameters to Experiment-Definition Cassandra Table with status "SUBMITTED"
- Response : "Experiment Submitted Sucessfully "
Note :
- All fields are mandatory
- Same Experiment will not be allowed to submit again unless the status of the experiment is FAILED
- If the experiment is submitted more than once , will send a response "Experiment already submitted"
GET API
URL : GET /experiment/:id
Request Params : ExperimentId
Repsonse : Experiment Details for the respective experiment Id
Sample Response :
Code Block | ||||
---|---|---|---|---|
| ||||
{ "expId": "U1234", "expName": "USER_ORG", "expDescription": "Experiment to get users with orgname = sunbird", "expData": { "startDate": "2019-08-01", "endDate": "2019-08-04", "key": "/org/profile" }, "createdBy": "User1", "updatedBy": "ExperimentDataProduct", "udpatedOn": "2019-08-02 19:00:00", "createdOn": "2019-08-01 10:00:00", "criteria": { "type": "user", "filter": { "exp_idorganisations.orgName": {[ "criteriasunbird": { ] "type": "user", } }, "channelstatus": "app/portal/desktopactive", "status_msg": "Experiment is actively mapped", "requeststats": { "filters": { "usersMatched": 234, "emailVerifieddevicesMatched": true 0 } } } } |
GET LIST API :
URL : GET /experiment/list
Output : List of all Experiments
Sample Response :
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "experiments": [ { } }"expId": "D1234", ] } |
Note : Currently all the filters are included as "AND" condition
Device Criteria Config
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "exp_idexpName": { "criteria": {"DEVICE_STATE_ANDHRAPRADESH", "typeexpDescription": "device",Experiment to get deviceids with first_access Sep1st "channel": "app/portal/desktopto Sep3rd", "requestexpData": { "filtersstartDate": ["2019-08-01", { "endDate": "2019-08-04", "namekey": "state/org/profile", }, "operatorcreatedBy": "INUser6", "value": ["updatedBy": "ExperimentDataProduct", "udpatedOn": "2019-08-02 19:00:00", "KarnatakacreatedOn": "2019-07-04 10:00:00", "criteria": { ] }"type": "device", "filter": { "name": "first_access", "operator": "GTRANGE", "value": { "value": "2019-07-17" } ] } } } } |
...
"start": "2019-02-10",
"end": "2019-02-20"
}
}
},
"status": "FAILED",
"status_msg": "Devices Not Found matching the Criteria",
"stats": {
"usersMatched": 0,
"devicesMatched": 0
}
},
{
"expId": "U1234",
"expName": "USER_ORG",
"expDescription": "Experiment to get users with orgname = sunbird",
"expData": {
"startDate": "2019-08-01",
"endDate": "2019-08-04",
"key": "/org/profile"
"client": "app"
},
"createdBy": "User1",
"updatedBy": "ExperimentDataProduct",
"udpatedOn": "2019-08-02 19:00:00",
"createdOn": "2019-08-01 10:00:00",
"criteria": {
"type": "user",
"filter": {
"organisations.orgName": [
"sunbird"
]
}
},
"status": "active",
"status_msg": "Experiment is actively mapped",
"stats": {
"usersMatched": 234,
"devicesMatched": 0
}
}
]
} |
Experiment Definition Schema:
Field | type | Description | |
---|---|---|---|
1 | expId | String | unique id for experiment |
2 | expName | String | name of the experiment |
3 | expDescription | String | descirption of the experiment |
expData | Map<String,String> | Experiment Data
| |
5 | createdBy | String | name of the user who created the experiment |
6 | updatedBy | String | name of product that last updated the experiment |
7 | udpatedOn | Timestamp | last udpated date by the source |
8 | createdOn | Timestamp | created date for the experiment |
9 | criteria | Map<String,String> | criteria of the experiment
|
10 | status | String | status of the experiment(SUBMITTED/PROCESSING/ACTIVE/FAILED/STOPPED/INACTIVE) |
11 | status_message | String | status description of the experiment |
12 | stats | Map<String,Long> | Statistic Data
|
Experiment Data Product :
Purpose
- To compute the user/device experiment mapping based on the experiment criteria and save it to elastic search
Input:
- Experiment_Definition Cassandra Table
Output
User experiment mapping index to elastic search
...