From 9c43e88aa42a2ef1bf362a387f3aeae690b5ed99 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 30 Oct 2020 00:46:38 +0100 Subject: [PATCH 1/8] add local changes --- openml_OS/views/pages/frontend/home/body.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/openml_OS/views/pages/frontend/home/body.php b/openml_OS/views/pages/frontend/home/body.php index b87e73883..46da94304 100644 --- a/openml_OS/views/pages/frontend/home/body.php +++ b/openml_OS/views/pages/frontend/home/body.php @@ -31,14 +31,16 @@ +
icon From b0b1766be7a99d582b4366ad7f0621ac59842568 Mon Sep 17 00:00:00 2001 From: joaquinvanschoren Date: Wed, 6 Apr 2022 18:05:26 +0200 Subject: [PATCH 2/8] skis minio url for sparse arff --- openml_OS/models/api/v1/Api_data.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openml_OS/models/api/v1/Api_data.php b/openml_OS/models/api/v1/Api_data.php index 7e061738c..b82f5dcfa 100644 --- a/openml_OS/models/api/v1/Api_data.php +++ b/openml_OS/models/api/v1/Api_data.php @@ -757,9 +757,10 @@ private function data($data_id) { if ($data_status != false) { $dataset->status = $data_status->status; } - - $dataset->minio_url = 'http://openml1.win.tue.nl/dataset' . $data_id . '/dataset_' . $data_id . '.pq'; - $this->xmlContents( 'data-get', $this->version, $dataset ); + if ($dataset->format != 'Sparse_ARFF') { + $dataset->minio_url = 'http://openml1.win.tue.nl/dataset' . $data_id . '/dataset_' . $data_id . '.pq'; + } + $this->xmlContents( 'data-get', $this->version, $dataset ); } private function data_reset($data_id) { From c174961a1027d1c353cf00e183df589efe642c11 Mon Sep 17 00:00:00 2001 From: Joaquin Vanschoren Date: Thu, 18 Aug 2022 12:36:54 +0200 Subject: [PATCH 3/8] Update .htaccess --- .htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index ce0db299b..29be885d8 100644 --- a/.htaccess +++ b/.htaccess @@ -13,7 +13,7 @@ RewriteRule ^(.*)$ index.php/$1 [L] - SetEnvIfNoCase Origin "https?://(www\.)?(openml\.org|staging\.openml\.org)(:\d+)?$" ACAO=$0 + SetEnvIfNoCase Origin "https?://(www\.|api\.)?(openml\.org|staging\.openml\.org)(:\d+)?$" ACAO=$0 Header set Access-Control-Allow-Origin %{ACAO}e env=ACAO Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept" From cd64fde590db8474a989ffe72e3742412d2dff2b Mon Sep 17 00:00:00 2001 From: joaquinvanschoren Date: Thu, 18 Aug 2022 16:51:43 +0200 Subject: [PATCH 4/8] cleanup --- openml_OS/models/api/v1/Api_data.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openml_OS/models/api/v1/Api_data.php b/openml_OS/models/api/v1/Api_data.php index b82f5dcfa..4531e1771 100644 --- a/openml_OS/models/api/v1/Api_data.php +++ b/openml_OS/models/api/v1/Api_data.php @@ -502,22 +502,28 @@ private function data_fork() { $latest_version = $this->Dataset-> getWhereSingle('`name` = "' . $dataset->name . '"', 'CAST(`version` AS DECIMAL) DESC'); $dataset->version = $latest_version->version + 1; unset($dataset->did); - $data_id = $this->Dataset->insert($dataset); - if (!$data_id) { + $new_data_id = $this->Dataset->insert($dataset); + if (!$new_data_id) { $this->returnError(1072, $this->version); return; } + + // create a copy of the latest description + $description_record = $this->Dataset_description->getWhereSingle('did =' . $data_id, 'version DESC'); + $description_record->did = $new_data_id; + $description_record->version = "1"; + $this->Dataset_description->insert($description_record); // update elastic search index. try { - $this->elasticsearch->index('data', $data_id); + $this->elasticsearch->index('data', $new_data_id); } catch (Exception $e) { $this->returnError(105, $this->version, $this->openmlGeneralErrorCode, $e->getMessage()); return; } // Return data id, for user to verify changes - $this->xmlContents( 'data-fork', $this->version, array( 'id' => $data_id) ); + $this->xmlContents( 'data-fork', $this->version, array( 'id' => $new_data_id) ); } private function data_edit() { From 957f8f6ad8cb7f3e93cd3985b17a6ab6aa9ca261 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Oct 2022 17:11:48 +0200 Subject: [PATCH 5/8] fix in data fork --- openml_OS/models/api/v1/Api_data.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/openml_OS/models/api/v1/Api_data.php b/openml_OS/models/api/v1/Api_data.php index b82f5dcfa..4f4f2b052 100644 --- a/openml_OS/models/api/v1/Api_data.php +++ b/openml_OS/models/api/v1/Api_data.php @@ -502,22 +502,28 @@ private function data_fork() { $latest_version = $this->Dataset-> getWhereSingle('`name` = "' . $dataset->name . '"', 'CAST(`version` AS DECIMAL) DESC'); $dataset->version = $latest_version->version + 1; unset($dataset->did); - $data_id = $this->Dataset->insert($dataset); - if (!$data_id) { + $new_data_id = $this->Dataset->insert($dataset); + if (!$new_data_id) { $this->returnError(1072, $this->version); return; } + + // create a copy of the latest description + $description_record = $this->Dataset_description->getWhereSingle('did =' . $data_id, 'version DESC'); + $description_record->did = $new_data_id; + $description_record->version = "1"; + $this->Dataset_description->insert($description_record); // update elastic search index. try { - $this->elasticsearch->index('data', $data_id); + $this->elasticsearch->index('data', $new_data_id); } catch (Exception $e) { $this->returnError(105, $this->version, $this->openmlGeneralErrorCode, $e->getMessage()); return; } // Return data id, for user to verify changes - $this->xmlContents( 'data-fork', $this->version, array( 'id' => $data_id) ); + $this->xmlContents( 'data-fork', $this->version, array( 'id' => $new_data_id) ); } private function data_edit() { @@ -758,6 +764,7 @@ private function data($data_id) { $dataset->status = $data_status->status; } if ($dataset->format != 'Sparse_ARFF') { + $dataset->parquet_url = 'http://openml1.win.tue.nl/dataset' . $data_id . '/dataset_' . $data_id . '.pq'; $dataset->minio_url = 'http://openml1.win.tue.nl/dataset' . $data_id . '/dataset_' . $data_id . '.pq'; } $this->xmlContents( 'data-get', $this->version, $dataset ); From 9fbff81bf6011a0baaff0e9343b9b14b1d47aa52 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Oct 2022 17:13:24 +0200 Subject: [PATCH 6/8] fix for CORS --- .htaccess | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.htaccess b/.htaccess index ce0db299b..6aefce681 100644 --- a/.htaccess +++ b/.htaccess @@ -10,10 +10,9 @@ RewriteRule ^(.*)$ https://www.openml.org/api_new/$1 [L,P] RewriteCond $1 !^(questions|SWF|img|docs|downloads|GFX|favicon\.ico|tiny_mce|index\.php|js|css|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L] - +RedirectMatch 301 ^/?$ http://api.openml.org/home - SetEnvIfNoCase Origin "https?://(www\.)?(openml\.org|staging\.openml\.org)(:\d+)?$" ACAO=$0 - Header set Access-Control-Allow-Origin %{ACAO}e env=ACAO + Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept" From efec162a65611e4c0e3bfdd6de31ec1dde0a6a73 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Oct 2022 17:34:01 +0200 Subject: [PATCH 7/8] minio_url to parquet_url rename --- openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php b/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php index 3e7a38c33..2cf26c3fb 100644 --- a/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php +++ b/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php @@ -12,6 +12,7 @@ + From 39d8ca004db00e4a5a283c5bb745d6b379b30dbb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Oct 2022 17:36:29 +0200 Subject: [PATCH 8/8] ES update --- openml_OS/libraries/ElasticSearch.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openml_OS/libraries/ElasticSearch.php b/openml_OS/libraries/ElasticSearch.php index f65630f79..a0f5854a5 100644 --- a/openml_OS/libraries/ElasticSearch.php +++ b/openml_OS/libraries/ElasticSearch.php @@ -1919,7 +1919,10 @@ public function index_data($id, $start_id = 0, $altmetrics=True, $verbosity=0) { private function build_data($d, $altmetrics=True) { $description_record = $this->CI->Dataset_description->getWhereSingle('did =' . $d->did, 'version DESC'); - $headless_description = trim(preg_replace('/\s+/', ' ', preg_replace('/^\*{2,}.*/m', '', $description_record->description))); + if(!$description_record){ + return 'Could not find description of dataset ' . $d->did; + } + $headless_description = trim(preg_replace('/\s+/', ' ', preg_replace('/^\*{2,}.*/m', '', $description_record->description))); $new_data = array( 'data_id' => $d->did, 'name' => $d->name,