{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ad36ae4c-6359-41f6-b9c5-971c96a678f0",
   "metadata": {},
   "source": [
    "# GNA : MOSI UseCase\n",
    "\n",
    "This notebooks provides a testing bed and configuration utility for <strong>GNA - MOSI</strong> use case served by <em>gCube CMS Suite</em>, by:\n",
    "\n",
    "- Creating UCD from schema URL\n",
    "- Registering MOSI UCD in corrent gCube Context\n",
    "- Parsing and registration of MOSI records from CSV (if provided)\n",
    "- Publication of registered MOSI records\n",
    "- Deletion of registered MOSI records\n",
    "\n",
    "NB This notebook relies on <strong>commons.ipynb</strong> distributed along with <em>gCube CMS Suite</em>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f82576d0-5896-4c6f-ad55-bef0bff21fdb",
   "metadata": {
    "jp-MarkdownHeadingCollapsed": true,
    "tags": []
   },
   "source": [
    "## Parameters Initialization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "ca65023e-ae07-45de-ba75-4d39d66df53b",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: simplejson in /opt/conda/lib/python3.9/site-packages (3.17.6)\n",
      "Requirement already satisfied: rich[jupyter] in /opt/conda/lib/python3.9/site-packages (12.2.0)\n",
      "Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (2.11.2)\n",
      "Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (0.9.1)\n",
      "Requirement already satisfied: ipywidgets<8.0.0,>=7.5.1 in /opt/conda/lib/python3.9/site-packages (from rich[jupyter]) (7.7.0)\n",
      "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.1.0)\n",
      "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
      "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.1.1)\n",
      "Requirement already satisfied: widgetsnbextension~=3.6.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.6.0)\n",
      "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (8.2.0)\n",
      "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.11.0)\n",
      "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.2.0)\n",
      "Requirement already satisfied: tornado>=6.1 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.1)\n",
      "Requirement already satisfied: setuptools>=60 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (61.3.1)\n",
      "Requirement already satisfied: nest-asyncio in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.5)\n",
      "Requirement already satisfied: matplotlib-inline>=0.1 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.1.3)\n",
      "Requirement already satisfied: psutil in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.9.0)\n",
      "Requirement already satisfied: jupyter-client>=6.1.12 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (7.2.1)\n",
      "Requirement already satisfied: debugpy>=1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.1)\n",
      "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
      "Requirement already satisfied: stack-data in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.0)\n",
      "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.18.1)\n",
      "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.0.27)\n",
      "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.5)\n",
      "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.8.0)\n",
      "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (5.1.1)\n",
      "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.4.0)\n",
      "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.9.2)\n",
      "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.4.10)\n",
      "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.3)\n",
      "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.18.1)\n",
      "Requirement already satisfied: attrs>=17.4.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.4.0)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.8.2)\n",
      "Requirement already satisfied: pyzmq>=22.3 in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (22.3.0)\n",
      "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.4)\n",
      "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.3.0)\n",
      "Requirement already satisfied: nbconvert>=5 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (6.4.5)\n",
      "Requirement already satisfied: Send2Trash>=1.8.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.8.0)\n",
      "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.13.3)\n",
      "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.1.1)\n",
      "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.13.1)\n",
      "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.0)\n",
      "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.5)\n",
      "Requirement already satisfied: asttokens in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.0.5)\n",
      "Requirement already satisfied: executing in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.3)\n",
      "Requirement already satisfied: pure-eval in /opt/conda/lib/python3.9/site-packages (from stack-data->ipython>=4.0.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.2.2)\n",
      "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.8.4)\n",
      "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.6.0)\n",
      "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.7.1)\n",
      "Requirement already satisfied: beautifulsoup4 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.10.0)\n",
      "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (4.1.0)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.1.1)\n",
      "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.1.2)\n",
      "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.5.0)\n",
      "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.5.13)\n",
      "Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.9/site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.16.0)\n",
      "Requirement already satisfied: argon2-cffi-bindings in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.2.0)\n",
      "Requirement already satisfied: cffi>=1.0.1 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi-bindings->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (1.15.0)\n",
      "Requirement already satisfied: soupsieve>1.2 in /opt/conda/lib/python3.9/site-packages (from beautifulsoup4->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.3.1)\n",
      "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (0.5.1)\n",
      "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (21.3)\n",
      "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (2.21)\n",
      "Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert>=5->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets<8.0.0,>=7.5.1->rich[jupyter]) (3.0.7)\n"
     ]
    }
   ],
   "source": [
    "%run commons.ipynb\n",
    "# These parameters should be discovered / initialized by common gcube libraries. \n",
    "gcube_token = \"3aa85bbf-d5f3-4df4-ad03-4f8f788eba3d-98187548\"\n",
    "service_base_endpoint =\"https://geoportal.dev.int.d4science.net/geoportal-service/srv\"\n",
    "\n",
    "# Actual customizable parameters\n",
    "ucid = \"GNA-MOSI\"\n",
    "gpkgFile = \"templateItalia.gpkg\"\n",
    "verbose=False\n",
    "\n",
    "#NB The following should not be changed \n",
    "projects_endpoint = service_base_endpoint + \"/projects/\"+ucid\n",
    "ucds_endpoint = service_base_endpoint + \"/ucd/\"\n",
    "ucd_endpoint = ucds_endpoint+ucid\n",
    "plugins_endpoint=service_base_endpoint + \"/plugins/\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a3fae252-963e-4a20-9968-e906d3709681",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Init parameters\n",
    "UCD = {\n",
    "  \"_id\" : ucid,\n",
    "  \"_mongoId\":None,\n",
    "  \"_version\" : \"1.0.0\",\n",
    "  \"_name\" : \"GNA : MOSI\",\n",
    "  \"_description\" : \"Modulistica siti\",\n",
    "  \"_handlers\" : []\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c43579c9-0c2c-4e30-a1c6-0565f27f9a55",
   "metadata": {
    "jp-MarkdownHeadingCollapsed": true,
    "tags": []
   },
   "source": [
    "## UCD Definition and Registration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "5e591ce5-0341-4d77-a6ff-08cdfd90b566",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'_mongoId': '626a972102ad3d3b47050dfd',\n",
       " '_id': 'GNA-MOSI',\n",
       " '_version': '1.0.0',\n",
       " '_name': 'GNA : MOSI',\n",
       " '_description': 'Modulistica siti',\n",
       " '_creationInfo': None,\n",
       " '_schema': None,\n",
       " '_handlers': [{'_id': 'DEFAULT-SINGLE-STEP',\n",
       "   '_type': 'LifecycleManagement',\n",
       "   '_configuration': {'step_access': [{'STEP': 'PUBLISH', 'roles': []}]}},\n",
       "  {'_id': 'SDI-Indexer-Plugin',\n",
       "   '_type': 'Indexer',\n",
       "   '_configuration': {'explicitFieldMapping': [],\n",
       "    'additionalLayers': [{'source': {'url': '...'}, 'toSetTitle': ''}]}}],\n",
       " '_dataAccessPolicies': [{'_policy': {'_write': 'own', '_read': 'any'},\n",
       "   '_roles': [],\n",
       "   '_enforcer': None}]}"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Check if already existing\n",
    "send(method=\"GET\",dest=ucd_endpoint)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7c0a9d27-86d3-4a9c-a51a-c47a80f2cadc",
   "metadata": {},
   "outputs": [],
   "source": [
    "# should read schema from git repo\n",
    "schema_url=\"https://code-repo.d4science.org/gCubeSystem/gcube-cms-suite/raw/branch/%2322686/test-data/profiledDocuments/schemas/MOSI-schema.json\"\n",
    "schema=send(method=\"GET\",dest=schema_url)\n",
    "#NB Cannot set schema from gpkg.MOSI if we want it structured\n",
    "#with fiona.open(gpkgFile, layer='MOSI_multipolygon') as layer:\n",
    "#    feature = layer[0]\n",
    "    #feature is GeoJSON\n",
    "UCD.update({\"_schema\" :schema})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "44280c2e-e513-4aec-825a-b4f9504ad35b",
   "metadata": {},
   "outputs": [],
   "source": [
    "#TODO DEFINE ROLES\n",
    "UCD.update({\"_dataAccessPolicies\" : [\n",
    "    {\"_policy\" : {\"_read\" : \"any\", \"_write\" : \"own\"}, \"_roles\":[]},\n",
    "  ]})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "9e3afe4a-a301-4eea-acd3-95cb03dd26b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# UPDATE Lifecycle Settings\n",
    "UCD[\"_handlers\"].append({\n",
    "      \"_id\" :  \"DEFAULT-SINGLE-STEP\",\n",
    "      \"_type\" :  \"LifecycleManagement\",\n",
    "      \"_configuration\" : {\n",
    "        \"step_access\" : [\n",
    "          {\"STEP\" : \"PUBLISH\", \"roles\" :[]}\n",
    "        ]\n",
    "      }\n",
    "    })"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c6ce3205-38e7-4531-9a46-bea2d48a9321",
   "metadata": {},
   "outputs": [],
   "source": [
    "# UPDATE Lifecycle Settings\n",
    "UCD[\"_handlers\"].append({\n",
    "      \"_id\" : \"SDI-Indexer-Plugin\",\n",
    "      \"_type\" : \"Indexer\",\n",
    "      \"_configuration\" : {\n",
    "# TODO use \n",
    "#     \"bboxEvaluation\" : [\"$..posizionamentoScavo.._bbox\"],\n",
    "        \"explicitFieldMapping\" : [\n",
    "#TODO READ FROM MOSI LAYER \n",
    "        ],\n",
    "        \"additionalLayers\" : [\n",
    "# TODO CONFIGURE Additional\n",
    "          {\"source\" : {\"url\" :  \"...\"},\"toSetTitle\":\"\"}\n",
    "        ]\n",
    "      }\n",
    "    }\n",
    "    )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3e32f361-31f0-4fb7-a0dd-f4b730c94ac4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
       "  <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_id\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"GNA-MOSI\"</span>,\n",
       "  <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_mongoId\"</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">null</span>,\n",
       "  <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_version\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"1.0.0\"</span>,\n",
       "  <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_name\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"GNA : MOSI\"</span>,\n",
       "  <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_description\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"Modulistica siti\"</span>,\n",
       "  <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_handlers\"</span>: <span style=\"font-weight: bold\">[</span>\n",
       "    <span style=\"font-weight: bold\">{</span>\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_id\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"DEFAULT-SINGLE-STEP\"</span>,\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_type\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"LifecycleManagement\"</span>,\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_configuration\"</span>: <span style=\"font-weight: bold\">{</span>\n",
       "        <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"step_access\"</span>: <span style=\"font-weight: bold\">[</span>\n",
       "          <span style=\"font-weight: bold\">{</span>\n",
       "            <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"STEP\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"PUBLISH\"</span>,\n",
       "            <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"roles\"</span>: <span style=\"font-weight: bold\">[]</span>\n",
       "          <span style=\"font-weight: bold\">}</span>\n",
       "        <span style=\"font-weight: bold\">]</span>\n",
       "      <span style=\"font-weight: bold\">}</span>\n",
       "    <span style=\"font-weight: bold\">}</span>,\n",
       "    <span style=\"font-weight: bold\">{</span>\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_id\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"SDI-Indexer-Plugin\"</span>,\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_type\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"Indexer\"</span>,\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_configuration\"</span>: <span style=\"font-weight: bold\">{</span>\n",
       "        <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"explicitFieldMapping\"</span>: <span style=\"font-weight: bold\">[]</span>,\n",
       "        <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"additionalLayers\"</span>: <span style=\"font-weight: bold\">[</span>\n",
       "          <span style=\"font-weight: bold\">{</span>\n",
       "            <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"source\"</span>: <span style=\"font-weight: bold\">{</span>\n",
       "              <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"url\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"...\"</span>\n",
       "            <span style=\"font-weight: bold\">}</span>,\n",
       "            <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"toSetTitle\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"\"</span>\n",
       "          <span style=\"font-weight: bold\">}</span>\n",
       "        <span style=\"font-weight: bold\">]</span>\n",
       "      <span style=\"font-weight: bold\">}</span>\n",
       "    <span style=\"font-weight: bold\">}</span>\n",
       "  <span style=\"font-weight: bold\">]</span>,\n",
       "  <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_dataAccessPolicies\"</span>: <span style=\"font-weight: bold\">[</span>\n",
       "    <span style=\"font-weight: bold\">{</span>\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_policy\"</span>: <span style=\"font-weight: bold\">{</span>\n",
       "        <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_read\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"any\"</span>,\n",
       "        <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_write\"</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"own\"</span>\n",
       "      <span style=\"font-weight: bold\">}</span>,\n",
       "      <span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">\"_roles\"</span>: <span style=\"font-weight: bold\">[]</span>\n",
       "    <span style=\"font-weight: bold\">}</span>\n",
       "  <span style=\"font-weight: bold\">]</span>\n",
       "<span style=\"font-weight: bold\">}</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m{\u001b[0m\n",
       "  \u001b[1;34m\"_id\"\u001b[0m: \u001b[32m\"GNA-MOSI\"\u001b[0m,\n",
       "  \u001b[1;34m\"_mongoId\"\u001b[0m: \u001b[3;35mnull\u001b[0m,\n",
       "  \u001b[1;34m\"_version\"\u001b[0m: \u001b[32m\"1.0.0\"\u001b[0m,\n",
       "  \u001b[1;34m\"_name\"\u001b[0m: \u001b[32m\"GNA : MOSI\"\u001b[0m,\n",
       "  \u001b[1;34m\"_description\"\u001b[0m: \u001b[32m\"Modulistica siti\"\u001b[0m,\n",
       "  \u001b[1;34m\"_handlers\"\u001b[0m: \u001b[1m[\u001b[0m\n",
       "    \u001b[1m{\u001b[0m\n",
       "      \u001b[1;34m\"_id\"\u001b[0m: \u001b[32m\"DEFAULT-SINGLE-STEP\"\u001b[0m,\n",
       "      \u001b[1;34m\"_type\"\u001b[0m: \u001b[32m\"LifecycleManagement\"\u001b[0m,\n",
       "      \u001b[1;34m\"_configuration\"\u001b[0m: \u001b[1m{\u001b[0m\n",
       "        \u001b[1;34m\"step_access\"\u001b[0m: \u001b[1m[\u001b[0m\n",
       "          \u001b[1m{\u001b[0m\n",
       "            \u001b[1;34m\"STEP\"\u001b[0m: \u001b[32m\"PUBLISH\"\u001b[0m,\n",
       "            \u001b[1;34m\"roles\"\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m\n",
       "          \u001b[1m}\u001b[0m\n",
       "        \u001b[1m]\u001b[0m\n",
       "      \u001b[1m}\u001b[0m\n",
       "    \u001b[1m}\u001b[0m,\n",
       "    \u001b[1m{\u001b[0m\n",
       "      \u001b[1;34m\"_id\"\u001b[0m: \u001b[32m\"SDI-Indexer-Plugin\"\u001b[0m,\n",
       "      \u001b[1;34m\"_type\"\u001b[0m: \u001b[32m\"Indexer\"\u001b[0m,\n",
       "      \u001b[1;34m\"_configuration\"\u001b[0m: \u001b[1m{\u001b[0m\n",
       "        \u001b[1;34m\"explicitFieldMapping\"\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n",
       "        \u001b[1;34m\"additionalLayers\"\u001b[0m: \u001b[1m[\u001b[0m\n",
       "          \u001b[1m{\u001b[0m\n",
       "            \u001b[1;34m\"source\"\u001b[0m: \u001b[1m{\u001b[0m\n",
       "              \u001b[1;34m\"url\"\u001b[0m: \u001b[32m\"...\"\u001b[0m\n",
       "            \u001b[1m}\u001b[0m,\n",
       "            \u001b[1;34m\"toSetTitle\"\u001b[0m: \u001b[32m\"\"\u001b[0m\n",
       "          \u001b[1m}\u001b[0m\n",
       "        \u001b[1m]\u001b[0m\n",
       "      \u001b[1m}\u001b[0m\n",
       "    \u001b[1m}\u001b[0m\n",
       "  \u001b[1m]\u001b[0m,\n",
       "  \u001b[1;34m\"_dataAccessPolicies\"\u001b[0m: \u001b[1m[\u001b[0m\n",
       "    \u001b[1m{\u001b[0m\n",
       "      \u001b[1;34m\"_policy\"\u001b[0m: \u001b[1m{\u001b[0m\n",
       "        \u001b[1;34m\"_read\"\u001b[0m: \u001b[32m\"any\"\u001b[0m,\n",
       "        \u001b[1;34m\"_write\"\u001b[0m: \u001b[32m\"own\"\u001b[0m\n",
       "      \u001b[1m}\u001b[0m,\n",
       "      \u001b[1;34m\"_roles\"\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m\n",
       "    \u001b[1m}\u001b[0m\n",
       "  \u001b[1m]\u001b[0m\n",
       "\u001b[1m}\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/ucd/\n",
      "Data is {'_id': 'GNA-MOSI', '_mongoId': None, '_version': '1.0.0', '_name': 'GNA : MOSI', '_description': 'Modulistica siti', '_handlers': [{'_id': 'DEFAULT-SINGLE-STEP', '_type': 'LifecycleManagement', '_configuration': {'step_access': [{'STEP': 'PUBLISH', 'roles': []}]}}, {'_id': 'SDI-Indexer-Plugin', '_type': 'Indexer', '_configuration': {'explicitFieldMapping': [], 'additionalLayers': [{'source': {'url': '...'}, 'toSetTitle': ''}]}}], '_dataAccessPolicies': [{'_policy': {'_read': 'any', '_write': 'own'}, '_roles': []}]}\n",
      "RESPONSE STATUS 500\n",
      "CAUSE \n",
      "<!doctype html><html lang=\"en\"><head><title>HTTP Status 500 ? Internal Server Error</title><style type=\"text/css\">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 ? Internal Server Error</h1><hr class=\"line\" /><p><b>Type</b> Status Report</p><p><b>Message</b> Request failed.</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><hr class=\"line\" /><h3>Apache Tomcat/8.5.39 (Ubuntu)</h3></body></html>\n"
     ]
    },
    {
     "ename": "JSONDecodeError",
     "evalue": "Expecting value: line 1 column 1 (char 0)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mJSONDecodeError\u001b[0m                           Traceback (most recent call last)",
      "Input \u001b[0;32mIn [11]\u001b[0m, in \u001b[0;36m<cell line: 7>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;66;03m# Update in context\u001b[39;00m\n\u001b[1;32m      2\u001b[0m \n\u001b[1;32m      3\u001b[0m \u001b[38;5;66;03m#UCD.update({\"_id\":\"1234\",\"_schema\":{}})\u001b[39;00m\n\u001b[1;32m      4\u001b[0m print_json(data\u001b[38;5;241m=\u001b[39mUCD)\n\u001b[0;32m----> 7\u001b[0m \u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mPOST\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mUCD\u001b[49m\u001b[43m,\u001b[49m\u001b[43mdest\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mucds_endpoint\u001b[49m\u001b[43m)\u001b[49m\n",
      "Input \u001b[0;32mIn [1]\u001b[0m, in \u001b[0;36msend\u001b[0;34m(dest, data, method, params)\u001b[0m\n\u001b[1;32m     41\u001b[0m        \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCAUSE \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m+\u001b[39m\u001b[38;5;28mstr\u001b[39m(response\u001b[38;5;241m.\u001b[39mreason))\n\u001b[1;32m     42\u001b[0m        \u001b[38;5;28mprint\u001b[39m(response\u001b[38;5;241m.\u001b[39mtext)\n\u001b[0;32m---> 43\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloads\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtext\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[0;32m/opt/conda/lib/python3.9/json/__init__.py:346\u001b[0m, in \u001b[0;36mloads\u001b[0;34m(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[1;32m    341\u001b[0m     s \u001b[38;5;241m=\u001b[39m s\u001b[38;5;241m.\u001b[39mdecode(detect_encoding(s), \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msurrogatepass\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m    343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m    344\u001b[0m         parse_int \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m parse_float \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m    345\u001b[0m         parse_constant \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_pairs_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m kw):\n\u001b[0;32m--> 346\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_default_decoder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    347\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m    348\u001b[0m     \u001b[38;5;28mcls\u001b[39m \u001b[38;5;241m=\u001b[39m JSONDecoder\n",
      "File \u001b[0;32m/opt/conda/lib/python3.9/json/decoder.py:337\u001b[0m, in \u001b[0;36mJSONDecoder.decode\u001b[0;34m(self, s, _w)\u001b[0m\n\u001b[1;32m    332\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdecode\u001b[39m(\u001b[38;5;28mself\u001b[39m, s, _w\u001b[38;5;241m=\u001b[39mWHITESPACE\u001b[38;5;241m.\u001b[39mmatch):\n\u001b[1;32m    333\u001b[0m     \u001b[38;5;124;03m\"\"\"Return the Python representation of ``s`` (a ``str`` instance\u001b[39;00m\n\u001b[1;32m    334\u001b[0m \u001b[38;5;124;03m    containing a JSON document).\u001b[39;00m\n\u001b[1;32m    335\u001b[0m \n\u001b[1;32m    336\u001b[0m \u001b[38;5;124;03m    \"\"\"\u001b[39;00m\n\u001b[0;32m--> 337\u001b[0m     obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraw_decode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midx\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_w\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mend\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    338\u001b[0m     end \u001b[38;5;241m=\u001b[39m _w(s, end)\u001b[38;5;241m.\u001b[39mend()\n\u001b[1;32m    339\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m end \u001b[38;5;241m!=\u001b[39m \u001b[38;5;28mlen\u001b[39m(s):\n",
      "File \u001b[0;32m/opt/conda/lib/python3.9/json/decoder.py:355\u001b[0m, in \u001b[0;36mJSONDecoder.raw_decode\u001b[0;34m(self, s, idx)\u001b[0m\n\u001b[1;32m    353\u001b[0m     obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mscan_once(s, idx)\n\u001b[1;32m    354\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[0;32m--> 355\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m JSONDecodeError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpecting value\u001b[39m\u001b[38;5;124m\"\u001b[39m, s, err\u001b[38;5;241m.\u001b[39mvalue) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28mNone\u001b[39m\n\u001b[1;32m    356\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m obj, end\n",
      "\u001b[0;31mJSONDecodeError\u001b[0m: Expecting value: line 1 column 1 (char 0)"
     ]
    }
   ],
   "source": [
    "# Update in context\n",
    "\n",
    "#UCD.update({\"_id\":\"1234\",\"_schema\":{}})\n",
    "print_json(data=UCD)\n",
    "\n",
    "\n",
    "send(method=\"POST\",data=json.dumps(UCD),dest=ucds_endpoint)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "56d75049-c5e0-4daf-b42d-eadad7df9408",
   "metadata": {
    "tags": []
   },
   "source": [
    "# MOSI Records parsing and registration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "047cf782-73d4-4d8c-9275-69eba2573e67",
   "metadata": {},
   "outputs": [],
   "source": [
    "# GPKG support\n",
    "# import fiona\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "bbbcce95-d413-490f-870f-f0442c708987",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: pandas in /opt/conda/lib/python3.9/site-packages (1.4.2)\n",
      "Requirement already satisfied: pytz>=2020.1 in /opt/conda/lib/python3.9/site-packages (from pandas) (2022.1)\n",
      "Requirement already satisfied: python-dateutil>=2.8.1 in /opt/conda/lib/python3.9/site-packages (from pandas) (2.8.2)\n",
      "Requirement already satisfied: numpy>=1.18.5 in /opt/conda/lib/python3.9/site-packages (from pandas) (1.22.3)\n",
      "Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.9/site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)\n"
     ]
    }
   ],
   "source": [
    "!pip install pandas\n",
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "098283ae-7e1a-4c30-bbdd-2ffe26147b7c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['fid', 'TSK', 'CBC', 'ACCE', 'ACCC', 'ACCS', 'AMB', 'AMA', 'OGD', 'OGT',\n",
      "       ...\n",
      "       'FUR', 'CMR', 'CMC', 'CMA', 'ADP', 'NOTE_INT', 'BIBM', 'DOZ', 'GECS',\n",
      "       'APED'],\n",
      "      dtype='object', length=106)\n",
      "GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/GNA-MOSI\n",
      "Data is {\"CD\": {\"TSK\": \"MOSI\", \"CBC\": null, \"ACC\": {\"ACCE\": null, \"ACCC\": \"SABAP-TO_2019_107_0006_a_b\", \"ACCS\": null}}, \"OG\": {\"AMB\": \"archeologico\", \"AMA\": \"archeologia preventiva\", \"OGD\": \"sito pluristratificato\", \"OGT\": \"{}\", \"OGN\": \"a) Belmonte (Valperga-Pertusio-Prascorsano),\\nVersante N (B1), alto versante SE (BE2), sommit\\u00e0 Campass (BE3, BE6), alto versan- te S (BE4), riparo da stacco graniti (?, BE5), estremit\\u00e0 W del colle (BE7); b-c)  Belmonte (Valperga-Pertusio-Prascorsano)\"}, \"LC\": {\"LCS\": \"Italia\", \"LCR\": \"Piemonte\", \"LCP\": \"TO\", \"LCC\": \"Valperga\", \"LCI\": null, \"PVL\": \"Belmonte (Valperga-Pertusio-Prascorsano)\\n\", \"PVZ\": null, \"ACB\": {\"ACBA\": null, \"ACBS\": null}}, \"DT\": {\"DTR\": \"a) Et\\u00e0 del Bronzo medio, fase finale-media Et\\u00e0 del Ferro; b) Et\\u00e0 romana; c) Et\\u00e0 Altomedievale\", \"DTT\": null}, \"DA\": {\"DES\": \"a) Et\\u00e0 del Bronzo medio, fase finale-media Et\\u00e0 del Ferro\\nIl quadro generale che emerge dall\\u2019analisi della distribuzione dei rinvenimenti appare piuttosto articolato, anche considerando che tutti i siti osservati hanno restituito materiali riferibili a un\\u2019unica fase culturale Bronzo Finale - Primo Ferro. I siti BE.1, BE5, BE.6 e parzialmente BE.2 si riferiscono a un villaggio di considerevoli dimensioni localizzato sulla sommit\\u00e0 del colle. Questo, data la morfologia aspra dell\\u2019intera area, appare formato da un agglomerato di gruppi di capanne situate nei numerosi piccoli ripiani della sommit\\u00e0. I due ripari sotto roccia dei siti BE.2 e BE.5 risultano inseriti nell\\u2019abitato e impiegati probabilmente come strutture secondarie per il ricovero di animali, derrate e attrezzi. I depositi dei siti BE.3 e BE.4 sono riferibili ad aree marginali all\\u2019insediamento e contengono livelli consistenti derivanti da discariche di materiali di ogni genere dall\\u2019abitato. Pare significativo che i livelli generati dalle discariche siano contenuti entro vallette e piccoli alvei. Ci\\u00f2 pu\\u00f2 forse sottolineare un massiccio uso di tutti gli spazi utili e la volont\\u00e0 di recuperarne dei nuovi mediante azioni di bonifica. Le ceramiche di Belmonte si riconoscono in un\\u2019unica facies culturale sebbene provengano da siti differenti.\\nTra le forme vascolari, ricorrono con frequenza i vasi a situla con ordini di tacche incise sulla spalla o sul bordo, oppure ordini di impressioni digitali. Cos\\u00ec pure le olle o ollette a gola con decorazioni sul bordo a ordini di tacche incise o impressioni digitali; pi\\u00f9 raramente con linee incise in prossimit\\u00e0 del collo. Inoltre si sono riconosciute ciotole carenate con breve collo a bordo lineare o ciotole emisferiche talvolta con impressioni di tacche incise oppure serie di linee in prossimit\\u00e0 del collo. Frequenti sono anche i vasi biconici con gola e bocca svasata, talvolta finiti molto bene e abbondantemente decorati. Si riscontrano indifferentemente fondi piatti o concavi, mentre i bordi sono di preferenza lineari, praticamente assenti le anse e rarissime le bugne. Gli impasti sono per larga misura rossi o marroni, pi\\u00f9 raramente chiari (grigi o gialli), con degrassante eterometrico abbondante. Le finiture superficiali realizzate mediante lisciatoio rigido sono spesso sommarie. Un piccolo quantitativo di reperti presenta un impasto pi\\u00f9 fine con degrassante omometrico raro e finitura superficiale (lucidatura) particolarmente curata. Sono pure presenti due figurine fittili di suidi sommariamente modellate, numerose fusaiole e pesi da telaio di varie dimensioni.\\nI reperti litici comprendono numerose macine a sella e macinelli, nonch\\u00e9 un\\u2019industria su quarzite e due perline di collana. Particolarmente scarsi i reperti metallici, com- prendono una fibula del tipo \\u00abCertosa\\u00bb e un frammento di lama di falcetto in bronzo. Il repertorio di Belmonte, particolarmente quello riguardante i materiali ceramici, trova confronti significativi con la cultura \\u00abCampi d\\u2019Urne\\u00bb tarda della Fossa del Rodano e del Massiccio Centrale e particolarmente con i siti del lago di Bourget (Savoia), la Grotta des Sarasins, l\\u2019Eschaillon Saint Quentin e Barne Bigou Fontaine (Is\\u00e8re), Chalucet e Fosse de Sous-Clan (Vienne), La Roque Saint Cristophe e Castel R\\u00e9aI (P\\u00e9rigord), les Agnielles (Gap). Nell\\u2019ambiente padano, confronti sono possibili con siti riconoscibili nell\\u2019orizzonte Protogolasecca e Golasecca I (Varese), Chiusa Pesio e Bec Bergiassa (Cuneo), Castellaro di Zignago (La Spezia), La Bessa (Vercelli).\\nSulla base dei confronti \\u00e8 possibile inquadrare il sito di Belmonte nel quadro delle culture del Bronzo Finale alpino, con consistenti riferimenti all\\u2019ambiente francese oltre a quelle con la Padania. Pare altres\\u00ec presente la transizione all\\u2019Et\\u00e0 del Ferro e l\\u2019antica Et\\u00e0 del Ferro con i materiali riconducibili all\\u2019ambito Protogolasecca e Golasecca.\\nL\\u2019abitato di Belmonte sorto nell\\u2019XI secolo a.C., cresce e si sviluppa per 4-5 secoli, quindi inspiegabilmente scompare o si riduce drasticamente, al punto da non lasciare tracce significative della sua esistenza oltre il V secolo a.C. Si esclude infatti la presenza di un grande insediamento nella seconda Et\\u00e0 del Ferro, analogo a quello del Bronzo Finale.\\n\\nb) Aprile 1919) durante escursione al santuario scoperte tombe accanto ad un muricciolo; una di esse era coperta da un tegolone con iscrizione in corsivo Orsicinus; altre tre tombe erano a NW della VI stazione della Via crucis, rivestite di laterizi. Agli inizi di giugno un contadino trov\\u00f2 una pietra iscritta, poi dispersa (rotolata gi\\u00f9 dal monte). cora nel 1919 (?): vari frr. di tegole di cui uno con bollo PRV, entro cartiglio rettango- lare.\\nEstate 1970) scavo di fronte alla cappella del \\\"Cireneo\\\": rinvenuti numerosi ambienti a S e a N di un muro largo 60 cm. A N due ambienti, uno molto grande a W e l'altro in parte scoperto, divisi da un corridoio di m 1,50; nel vano molto grande numerosi frr. ceramici e di pietra ollare e una fossa con molti oggetti di ferro. Rimuovendo il ceppo di castagno affiorarono alcuni oggetti tardo romani.\\nDal grande vano scavato nel 1970: tre monete di Et\\u00e0 costantiniana, un manico di specchio in bronzo, molti frammenti di embrici con decorazione impressa, una fibula di bronzo e una pietra dura (corniola) incisa. Rinvenuta anche numerosa ceramica barbarica.\\n\\nc) Et\\u00e0 Altomedievale (Met\\u00e0 V-VII secolo d.C) \\nRinvenute le strutture di un castrum, racchiuso in un\\u2019area di 2,5 ettari da una cinta muraria articolata in pi\\u00f9 fasi, relative ad un esteso abitato con edifici, perlopi\\u00f9 a pianta rettangolare in pietra e legno, all\\u2019interno dei quali si sono recuperate cospicue quantit\\u00e0 di reperti metallici. Il rinvenimento di un capitello databile all\\u2019VIII d.C. farebbe presumere l\\u2019esistenza di una chiesa collegata ad un insediamento ancora vitale.\\n\\n\\n\", \"OGM\": \"{dati bibliografici, dati di archivio}\"}, \"GE\": {\"GEL\": \"localizzazione fisica\", \"GET\": \"georeferenziazione puntuale\", \"GEP\": \"WGS84\", \"GEC\": {\"GECX\": null, \"GECY\": null}, \"GPT\": \"(rilievo da cartografia senza sopralluogo)\", \"GPM\": \"posizionamento esatto\", \"GPB\": {\"GPBB\": null}}, \"TU\": {\"CDG\": {\"CDGG\": \"dato non disponibile\"}, \"BPT\": \"dato non disponibile\", \"NVC\": {\"NVCT\": null, \"NVCM\": null, \"NVCE\": null, \"NVCP\": null}, \"STU\": {\"STUE\": null, \"STUT\": null, \"STUS\": null}}, \"RE\": {\"RCG\": {\"RCGV\": \"dato non disponibile\", \"RCGD\": \"dato non disponibile\", \"RCGT\": null, \"RCGE\": \"archeologia preventiva\"}, \"MTP\": {\"MTPC\": \"{}\", \"MTPZ\": null}, \"MTZ\": null, \"FOI\": {\"FOIT\": null, \"FOIR\": null, \"FOIA\": null, \"FOIQ\": null, \"FOIF\": null, \"FOIO\": null, \"FOIN\": null}}, \"IP\": {\"IAP\": {\"IAPN\": null, \"IAPR\": null, \"IAPI\": null, \"IAPS\": null}}, \"MT\": {\"MIS\": {\"MISZ\": \"area\", \"MISU\": \"mq\", \"MISM\": 290343.01953125}, \"MTA\": {\"MTAP\": null, \"MTAM\": null, \"MTAX\": null, \"MTAR\": null, \"MTAS\": null}}, \"VR\": {\"VRP\": {\"VRPI\": \"sito pluristratificato di Belmonte\", \"VRPA\": \"buona\", \"VRPV\": null, \"VRPS\": \"potenziale non valutabile\", \"VRPN\": null}, \"VRR\": {\"VRRP\": \"SABAP-TO_2019_107\", \"VRRO\": \"dato non disponibile\", \"VRRR\": null, \"VRRS\": \"dato non disponibile\", \"VRRN\": null}}, \"DO\": {\"FTA\": {\"FTAN\": null, \"FTAX\": \"documentazione allegata\", \"FTAP\": \"fotografia digitale (file)\", \"FTAC\": null}, \"DRA\": {\"DRAN\": null, \"DRAX\": \"documentazione allegata\", \"DRAT\": null, \"DRAC\": null, \"DRAK\": null}, \"FNT\": {\"FNTI\": null, \"FNTX\": \"documentazione allegata\", \"FNTP\": null, \"FNTS\": \"SABAP-TO, fasc. Parco Belmonte, IV, 2\", \"FNTK\": null}, \"BIB\": {\"BIBR\": \"CIMA-FOZZATI-NISBET 1983; CIMA 1984; PEJRANI BARICCO 1986; MICHELETTO 1998, p. 58\", \"BIBX\": \"bibliografia specifica\", \"BIBM\": \"Carta Archeologica SAP, n. 1287073; CIMA M. \\u2013 FOZZATI L. - NISBET R. 1983, Pertusio, Prascorsano, Valperga, loc. Belmonte. Insediamenti del Bron- zo finale e della prima Et\\u00e0 del Ferro, in QuadSAP 1983, 3, pp.174-176; CIMA M. 1984, Pertusio, Prascorsano, Valperga, loc. Belmonte. Insediamenti del Bronzo finale e della prima Et\\u00e0  del Ferro, in QuadSAP 1984, 4, pp.276-279; PEJRANI BARICCO L. 1986, Pertusio - Prascorsano - Valperga (TO), loc. Belmonte. Insediamento di Et\\u00e0 longobarda, in QuadSAP 1986, 5, p.229; MICHELETTO E. 1998, Forme di insediamento tra V e XIII secolo: il contributo dell\\u2019archeologia, in a c. di L. Mercando ed E. Micheletto, Archeologia in Piemonte. L\\u2019Et\\u00e0 medievale, III, Torino, pp. 51-80\\n\\n\", \"BIBN\": null}}, \"CM\": {\"FUR\": \"Ratto, Stefania\", \"CMR\": \"Leonardi, Micaela\", \"CMC\": \"Nardi, Rosanna\", \"CMA\": 2019, \"ADP\": 1}}\n",
      "RESPONSE STATUS 200\n",
      "Registered 626a99c502ad3d3b47050e00\n",
      "GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/GNA-MOSI\n",
      "Data is {\"CD\": {\"TSK\": \"MOSI\", \"CBC\": null, \"ACC\": {\"ACCE\": null, \"ACCC\": \"SABAP-TO_2019_107_00014\", \"ACCS\": null}}, \"OG\": {\"AMB\": \"archeologico\", \"AMA\": \"archeologia preventiva\", \"OGD\": \"insediamento\", \"OGT\": \"{insediamento urbano}\", \"OGN\": \"via Peradotto, F. VIII cat. di Valperga\"}, \"LC\": {\"LCS\": \"Italia\", \"LCR\": \"Piemonte\", \"LCP\": \"TO\", \"LCC\": \"Valperga\", \"LCI\": \"via Peradotto, F. VIII cat. di Valperga\", \"PVL\": null, \"PVZ\": null, \"ACB\": {\"ACBA\": null, \"ACBS\": null}}, \"DT\": {\"DTR\": \"fine Et\\u00e0 del Ferro-inizi Impero\", \"DTT\": null}, \"DA\": {\"DES\": \"Durante i lavori per la costruzione di un edificio, tra i materiali di risulta si scoprirono alcuni reperti fittili. L'ispezione accurata di tutti i fronti di sbancamento port\\u00f2 all'individuazione di depositi antropici dovuti ad una prolungata fase insediativa. Si effettuarono prospezioni che permisero di recuperare frr. di vasi non torniti di impasto grigio, frammenti di argilla depurata chiara, pareti sottili.\", \"OGM\": \"{dati bibliografici, dati di archivio}\"}, \"GE\": {\"GEL\": \"localizzazione fisica\", \"GET\": \"georeferenziazione puntuale\", \"GEP\": \"WGS84\", \"GEC\": {\"GECX\": null, \"GECY\": null}, \"GPT\": \"(rilievo da cartografia senza sopralluogo)\", \"GPM\": \"posizionamento esatto\", \"GPB\": {\"GPBB\": null}}, \"TU\": {\"CDG\": {\"CDGG\": \"dato non disponibile\"}, \"BPT\": \"dato non disponibile\", \"NVC\": {\"NVCT\": null, \"NVCM\": null, \"NVCE\": null, \"NVCP\": null}, \"STU\": {\"STUE\": null, \"STUT\": null, \"STUS\": null}}, \"RE\": {\"RCG\": {\"RCGV\": \"dato non disponibile\", \"RCGD\": \"dato non disponibile\", \"RCGT\": null, \"RCGE\": \"archeologia preventiva\"}, \"MTP\": {\"MTPC\": \"{}\", \"MTPZ\": null}, \"MTZ\": null, \"FOI\": {\"FOIT\": null, \"FOIR\": null, \"FOIA\": null, \"FOIQ\": null, \"FOIF\": null, \"FOIO\": null, \"FOIN\": null}}, \"IP\": {\"IAP\": {\"IAPN\": null, \"IAPR\": null, \"IAPI\": null, \"IAPS\": null}}, \"MT\": {\"MIS\": {\"MISZ\": \"area\", \"MISU\": \"mq\", \"MISM\": 13229.884765625}, \"MTA\": {\"MTAP\": null, \"MTAM\": null, \"MTAX\": null, \"MTAR\": null, \"MTAS\": null}}, \"VR\": {\"VRP\": {\"VRPI\": \"insediamento urbano\", \"VRPA\": \"discreta\", \"VRPV\": null, \"VRPS\": \"potenziale non valutabile\", \"VRPN\": null}, \"VRR\": {\"VRRP\": \"SABAP-TO_2019_107\", \"VRRO\": \"dato non disponibile\", \"VRRR\": null, \"VRRS\": \"dato non disponibile\", \"VRRN\": null}}, \"DO\": {\"FTA\": {\"FTAN\": null, \"FTAX\": \"documentazione allegata\", \"FTAP\": \"fotografia digitale (file)\", \"FTAC\": null}, \"DRA\": {\"DRAN\": null, \"DRAX\": \"documentazione allegata\", \"DRAT\": null, \"DRAC\": null, \"DRAK\": null}, \"FNT\": {\"FNTI\": null, \"FNTX\": \"documentazione allegata\", \"FNTP\": null, \"FNTS\": \"NULLSAP, V, 6 (Valperga), fasc. 5\", \"FNTK\": null}, \"BIB\": {\"BIBR\": \"Carta Archeologica SAP, n. 1287065; CIMA 1988, pp. 97-98 n.4\", \"BIBX\": \"bibliografia specifica\", \"BIBM\": \"CIMA M. 1988, I materiali. Il territorio a N delle Vaude, in Per pagos vicosque 1988, pp. 95-150.\", \"BIBN\": null}}, \"CM\": {\"FUR\": \"Ratto, Stefania\", \"CMR\": \"Leonardi, Micaela\", \"CMC\": \"Nardi, Rosanna\", \"CMA\": 2019, \"ADP\": 1}}\n",
      "RESPONSE STATUS 200\n",
      "Registered 626a99c602ad3d3b47050e01\n",
      "GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/GNA-MOSI\n",
      "Data is {\"CD\": {\"TSK\": \"MOSI\", \"CBC\": null, \"ACC\": {\"ACCE\": null, \"ACCC\": \"LU_MBAC_SBATOS_3524_05/03/2013_061\", \"ACCS\": null}}, \"OG\": {\"AMB\": \"archeologico\", \"AMA\": \"archeologia preventiva\", \"OGD\": \"infrastruttura viaria\", \"OGT\": \"{}\", \"OGN\": \"Tempagnano - Valdottavo\"}, \"LC\": {\"LCS\": \"Italia\", \"LCR\": \"Toscana\", \"LCP\": \"LU\", \"LCC\": \"Lucca\", \"LCI\": null, \"PVL\": null, \"PVZ\": \"(contesto territoriale)\", \"ACB\": {\"ACBA\": \"dato non disponibile\", \"ACBS\": null}}, \"DT\": {\"DTR\": \"et\\u00e0 preromana\", \"DTT\": \"VI-V a.C.\"}, \"DA\": {\"DES\": \"Ad est dell'abitato \\u00e8 stato messo in luce un tratto di massicciata stradale larga m\\n1,50, accuratamente realizzata con ciottoli e frammenti laterizi compattati.\", \"OGM\": \"{dati bibliografici}\"}, \"GE\": {\"GEL\": \"localizzazione fisica\", \"GET\": \"georeferenziazione puntuale\", \"GEP\": \"WGS84\", \"GEC\": {\"GECX\": null, \"GECY\": null}, \"GPT\": \"(rilievo da cartografia senza sopralluogo)\", \"GPM\": null, \"GPB\": {\"GPBB\": null}}, \"TU\": {\"CDG\": {\"CDGG\": \"dato non disponibile\"}, \"BPT\": \"dato non disponibile\", \"NVC\": {\"NVCT\": null, \"NVCM\": null, \"NVCE\": null, \"NVCP\": null}, \"STU\": {\"STUE\": null, \"STUT\": null, \"STUS\": null}}, \"RE\": {\"RCG\": {\"RCGV\": \"dato non disponibile\", \"RCGD\": \"dato non disponibile\", \"RCGT\": null, \"RCGE\": \"archeologia preventiva\"}, \"MTP\": {\"MTPC\": \"{}\", \"MTPZ\": null}, \"MTZ\": null, \"FOI\": {\"FOIT\": null, \"FOIR\": null, \"FOIA\": null, \"FOIQ\": null, \"FOIF\": null, \"FOIO\": null, \"FOIN\": null}}, \"IP\": {\"IAP\": {\"IAPN\": null, \"IAPR\": null, \"IAPI\": null, \"IAPS\": null}}, \"MT\": {\"MIS\": {\"MISZ\": \"area\", \"MISU\": \"mq\", \"MISM\": 976.1494140625}, \"MTA\": {\"MTAP\": null, \"MTAM\": null, \"MTAX\": null, \"MTAR\": null, \"MTAS\": null}}, \"VR\": {\"VRP\": {\"VRPI\": null, \"VRPA\": null, \"VRPV\": null, \"VRPS\": \"potenziale non valutabile\", \"VRPN\": null}, \"VRR\": {\"VRRP\": null, \"VRRO\": \"dato non disponibile\", \"VRRR\": null, \"VRRS\": \"dato non disponibile\", \"VRRN\": null}}, \"DO\": {\"FTA\": {\"FTAN\": null, \"FTAX\": \"documentazione allegata\", \"FTAP\": \"fotografia digitale (file)\", \"FTAC\": null}, \"DRA\": {\"DRAN\": \"T00SG02AMBPL01A\", \"DRAX\": \"documentazione allegata\", \"DRAT\": \"posizionamento topografico\", \"DRAC\": \"LU_MBAC_SABAP_LU_3524_05/03/2013\", \"DRAK\": \"pdf\"}, \"FNT\": {\"FNTI\": \"T00SG02AMBRE01A\", \"FNTX\": \"documentazione allegata\", \"FNTP\": null, \"FNTS\": null, \"FNTK\": \"ALLEGATI/LU_AutostradaA11_Frizzone/T00SG02AMBRE01A.pdf\"}, \"BIB\": {\"BIBR\": null, \"BIBX\": \"bibliografia specifica\", \"BIBM\": null, \"BIBN\": null}}, \"CM\": {\"FUR\": \"Chiarenza, Neva\", \"CMR\": \"De Angeli, Stefano\", \"CMC\": \"Palchetti, Alessandro\", \"CMA\": 2019, \"ADP\": 1}}\n",
      "RESPONSE STATUS 200\n",
      "Registered 626a99c702ad3d3b47050e02\n",
      "GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/GNA-MOSI\n",
      "Data is {\"CD\": {\"TSK\": \"MOSI\", \"CBC\": null, \"ACC\": {\"ACCE\": null, \"ACCC\": \"LU_MBAC_SBATOS_3524_05/03/2013_044\", \"ACCS\": null}}, \"OG\": {\"AMB\": \"archeologico\", \"AMA\": \"archeologia preventiva\", \"OGD\": \"infrastruttura viaria\", \"OGT\": \"{}\", \"OGN\": \"Frizzone\"}, \"LC\": {\"LCS\": \"Italia\", \"LCR\": \"Toscana\", \"LCP\": \"LU\", \"LCC\": \"Capannori\", \"LCI\": null, \"PVL\": null, \"PVZ\": \"(contesto territoriale)\", \"ACB\": {\"ACBA\": \"dato non disponibile\", \"ACBS\": null}}, \"DT\": {\"DTR\": \"et\\u00e0 preistorica-et\\u00e0 romana\", \"DTT\": \"et\\u00e0 del Bronzo-et\\u00e0 tardoantica\"}, \"DA\": {\"DES\": \"Le indagine archeologiche eseguite tra il 2004 e il 2005 hanno permesso l\\u2019individuazione\\ndi due strade glareate, fortemente compromesse dalle opere di bonifica romane e\\nmedievali.\\nBibliografia\", \"OGM\": \"{dati bibliografici}\"}, \"GE\": {\"GEL\": \"localizzazione fisica\", \"GET\": \"georeferenziazione puntuale\", \"GEP\": \"WGS84\", \"GEC\": {\"GECX\": null, \"GECY\": null}, \"GPT\": \"(rilievo da cartografia senza sopralluogo)\", \"GPM\": null, \"GPB\": {\"GPBB\": null}}, \"TU\": {\"CDG\": {\"CDGG\": \"dato non disponibile\"}, \"BPT\": \"dato non disponibile\", \"NVC\": {\"NVCT\": null, \"NVCM\": null, \"NVCE\": null, \"NVCP\": null}, \"STU\": {\"STUE\": null, \"STUT\": null, \"STUS\": null}}, \"RE\": {\"RCG\": {\"RCGV\": \"dato non disponibile\", \"RCGD\": \"dato non disponibile\", \"RCGT\": null, \"RCGE\": \"archeologia preventiva\"}, \"MTP\": {\"MTPC\": \"{}\", \"MTPZ\": null}, \"MTZ\": null, \"FOI\": {\"FOIT\": null, \"FOIR\": null, \"FOIA\": null, \"FOIQ\": null, \"FOIF\": null, \"FOIO\": null, \"FOIN\": null}}, \"IP\": {\"IAP\": {\"IAPN\": null, \"IAPR\": null, \"IAPI\": null, \"IAPS\": null}}, \"MT\": {\"MIS\": {\"MISZ\": \"area\", \"MISU\": \"mq\", \"MISM\": 624.7353515625}, \"MTA\": {\"MTAP\": null, \"MTAM\": null, \"MTAX\": null, \"MTAR\": null, \"MTAS\": null}}, \"VR\": {\"VRP\": {\"VRPI\": null, \"VRPA\": null, \"VRPV\": null, \"VRPS\": \"potenziale non valutabile\", \"VRPN\": null}, \"VRR\": {\"VRRP\": null, \"VRRO\": \"dato non disponibile\", \"VRRR\": null, \"VRRS\": \"dato non disponibile\", \"VRRN\": null}}, \"DO\": {\"FTA\": {\"FTAN\": null, \"FTAX\": \"documentazione allegata\", \"FTAP\": \"fotografia digitale (file)\", \"FTAC\": null}, \"DRA\": {\"DRAN\": \"T00SG02AMBPL01A\", \"DRAX\": \"documentazione allegata\", \"DRAT\": \"posizionamento topografico\", \"DRAC\": \"LU_MBAC_SABAP_LU_3524_05/03/2013\", \"DRAK\": \"pdf\"}, \"FNT\": {\"FNTI\": \"T00SG02AMBRE01A\", \"FNTX\": \"documentazione allegata\", \"FNTP\": null, \"FNTS\": null, \"FNTK\": \"ALLEGATI/LU_AutostradaA11_Frizzone/T00SG02AMBRE01A.pdf\"}, \"BIB\": {\"BIBR\": null, \"BIBX\": \"bibliografia specifica\", \"BIBM\": \"Ciampoltrini G., \\u201cAspetti dell'insediamento etrusco nella valle del Serchio: il V sec. a.C.\\u201d,\\nin Studi Etruschi LIX, 1994\\nZecchini M., Lucca etrusca. Abitati, necropoli, luoghi di culto, Lucca 1999\\nAndreotti A., Zanini A., \\u201cL'insediamento di Fossa Ne\", \"BIBN\": null}}, \"CM\": {\"FUR\": \"Chiarenza, Neva\", \"CMR\": \"De Angeli, Stefano\", \"CMC\": \"Palchetti, Alessandro\", \"CMA\": 2019, \"ADP\": 1}}\n",
      "RESPONSE STATUS 200\n",
      "Registered 626a99c702ad3d3b47050e03\n",
      "GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/GNA-MOSI\n",
      "Data is {\"CD\": {\"TSK\": \"MOSI\", \"CBC\": null, \"ACC\": {\"ACCE\": null, \"ACCC\": \"LU_MBAC_SBATOS_3524_05/03/2013_039\", \"ACCS\": null}}, \"OG\": {\"AMB\": \"archeologico\", \"AMA\": \"archeologia preventiva\", \"OGD\": \"ritrovamento sporadico\", \"OGT\": \"{epigrafe}\", \"OGN\": \"Castelvecchio - Villa Ravano\"}, \"LC\": {\"LCS\": \"Italia\", \"LCR\": \"Toscana\", \"LCP\": \"LU\", \"LCC\": \"Capannori\", \"LCI\": null, \"PVL\": null, \"PVZ\": \"(contesto suburbano)\", \"ACB\": {\"ACBA\": \"dato non disponibile\", \"ACBS\": null}}, \"DT\": {\"DTR\": \"et\\u00e0 romana \", \"DTT\": \"I d.C.\"}, \"DA\": {\"DES\": \"Circa a 1km a N di Castelvecchio nel 1953 fu scoperta casualmente nel giardino della villa una stele (147x58x11) funeraria in marmo con iscrizione del I d.C.\", \"OGM\": \"{dati bibliografici}\"}, \"GE\": {\"GEL\": \"localizzazione fisica\", \"GET\": \"georeferenziazione puntuale\", \"GEP\": \"WGS84\", \"GEC\": {\"GECX\": null, \"GECY\": null}, \"GPT\": \"(rilievo da cartografia senza sopralluogo)\", \"GPM\": \"posizionamento approssimato\", \"GPB\": {\"GPBB\": null}}, \"TU\": {\"CDG\": {\"CDGG\": \"dato non disponibile\"}, \"BPT\": \"dato non disponibile\", \"NVC\": {\"NVCT\": null, \"NVCM\": null, \"NVCE\": null, \"NVCP\": null}, \"STU\": {\"STUE\": null, \"STUT\": null, \"STUS\": null}}, \"RE\": {\"RCG\": {\"RCGV\": \"dato non disponibile\", \"RCGD\": \"dato non disponibile\", \"RCGT\": null, \"RCGE\": \"archeologia preventiva\"}, \"MTP\": {\"MTPC\": \"{}\", \"MTPZ\": null}, \"MTZ\": null, \"FOI\": {\"FOIT\": null, \"FOIR\": null, \"FOIA\": null, \"FOIQ\": null, \"FOIF\": null, \"FOIO\": null, \"FOIN\": null}}, \"IP\": {\"IAP\": {\"IAPN\": null, \"IAPR\": null, \"IAPI\": null, \"IAPS\": null}}, \"MT\": {\"MIS\": {\"MISZ\": \"area\", \"MISU\": \"mq\", \"MISM\": 11996.62890625}, \"MTA\": {\"MTAP\": null, \"MTAM\": null, \"MTAX\": null, \"MTAR\": null, \"MTAS\": null}}, \"VR\": {\"VRP\": {\"VRPI\": \"sito non interpretabile\", \"VRPA\": \"scarsa\", \"VRPV\": null, \"VRPS\": \"potenziale non valutabile\", \"VRPN\": null}, \"VRR\": {\"VRRP\": \"LU_MBAC_SBATOS_3524_05/03/2013\", \"VRRO\": \"dato non disponibile\", \"VRRR\": null, \"VRRS\": \"dato non disponibile\", \"VRRN\": null}}, \"DO\": {\"FTA\": {\"FTAN\": null, \"FTAX\": \"documentazione allegata\", \"FTAP\": \"fotografia digitale (file)\", \"FTAC\": null}, \"DRA\": {\"DRAN\": null, \"DRAX\": \"documentazione allegata\", \"DRAT\": null, \"DRAC\": \"LU_MBAC_SABAP_LU_3524_05/03/2013\", \"DRAK\": null}, \"FNT\": {\"FNTI\": \"T00SG02AMBRE01A\", \"FNTX\": \"documentazione allegata\", \"FNTP\": null, \"FNTS\": null, \"FNTK\": \"ALLEGATI/LU_AutostradaA11_Frizzone/T00SG02AMBRE01A.pdf\"}, \"BIB\": {\"BIBR\": null, \"BIBX\": \"bibliografia specifica\", \"BIBM\": \"Mencacci P., Zecchini M., Lucca romana, Lucca, 1981, p. 200.\", \"BIBN\": null}}, \"CM\": {\"FUR\": \"Chiarenza, Neva\", \"CMR\": \"De Angeli, Stefano\", \"CMC\": \"Palchetti, Alessandro\", \"CMA\": 2019, \"ADP\": 1}}\n",
      "RESPONSE STATUS 200\n",
      "Registered 626a99c702ad3d3b47050e04\n",
      "GOING TO SEND POST REQUEST TO https://geoportal.dev.int.d4science.net/geoportal-service/srv/projects/GNA-MOSI\n",
      "Data is {\"CD\": {\"TSK\": \"MOSI\", \"CBC\": null, \"ACC\": {\"ACCE\": null, \"ACCC\": \"LU_MBAC_SBATOS_3524_05/03/2013_045\", \"ACCS\": null}}, \"OG\": {\"AMB\": \"archeologico\", \"AMA\": \"archeologia preventiva\", \"OGD\": \"sito pluristratificato\", \"OGT\": \"{}\", \"OGN\": \"Pozzuolo\"}, \"LC\": {\"LCS\": \"Italia\", \"LCR\": \"Toscana\", \"LCP\": \"LU\", \"LCC\": \"Lucca\", \"LCI\": null, \"PVL\": null, \"PVZ\": \"(contesto territoriale)\", \"ACB\": {\"ACBA\": \"dato non disponibile\", \"ACBS\": null}}, \"DT\": {\"DTR\": \"et\\u00e0 preromana\", \"DTT\": \"VI-III a.C.\"}, \"DA\": {\"DES\": \"L'abitato etrusco \\u00e8 stato individuato casualmente nel 1984, in occasione di lavori di scavo per un acquedotto. L'azione dei mezzi meccanici, che aprirono un profondo scavo sulla cima del rilievo, provoc\\u00f2 la distruzione di gran parte dei sedimenti archeologici relativi all'insediamento pi\\u00f9 antico, dell'et\\u00e0 tardo arcaica e classica, documentato dai reperti ceramici recuperati in seguito. Un saggio di scavo, effettuato nell'autunno 1985, permise invece di indagare una porzione del successivo abitato di et\\u00e0 ellenistica. L'insediamento pi\\u00f9 antico (fine VI V sec. a.C.) venne impiantato su un versante della collina regolarizzato con tagli e livellamenti artificiali della roccia scistosa di base. Le abitazioni dovevano essere semplici capanne con struttura lignea e rivestimento di argilla impastata con pietrisco. Tra i reperti recuperati, sono presenti frammenti ceramici con brevi iscrizioni in caratteri etruschi, indizio di una certa diffusione della scrittura che, in questa epoca, nell'area lucchese, pare caratterizzare solo gli insediamenti di altura. Agli inizi del III secolo a.C., con un'ampia opera di livellamento, il sito venne nuovamente occupato. Le abitazioni erano realizzate ancora con legno e argilla impastata, ma nelle coperture comincia a diffondersi anche l'uso di laterizi. Di notevole interesse \\u00e8 il ritrovamento di un tesoretto di otto monete d'argento che furono perdute, o deliberatamente nascoste, nell'abitato: tre esemplari con la raffigurazione dell'ippocampo che nuota tra delfini, e quattro con la raffigurazione del cigno, che potrebbe alludere alle lagune costiere\", \"OGM\": \"{dati bibliografici}\"}, \"GE\": {\"GEL\": \"localizzazione fisica\", \"GET\": \"georeferenziazione puntuale\", \"GEP\": \"WGS84\", \"GEC\": {\"GECX\": null, \"GECY\": null}, \"GPT\": \"(rilievo da cartografia senza sopralluogo)\", \"GPM\": \"posizionamento approssimato\", \"GPB\": {\"GPBB\": null}}, \"TU\": {\"CDG\": {\"CDGG\": \"dato non disponibile\"}, \"BPT\": \"dato non disponibile\", \"NVC\": {\"NVCT\": null, \"NVCM\": null, \"NVCE\": null, \"NVCP\": null}, \"STU\": {\"STUE\": null, \"STUT\": null, \"STUS\": null}}, \"RE\": {\"RCG\": {\"RCGV\": \"dato non disponibile\", \"RCGD\": \"dato non disponibile\", \"RCGT\": null, \"RCGE\": \"archeologia preventiva\"}, \"MTP\": {\"MTPC\": \"{}\", \"MTPZ\": null}, \"MTZ\": null, \"FOI\": {\"FOIT\": null, \"FOIR\": null, \"FOIA\": null, \"FOIQ\": null, \"FOIF\": null, \"FOIO\": null, \"FOIN\": null}}, \"IP\": {\"IAP\": {\"IAPN\": null, \"IAPR\": null, \"IAPI\": null, \"IAPS\": null}}, \"MT\": {\"MIS\": {\"MISZ\": \"area\", \"MISU\": \"mq\", \"MISM\": 24036.017578125}, \"MTA\": {\"MTAP\": null, \"MTAM\": null, \"MTAX\": null, \"MTAR\": null, \"MTAS\": null}}, \"VR\": {\"VRP\": {\"VRPI\": \"abitato etrusco\", \"VRPA\": \"discreta\", \"VRPV\": null, \"VRPS\": \"potenziale non valutabile\", \"VRPN\": null}, \"VRR\": {\"VRRP\": \"LU_MBAC_SBATOS_3524_05/03/2013\", \"VRRO\": \"dato non disponibile\", \"VRRR\": null, \"VRRS\": \"dato non disponibile\", \"VRRN\": null}}, \"DO\": {\"FTA\": {\"FTAN\": null, \"FTAX\": \"documentazione allegata\", \"FTAP\": \"fotografia digitale (file)\", \"FTAC\": null}, \"DRA\": {\"DRAN\": \"T00SG02AMBPL01A\", \"DRAX\": \"documentazione allegata\", \"DRAT\": \"posizionamento topografico\", \"DRAC\": \"LU_MBAC_SABAP_LU_3524_05/03/2013\", \"DRAK\": \"pdf\"}, \"FNT\": {\"FNTI\": \"T00SG02AMBRE01A\", \"FNTX\": \"documentazione allegata\", \"FNTP\": null, \"FNTS\": null, \"FNTK\": \"ALLEGATI/LU_AutostradaA11_Frizzone/T00SG02AMBRE01A.pdf\"}, \"BIB\": {\"BIBR\": null, \"BIBX\": \"bibliografia specifica\", \"BIBM\": \"Ciampoltrini G., \\u201cAspetti dell'insediamento etrusco nella valle del Serchio: il V sec. a.C.\\u201d, in Studi Etruschi LIX, 1994; Ciampoltrini G., Zecchini M., \\u201cUn insediamento etrusco di et\\u00e0 ellenistica sul versante lucchese\\u201d, in Paribeni E. (a cura di), Et\", \"BIBN\": null}}, \"CM\": {\"FUR\": \"Chiarenza, Neva\", \"CMR\": \"De Angeli, Stefano\", \"CMC\": \"Palchetti, Alessandro\", \"CMA\": 2019, \"ADP\": 1}}\n",
      "RESPONSE STATUS 200\n",
      "Registered 626a99c802ad3d3b47050e05\n"
     ]
    }
   ],
   "source": [
    "# creating a data frame\n",
    "df = pd.read_csv(\"MOSI_multipolygon_templateIta.csv\",delimiter = \",\")    \n",
    "for row in df.itertuples():\n",
    "        mosi={\n",
    "      \"CD\" : {\n",
    "        \"TSK\" : row.TSK,\n",
    "          #SIGEC Web fields... ask Mibac\n",
    "#        \"CMD\" : row.CMD,\n",
    "#        \"ESC\" : row.ESC,\n",
    "#        \"ECP\" : row.ECP,\n",
    "        \"CBC\" : row.CBC,\n",
    "        \"ACC\" : {\n",
    "          \"ACCE\" : row.ACCE,\n",
    "          \"ACCC\" : row.ACCC,\n",
    "          \"ACCS\" : row.ACCS\n",
    "        }\n",
    "      },\n",
    "      \"OG\" : {\n",
    "        \"AMB\" : row.AMB,\n",
    "        \"AMA\" : row.AMA,\n",
    "        \"OGD\": row.OGD,\n",
    "        \"OGT\" : row.OGT,\n",
    "        \"OGN\" : row.OGN\n",
    "      },\n",
    "      \"LC\" : {\n",
    "        \"LCS\" : row.LCS,\n",
    "        \"LCR\" : row.LCR,\n",
    "        \"LCP\" : row.LCP,\n",
    "        \"LCC\" : row.LCC,\n",
    "        \"LCI\" : row.LCI,\n",
    "        \"PVL\" : row.PVL,\n",
    "        \"PVZ\" : row.PVZ,\n",
    "        \"ACB\" : {\n",
    "          \"ACBA\" : row.ACBA,\n",
    "          \"ACBS\" : row.ACBS\n",
    "        }\n",
    "      },\n",
    "      \"DT\" : {\n",
    "        \"DTR\" : row.DTR,\n",
    "        \"DTT\" : row.DTT\n",
    "      },\n",
    "      \"DA\" : {\n",
    "        \"DES\" : row.DES,\n",
    "        \"OGM\": row.OGM\n",
    "      },\n",
    "      \"GE\" : {\n",
    "        \"GEL\" : row.GEL,\n",
    "        \"GET\" : row.GET,\n",
    "        \"GEP\" : row.GEP,\n",
    "        \"GEC\" : {\n",
    "          \"GECX\" : row.GECX,\n",
    "          \"GECY\" : row.GECY\n",
    "        },\n",
    "        \"GPT\": row.GPT,\n",
    "        \"GPM\": row.GPM,\n",
    "        \"GPB\" : {\n",
    "          \"GPBB\" : row.GPBB\n",
    "        }\n",
    "      },\n",
    "      \"TU\" : {\n",
    "        \"CDG\": {\n",
    "          \"CDGG\": row.CDGG\n",
    "        },\n",
    "        \"BPT\" : row.BPT,\n",
    "        \"NVC\": {\n",
    "          \"NVCT\" : row.NVCT,\n",
    "          \"NVCM\" : row.NVCM,\n",
    "          \"NVCE\" : row.NVCE,\n",
    "          \"NVCP\" : row.NVCP,\n",
    "            \n",
    "            # Not found in csv\n",
    "#          \"NWCN\" : row.NWCN\n",
    "        },\n",
    "        \"STU\":{\n",
    "          \"STUE\" : row.STUE,\n",
    "          \"STUT\" : row.STUT,\n",
    "          \"STUS\" : row.STUS\n",
    "        }\n",
    "      },\n",
    "      \"RE\" : {\n",
    "        \"RCG\": {\n",
    "          \"RCGV\" : row.RCGV,\n",
    "          \"RCGD\" : row.RCGD,\n",
    "          \"RCGT\" : row.RCGT,\n",
    "          \"RCGE\" : row.RCGE\n",
    "        },\n",
    "        \"MTP\" : {\n",
    "          \"MTPC\": row.MTPC,\n",
    "          \"MTPZ\" : row.MTPZ\n",
    "        },\n",
    "        \"MTZ\" : row.MTZ,\n",
    "        \"FOI\" : {\n",
    "          \"FOIT\" : row.FOIT,\n",
    "          \"FOIR\" : row.FOIR,\n",
    "          \"FOIA\" : row.FOIA,\n",
    "          \"FOIQ\" : row.FOIQ,\n",
    "          \"FOIF\" : row.FOIF,\n",
    "          \"FOIO\" : row.FOIO,\n",
    "          \"FOIN\" : row.FOIN\n",
    "        }\n",
    "      },\n",
    "      \"IP\" : {\n",
    "        \"IAP\" : {\n",
    "          \"IAPN\" : row.IAPN,\n",
    "          \"IAPR\" : row.IAPR,\n",
    "          \"IAPI\" : row.IAPI,\n",
    "          \"IAPS\" : row.IAPS\n",
    "        }\n",
    "      },\n",
    "      \"MT\" : {\n",
    "        \"MIS\" : {\n",
    "          \"MISZ\" : row.MISZ,\n",
    "          \"MISU\" : row.MISU,\n",
    "          \"MISM\" : row.MISM\n",
    "        },\n",
    "        \"MTA\" : {\n",
    "          \"MTAP\" : row.MTAP,\n",
    "          \"MTAM\" : row.MTAM,\n",
    "          \"MTAX\" : row.MTAX,\n",
    "          \"MTAR\" : row.MTAR,\n",
    "          \"MTAS\" : row.MTAS\n",
    "        }\n",
    "      },\n",
    "      \"VR\" : {\n",
    "        \"VRP\" : {\n",
    "          \"VRPI\" : row.VRPI,\n",
    "          \"VRPA\" : row.VRPA,\n",
    "          \"VRPV\" : row.VRPV,\n",
    "          \"VRPS\" : row.VRPS,\n",
    "          \"VRPN\" : row.VRPN\n",
    "        },\n",
    "        \"VRR\" : {\n",
    "          \"VRRP\" : row.VRRP,\n",
    "          \"VRRO\" : row.VRRO,\n",
    "          \"VRRR\" : row.VRRR,\n",
    "          \"VRRS\" : row.VRRS,\n",
    "          \"VRRN\" : row.VRRN\n",
    "        }\n",
    "      },\n",
    "      \"DO\" : {\n",
    "        \"FTA\" : {\n",
    "          \"FTAN\" : row.FTAN,\n",
    "          \"FTAX\" : row.FTAX,\n",
    "          \"FTAP\" : row.FTAP,\n",
    "          \"FTAC\" : row.FTAC\n",
    "        },\n",
    "        \"DRA\" : {\n",
    "          \"DRAN\" : row.DRAN,\n",
    "          \"DRAX\" : row.DRAX,\n",
    "          \"DRAT\" : row.DRAT,\n",
    "          \"DRAC\" : row.DRAC,\n",
    "          \"DRAK\" : row.DRAK\n",
    "        },\n",
    "        \"FNT\" : {\n",
    "          \"FNTI\" : row.FNTI,\n",
    "          \"FNTX\" : row.FNTX,\n",
    "          \"FNTP\" : row.FNTP,\n",
    "          \"FNTS\" : row.FNTS,\n",
    "          \"FNTK\" : row.FNTK\n",
    "        },\n",
    "        \"BIB\" : {\n",
    "          \"BIBR\" : row.BIBR,\n",
    "          \"BIBX\" : row.BIBX,\n",
    "          \"BIBM\" : row.BIBM,\n",
    "          \"BIBN\" : row.BIBN\n",
    "        }\n",
    "      },\n",
    "      \"CM\" : {\n",
    "        \"FUR\" : row.FUR,\n",
    "        \"CMR\" : row.CMR,\n",
    "        \"CMC\" : row.CMC,\n",
    "        \"CMA\" : row.CMA,\n",
    "        \"ADP\" : row.ADP\n",
    "      }\n",
    "    }\n",
    "        mosi = send(method=\"POST\",data=json.dumps(mosi,ignore_nan=True),dest=projects_endpoint)\n",
    "        print(\"Registered \"+mosi[\"_id\"])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7524bde6-b944-4cbc-af96-1b99b5f007a9",
   "metadata": {},
   "source": [
    "## MOSI Record publication\n",
    "\n",
    "Set <strong>PUBLISHING = True</strong> below to activate this section."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "d7ba9d88-4ee3-41ff-9a28-147ad320954e",
   "metadata": {},
   "outputs": [],
   "source": [
    "PUBLISH=True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "fe62e187-22a0-4f77-9162-f42545329462",
   "metadata": {},
   "outputs": [],
   "source": [
    "#Get all existing MOSI\n",
    "existing=send(method=\"GET\",dest=projects_endpoint)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "16cbb048-05f0-490d-8546-7b53d29773b8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "626a99c502ad3d3b47050e00 a) Belmonte (Valperga-Pertusio-Prascorsano),\n",
      "Versante N (B1), alto versante SE (BE2), sommità Campass (BE3, BE6), alto versan- te S (BE4), riparo da stacco graniti (?, BE5), estremità W del colle (BE7); b-c)  Belmonte (Valperga-Pertusio-Prascorsano)\n",
      "626a99c602ad3d3b47050e01 via Peradotto, F. VIII cat. di Valperga\n",
      "626a99c702ad3d3b47050e02 Tempagnano - Valdottavo\n",
      "626a99c702ad3d3b47050e03 Frizzone\n",
      "626a99c702ad3d3b47050e04 Castelvecchio - Villa Ravano\n",
      "626a99c802ad3d3b47050e05 Pozzuolo\n"
     ]
    }
   ],
   "source": [
    "for r in existing :\n",
    "    print(r['_id']+\" \"+r['_theDocument']['OG']['OGN'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "9bb1a25c-606d-4094-b91f-757bf06260d1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data is {\"stepID\": \"PUBLISH\"}\n",
      "Data is {\"stepID\": \"PUBLISH\"}\n",
      "Data is {\"stepID\": \"PUBLISH\"}\n",
      "Data is {\"stepID\": \"PUBLISH\"}\n",
      "Data is {\"stepID\": \"PUBLISH\"}\n",
      "Data is {\"stepID\": \"PUBLISH\"}\n"
     ]
    }
   ],
   "source": [
    "verbose = False \n",
    "if PUBLISH : \n",
    "    STEPrequest={\"stepID\" : \"PUBLISH\"}\n",
    "    for r in existing:\n",
    "        send(method=\"POST\",data=json.dumps(STEPrequest),dest=projects_endpoint+\"/step/\"+r['_id'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "83094d4c-a85c-4748-93b0-b8e926789bf6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "626a99c502ad3d3b47050e00 {\"_phase\": \"DRAFT\", \"_lastInvokedStep\": \"PUBLISH\", \"_lastOperationStatus\": \"ERROR\", \"_errorMessages\": [\"No Configuration found for SDI-Default-Materializer in GNA-MOSI\"], \"_warningMessages\": [], \"_triggeredEvents\": [], \"_notes\": null}\n",
      "626a99c602ad3d3b47050e01 {\"_phase\": \"DRAFT\", \"_lastInvokedStep\": \"PUBLISH\", \"_lastOperationStatus\": \"ERROR\", \"_errorMessages\": [\"No Configuration found for SDI-Default-Materializer in GNA-MOSI\"], \"_warningMessages\": [], \"_triggeredEvents\": [], \"_notes\": null}\n",
      "626a99c702ad3d3b47050e02 {\"_phase\": \"DRAFT\", \"_lastInvokedStep\": \"PUBLISH\", \"_lastOperationStatus\": \"ERROR\", \"_errorMessages\": [\"No Configuration found for SDI-Default-Materializer in GNA-MOSI\"], \"_warningMessages\": [], \"_triggeredEvents\": [], \"_notes\": null}\n",
      "626a99c702ad3d3b47050e03 {\"_phase\": \"DRAFT\", \"_lastInvokedStep\": \"PUBLISH\", \"_lastOperationStatus\": \"ERROR\", \"_errorMessages\": [\"No Configuration found for SDI-Default-Materializer in GNA-MOSI\"], \"_warningMessages\": [], \"_triggeredEvents\": [], \"_notes\": null}\n",
      "626a99c702ad3d3b47050e04 {\"_phase\": \"DRAFT\", \"_lastInvokedStep\": \"PUBLISH\", \"_lastOperationStatus\": \"ERROR\", \"_errorMessages\": [\"No Configuration found for SDI-Default-Materializer in GNA-MOSI\"], \"_warningMessages\": [], \"_triggeredEvents\": [], \"_notes\": null}\n",
      "626a99c802ad3d3b47050e05 {\"_phase\": \"DRAFT\", \"_lastInvokedStep\": \"PUBLISH\", \"_lastOperationStatus\": \"ERROR\", \"_errorMessages\": [\"No Configuration found for SDI-Default-Materializer in GNA-MOSI\"], \"_warningMessages\": [], \"_triggeredEvents\": [], \"_notes\": null}\n"
     ]
    }
   ],
   "source": [
    "for r in send(method=\"GET\",dest=projects_endpoint) : \n",
    "    info = r['_lifecycleInformation']\n",
    "    if info['_lastOperationStatus'] != \"OK\" :\n",
    "        print(r['_id']+\" \"+json.dumps(info))\n",
    "    else : print(r['_id']+\" \"+info['_lastOperationStatus'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fcf05cb9-e019-406f-bb1b-4448bd895596",
   "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
