Skip to content

Commit 1120db0

Browse files
joaquinvanschorenjanvanrijn
authored andcommitted
Develop (#999)
* fixed link * ES bugfix * setup api docs * apidocs fix * Return the reason why the XML was not valid according to the XSD * force download of RDF files * add uploader to evaluation_list * add user_id to name * add to initial check * list of user names * add username tpl to views and remove from_id function * remove extra brace * add uploader to evaluations * change uploader to user * change uploader to user * doc update * doc update * Delete swagger.json * Delete swagger.yaml * review comments * add space * extended error messages * better error handling * increase stat circles on cover page * indentation changes * two spaces * fix code style
1 parent d459eb3 commit 1120db0

10 files changed

Lines changed: 184 additions & 24 deletions

File tree

css/expdb.css

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,11 +2762,10 @@ a.bold:hover{
27622762
font-weight: 100;
27632763

27642764

2765-
width: 76px;
2766-
height: 76px;
2765+
width: 100px;
2766+
height: 100px;
27672767
padding: 0px;
27682768

2769-
background: #fff;
27702769
color: #fff;
27712770
display:block;
27722771
position: relative;
@@ -2793,10 +2792,9 @@ a.bold:hover{
27932792
}
27942793

27952794
.arc {
2796-
height: 84px;
2797-
width: 84px;
2798-
left: -3px;
2799-
top: -5px;
2795+
height: 100px;
2796+
width: 100px;
2797+
top: -15px;
28002798
position: absolute;
28012799
box-shadow: 0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28);
28022800

downloads/swagger.json

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,6 +1979,7 @@
19791979
"evaluation" : [ {
19801980
"run_id" : "1",
19811981
"task_id" : "68",
1982+
"uploader" : "1",
19821983
"flow_id" : "61",
19831984
"function" : "area_under_roc_curve",
19841985
"upload_time" : "2014-04-06 23:30:40",
@@ -1987,6 +1988,7 @@
19871988
}, {
19881989
"run_id" : "1",
19891990
"task_id" : "68",
1991+
"uploader" : "1",
19901992
"flow_id" : "61",
19911993
"function" : "f_measure",
19921994
"upload_time" : "2014-04-06 23:30:40",
@@ -1995,6 +1997,7 @@
19951997
}, {
19961998
"run_id" : "1",
19971999
"task_id" : "68",
2000+
"uploader" : "1",
19982001
"flow_id" : "61",
19992002
"function" : "predictive_accuracy",
20002003
"upload_time" : "2014-04-06 23:30:40",
@@ -2237,16 +2240,16 @@
22372240
"parameters" : [ {
22382241
"name" : "id",
22392242
"in" : "path",
2240-
"description" : "Id of the study.",
2243+
"description" : "Id of the study. Supplied in the URL path.",
22412244
"required" : true,
22422245
"type" : "number",
22432246
"format" : "integer"
22442247
}, {
2245-
"name" : "description",
2248+
"name" : "ids",
22462249
"in" : "formData",
2247-
"description" : "An XML file describing the entities to be attached. Also see the [XSD schema](https://www.openml.org/api/v1/xsd/openml.study.attach) and an [XML example](https://www.openml.org/api/v1/xml_example/attach).",
2250+
"description" : "Comma-separated list of entity IDs to be attached to the study. For instance, if this is a run study, the list of run IDs that need to be added (attached) to the study. Must be supplied as a POST variable.",
22482251
"required" : true,
2249-
"type" : "file"
2252+
"type" : "string"
22502253
}, {
22512254
"name" : "api_key",
22522255
"in" : "query",
@@ -2292,11 +2295,11 @@
22922295
"type" : "number",
22932296
"format" : "integer"
22942297
}, {
2295-
"name" : "description",
2298+
"name" : "ids",
22962299
"in" : "formData",
2297-
"description" : "An XML file describing the entities to be detached. Also see the [XSD schema](https://www.openml.org/api/v1/xsd/openml.study.detach) and an [XML example](https://www.openml.org/api/v1/xml_example/detach).",
2300+
"description" : "Comma-separated list of entity IDs to be detached from the study. For instance, if this is a run study, the list of run IDs that need to be removed (detached) from the study. Must be supplied as a POST variable.",
22982301
"required" : true,
2299-
"type" : "file"
2302+
"type" : "string"
23002303
}, {
23012304
"name" : "api_key",
23022305
"in" : "query",
@@ -2359,6 +2362,31 @@
23592362
}
23602363
}
23612364
},
2365+
"/user/list" : {
2366+
"get" : {
2367+
"tags" : [ "user" ],
2368+
"summary" : "List all users by user id",
2369+
"description" : "Returns an array with all user ids and names.\n",
2370+
"parameters" : [ {
2371+
"name" : "api_key",
2372+
"in" : "query",
2373+
"description" : "API key to authenticate the user",
2374+
"required" : false,
2375+
"type" : "string"
2376+
} ],
2377+
"responses" : {
2378+
"200" : {
2379+
"description" : "A list of users",
2380+
"examples" : {
2381+
"application/json" : "{\n \"users\":{\n \"user\":[\n {\n \"id\":\"1\",\n \"username\":\"janvanrijn@gmail.com\"},\n {\n \"id\":\"2\",\n \"username\":\"joaquin.vanschoren@gmail.com\"}\n ]\n }\n}"
2382+
},
2383+
"schema" : {
2384+
"$ref" : "#/definitions/UserList"
2385+
}
2386+
}
2387+
}
2388+
}
2389+
},
23622390
"/evaluationmeasure/list" : {
23632391
"get" : {
23642392
"tags" : [ "evaluationmeasure" ],
@@ -2402,6 +2430,14 @@
24022430
}
24032431
}
24042432
},
2433+
"UserList" : {
2434+
"type" : "object",
2435+
"properties" : {
2436+
"users" : {
2437+
"$ref" : "#/definitions/UserList_users"
2438+
}
2439+
}
2440+
},
24052441
"Task" : {
24062442
"type" : "object",
24072443
"properties" : {
@@ -3146,6 +3182,28 @@
31463182
}
31473183
}
31483184
},
3185+
"UserList_users_user" : {
3186+
"properties" : {
3187+
"id" : {
3188+
"type" : "string",
3189+
"description" : "The user ID"
3190+
},
3191+
"username" : {
3192+
"type" : "string",
3193+
"description" : "The full user name"
3194+
}
3195+
}
3196+
},
3197+
"UserList_users" : {
3198+
"properties" : {
3199+
"user" : {
3200+
"type" : "array",
3201+
"items" : {
3202+
"$ref" : "#/definitions/UserList_users_user"
3203+
}
3204+
}
3205+
}
3206+
},
31493207
"Task_task_description_data_set" : {
31503208
"properties" : {
31513209
"data_set_id" : {

downloads/swagger.yaml

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,20 +2635,23 @@ paths:
26352635
evaluation:
26362636
- run_id: "1"
26372637
task_id: "68"
2638+
uploader: "1"
26382639
flow_id: "61"
26392640
function: area_under_roc_curve
26402641
upload_time: 2014-04-06 23:30:40
26412642
value: "0.839359"
26422643
array_data: '[0,0.99113,0.898048,0.874862,0.791282,0.807343,0.820674]'
26432644
- run_id: "1"
26442645
task_id: "68"
2646+
uploader: "1"
26452647
flow_id: "61"
26462648
function: f_measure
26472649
upload_time: 2014-04-06 23:30:40
26482650
value: "0.600026"
26492651
array_data: '[0,0,0.711934,0.735714,0.601363,0.435678,0.430913]'
26502652
- run_id: "1"
26512653
task_id: "68"
2654+
uploader: "1"
26522655
flow_id: "61"
26532656
function: predictive_accuracy
26542657
upload_time: 2014-04-06 23:30:40
@@ -2914,15 +2917,15 @@ paths:
29142917
parameters:
29152918
- name: id
29162919
in: path
2917-
description: Id of the study.
2920+
description: Id of the study. Supplied in the URL path.
29182921
required: true
29192922
type: number
29202923
format: integer
2921-
- name: description
2924+
- name: ids
29222925
in: formData
2923-
description: An XML file describing the entities to be attached. Also see the [XSD schema](https://www.openml.org/api/v1/xsd/openml.study.attach) and an [XML example](https://www.openml.org/api/v1/xml_example/attach).
2926+
description: Comma-separated list of entity IDs to be attached to the study. For instance, if this is a run study, the list of run IDs that need to be added (attached) to the study. Must be supplied as a POST variable.
29242927
required: true
2925-
type: file
2928+
type: string
29262929
- name: api_key
29272930
in: query
29282931
description: Api key to authenticate the user
@@ -2971,11 +2974,11 @@ paths:
29712974
required: true
29722975
type: number
29732976
format: integer
2974-
- name: description
2977+
- name: ids
29752978
in: formData
2976-
description: An XML file describing the entities to be detached. Also see the [XSD schema](https://www.openml.org/api/v1/xsd/openml.study.detach) and an [XML example](https://www.openml.org/api/v1/xml_example/detach).
2979+
description: Comma-separated list of entity IDs to be detached from the study. For instance, if this is a run study, the list of run IDs that need to be removed (detached) from the study. Must be supplied as a POST variable.
29772980
required: true
2978-
type: file
2981+
type: string
29792982
- name: api_key
29802983
in: query
29812984
description: Api key to authenticate the user
@@ -3052,6 +3055,38 @@ paths:
30523055
500 - No model performance estimation procedures available.
30533056
schema:
30543057
$ref: '#/definitions/Error'
3058+
/user/list:
3059+
get:
3060+
tags:
3061+
- user
3062+
summary: List all users by user id
3063+
description: |
3064+
Returns an array with all user ids and names.
3065+
parameters:
3066+
- name: api_key
3067+
in: query
3068+
description: API key to authenticate the user
3069+
required: false
3070+
type: string
3071+
responses:
3072+
200:
3073+
description: A list of users
3074+
examples:
3075+
application/json: |-
3076+
{
3077+
"users":{
3078+
"user":[
3079+
{
3080+
"id":"1",
3081+
"username":"janvanrijn@gmail.com"},
3082+
{
3083+
"id":"2",
3084+
"username":"joaquin.vanschoren@gmail.com"}
3085+
]
3086+
}
3087+
}
3088+
schema:
3089+
$ref: '#/definitions/UserList'
30553090
/evaluationmeasure/list:
30563091
get:
30573092
tags:
@@ -3095,6 +3130,11 @@ definitions:
30953130
properties:
30963131
flows:
30973132
$ref: '#/definitions/FlowList_flows'
3133+
UserList:
3134+
type: object
3135+
properties:
3136+
users:
3137+
$ref: '#/definitions/UserList_users'
30983138
Task:
30993139
type: object
31003140
properties:
@@ -3563,6 +3603,20 @@ definitions:
35633603
type: array
35643604
items:
35653605
$ref: '#/definitions/FlowList_flows_flow'
3606+
UserList_users_user:
3607+
properties:
3608+
id:
3609+
type: string
3610+
description: The user ID
3611+
username:
3612+
type: string
3613+
description: The full user name
3614+
UserList_users:
3615+
properties:
3616+
user:
3617+
type: array
3618+
items:
3619+
$ref: '#/definitions/UserList_users_user'
35663620
Task_task_description_data_set:
35673621
properties:
35683622
data_set_id:

openml_OS/helpers/api_helper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ function validateXml( $xmlDocument, $xsdDocument, &$xmlErrors, $from_file = true
1010
else
1111
$xml->loadXML( $xmlDocument );
1212

13-
$cxmlErrors = '';
1413
foreach (libxml_get_errors() as $error) {
1514
$xmlErrors .= $error->message . '. ';
1615
}
@@ -19,6 +18,9 @@ function validateXml( $xmlDocument, $xsdDocument, &$xmlErrors, $from_file = true
1918
return true;
2019
} else {
2120
$xmlErrors .= 'XML does not correspond to XSD schema. ';
21+
foreach (libxml_get_errors() as $error) {
22+
$xmlErrors .= 'Error ' . $error->message . ' on line ' . $error->line . ' column ' . $error->column . '. ';
23+
}
2224
return false;
2325
}
2426
}

openml_OS/models/api/v1/Api_evaluation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ private function evaluation_list($segs, $user_id) {
207207
// TODO: remove dependency on task_inputs and dataset table
208208
// TODO (2): transform into subquery where all columns except evaluation_fold are obtained in subquery (along with limit requirements, as MYSQL query optimizer does not seem to understand this query has an upper limit to the number of obtained runs that need to be inspected)
209209
$sql =
210-
'SELECT r.rid, r.task_id, r.start_time, s.implementation_id, s.sid, f.name AS `function`, i.fullName, d.did, d.name, e.evaluation_engine_id, ' . $columns . ' ' .
210+
'SELECT r.rid, r.task_id, r.start_time, r.uploader, s.implementation_id, s.sid, f.name AS `function`, i.fullName, d.did, d.name, e.evaluation_engine_id, ' . $columns . ' ' .
211211
'FROM run r, ' . $eval_table . ' e, algorithm_setup s, implementation i, dataset d, task t, task_inputs ti, math_function f ' .
212212
'WHERE r.setup = s.sid ' .
213213
'AND e.source = r.rid ' .

openml_OS/models/api/v1/Api_study.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ private function study_create() {
143143
);
144144

145145
$study_id = $this->Study->insert($schedule_data);
146+
if (!$study_id) {
147+
$this->db->trans_rollback();
148+
$this->returnError(1039, $this->version, $this->openmlGeneralErrorCode, 'Problem creating study record. Please check whether the alias is unique. ');
149+
return;
150+
}
146151

147152
$res = $this->_link_entities($study_id, $this->user_id, $link_entities);
148153

@@ -519,7 +524,10 @@ private function _link_entities($study_id, $uploader_id, $link_entities) {
519524
'uploader' => $uploader_id,
520525
'date' => now(),
521526
);
522-
$this->{$model}->insert($data);
527+
$result = $this->{$model}->insert($data);
528+
if (!$result) {
529+
return false;
530+
}
523531
}
524532
return true;
525533
}

openml_OS/models/api/v1/Api_user.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ function __construct() {
1515

1616
function bootstrap($format, $segments, $request_type, $user_id) {
1717
$this->outputFormat = $format;
18+
19+
# http://test.openml.org/api/v1/user/list/uploader/1,2
20+
if (count($segments) >= 1 && $segments[0] == 'list') {
21+
array_shift($segments);
22+
$this->username_list($segments);
23+
return;
24+
}
1825

1926
/*$getpost = array('get','post');
2027
@@ -74,5 +81,25 @@ function bootstrap($format, $segments, $request_type, $user_id) {
7481
$this->_xmlContents( 'user-delete', array( 'user' => $user ) );
7582
} */
7683

84+
85+
private function username_list($segs) {
86+
# pass uploader list to get username list
87+
$legal_filters = array('user_id');
88+
$query_string = array();
89+
for ($i = 0; $i < count($segs); $i += 2) {
90+
$query_string[$segs[$i]] = urldecode($segs[$i+1]);
91+
if (in_array($segs[$i], $legal_filters) == false) {
92+
$this->returnError(370, $this->version, $this->openmlGeneralErrorCode, 'Legal filter operators: ' . implode(',', $legal_filters) .'. Found illegal filter: ' . $segs[$i]);
93+
return;
94+
}
95+
}
96+
$user_id = element('user_id', $query_string);
97+
$users = $this->Author->getWhere('`id` IN (' . $user_id . ')');
98+
$this->xmlContents('user-name', $this->version, array('users' => $users));
99+
}
100+
77101
}
102+
103+
104+
78105
?>

openml_OS/views/pages/api_new/v1/xml/evaluations.tpl.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<?php foreach( $evaluations as $e ): ?>
33
<oml:evaluation>
44
<oml:run_id><?php echo $e->rid; ?></oml:run_id>
5+
<oml:uploader><?php echo $e->uploader; ?></oml:uploader>
56
<oml:task_id><?php echo $e->task_id; ?></oml:task_id>
67
<oml:setup_id><?php echo $e->sid; ?></oml:setup_id>
78
<oml:flow_id><?php echo $e->implementation_id; ?></oml:flow_id>

0 commit comments

Comments
 (0)