From aaac37da0833477783ac1467e81dda248a04325c Mon Sep 17 00:00:00 2001 From: Calum Macdonald Date: Mon, 19 Feb 2024 11:01:03 +0000 Subject: [PATCH] add some more info on errors --- Tutorial.ipynb | 1841 ++++++++++++++++++++++++++++++++++ docs/creating-a-dataset.md | 14 +- docs/deleting-a-dataset.md | 24 +- docs/retrieving-a-dataset.md | 129 ++- docs/updating-a-dataset.md | 68 +- 5 files changed, 2014 insertions(+), 62 deletions(-) create mode 100644 Tutorial.ipynb diff --git a/Tutorial.ipynb b/Tutorial.ipynb new file mode 100644 index 0000000..5adc832 --- /dev/null +++ b/Tutorial.ipynb @@ -0,0 +1,1841 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "id": "fa7b9741", + "metadata": {}, + "outputs": [], + "source": [ + "import requests\n", + "import json\n", + "\n", + "\n", + "client_id = \"Nout1YMmBcNBlGUb0fUdZhAE7tnplYttRf7mPXQO\"\n", + "app_id = \"NgUSJVWBGlelGLVJITtA0iATmN0QF8xffWKwGcaw\"\n", + "\n", + "api_path = \"http://localhost:8000/api/v1\"\n", + "\n", + "\n", + "headers = {\n", + " \"x-client-id\": client_id,\n", + " \"x-application-id\": app_id,\n", + " \"Content-Type\": \"application/json\",\n", + "}\n", + "\n", + "metadata = {\"metadata\": json.load(open(\"example-hdruk212.json\"))}\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "d28497d4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"message\": \"created\",\n", + " \"data\": 876,\n", + " \"version\": 877\n", + "}\n" + ] + } + ], + "source": [ + "response = requests.post(\n", + " f\"{api_path}/integrations/datasets\", headers=headers, json=metadata\n", + ")\n", + "print(json.dumps(response.json(), indent=6))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "8c59364c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "201" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response.status_code" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "aeeebe94", + "metadata": {}, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'data'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[22], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m dataset_id \u001b[38;5;241m=\u001b[39m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mjson\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdata\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 2\u001b[0m dataset_id\n", + "\u001b[0;31mKeyError\u001b[0m: 'data'" + ] + } + ], + "source": [ + "dataset_id = response.json()[\"data\"]\n", + "dataset_id" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "f048faa2", + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "500\n" + ] + } + ], + "source": [ + "dataset_id = 876\n", + "response = requests.get(\n", + " f\"{api_path}/integrations/datasets/{dataset_id}\", headers=headers\n", + ")\n", + "print (response.status_code)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "887851fc", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"code\": 500,\n", + " \"message\": \"Dataset with id=876 cannot be found\",\n", + " \"details\": {\n", + " \"exception\": \"Exception\",\n", + " \"trace\": [\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php\",\n", + " \"line\": 54,\n", + " \"function\": \"show\",\n", + " \"class\": \"App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " 876\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php\",\n", + " \"line\": 43,\n", + " \"function\": \"callAction\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Controller\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " \"show\",\n", + " {\n", + " \"0\": {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " \"id\": \"876\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php\",\n", + " \"line\": 259,\n", + " \"function\": \"dispatch\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\ControllerDispatcher\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"uri\": \"api/v1/integrations/datasets/{id}\",\n", + " \"methods\": [\n", + " \"GET\",\n", + " \"HEAD\"\n", + " ],\n", + " \"action\": {\n", + " \"middleware\": [\n", + " \"api\",\n", + " \"integration.auth\",\n", + " \"check.integration.access:permissions,datasets.read\"\n", + " ],\n", + " \"uses\": \"App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@show\",\n", + " \"controller\": \"App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@show\",\n", + " \"namespace\": null,\n", + " \"prefix\": \"api/v1\",\n", + " \"where\": []\n", + " },\n", + " \"isFallback\": false,\n", + " \"controller\": {},\n", + " \"defaults\": [],\n", + " \"wheres\": {\n", + " \"id\": \"[0-9]+\"\n", + " },\n", + " \"parameters\": {\n", + " \"id\": \"876\"\n", + " },\n", + " \"parameterNames\": [\n", + " \"id\"\n", + " ],\n", + " \"computedMiddleware\": [\n", + " \"api\",\n", + " \"integration.auth\",\n", + " \"check.integration.access:permissions,datasets.read\"\n", + " ],\n", + " \"compiled\": {}\n", + " },\n", + " {},\n", + " \"show\"\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php\",\n", + " \"line\": 205,\n", + " \"function\": \"runController\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Route\",\n", + " \"type\": \"->\",\n", + " \"args\": []\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php\",\n", + " \"line\": 806,\n", + " \"function\": \"run\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Route\",\n", + " \"type\": \"->\",\n", + " \"args\": []\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 144,\n", + " \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Router\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/app/Http/Middleware/CheckIntegrationAccessMiddleware.php\",\n", + " \"line\": 43,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"App\\\\Http\\\\Middleware\\\\CheckIntegrationAccessMiddleware\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {},\n", + " \"permissions\",\n", + " \"datasets.read\"\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/app/Http/Middleware/AuthenticateIntegrationMiddleware.php\",\n", + " \"line\": 65,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"App\\\\Http\\\\Middleware\\\\AuthenticateIntegrationMiddleware\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php\",\n", + " \"line\": 50,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Middleware\\\\SubstituteBindings\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php\",\n", + " \"line\": 159,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php\",\n", + " \"line\": 125,\n", + " \"function\": \"handleRequest\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Middleware\\\\ThrottleRequests\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {},\n", + " [\n", + " {\n", + " \"key\": \"a75f3f172bfb296f2e10cbfc6dfc1883\",\n", + " \"maxAttempts\": 1000,\n", + " \"decayMinutes\": 1,\n", + " \"responseCallback\": null\n", + " }\n", + " ]\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php\",\n", + " \"line\": 87,\n", + " \"function\": \"handleRequestUsingNamedLimiter\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Middleware\\\\ThrottleRequests\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {},\n", + " \"api\",\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Middleware\\\\ThrottleRequests\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {},\n", + " \"api\"\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php\",\n", + " \"line\": 121,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php\",\n", + " \"line\": 64,\n", + " \"function\": \"handleStatefulRequest\",\n", + " \"class\": \"Illuminate\\\\Session\\\\Middleware\\\\StartSession\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {},\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Session\\\\Middleware\\\\StartSession\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 119,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php\",\n", + " \"line\": 805,\n", + " \"function\": \"then\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php\",\n", + " \"line\": 784,\n", + " \"function\": \"runRouteWithinStack\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Router\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"uri\": \"api/v1/integrations/datasets/{id}\",\n", + " \"methods\": [\n", + " \"GET\",\n", + " \"HEAD\"\n", + " ],\n", + " \"action\": {\n", + " \"middleware\": [\n", + " \"api\",\n", + " \"integration.auth\",\n", + " \"check.integration.access:permissions,datasets.read\"\n", + " ],\n", + " \"uses\": \"App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@show\",\n", + " \"controller\": \"App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@show\",\n", + " \"namespace\": null,\n", + " \"prefix\": \"api/v1\",\n", + " \"where\": []\n", + " },\n", + " \"isFallback\": false,\n", + " \"controller\": {},\n", + " \"defaults\": [],\n", + " \"wheres\": {\n", + " \"id\": \"[0-9]+\"\n", + " },\n", + " \"parameters\": {\n", + " \"id\": \"876\"\n", + " },\n", + " \"parameterNames\": [\n", + " \"id\"\n", + " ],\n", + " \"computedMiddleware\": [\n", + " \"api\",\n", + " \"integration.auth\",\n", + " \"check.integration.access:permissions,datasets.read\"\n", + " ],\n", + " \"compiled\": {}\n", + " },\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php\",\n", + " \"line\": 748,\n", + " \"function\": \"runRoute\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Router\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {\n", + " \"uri\": \"api/v1/integrations/datasets/{id}\",\n", + " \"methods\": [\n", + " \"GET\",\n", + " \"HEAD\"\n", + " ],\n", + " \"action\": {\n", + " \"middleware\": [\n", + " \"api\",\n", + " \"integration.auth\",\n", + " \"check.integration.access:permissions,datasets.read\"\n", + " ],\n", + " \"uses\": \"App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@show\",\n", + " \"controller\": \"App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@show\",\n", + " \"namespace\": null,\n", + " \"prefix\": \"api/v1\",\n", + " \"where\": []\n", + " },\n", + " \"isFallback\": false,\n", + " \"controller\": {},\n", + " \"defaults\": [],\n", + " \"wheres\": {\n", + " \"id\": \"[0-9]+\"\n", + " },\n", + " \"parameters\": {\n", + " \"id\": \"876\"\n", + " },\n", + " \"parameterNames\": [\n", + " \"id\"\n", + " ],\n", + " \"computedMiddleware\": [\n", + " \"api\",\n", + " \"integration.auth\",\n", + " \"check.integration.access:permissions,datasets.read\"\n", + " ],\n", + " \"compiled\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php\",\n", + " \"line\": 737,\n", + " \"function\": \"dispatchToRoute\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Router\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php\",\n", + " \"line\": 200,\n", + " \"function\": \"dispatch\",\n", + " \"class\": \"Illuminate\\\\Routing\\\\Router\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 144,\n", + " \"function\": \"Illuminate\\\\Foundation\\\\Http\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Kernel\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php\",\n", + " \"line\": 21,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php\",\n", + " \"line\": 31,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TransformsRequest\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\ConvertEmptyStringsToNull\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php\",\n", + " \"line\": 21,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php\",\n", + " \"line\": 40,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TransformsRequest\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TrimStrings\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php\",\n", + " \"line\": 27,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\ValidatePostSize\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php\",\n", + " \"line\": 99,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\PreventRequestsDuringMaintenance\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php\",\n", + " \"line\": 39,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Http\\\\Middleware\\\\TrustProxies\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/app/Http/Middleware/Cors.php\",\n", + " \"line\": 24,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 183,\n", + " \"function\": \"handle\",\n", + " \"class\": \"App\\\\Http\\\\Middleware\\\\Cors\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " },\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php\",\n", + " \"line\": 119,\n", + " \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php\",\n", + " \"line\": 175,\n", + " \"function\": \"then\",\n", + " \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {}\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php\",\n", + " \"line\": 144,\n", + " \"function\": \"sendRequestThroughRouter\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Kernel\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/public/index.php\",\n", + " \"line\": 51,\n", + " \"function\": \"handle\",\n", + " \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Kernel\",\n", + " \"type\": \"->\",\n", + " \"args\": [\n", + " {\n", + " \"attributes\": {},\n", + " \"request\": {},\n", + " \"query\": {},\n", + " \"server\": {},\n", + " \"files\": {},\n", + " \"cookies\": {},\n", + " \"headers\": {}\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"file\": \"/var/www/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php\",\n", + " \"line\": 16,\n", + " \"args\": [\n", + " \"/var/www/public/index.php\"\n", + " ],\n", + " \"function\": \"require_once\"\n", + " }\n", + " ]\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "print(json.dumps(response.json(),indent=6))" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "6b1fcb2d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'code': 500, 'message': 'Dataset with id=876 cannot be found', 'details': {'exception': 'Exception', 'trace': [{'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php', 'line': 54, 'function': 'destroy', 'class': 'App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, '876']}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php', 'line': 43, 'function': 'callAction', 'class': 'Illuminate\\\\Routing\\\\Controller', 'type': '->', 'args': ['destroy', {'0': {'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, 'id': '876'}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php', 'line': 259, 'function': 'dispatch', 'class': 'Illuminate\\\\Routing\\\\ControllerDispatcher', 'type': '->', 'args': [{'uri': 'api/v1/integrations/datasets/{id}', 'methods': ['DELETE'], 'action': {'middleware': ['api', 'integration.auth', 'check.integration.access:permissions,datasets.delete'], 'uses': 'App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@destroy', 'controller': 'App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@destroy', 'namespace': None, 'prefix': 'api/v1', 'where': []}, 'isFallback': False, 'controller': {}, 'defaults': [], 'wheres': ['id', '[0-9]+'], 'parameters': {'id': '876'}, 'parameterNames': ['id'], 'computedMiddleware': ['api', 'integration.auth', 'check.integration.access:permissions,datasets.delete'], 'compiled': {}}, {}, 'destroy']}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php', 'line': 205, 'function': 'runController', 'class': 'Illuminate\\\\Routing\\\\Route', 'type': '->', 'args': []}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line': 806, 'function': 'run', 'class': 'Illuminate\\\\Routing\\\\Route', 'type': '->', 'args': []}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 144, 'function': 'Illuminate\\\\Routing\\\\{closure}', 'class': 'Illuminate\\\\Routing\\\\Router', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/app/Http/Middleware/CheckIntegrationAccessMiddleware.php', 'line': 43, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'App\\\\Http\\\\Middleware\\\\CheckIntegrationAccessMiddleware', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}, 'permissions', 'datasets.delete']}, {'file': '/var/www/app/Http/Middleware/AuthenticateIntegrationMiddleware.php', 'line': 65, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'App\\\\Http\\\\Middleware\\\\AuthenticateIntegrationMiddleware', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php', 'line': 50, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Routing\\\\Middleware\\\\SubstituteBindings', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php', 'line': 159, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php', 'line': 125, 'function': 'handleRequest', 'class': 'Illuminate\\\\Routing\\\\Middleware\\\\ThrottleRequests', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}, [{'key': 'a75f3f172bfb296f2e10cbfc6dfc1883', 'maxAttempts': 1000, 'decayMinutes': 1, 'responseCallback': None}]]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php', 'line': 87, 'function': 'handleRequestUsingNamedLimiter', 'class': 'Illuminate\\\\Routing\\\\Middleware\\\\ThrottleRequests', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}, 'api', {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Routing\\\\Middleware\\\\ThrottleRequests', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}, 'api']}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php', 'line': 121, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php', 'line': 64, 'function': 'handleStatefulRequest', 'class': 'Illuminate\\\\Session\\\\Middleware\\\\StartSession', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Session\\\\Middleware\\\\StartSession', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 119, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line': 805, 'function': 'then', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line': 784, 'function': 'runRouteWithinStack', 'class': 'Illuminate\\\\Routing\\\\Router', 'type': '->', 'args': [{'uri': 'api/v1/integrations/datasets/{id}', 'methods': ['DELETE'], 'action': {'middleware': ['api', 'integration.auth', 'check.integration.access:permissions,datasets.delete'], 'uses': 'App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@destroy', 'controller': 'App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@destroy', 'namespace': None, 'prefix': 'api/v1', 'where': []}, 'isFallback': False, 'controller': {}, 'defaults': [], 'wheres': ['id', '[0-9]+'], 'parameters': {'id': '876'}, 'parameterNames': ['id'], 'computedMiddleware': ['api', 'integration.auth', 'check.integration.access:permissions,datasets.delete'], 'compiled': {}}, {'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line': 748, 'function': 'runRoute', 'class': 'Illuminate\\\\Routing\\\\Router', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {'uri': 'api/v1/integrations/datasets/{id}', 'methods': ['DELETE'], 'action': {'middleware': ['api', 'integration.auth', 'check.integration.access:permissions,datasets.delete'], 'uses': 'App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@destroy', 'controller': 'App\\\\Http\\\\Controllers\\\\Api\\\\V1\\\\IntegrationDatasetController@destroy', 'namespace': None, 'prefix': 'api/v1', 'where': []}, 'isFallback': False, 'controller': {}, 'defaults': [], 'wheres': ['id', '[0-9]+'], 'parameters': {'id': '876'}, 'parameterNames': ['id'], 'computedMiddleware': ['api', 'integration.auth', 'check.integration.access:permissions,datasets.delete'], 'compiled': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line': 737, 'function': 'dispatchToRoute', 'class': 'Illuminate\\\\Routing\\\\Router', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', 'line': 200, 'function': 'dispatch', 'class': 'Illuminate\\\\Routing\\\\Router', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 144, 'function': 'Illuminate\\\\Foundation\\\\Http\\\\{closure}', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Kernel', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php', 'line': 21, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php', 'line': 31, 'function': 'handle', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TransformsRequest', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\ConvertEmptyStringsToNull', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php', 'line': 21, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php', 'line': 40, 'function': 'handle', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TransformsRequest', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TrimStrings', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php', 'line': 27, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\ValidatePostSize', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php', 'line': 99, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\PreventRequestsDuringMaintenance', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php', 'line': 39, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'Illuminate\\\\Http\\\\Middleware\\\\TrustProxies', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/app/Http/Middleware/Cors.php', 'line': 24, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 183, 'function': 'handle', 'class': 'App\\\\Http\\\\Middleware\\\\Cors', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}, {}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line': 119, 'function': 'Illuminate\\\\Pipeline\\\\{closure}', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', 'line': 175, 'function': 'then', 'class': 'Illuminate\\\\Pipeline\\\\Pipeline', 'type': '->', 'args': [{}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', 'line': 144, 'function': 'sendRequestThroughRouter', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Kernel', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/public/index.php', 'line': 51, 'function': 'handle', 'class': 'Illuminate\\\\Foundation\\\\Http\\\\Kernel', 'type': '->', 'args': [{'attributes': {}, 'request': {}, 'query': {}, 'server': {}, 'files': {}, 'cookies': {}, 'headers': {}}]}, {'file': '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php', 'line': 16, 'args': ['/var/www/public/index.php'], 'function': 'require_once'}]}}\n" + ] + } + ], + "source": [ + "response = requests.delete(\n", + " f\"{api_path}/integrations/datasets/{dataset_id}\", headers=headers\n", + ")\n", + "print (response.json())" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "a0874904", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"message\": \"failed to translate\",\n", + " \"details\": {\n", + " \"traser_message\": {\n", + " \"error\": \"Translation not found\",\n", + " \"message\": \"Request failed with status code 404\",\n", + " \"details\": \"Translation for GWDM-1.1 to HDRUK-2.2.3 is not implemented\"\n", + " },\n", + " \"wasTranslated\": false,\n", + " \"metadata\": null,\n", + " \"statusCode\": 400\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "response = requests.get(\n", + " f\"{api_path}/integrations/datasets/{dataset_id}?schema_model=HDRUK&schema_version=2.2.3\", headers=headers\n", + ")\n", + "print (json.dumps(response.json(),indent=6))" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "9ae97f85", + "metadata": {}, + "outputs": [], + "source": [ + "temp = json.load(open(\"example-hdruk212.json\"))\n", + "temp['version'] = '3.0.1'\n", + "temp['summary']['title'] = 'UPDATED TITLE'\n", + "\n", + "newmetadata = {\"metadata\": temp}" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "id": "14be6979", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"message\": \"success\",\n", + " \"data\": {\n", + " \"id\": 875,\n", + " \"mongo_object_id\": null,\n", + " \"mongo_id\": null,\n", + " \"mongo_pid\": null,\n", + " \"datasetid\": null,\n", + " \"pid\": \"96bea284-dd48-4617-84e5-8b8f888b2fb3\",\n", + " \"source\": null,\n", + " \"discourse_topic_id\": 0,\n", + " \"is_cohort_discovery\": false,\n", + " \"commercial_use\": 0,\n", + " \"state_id\": 0,\n", + " \"uploader_id\": 0,\n", + " \"metadataquality_id\": 0,\n", + " \"user_id\": 3,\n", + " \"team_id\": 26,\n", + " \"views_count\": 0,\n", + " \"views_prev_count\": 0,\n", + " \"has_technical_details\": 1,\n", + " \"created\": \"2024-02-16 14:40:21\",\n", + " \"updated\": \"2024-02-16 15:00:55\",\n", + " \"submitted\": \"2024-02-16 14:40:21\",\n", + " \"published\": null,\n", + " \"created_at\": \"2024-02-16T14:40:21.000000Z\",\n", + " \"updated_at\": \"2024-02-16T15:00:55.000000Z\",\n", + " \"deleted_at\": null,\n", + " \"create_origin\": \"API\",\n", + " \"status\": \"ACTIVE\",\n", + " \"versions\": [\n", + " {\n", + " \"id\": 875,\n", + " \"created_at\": \"2024-02-16T14:40:21.000000Z\",\n", + " \"updated_at\": \"2024-02-16T14:40:21.000000Z\",\n", + " \"deleted_at\": null,\n", + " \"dataset_id\": 875,\n", + " \"metadata\": {\n", + " \"metadata\": {\n", + " \"required\": {\n", + " \"gatewayId\": \"875\",\n", + " \"gatewayPid\": \"96bea284-dd48-4617-84e5-8b8f888b2fb3\",\n", + " \"issued\": \"2024-02-16T14:40:21.422962Z\",\n", + " \"modified\": \"2024-02-16T14:40:21.422977Z\",\n", + " \"revisions\": [],\n", + " \"version\": \"3.0.0\"\n", + " },\n", + " \"summary\": {\n", + " \"abstract\": \"Patient-level data set that captures information about people in contact with services commissioned as part of the adult Improving Access to Psychological Services (IAPT) programme.\",\n", + " \"contactPoint\": \"enquiries@nhsdigital.nhs.uk\",\n", + " \"keywords\": \"Depression,Anxiety,CBT,Counselling,Talking theraphy,Cognitive,National Core Study,NCS\",\n", + " \"controlledKeywords\": null,\n", + " \"datasetType\": \"Healthdata\",\n", + " \"description\": \"Collecting information about people in contact with adult psychological therapy services in England. The IAPT data set was developed with the IAPT programme as a patient level, output based, secondary uses data set which aims to deliver robust, comprehensive, nationally consistent and comparable information for patients accessing NHS-funded IAPT services in England. This national data set has been collected since April 2012 and is a mandatory submission for all NHS funded care, including care delivered by independent sector healthcare providers. Data collection on patients with depression and anxiety disorders that are offered psychological therapies, so that we can improve the delivery of care for these conditions.\\n\\nProviders of NHS-funded IAPT services are required to submit data to NHS Digital on a monthly basis.\\n\\nAs a secondary uses data set the IAPT data set re-uses clinical and operational data for purposes other than direct patient care. It defines the data items, definitions and associated value sets extracted or derived from local information systems and sent to NHS Digital for analysis purposes. Timescales for dissemination can be found under 'Our Service Levels' at the following link: https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-process\",\n", + " \"doiName\": null,\n", + " \"shortTitle\": \"Improving Access to Psychological Therapies Data Set\",\n", + " \"title\": \"Improving Access to Psychological Therapies Data Set\",\n", + " \"publisher\": {\n", + " \"gatewayId\": \"6c3eabaa-2f38-46d8-8e3b-83bc64896e30\",\n", + " \"name\": \"Lehner Inc\"\n", + " },\n", + " \"populationSize\": 0,\n", + " \"datasetSubType\": null\n", + " },\n", + " \"coverage\": {\n", + " \"pathway\": null,\n", + " \"spatial\": \"United Kingdom,England\",\n", + " \"followup\": \"0 - 6 MONTHS\",\n", + " \"typicalAgeRange\": \"18-150\",\n", + " \"biologicalsamples\": null,\n", + " \"gender\": null,\n", + " \"psychological\": null,\n", + " \"physical\": null,\n", + " \"anthropometric\": null,\n", + " \"lifestyle\": null,\n", + " \"socioeconomic\": null\n", + " },\n", + " \"provenance\": {\n", + " \"origin\": {\n", + " \"purpose\": \"OTHER,ADMINISTRATIVE\",\n", + " \"source\": \"EPR\",\n", + " \"collectionSituation\": \"COMMUNITY,PRIMARY CARE\"\n", + " },\n", + " \"temporal\": {\n", + " \"endDate\": null,\n", + " \"startDate\": \"2012-04-01\",\n", + " \"timeLag\": \"2-6 MONTHS\",\n", + " \"accrualPeriodicity\": \"MONTHLY\",\n", + " \"distributionReleaseDate\": null\n", + " }\n", + " },\n", + " \"accessibility\": {\n", + " \"access\": {\n", + " \"deliveryLeadTime\": null,\n", + " \"jurisdiction\": \"GB-ENG\",\n", + " \"dataController\": \"NHS DIGITAL\",\n", + " \"dataProcessor\": null,\n", + " \"accessRights\": \"https://digital.nhs.uk/services/data-access-request-service-dars\",\n", + " \"accessService\": \"Once your DARS application has been approved, data will be made available either by secure file transfer or through the Data Access Environment (DAE). BL\\n\\nSecure file transfer: https://digital.nhs.uk/services/transfer-data-securely\\n\\nDAE: https://digital.nhs.uk/services/data-access-environment-dae\",\n", + " \"accessRequestCost\": \"https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-charges\"\n", + " },\n", + " \"usage\": {\n", + " \"dataUseLimitation\": \"NO RESTRICTION\",\n", + " \"dataUseRequirement\": \"INSTITUTION SPECIFIC RESTRICTIONS,PROJECT SPECIFIC RESTRICTIONS,TIME LIMIT ON USE\",\n", + " \"resourceCreator\": {\n", + " \"name\": \"NHS DIGITIAL\",\n", + " \"gatewayId\": null,\n", + " \"rorId\": null\n", + " }\n", + " },\n", + " \"formatAndStandards\": {\n", + " \"vocabularyEncodingSchemes\": \"ODS,SNOMED CT,NHS NATIONAL CODES,ICD10\",\n", + " \"conformsTo\": \"NHS DATA DICTIONARY\",\n", + " \"languages\": \"en\",\n", + " \"formats\": \"CSV\"\n", + " }\n", + " },\n", + " \"linkage\": {\n", + " \"associatedMedia\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set,https://digital.nhs.uk/about-nhs-digital/corporate-information-and-documents/directions-and-data-provision-notices/data-provision-notices-dpns/improving-access-to-psychological-therapies-data-set-data-provision-notice\",\n", + " \"isReferenceIn\": null,\n", + " \"tools\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set/submitting-iapt-data\",\n", + " \"datasetLinkage\": {\n", + " \"isDerivedFrom\": \"Data will be minimised as appropriate relative to the data access application\",\n", + " \"isPartOf\": \"mental health\",\n", + " \"linkedDatasets\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"isMemberOf\": null\n", + " },\n", + " \"investigations\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"isGeneratedUsing\": null,\n", + " \"dataUses\": null\n", + " },\n", + " \"observations\": [\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 114125,\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"disambiguatingDescription\": \"In December 2020 there were 114,125 referrals made into IAPT services in England.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 81578,\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"disambiguatingDescription\": \"In December 2020, 81,578 referrals into IAPT services in England started a course of treatment.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 48331,\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"disambiguatingDescription\": \"In December 2020, 48,331 referrals into IAPT services in England completed a course of treatment.\"\n", + " }\n", + " ],\n", + " \"structuralMetadata\": [\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"columns\": [\n", + " {\n", + " \"name\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"description\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"dataType\": \"Number\",\n", + " \"sensitive\": false,\n", + " \"values\": [\n", + " {\n", + " \"name\": \"Male\",\n", + " \"frequency\": 50,\n", + " \"description\": null\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"columns\": [\n", + " {\n", + " \"name\": \"Pseudonymised Service Request Identifier\",\n", + " \"description\": \"A request for the provision of care services to a PATIENT.\",\n", + " \"dataType\": \"String\",\n", + " \"sensitive\": false,\n", + " \"values\": [\n", + " {\n", + " \"name\": \"Male\",\n", + " \"frequency\": 50,\n", + " \"description\": null\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + " }\n", + " ],\n", + " \"tissuesSampleCollection\": null\n", + " },\n", + " \"app\": {\n", + " \"id\": 0\n", + " },\n", + " \"original_metadata\": {\n", + " \"identifier\": \"https://web.www.healthdatagateway.org/19525c5f-92ee-41b6-bb79-673624b27bdd\",\n", + " \"version\": \"3.0.0\",\n", + " \"issued\": \"2021-05-10T00:00:00.000Z\",\n", + " \"modified\": \"2021-05-10T00:00:00.000Z\",\n", + " \"revisions\": [],\n", + " \"summary\": {\n", + " \"title\": \"Improving Access to Psychological Therapies Data Set\",\n", + " \"abstract\": \"Patient-level data set that captures information about people in contact with services commissioned as part of the adult Improving Access to Psychological Services (IAPT) programme.\",\n", + " \"publisher\": {\n", + " \"identifier\": \"https://web.www.healthdatagateway.org/5f86cd34980f41c6f02261f4\",\n", + " \"name\": \"NHS DIGITAL\",\n", + " \"logo\": null,\n", + " \"description\": null,\n", + " \"contactPoint\": null,\n", + " \"memberOf\": \"ALLIANCE\"\n", + " },\n", + " \"contactPoint\": \"enquiries@nhsdigital.nhs.uk\",\n", + " \"keywords\": \"Depression,Anxiety,CBT,Counselling,Talking theraphy,Cognitive,National Core Study,NCS\",\n", + " \"alternateIdentifiers\": null,\n", + " \"doiName\": null\n", + " },\n", + " \"documentation\": {\n", + " \"description\": \"Collecting information about people in contact with adult psychological therapy services in England. The IAPT data set was developed with the IAPT programme as a patient level, output based, secondary uses data set which aims to deliver robust, comprehensive, nationally consistent and comparable information for patients accessing NHS-funded IAPT services in England. This national data set has been collected since April 2012 and is a mandatory submission for all NHS funded care, including care delivered by independent sector healthcare providers. Data collection on patients with depression and anxiety disorders that are offered psychological therapies, so that we can improve the delivery of care for these conditions.\\n\\nProviders of NHS-funded IAPT services are required to submit data to NHS Digital on a monthly basis.\\n\\nAs a secondary uses data set the IAPT data set re-uses clinical and operational data for purposes other than direct patient care. It defines the data items, definitions and associated value sets extracted or derived from local information systems and sent to NHS Digital for analysis purposes. Timescales for dissemination can be found under 'Our Service Levels' at the following link: https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-process\",\n", + " \"associatedMedia\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set,https://digital.nhs.uk/about-nhs-digital/corporate-information-and-documents/directions-and-data-provision-notices/data-provision-notices-dpns/improving-access-to-psychological-therapies-data-set-data-provision-notice\",\n", + " \"isPartOf\": \"mental health\"\n", + " },\n", + " \"coverage\": {\n", + " \"spatial\": \"United Kingdom,England\",\n", + " \"typicalAgeRange\": \"18-150\",\n", + " \"physicalSampleAvailability\": null,\n", + " \"followup\": \"0 - 6 MONTHS\",\n", + " \"pathway\": null\n", + " },\n", + " \"provenance\": {\n", + " \"origin\": {\n", + " \"purpose\": \"OTHER,ADMINISTRATIVE\",\n", + " \"source\": \"EPR\",\n", + " \"collectionSituation\": \"COMMUNITY,PRIMARY CARE\"\n", + " },\n", + " \"temporal\": {\n", + " \"accrualPeriodicity\": \"MONTHLY\",\n", + " \"distributionReleaseDate\": null,\n", + " \"startDate\": \"2012-04-01\",\n", + " \"endDate\": null,\n", + " \"timeLag\": \"2-6 MONTHS\"\n", + " }\n", + " },\n", + " \"accessibility\": {\n", + " \"usage\": {\n", + " \"dataUseLimitation\": \"NO RESTRICTION\",\n", + " \"dataUseRequirements\": \"INSTITUTION SPECIFIC RESTRICTIONS,PROJECT SPECIFIC RESTRICTIONS,TIME LIMIT ON USE\",\n", + " \"resourceCreator\": \"NHS DIGITIAL\",\n", + " \"investigations\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"isReferencedBy\": null\n", + " },\n", + " \"access\": {\n", + " \"accessRights\": \"https://digital.nhs.uk/services/data-access-request-service-dars\",\n", + " \"accessService\": \"Once your DARS application has been approved, data will be made available either by secure file transfer or through the Data Access Environment (DAE). BL\\n\\nSecure file transfer: https://digital.nhs.uk/services/transfer-data-securely\\n\\nDAE: https://digital.nhs.uk/services/data-access-environment-dae\",\n", + " \"accessRequestCost\": \"https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-charges\",\n", + " \"deliveryLeadTime\": null,\n", + " \"jurisdiction\": \"GB-ENG\",\n", + " \"dataProcessor\": null,\n", + " \"dataController\": \"NHS DIGITAL\"\n", + " },\n", + " \"formatAndStandards\": {\n", + " \"vocabularyEncodingScheme\": \"ODS,SNOMED CT,NHS NATIONAL CODES,ICD10\",\n", + " \"conformsTo\": \"NHS DATA DICTIONARY\",\n", + " \"language\": \"en\",\n", + " \"format\": \"CSV\"\n", + " }\n", + " },\n", + " \"enrichmentAndLinkage\": {\n", + " \"qualifiedRelation\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"derivation\": \"Data will be minimised as appropriate relative to the data access application\",\n", + " \"tools\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set/submitting-iapt-data\"\n", + " },\n", + " \"observations\": [\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 114125,\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"disambiguatingDescription\": \"In December 2020 there were 114,125 referrals made into IAPT services in England.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 81578,\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"disambiguatingDescription\": \"In December 2020, 81,578 referrals into IAPT services in England started a course of treatment.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 48331,\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"disambiguatingDescription\": \"In December 2020, 48,331 referrals into IAPT services in England completed a course of treatment.\"\n", + " }\n", + " ],\n", + " \"structuralMetadata\": [\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"elements\": [\n", + " {\n", + " \"name\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"description\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"dataType\": \"Number\",\n", + " \"sensitive\": false\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"elements\": [\n", + " {\n", + " \"name\": \"Pseudonymised Service Request Identifier\",\n", + " \"description\": \"A request for the provision of care services to a PATIENT.\",\n", + " \"dataType\": \"String\",\n", + " \"sensitive\": false\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + " },\n", + " \"gwdmVersion\": \"1.1\"\n", + " },\n", + " \"version\": 1\n", + " },\n", + " {\n", + " \"id\": 876,\n", + " \"created_at\": \"2024-02-16T15:00:55.000000Z\",\n", + " \"updated_at\": \"2024-02-16T15:00:55.000000Z\",\n", + " \"deleted_at\": null,\n", + " \"dataset_id\": 875,\n", + " \"metadata\": {\n", + " \"metadata\": {\n", + " \"required\": {\n", + " \"gatewayId\": \"875\",\n", + " \"gatewayPid\": \"96bea284-dd48-4617-84e5-8b8f888b2fb3\",\n", + " \"issued\": \"2021-05-10T00:00:00.000Z\",\n", + " \"modified\": \"2024-02-16T15:00:55.934192Z\",\n", + " \"revisions\": [\n", + " {\n", + " \"url\": \"https://placeholder.blah/96bea284-dd48-4617-84e5-8b8f888b2fb3?version=3.0.0\",\n", + " \"version\": \"3.0.0\"\n", + " }\n", + " ],\n", + " \"version\": \"3.0.1\"\n", + " },\n", + " \"summary\": {\n", + " \"abstract\": \"Patient-level data set that captures information about people in contact with services commissioned as part of the adult Improving Access to Psychological Services (IAPT) programme.\",\n", + " \"contactPoint\": \"enquiries@nhsdigital.nhs.uk\",\n", + " \"keywords\": \"Depression,Anxiety,CBT,Counselling,Talking theraphy,Cognitive,National Core Study,NCS\",\n", + " \"controlledKeywords\": null,\n", + " \"datasetType\": \"Healthdata\",\n", + " \"description\": \"Collecting information about people in contact with adult psychological therapy services in England. The IAPT data set was developed with the IAPT programme as a patient level, output based, secondary uses data set which aims to deliver robust, comprehensive, nationally consistent and comparable information for patients accessing NHS-funded IAPT services in England. This national data set has been collected since April 2012 and is a mandatory submission for all NHS funded care, including care delivered by independent sector healthcare providers. Data collection on patients with depression and anxiety disorders that are offered psychological therapies, so that we can improve the delivery of care for these conditions.\\n\\nProviders of NHS-funded IAPT services are required to submit data to NHS Digital on a monthly basis.\\n\\nAs a secondary uses data set the IAPT data set re-uses clinical and operational data for purposes other than direct patient care. It defines the data items, definitions and associated value sets extracted or derived from local information systems and sent to NHS Digital for analysis purposes. Timescales for dissemination can be found under 'Our Service Levels' at the following link: https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-process\",\n", + " \"doiName\": null,\n", + " \"shortTitle\": \"UPDATED TITLE\",\n", + " \"title\": \"UPDATED TITLE\",\n", + " \"publisher\": {\n", + " \"name\": \"Lehner Inc\",\n", + " \"gatewayId\": \"6c3eabaa-2f38-46d8-8e3b-83bc64896e30\",\n", + " \"rorId\": null\n", + " },\n", + " \"populationSize\": 0,\n", + " \"datasetSubType\": null\n", + " },\n", + " \"coverage\": {\n", + " \"pathway\": null,\n", + " \"spatial\": \"United Kingdom,England\",\n", + " \"followup\": \"0 - 6 MONTHS\",\n", + " \"typicalAgeRange\": \"18-150\",\n", + " \"biologicalsamples\": null,\n", + " \"gender\": null,\n", + " \"psychological\": null,\n", + " \"physical\": null,\n", + " \"anthropometric\": null,\n", + " \"lifestyle\": null,\n", + " \"socioeconomic\": null\n", + " },\n", + " \"provenance\": {\n", + " \"origin\": {\n", + " \"purpose\": \"OTHER,ADMINISTRATIVE\",\n", + " \"source\": \"EPR\",\n", + " \"collectionSituation\": \"COMMUNITY,PRIMARY CARE\"\n", + " },\n", + " \"temporal\": {\n", + " \"endDate\": null,\n", + " \"startDate\": \"2012-04-01\",\n", + " \"timeLag\": \"2-6 MONTHS\",\n", + " \"accrualPeriodicity\": \"MONTHLY\",\n", + " \"distributionReleaseDate\": null\n", + " }\n", + " },\n", + " \"accessibility\": {\n", + " \"access\": {\n", + " \"deliveryLeadTime\": null,\n", + " \"jurisdiction\": \"GB-ENG\",\n", + " \"dataController\": \"NHS DIGITAL\",\n", + " \"dataProcessor\": null,\n", + " \"accessRights\": \"https://digital.nhs.uk/services/data-access-request-service-dars\",\n", + " \"accessService\": \"Once your DARS application has been approved, data will be made available either by secure file transfer or through the Data Access Environment (DAE). BL\\n\\nSecure file transfer: https://digital.nhs.uk/services/transfer-data-securely\\n\\nDAE: https://digital.nhs.uk/services/data-access-environment-dae\",\n", + " \"accessRequestCost\": \"https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-charges\"\n", + " },\n", + " \"usage\": {\n", + " \"dataUseLimitation\": \"NO RESTRICTION\",\n", + " \"dataUseRequirement\": \"INSTITUTION SPECIFIC RESTRICTIONS,PROJECT SPECIFIC RESTRICTIONS,TIME LIMIT ON USE\",\n", + " \"resourceCreator\": {\n", + " \"name\": \"NHS DIGITIAL\",\n", + " \"gatewayId\": null,\n", + " \"rorId\": null\n", + " }\n", + " },\n", + " \"formatAndStandards\": {\n", + " \"vocabularyEncodingSchemes\": \"ODS,SNOMED CT,NHS NATIONAL CODES,ICD10\",\n", + " \"conformsTo\": \"NHS DATA DICTIONARY\",\n", + " \"languages\": \"en\",\n", + " \"formats\": \"CSV\"\n", + " }\n", + " },\n", + " \"linkage\": {\n", + " \"associatedMedia\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set,https://digital.nhs.uk/about-nhs-digital/corporate-information-and-documents/directions-and-data-provision-notices/data-provision-notices-dpns/improving-access-to-psychological-therapies-data-set-data-provision-notice\",\n", + " \"isReferenceIn\": null,\n", + " \"tools\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set/submitting-iapt-data\",\n", + " \"datasetLinkage\": {\n", + " \"isDerivedFrom\": \"Data will be minimised as appropriate relative to the data access application\",\n", + " \"isPartOf\": \"mental health\",\n", + " \"linkedDatasets\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"isMemberOf\": null\n", + " },\n", + " \"investigations\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"isGeneratedUsing\": null,\n", + " \"dataUses\": null\n", + " },\n", + " \"observations\": [\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 114125,\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"disambiguatingDescription\": \"In December 2020 there were 114,125 referrals made into IAPT services in England.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 81578,\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"disambiguatingDescription\": \"In December 2020, 81,578 referrals into IAPT services in England started a course of treatment.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 48331,\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"disambiguatingDescription\": \"In December 2020, 48,331 referrals into IAPT services in England completed a course of treatment.\"\n", + " }\n", + " ],\n", + " \"structuralMetadata\": [\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"columns\": [\n", + " {\n", + " \"name\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"description\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"dataType\": \"Number\",\n", + " \"sensitive\": false,\n", + " \"values\": [\n", + " {\n", + " \"name\": \"Male\",\n", + " \"frequency\": 50,\n", + " \"description\": null\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"columns\": [\n", + " {\n", + " \"name\": \"Pseudonymised Service Request Identifier\",\n", + " \"description\": \"A request for the provision of care services to a PATIENT.\",\n", + " \"dataType\": \"String\",\n", + " \"sensitive\": false,\n", + " \"values\": [\n", + " {\n", + " \"name\": \"Male\",\n", + " \"frequency\": 50,\n", + " \"description\": null\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + " }\n", + " ],\n", + " \"tissuesSampleCollection\": null\n", + " },\n", + " \"app\": {\n", + " \"id\": 0\n", + " },\n", + " \"id\": \"875\",\n", + " \"original_metadata\": {\n", + " \"identifier\": \"https://web.www.healthdatagateway.org/19525c5f-92ee-41b6-bb79-673624b27bdd\",\n", + " \"version\": \"3.0.1\",\n", + " \"issued\": \"2021-05-10T00:00:00.000Z\",\n", + " \"modified\": \"2021-05-10T00:00:00.000Z\",\n", + " \"revisions\": [],\n", + " \"summary\": {\n", + " \"title\": \"UPDATED TITLE\",\n", + " \"abstract\": \"Patient-level data set that captures information about people in contact with services commissioned as part of the adult Improving Access to Psychological Services (IAPT) programme.\",\n", + " \"publisher\": {\n", + " \"identifier\": \"https://web.www.healthdatagateway.org/5f86cd34980f41c6f02261f4\",\n", + " \"name\": \"NHS DIGITAL\",\n", + " \"logo\": null,\n", + " \"description\": null,\n", + " \"contactPoint\": null,\n", + " \"memberOf\": \"ALLIANCE\"\n", + " },\n", + " \"contactPoint\": \"enquiries@nhsdigital.nhs.uk\",\n", + " \"keywords\": \"Depression,Anxiety,CBT,Counselling,Talking theraphy,Cognitive,National Core Study,NCS\",\n", + " \"alternateIdentifiers\": null,\n", + " \"doiName\": null\n", + " },\n", + " \"documentation\": {\n", + " \"description\": \"Collecting information about people in contact with adult psychological therapy services in England. The IAPT data set was developed with the IAPT programme as a patient level, output based, secondary uses data set which aims to deliver robust, comprehensive, nationally consistent and comparable information for patients accessing NHS-funded IAPT services in England. This national data set has been collected since April 2012 and is a mandatory submission for all NHS funded care, including care delivered by independent sector healthcare providers. Data collection on patients with depression and anxiety disorders that are offered psychological therapies, so that we can improve the delivery of care for these conditions.\\n\\nProviders of NHS-funded IAPT services are required to submit data to NHS Digital on a monthly basis.\\n\\nAs a secondary uses data set the IAPT data set re-uses clinical and operational data for purposes other than direct patient care. It defines the data items, definitions and associated value sets extracted or derived from local information systems and sent to NHS Digital for analysis purposes. Timescales for dissemination can be found under 'Our Service Levels' at the following link: https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-process\",\n", + " \"associatedMedia\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set,https://digital.nhs.uk/about-nhs-digital/corporate-information-and-documents/directions-and-data-provision-notices/data-provision-notices-dpns/improving-access-to-psychological-therapies-data-set-data-provision-notice\",\n", + " \"isPartOf\": \"mental health\"\n", + " },\n", + " \"coverage\": {\n", + " \"spatial\": \"United Kingdom,England\",\n", + " \"typicalAgeRange\": \"18-150\",\n", + " \"physicalSampleAvailability\": null,\n", + " \"followup\": \"0 - 6 MONTHS\",\n", + " \"pathway\": null\n", + " },\n", + " \"provenance\": {\n", + " \"origin\": {\n", + " \"purpose\": \"OTHER,ADMINISTRATIVE\",\n", + " \"source\": \"EPR\",\n", + " \"collectionSituation\": \"COMMUNITY,PRIMARY CARE\"\n", + " },\n", + " \"temporal\": {\n", + " \"accrualPeriodicity\": \"MONTHLY\",\n", + " \"distributionReleaseDate\": null,\n", + " \"startDate\": \"2012-04-01\",\n", + " \"endDate\": null,\n", + " \"timeLag\": \"2-6 MONTHS\"\n", + " }\n", + " },\n", + " \"accessibility\": {\n", + " \"usage\": {\n", + " \"dataUseLimitation\": \"NO RESTRICTION\",\n", + " \"dataUseRequirements\": \"INSTITUTION SPECIFIC RESTRICTIONS,PROJECT SPECIFIC RESTRICTIONS,TIME LIMIT ON USE\",\n", + " \"resourceCreator\": \"NHS DIGITIAL\",\n", + " \"investigations\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"isReferencedBy\": null\n", + " },\n", + " \"access\": {\n", + " \"accessRights\": \"https://digital.nhs.uk/services/data-access-request-service-dars\",\n", + " \"accessService\": \"Once your DARS application has been approved, data will be made available either by secure file transfer or through the Data Access Environment (DAE). BL\\n\\nSecure file transfer: https://digital.nhs.uk/services/transfer-data-securely\\n\\nDAE: https://digital.nhs.uk/services/data-access-environment-dae\",\n", + " \"accessRequestCost\": \"https://digital.nhs.uk/services/data-access-request-service-dars/data-access-request-service-dars-charges\",\n", + " \"deliveryLeadTime\": null,\n", + " \"jurisdiction\": \"GB-ENG\",\n", + " \"dataProcessor\": null,\n", + " \"dataController\": \"NHS DIGITAL\"\n", + " },\n", + " \"formatAndStandards\": {\n", + " \"vocabularyEncodingScheme\": \"ODS,SNOMED CT,NHS NATIONAL CODES,ICD10\",\n", + " \"conformsTo\": \"NHS DATA DICTIONARY\",\n", + " \"language\": \"en\",\n", + " \"format\": \"CSV\"\n", + " }\n", + " },\n", + " \"enrichmentAndLinkage\": {\n", + " \"qualifiedRelation\": \"https://digital.nhs.uk/services/data-access-request-service-dars/register-of-approved-data-releases\",\n", + " \"derivation\": \"Data will be minimised as appropriate relative to the data access application\",\n", + " \"tools\": \"https://digital.nhs.uk/data-and-information/data-collections-and-data-sets/data-sets/improving-access-to-psychological-therapies-data-set/submitting-iapt-data\"\n", + " },\n", + " \"observations\": [\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 114125,\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"disambiguatingDescription\": \"In December 2020 there were 114,125 referrals made into IAPT services in England.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 81578,\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"disambiguatingDescription\": \"In December 2020, 81,578 referrals into IAPT services in England started a course of treatment.\"\n", + " },\n", + " {\n", + " \"observedNode\": \"EVENTS\",\n", + " \"measuredValue\": 48331,\n", + " \"measuredProperty\": \"COUNT\",\n", + " \"observationDate\": \"2021-02-25\",\n", + " \"disambiguatingDescription\": \"In December 2020, 48,331 referrals into IAPT services in England completed a course of treatment.\"\n", + " }\n", + " ],\n", + " \"structuralMetadata\": [\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"elements\": [\n", + " {\n", + " \"name\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"description\": \"Count of number of Non-guided Self Help (Computer) sessions (derived)\",\n", + " \"dataType\": \"Number\",\n", + " \"sensitive\": false\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"name\": \"IAPT.iapt.Rep_Referral\",\n", + " \"description\": \"IAPT.iapt.Rep_Referral\",\n", + " \"elements\": [\n", + " {\n", + " \"name\": \"Pseudonymised Service Request Identifier\",\n", + " \"description\": \"A request for the provision of care services to a PATIENT.\",\n", + " \"dataType\": \"String\",\n", + " \"sensitive\": false\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + " },\n", + " \"gwdmVersion\": \"1.1\"\n", + " },\n", + " \"version\": 2\n", + " }\n", + " ]\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "response = requests.put(\n", + " f\"{api_path}/integrations/datasets/{dataset_id}\", headers=headers, json=newmetadata\n", + ")\n", + "print(json.dumps(response.json(), indent=6))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "dfce3deb", + "metadata": {}, + "outputs": [], + "source": [ + "response = requests.get(\n", + " f\"{api_path}/integrations/datasets/{dataset_id}\", headers=headers\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "id": "e75312a6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3\n" + ] + } + ], + "source": [ + "data = response.json()[\"data\"]\n", + "versions = data[\"versions\"]\n", + "#print(json.dumps(versions, indent=6))\n", + "print(len(versions))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b8544866", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.18" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/creating-a-dataset.md b/docs/creating-a-dataset.md index d5b6e03..aaa19c5 100644 --- a/docs/creating-a-dataset.md +++ b/docs/creating-a-dataset.md @@ -67,7 +67,19 @@ You should make a record of the dataset ID that is returned in the `data` field ### Errors -Incase you come across the following errors, please find explainations of what to do solve. +Please find below a summary of likely errors and their meanings. + +#### Unauthorised permissions to create + +If your app did enable permissions to create a dataset then you'll see the following response (code `400`) from the + +```json +{ + "code": 400, + "message": "Application permissions do not allow this request", + "details": {...} +} +``` #### No x-application-id or x-client-id in your headers diff --git a/docs/deleting-a-dataset.md b/docs/deleting-a-dataset.md index 1db0b42..0379cf8 100644 --- a/docs/deleting-a-dataset.md +++ b/docs/deleting-a-dataset.md @@ -1,5 +1,5 @@ Deleting an dataset using `DELETE` on the endpoint [`/api/v1/integrations/datasets/{id}`](https://api.dev.hdruk.cloud/api/documentation#/Dataset%20Integrations/create_datasets_from_app) -=== " python requests " +=== " python " ```python @@ -8,16 +8,22 @@ Deleting an dataset using `DELETE` on the endpoint [`/api/v1/integrations/datase headers=headers ) - print(json.dumps(response.json(), indent=6)) - ``` - Running this returns the dat that we store for your metadata - ``` - { - "message": "success" - } ``` === "CURL" - + ```bash + curl -X DELETE \ + --location 'https://api.dev.hdruk.cloud/api/v1/integrations/datasets/' \ + --header 'x-application-id: ' \ + --header 'x-client-id: ' \ + ``` + +Running this returns the message if it was successfull + +``` +{ + "message": "success" +} +``` diff --git a/docs/retrieving-a-dataset.md b/docs/retrieving-a-dataset.md index 4dc4704..e50fe74 100644 --- a/docs/retrieving-a-dataset.md +++ b/docs/retrieving-a-dataset.md @@ -9,33 +9,37 @@ The endpoint [`/api/v1/integrations/datasets/{id}`](https://api.dev.hdruk.cloud/ headers=headers ) - print(json.dumps(response.json(), indent=6)) ``` - Running this returns the dat that we store for your metadata +=== "CURL" + ``` - { - "id": 16, - "created_at": "2024-02-09T12:10:23.000000Z", - "updated_at": "2024-02-09T12:10:23.000000Z", - "deleted_at": null, - "dataset_id": 16, - "metadata": { - "metadata": { - "required": { - "gatewayId": "16", - "gatewayPid": "5537be3a-e448-4214-8946-8ce1e75a74c8", - "issued": "2024-02-09T12:10:23.591675Z", - "modified": "2024-02-09T12:10:23.591698Z", - "revisions": [], - "version": "3.0.0" - }, - ... + curl --location 'https://api.dev.hdruk.cloud/api/v1/integrations/datasets/' \ + --header 'x-application-id: ' \ + --header 'x-client-id: ' ``` -=== "CURL" +Running this returns the dat that we store for your metadata - +``` + { + "id": 16, + "created_at": "2024-02-09T12:10:23.000000Z", + "updated_at": "2024-02-09T12:10:23.000000Z", + "deleted_at": null, + "dataset_id": 16, + "metadata": { + "metadata": { + "required": { + "gatewayId": "16", + "gatewayPid": "5537be3a-e448-4214-8946-8ce1e75a74c8", + "issued": "2024-02-09T12:10:23.591675Z", + "modified": "2024-02-09T12:10:23.591698Z", + "revisions": [], + "version": "3.0.0" + }, + ... +``` ### Alternative metadata schema @@ -57,7 +61,7 @@ You can request to get your dataset metadata back using a different schema model === "CURL" ```bash - curl --location 'https://api.dev.hdruk.cloud/api/v1/integrations/datasets/875?schema_model=SchemaOrg&schema_version=BioSchema' \ + curl --location 'https://api.dev.hdruk.cloud/api/v1/integrations/datasets/?schema_model=SchemaOrg&schema_version=BioSchema' \ --header 'x-application-id: ' \ --header 'x-client-id: ' \ ``` @@ -80,7 +84,7 @@ Will return the `data` payload with your metadata in your requested model (and v #### HDRUK 2.2.0 (public schema) -Using `/api/v1/integrations/datasets/875?schema_model=HDRUK&schema_version=2.2.0` +Using `/api/v1/integrations/datasets/?schema_model=HDRUK&schema_version=2.2.0` You can get back your metadata conforming to our public schema from our gateway data model (GWDM) @@ -99,4 +103,83 @@ You can get back your metadata conforming to our public schema from our gateway ], "version": "3.0.1", ... + } +} +``` + +### Errors + +Please find below a summary of likely errors and their meanings. + +#### Cannot find dataset by + +If the `` that you use to retrieve your dataset (`/api/v1/integrations/datasets/`) does not exist or is invalid then you'll see the following error: + +```json +{ + "status": "INVALID_ARGUMENT", + "message": "Invalid argument(s)", + "errors": [ + { + "reason": "EXISTS", + "message": "The selected id is invalid.", + "field": "id" + } + ] +} +``` + +If a dataset has been created and then subsquently deleted you will get the following `500` response: + +```json +{ + "code": 500, + "message": "Dataset with id= cannot be found", + "details": {...} +} +``` + +#### Unauthorised permissions to retrieve + +If your app did enable permissions to retrieve a dataset then you'll see the following response (code `400`). + +```json +{ + "code": 400, + "message": "Application permissions do not allow this request", + "details": {...} +} +``` + +#### No schema version + +If you request the data in another model, you must use `/integrations/datasets/{dataset_id}?schema_model={model}&schema_verson={version}"` +otherwise you may get a `500` response if you forgot to specify both: + +```json +{ + 'code': 500, + 'message': 'You have given a schema_model but not a schema_version', + ... +} +``` + +#### Unknown output schema + +If you request the output schema that does not exist or is not supported, example `/integrations/datasets/{dataset_id}?schema_model=HDRUK&schema_version=2.2.3`. You'll get the following response and error coming from our translation service. Navigate to 'creating metadata' to learn about what models and translations are supported. + +```json +{ + "message": "failed to translate", + "details": { + "traser_message": { + "error": "Translation not found", + "message": "Request failed with status code 404", + "details": "Translation for GWDM-1.1 to HDRUK-2.2.3 is not implemented" + }, + "wasTranslated": false, + "metadata": null, + "statusCode": 400 + } +} ``` diff --git a/docs/updating-a-dataset.md b/docs/updating-a-dataset.md index 73114cf..f9686a2 100644 --- a/docs/updating-a-dataset.md +++ b/docs/updating-a-dataset.md @@ -2,42 +2,52 @@ Method `PUT` [`/api/v1/integrations/datasets/{id}`](https://api.dev.hdruk.cloud/ === " python requests " - Using python `requests` - ``` python - import requests - import json + ```python - metadata = json.load(open("example-hdruk212.json")) - - - client_id = "fScHE7KHejPZb0TLh4vgdJoitfymyGSMLt7oS10e" - app_id = "3pO6liuh64iYRkTlTEpZrdGGj8IJnTFH5h3l7HAC" - api_path = "http://localhost:8000/api/v1" - headers = { - "client_id": client_id, - "app_id": app_id, - "Content-Type": "application/json", - } - - - response = requests.post( - f"{api_path}/integrations/datasets", + response = requests.put( + f"{api_path}/integrations/datasets/", headers=headers, json={"metadata": metadata}, ) - print(json.dumps(response.json(), indent=6)) ``` - Running this returns: +=== "CURL" + ``` - { - "message": "created", - "data": , - "version": - } + curl -X PUT \ + --location 'https://api.dev.hdruk.cloud/api/v1/integrations/datasets/' \ + --header 'x-application-id: ' \ + --header 'x-client-id: ' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "metadata": {} + }' ``` -=== "CURL" - - +Running this returns a structure like: + +``` +{ + "message": "success", + "data": { + "id": 875, + ... + "create_origin": "API", + "status": "ACTIVE", + "versions": [ + { + "id": 875, + ... + }, + ... + ] + } +} +``` + +It returns what data we now hold for this dataset (i.e. multiple versions as you have now updated your dataset with a new version) + +### Errors + +Please see the previous page for dataset creation, the errors you may receive from an update will be similar to errors you can get from creating a dataset - they'll most likely be due to incorrect metadata or non-existing a non-existing dataset.