{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from seeq import spy\n",
    "import pandas as pd\n",
    "\n",
    "# Set the compatibility option so that you maximize the chance that SPy will remain compatible with your notebook/script\n",
    "spy.options.compatibility = 193"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Logged in to <strong>http://localhost:34216</strong> as <strong>agent_api_key</strong>.<br>Seeq Server Version: <strong>R66.0.0-SNAPSHOT</strong><br>Seeq SDK Module Version: <strong>66.0.0</strong> @ C:\\git\\crab\\sdk\\pypi\\seeq\\sdk<br>Seeq SPy Module Version: <strong>193.0</strong> @ C:\\git\\crab\\sdk\\pypi\\seeq\\spy</div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Log into Seeq Server if you're not using Seeq Data Lab:\n",
    "spy.login(url='http://localhost:34216', credentials_file='../credentials.key', force=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# spy.push\n",
    "\n",
    "Uploads signals, conditions, scalars, and assets to the Seeq Server.\n",
    "\n",
    "There are two main types of information processed by Seeq: _Data_ and _metadata_:\n",
    "\n",
    "- **Data** is the time series and time interval information that is either collected or derived from sensor data. It consists of timestamps and values (samples), or time intervals and properties (capsules). This data can be plotted on a trend or used to train a neural network, for example.\n",
    "\n",
    "- **Metadata** is the information about the data, that is independent of a particular point in time or time interval. For example, a signal's _name_, _description_ and _unit of measure_ is classified as metadata; or the formula that is used to derive a new signal from one or more source signals; or the asset tree that is used to model similar equipment or industrial processes.\n",
    "\n",
    "The `spy.push()` command allows you to upload both types of information to Seeq Server. When you push _metadata_, you make entries in Seeq's data index, which allows you or other users to search for and find such entries. If you also push _data_, then samples or capsules or scalars will appear when the user selects those index entries for inclusion on a trend, scatter plot, scorecard or other visualization."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "spy.push(data=None, metadata=None, item_type=None, workbook='Data Lab >> Data Lab Analysis',\n",
    "         worksheet='From Data Lab', datasource=None, archive=False, type_mismatches='raise', errors='catalog')\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Workbook scoping\n",
    "\n",
    "When you push any type of data, it is only available/discoverable within the workbook specified by the `workbook` argument. This allows you to _sandbox_ your activity by default, and only publish to your colleagues later when your experimentation is largely over."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Pushing signal data\n",
    "\n",
    "The simplest activity you can do with the `spy.push()` command is to read in a CSV file using Pandas and push it into Seeq. It will be stored in Seeq's internal time series database."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>BITDEP(ft)</th>\n",
       "      <th>BLOCKCOMP(ft)</th>\n",
       "      <th>DEP_RTN(ft)</th>\n",
       "      <th>DEPTH(ft)</th>\n",
       "      <th>FLOWIN(USgal/min)</th>\n",
       "      <th>FLOWOUTPC(%)</th>\n",
       "      <th>ROP_AVG(ft/h)</th>\n",
       "      <th>DIFP(psi)</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>TIME(unitless)</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-07-25 23:00:01-06:00</th>\n",
       "      <td>4630.217</td>\n",
       "      <td>74.813</td>\n",
       "      <td>4627.0</td>\n",
       "      <td>4630.217</td>\n",
       "      <td>799.857</td>\n",
       "      <td>40.799</td>\n",
       "      <td>142.698</td>\n",
       "      <td>454.214</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-25 23:00:03-06:00</th>\n",
       "      <td>4630.354</td>\n",
       "      <td>74.735</td>\n",
       "      <td>4627.5</td>\n",
       "      <td>4630.354</td>\n",
       "      <td>799.857</td>\n",
       "      <td>40.576</td>\n",
       "      <td>142.698</td>\n",
       "      <td>481.383</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-25 23:00:05-06:00</th>\n",
       "      <td>4630.470</td>\n",
       "      <td>74.619</td>\n",
       "      <td>4627.5</td>\n",
       "      <td>4630.470</td>\n",
       "      <td>799.857</td>\n",
       "      <td>39.929</td>\n",
       "      <td>142.698</td>\n",
       "      <td>487.502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-25 23:00:07-06:00</th>\n",
       "      <td>4630.588</td>\n",
       "      <td>74.501</td>\n",
       "      <td>4627.5</td>\n",
       "      <td>4630.588</td>\n",
       "      <td>799.857</td>\n",
       "      <td>40.305</td>\n",
       "      <td>210.705</td>\n",
       "      <td>561.480</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-25 23:00:09-06:00</th>\n",
       "      <td>4630.699</td>\n",
       "      <td>74.390</td>\n",
       "      <td>4627.5</td>\n",
       "      <td>4630.699</td>\n",
       "      <td>799.292</td>\n",
       "      <td>40.245</td>\n",
       "      <td>210.705</td>\n",
       "      <td>610.968</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           BITDEP(ft)  BLOCKCOMP(ft)  DEP_RTN(ft)  DEPTH(ft)  \\\n",
       "TIME(unitless)                                                                 \n",
       "2018-07-25 23:00:01-06:00    4630.217         74.813       4627.0   4630.217   \n",
       "2018-07-25 23:00:03-06:00    4630.354         74.735       4627.5   4630.354   \n",
       "2018-07-25 23:00:05-06:00    4630.470         74.619       4627.5   4630.470   \n",
       "2018-07-25 23:00:07-06:00    4630.588         74.501       4627.5   4630.588   \n",
       "2018-07-25 23:00:09-06:00    4630.699         74.390       4627.5   4630.699   \n",
       "\n",
       "                           FLOWIN(USgal/min)  FLOWOUTPC(%)  ROP_AVG(ft/h)  \\\n",
       "TIME(unitless)                                                              \n",
       "2018-07-25 23:00:01-06:00            799.857        40.799        142.698   \n",
       "2018-07-25 23:00:03-06:00            799.857        40.576        142.698   \n",
       "2018-07-25 23:00:05-06:00            799.857        39.929        142.698   \n",
       "2018-07-25 23:00:07-06:00            799.857        40.305        210.705   \n",
       "2018-07-25 23:00:09-06:00            799.292        40.245        210.705   \n",
       "\n",
       "                           DIFP(psi)  \n",
       "TIME(unitless)                        \n",
       "2018-07-25 23:00:01-06:00    454.214  \n",
       "2018-07-25 23:00:03-06:00    481.383  \n",
       "2018-07-25 23:00:05-06:00    487.502  \n",
       "2018-07-25 23:00:07-06:00    561.480  \n",
       "2018-07-25 23:00:09-06:00    610.968  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import csv\n",
    "csv_file = pd.read_csv('Support Files/csv_import_example.csv', parse_dates=['TIME(unitless)'], index_col='TIME(unitless)')\n",
    "csv_file.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "When you want to push data, it must have an index with a datetime data type. That's why we used the `parse_dates` and `index_col` arguments for `Pandas.read_csv()`.\n",
    "\n",
    "Now you can just push it into Seeq:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Pushed successfully to datasource <strong>Seeq Data Lab [Datasource ID: Seeq Data Lab]</strong> and scoped to workbook ID <strong>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</strong><br>Click the following link to see what you pushed in Seeq:<br><a href=\"http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66\" target=\"_blank\">http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66</a></div><table class=\"tex2jax_ignore\" style=\"color:black;\"><tr><td style=\"background-color: #EEFFEE;\"></td><td style=\"background-color: #EEFFEE; text-align: right;\">Count</td><td style=\"background-color: #EEFFEE; text-align: right;\">Pages</td><td style=\"background-color: #EEFFEE; text-align: left;\">Result</td><td style=\"background-color: #EEFFEE; text-align: right;\">Time</td><td style=\"background-color: #EEFFEE; text-align: left;\">Type</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">BITDEP(ft)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.44</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">BLOCKCOMP(ft)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.23</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">DEP_RTN(ft)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.46</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">DEPTH(ft)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.58</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">FLOWIN(USgal/min)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.41</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">FLOWOUTPC(%)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.34</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">ROP_AVG(ft/h)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.33</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">DIFP(psi)</td><td style=\"text-align: right; vertical-align: top;\">11485</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td><td style=\"vertical-align: top;\">00:00:00.28</td><td style=\"text-align: left; vertical-align: top;\">StoredSignal</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Push Count</th>\n",
       "      <th>Push Time</th>\n",
       "      <th>Push Result</th>\n",
       "      <th>Name</th>\n",
       "      <th>ID</th>\n",
       "      <th>Type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>BITDEP(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.437693</td>\n",
       "      <td>Success</td>\n",
       "      <td>BITDEP(ft)</td>\n",
       "      <td>0EF5BF13-FD2F-62D0-8230-0E7CB97ABFBA</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BLOCKCOMP(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.231501</td>\n",
       "      <td>Success</td>\n",
       "      <td>BLOCKCOMP(ft)</td>\n",
       "      <td>0EF5BF13-FCC6-7320-98A8-746C08687C42</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEP_RTN(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.459309</td>\n",
       "      <td>Success</td>\n",
       "      <td>DEP_RTN(ft)</td>\n",
       "      <td>0EF5BF13-FDA4-75D0-B708-760DB015FCAF</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEPTH(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.580592</td>\n",
       "      <td>Success</td>\n",
       "      <td>DEPTH(ft)</td>\n",
       "      <td>0EF5BF13-FEF5-6470-863C-8547DBA3093E</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FLOWIN(USgal/min)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.414194</td>\n",
       "      <td>Success</td>\n",
       "      <td>FLOWIN(USgal/min)</td>\n",
       "      <td>0EF5BF13-FE19-E8D0-A034-5755EB4EDF99</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FLOWOUTPC(%)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.338931</td>\n",
       "      <td>Success</td>\n",
       "      <td>FLOWOUTPC(%)</td>\n",
       "      <td>0EF5BF13-FFF5-EA00-A061-55DBB4052834</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ROP_AVG(ft/h)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.329003</td>\n",
       "      <td>Success</td>\n",
       "      <td>ROP_AVG(ft/h)</td>\n",
       "      <td>0EF5BF14-004F-FF50-85A8-D187570FD18C</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DIFP(psi)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.284236</td>\n",
       "      <td>Success</td>\n",
       "      <td>DIFP(psi)</td>\n",
       "      <td>0EF5BF14-004F-FF50-84F3-D062AFD1F8AE</td>\n",
       "      <td>StoredSignal</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Push Count              Push Time Push Result  \\\n",
       "BITDEP(ft)            11485.0 0 days 00:00:00.437693     Success   \n",
       "BLOCKCOMP(ft)         11485.0 0 days 00:00:00.231501     Success   \n",
       "DEP_RTN(ft)           11485.0 0 days 00:00:00.459309     Success   \n",
       "DEPTH(ft)             11485.0 0 days 00:00:00.580592     Success   \n",
       "FLOWIN(USgal/min)     11485.0 0 days 00:00:00.414194     Success   \n",
       "FLOWOUTPC(%)          11485.0 0 days 00:00:00.338931     Success   \n",
       "ROP_AVG(ft/h)         11485.0 0 days 00:00:00.329003     Success   \n",
       "DIFP(psi)             11485.0 0 days 00:00:00.284236     Success   \n",
       "\n",
       "                                Name                                    ID  \\\n",
       "BITDEP(ft)                BITDEP(ft)  0EF5BF13-FD2F-62D0-8230-0E7CB97ABFBA   \n",
       "BLOCKCOMP(ft)          BLOCKCOMP(ft)  0EF5BF13-FCC6-7320-98A8-746C08687C42   \n",
       "DEP_RTN(ft)              DEP_RTN(ft)  0EF5BF13-FDA4-75D0-B708-760DB015FCAF   \n",
       "DEPTH(ft)                  DEPTH(ft)  0EF5BF13-FEF5-6470-863C-8547DBA3093E   \n",
       "FLOWIN(USgal/min)  FLOWIN(USgal/min)  0EF5BF13-FE19-E8D0-A034-5755EB4EDF99   \n",
       "FLOWOUTPC(%)            FLOWOUTPC(%)  0EF5BF13-FFF5-EA00-A061-55DBB4052834   \n",
       "ROP_AVG(ft/h)          ROP_AVG(ft/h)  0EF5BF14-004F-FF50-85A8-D187570FD18C   \n",
       "DIFP(psi)                  DIFP(psi)  0EF5BF14-004F-FF50-84F3-D062AFD1F8AE   \n",
       "\n",
       "                           Type  \n",
       "BITDEP(ft)         StoredSignal  \n",
       "BLOCKCOMP(ft)      StoredSignal  \n",
       "DEP_RTN(ft)        StoredSignal  \n",
       "DEPTH(ft)          StoredSignal  \n",
       "FLOWIN(USgal/min)  StoredSignal  \n",
       "FLOWOUTPC(%)       StoredSignal  \n",
       "ROP_AVG(ft/h)      StoredSignal  \n",
       "DIFP(psi)          StoredSignal  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "push_results = spy.push(data=csv_file, workbook='SPy Documentation Examples >> spy.push')\n",
    "push_results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "NOTE: Pushing data can be relatively slow. This is an area that Seeq will be optimizing in future versions.\n",
    "\n",
    "You can push multiple times, and as long as the names are the same and the workbook hasn't changed, you'll just add to the existing signal."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Pushing metadata"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now let's try pushing just metadata. You can see that the column names from the CSV file contain the unit of measure in parentheses. Let's use Pandas to extract the name and the unit of measure as separate columns."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Push Count</th>\n",
       "      <th>Push Time</th>\n",
       "      <th>Push Result</th>\n",
       "      <th>Name</th>\n",
       "      <th>ID</th>\n",
       "      <th>Type</th>\n",
       "      <th>Original Name</th>\n",
       "      <th>Value Unit Of Measure</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>BITDEP(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.437693</td>\n",
       "      <td>Success</td>\n",
       "      <td>BITDEP</td>\n",
       "      <td>0EF5BF13-FD2F-62D0-8230-0E7CB97ABFBA</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>BITDEP(ft)</td>\n",
       "      <td>ft</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BLOCKCOMP(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.231501</td>\n",
       "      <td>Success</td>\n",
       "      <td>BLOCKCOMP</td>\n",
       "      <td>0EF5BF13-FCC6-7320-98A8-746C08687C42</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>BLOCKCOMP(ft)</td>\n",
       "      <td>ft</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEP_RTN(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.459309</td>\n",
       "      <td>Success</td>\n",
       "      <td>DEP_RTN</td>\n",
       "      <td>0EF5BF13-FDA4-75D0-B708-760DB015FCAF</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>DEP_RTN(ft)</td>\n",
       "      <td>ft</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEPTH(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.580592</td>\n",
       "      <td>Success</td>\n",
       "      <td>DEPTH</td>\n",
       "      <td>0EF5BF13-FEF5-6470-863C-8547DBA3093E</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>DEPTH(ft)</td>\n",
       "      <td>ft</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FLOWIN(USgal/min)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.414194</td>\n",
       "      <td>Success</td>\n",
       "      <td>FLOWIN</td>\n",
       "      <td>0EF5BF13-FE19-E8D0-A034-5755EB4EDF99</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>FLOWIN(USgal/min)</td>\n",
       "      <td>USgal/min</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FLOWOUTPC(%)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.338931</td>\n",
       "      <td>Success</td>\n",
       "      <td>FLOWOUTPC</td>\n",
       "      <td>0EF5BF13-FFF5-EA00-A061-55DBB4052834</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>FLOWOUTPC(%)</td>\n",
       "      <td>%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ROP_AVG(ft/h)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.329003</td>\n",
       "      <td>Success</td>\n",
       "      <td>ROP_AVG</td>\n",
       "      <td>0EF5BF14-004F-FF50-85A8-D187570FD18C</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>ROP_AVG(ft/h)</td>\n",
       "      <td>ft/h</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DIFP(psi)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.284236</td>\n",
       "      <td>Success</td>\n",
       "      <td>DIFP</td>\n",
       "      <td>0EF5BF14-004F-FF50-84F3-D062AFD1F8AE</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>DIFP(psi)</td>\n",
       "      <td>psi</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Push Count              Push Time Push Result       Name  \\\n",
       "BITDEP(ft)            11485.0 0 days 00:00:00.437693     Success     BITDEP   \n",
       "BLOCKCOMP(ft)         11485.0 0 days 00:00:00.231501     Success  BLOCKCOMP   \n",
       "DEP_RTN(ft)           11485.0 0 days 00:00:00.459309     Success    DEP_RTN   \n",
       "DEPTH(ft)             11485.0 0 days 00:00:00.580592     Success      DEPTH   \n",
       "FLOWIN(USgal/min)     11485.0 0 days 00:00:00.414194     Success     FLOWIN   \n",
       "FLOWOUTPC(%)          11485.0 0 days 00:00:00.338931     Success  FLOWOUTPC   \n",
       "ROP_AVG(ft/h)         11485.0 0 days 00:00:00.329003     Success    ROP_AVG   \n",
       "DIFP(psi)             11485.0 0 days 00:00:00.284236     Success       DIFP   \n",
       "\n",
       "                                                     ID          Type  \\\n",
       "BITDEP(ft)         0EF5BF13-FD2F-62D0-8230-0E7CB97ABFBA  StoredSignal   \n",
       "BLOCKCOMP(ft)      0EF5BF13-FCC6-7320-98A8-746C08687C42  StoredSignal   \n",
       "DEP_RTN(ft)        0EF5BF13-FDA4-75D0-B708-760DB015FCAF  StoredSignal   \n",
       "DEPTH(ft)          0EF5BF13-FEF5-6470-863C-8547DBA3093E  StoredSignal   \n",
       "FLOWIN(USgal/min)  0EF5BF13-FE19-E8D0-A034-5755EB4EDF99  StoredSignal   \n",
       "FLOWOUTPC(%)       0EF5BF13-FFF5-EA00-A061-55DBB4052834  StoredSignal   \n",
       "ROP_AVG(ft/h)      0EF5BF14-004F-FF50-85A8-D187570FD18C  StoredSignal   \n",
       "DIFP(psi)          0EF5BF14-004F-FF50-84F3-D062AFD1F8AE  StoredSignal   \n",
       "\n",
       "                       Original Name Value Unit Of Measure  \n",
       "BITDEP(ft)                BITDEP(ft)                    ft  \n",
       "BLOCKCOMP(ft)          BLOCKCOMP(ft)                    ft  \n",
       "DEP_RTN(ft)              DEP_RTN(ft)                    ft  \n",
       "DEPTH(ft)                  DEPTH(ft)                    ft  \n",
       "FLOWIN(USgal/min)  FLOWIN(USgal/min)             USgal/min  \n",
       "FLOWOUTPC(%)            FLOWOUTPC(%)                     %  \n",
       "ROP_AVG(ft/h)          ROP_AVG(ft/h)                  ft/h  \n",
       "DIFP(psi)                  DIFP(psi)                   psi  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "better_metadata = push_results.copy()\n",
    "better_metadata['Original Name'] = better_metadata.index\n",
    "better_metadata['Name'] = better_metadata['Original Name'].str.extract(r'(.*)\\(')\n",
    "better_metadata['Value Unit Of Measure'] = better_metadata['Original Name'].str.extract(r'.*\\((.*)\\)')\n",
    "better_metadata"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Pushed successfully to datasource <strong>Seeq Data Lab [Datasource ID: Seeq Data Lab]</strong> and scoped to workbook ID <strong>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</strong><br>Click the following link to see what you pushed in Seeq:<br><a href=\"http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66\" target=\"_blank\">http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66</a></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Push Count</th>\n",
       "      <th>Push Time</th>\n",
       "      <th>Name</th>\n",
       "      <th>ID</th>\n",
       "      <th>Type</th>\n",
       "      <th>Original Name</th>\n",
       "      <th>Value Unit Of Measure</th>\n",
       "      <th>Scoped To</th>\n",
       "      <th>Datasource Class</th>\n",
       "      <th>Datasource ID</th>\n",
       "      <th>Formula Parameters</th>\n",
       "      <th>Data ID</th>\n",
       "      <th>Push Result</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>BITDEP(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.437693</td>\n",
       "      <td>BITDEP</td>\n",
       "      <td>0EF5BF13-FD2F-62D0-8230-0E7CB97ABFBA</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>BITDEP(ft)</td>\n",
       "      <td>ft</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BLOCKCOMP(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.231501</td>\n",
       "      <td>BLOCKCOMP</td>\n",
       "      <td>0EF5BF13-FCC6-7320-98A8-746C08687C42</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>BLOCKCOMP(ft)</td>\n",
       "      <td>ft</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEP_RTN(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.459309</td>\n",
       "      <td>DEP_RTN</td>\n",
       "      <td>0EF5BF13-FDA4-75D0-B708-760DB015FCAF</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>DEP_RTN(ft)</td>\n",
       "      <td>ft</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEPTH(ft)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.580592</td>\n",
       "      <td>DEPTH</td>\n",
       "      <td>0EF5BF13-FEF5-6470-863C-8547DBA3093E</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>DEPTH(ft)</td>\n",
       "      <td>ft</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FLOWIN(USgal/min)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.414194</td>\n",
       "      <td>FLOWIN</td>\n",
       "      <td>0EF5BF13-FE19-E8D0-A034-5755EB4EDF99</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>FLOWIN(USgal/min)</td>\n",
       "      <td>USgal/min</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FLOWOUTPC(%)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.338931</td>\n",
       "      <td>FLOWOUTPC</td>\n",
       "      <td>0EF5BF13-FFF5-EA00-A061-55DBB4052834</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>FLOWOUTPC(%)</td>\n",
       "      <td>%</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ROP_AVG(ft/h)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.329003</td>\n",
       "      <td>ROP_AVG</td>\n",
       "      <td>0EF5BF14-004F-FF50-85A8-D187570FD18C</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>ROP_AVG(ft/h)</td>\n",
       "      <td>ft/h</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DIFP(psi)</th>\n",
       "      <td>11485.0</td>\n",
       "      <td>0 days 00:00:00.284236</td>\n",
       "      <td>DIFP</td>\n",
       "      <td>0EF5BF14-004F-FF50-84F3-D062AFD1F8AE</td>\n",
       "      <td>StoredSignal</td>\n",
       "      <td>DIFP(psi)</td>\n",
       "      <td>psi</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...</td>\n",
       "      <td>Success</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Push Count              Push Time       Name  \\\n",
       "BITDEP(ft)            11485.0 0 days 00:00:00.437693     BITDEP   \n",
       "BLOCKCOMP(ft)         11485.0 0 days 00:00:00.231501  BLOCKCOMP   \n",
       "DEP_RTN(ft)           11485.0 0 days 00:00:00.459309    DEP_RTN   \n",
       "DEPTH(ft)             11485.0 0 days 00:00:00.580592      DEPTH   \n",
       "FLOWIN(USgal/min)     11485.0 0 days 00:00:00.414194     FLOWIN   \n",
       "FLOWOUTPC(%)          11485.0 0 days 00:00:00.338931  FLOWOUTPC   \n",
       "ROP_AVG(ft/h)         11485.0 0 days 00:00:00.329003    ROP_AVG   \n",
       "DIFP(psi)             11485.0 0 days 00:00:00.284236       DIFP   \n",
       "\n",
       "                                                     ID          Type  \\\n",
       "BITDEP(ft)         0EF5BF13-FD2F-62D0-8230-0E7CB97ABFBA  StoredSignal   \n",
       "BLOCKCOMP(ft)      0EF5BF13-FCC6-7320-98A8-746C08687C42  StoredSignal   \n",
       "DEP_RTN(ft)        0EF5BF13-FDA4-75D0-B708-760DB015FCAF  StoredSignal   \n",
       "DEPTH(ft)          0EF5BF13-FEF5-6470-863C-8547DBA3093E  StoredSignal   \n",
       "FLOWIN(USgal/min)  0EF5BF13-FE19-E8D0-A034-5755EB4EDF99  StoredSignal   \n",
       "FLOWOUTPC(%)       0EF5BF13-FFF5-EA00-A061-55DBB4052834  StoredSignal   \n",
       "ROP_AVG(ft/h)      0EF5BF14-004F-FF50-85A8-D187570FD18C  StoredSignal   \n",
       "DIFP(psi)          0EF5BF14-004F-FF50-84F3-D062AFD1F8AE  StoredSignal   \n",
       "\n",
       "                       Original Name Value Unit Of Measure  \\\n",
       "BITDEP(ft)                BITDEP(ft)                    ft   \n",
       "BLOCKCOMP(ft)          BLOCKCOMP(ft)                    ft   \n",
       "DEP_RTN(ft)              DEP_RTN(ft)                    ft   \n",
       "DEPTH(ft)                  DEPTH(ft)                    ft   \n",
       "FLOWIN(USgal/min)  FLOWIN(USgal/min)             USgal/min   \n",
       "FLOWOUTPC(%)            FLOWOUTPC(%)                     %   \n",
       "ROP_AVG(ft/h)          ROP_AVG(ft/h)                  ft/h   \n",
       "DIFP(psi)                  DIFP(psi)                   psi   \n",
       "\n",
       "                                              Scoped To Datasource Class  \\\n",
       "BITDEP(ft)         0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "BLOCKCOMP(ft)      0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "DEP_RTN(ft)        0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "DEPTH(ft)          0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "FLOWIN(USgal/min)  0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "FLOWOUTPC(%)       0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "ROP_AVG(ft/h)      0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "DIFP(psi)          0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab   \n",
       "\n",
       "                   Datasource ID Formula Parameters  \\\n",
       "BITDEP(ft)         Seeq Data Lab                 []   \n",
       "BLOCKCOMP(ft)      Seeq Data Lab                 []   \n",
       "DEP_RTN(ft)        Seeq Data Lab                 []   \n",
       "DEPTH(ft)          Seeq Data Lab                 []   \n",
       "FLOWIN(USgal/min)  Seeq Data Lab                 []   \n",
       "FLOWOUTPC(%)       Seeq Data Lab                 []   \n",
       "ROP_AVG(ft/h)      Seeq Data Lab                 []   \n",
       "DIFP(psi)          Seeq Data Lab                 []   \n",
       "\n",
       "                                                             Data ID  \\\n",
       "BITDEP(ft)         [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "BLOCKCOMP(ft)      [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "DEP_RTN(ft)        [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "DEPTH(ft)          [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "FLOWIN(USgal/min)  [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "FLOWOUTPC(%)       [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "ROP_AVG(ft/h)      [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "DIFP(psi)          [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Signal...   \n",
       "\n",
       "                  Push Result  \n",
       "BITDEP(ft)            Success  \n",
       "BLOCKCOMP(ft)         Success  \n",
       "DEP_RTN(ft)           Success  \n",
       "DEPTH(ft)             Success  \n",
       "FLOWIN(USgal/min)     Success  \n",
       "FLOWOUTPC(%)          Success  \n",
       "ROP_AVG(ft/h)         Success  \n",
       "DIFP(psi)             Success  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spy.push(metadata=better_metadata, workbook='SPy Documentation Examples >> spy.push')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Pushing condition and capsule data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can also push capsules, which are time intervals of interest, to Seeq by supplying a DataFrame with `Capsule Start` and `Capsule End` columns. Any additional columns will be added as properties of the capsule."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Capsule Start</th>\n",
       "      <th>Capsule End</th>\n",
       "      <th>Operator On Duty</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2019-01-10 09:00:00+00:00</td>\n",
       "      <td>2019-01-10 17:00:00+00:00</td>\n",
       "      <td>Mark</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2019-01-11 09:00:00+00:00</td>\n",
       "      <td>2019-01-11 17:00:00+00:00</td>\n",
       "      <td>Hedwig</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              Capsule Start               Capsule End Operator On Duty\n",
       "0 2019-01-10 09:00:00+00:00 2019-01-10 17:00:00+00:00             Mark\n",
       "1 2019-01-11 09:00:00+00:00 2019-01-11 17:00:00+00:00           Hedwig"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "capsule_data = pd.DataFrame([{\n",
    "    'Capsule Start':    pd.to_datetime('2019-01-10T09:00:00.000Z'),\n",
    "    'Capsule End':      pd.to_datetime('2019-01-10T17:00:00.000Z'),\n",
    "    'Operator On Duty': 'Mark'\n",
    "}, {\n",
    "    'Capsule Start':    pd.to_datetime('2019-01-11T09:00:00.000Z'),\n",
    "    'Capsule End':      pd.to_datetime('2019-01-11T17:00:00.000Z'),\n",
    "    'Operator On Duty': 'Hedwig'\n",
    "}])\n",
    "\n",
    "capsule_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "When you push capsule data, you must supply a `metadata` DataFrame that contains, at minimum, the `Name`, `Type` and `Maximum Duration` columns like the example below.\n",
    "\n",
    "If your `metadata` DataFrame includes multiple conditions, the `data` DataFrame must have a `Condition` column to indicate which condition will receive that particular capsule. The value of the `Condition` column must correspond to an index entry of the `metadata` DataFrame."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Pushed successfully to datasource <strong>Seeq Data Lab [Datasource ID: Seeq Data Lab]</strong> and scoped to workbook ID <strong>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</strong><br>Click the following link to see what you pushed in Seeq:<br><a href=\"http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66\" target=\"_blank\">http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66</a></div><table class=\"tex2jax_ignore\" style=\"color:black;\"><tr><td style=\"background-color: #EEFFEE;\"></td><td style=\"background-color: #EEFFEE; text-align: left;\">ID</td><td style=\"background-color: #EEFFEE; text-align: left;\">Type</td><td style=\"background-color: #EEFFEE; text-align: left;\">Name</td><td style=\"background-color: #EEFFEE; text-align: right;\">Count</td><td style=\"background-color: #EEFFEE; text-align: right;\">Pages</td><td style=\"background-color: #EEFFEE; text-align: right;\">Time</td><td style=\"background-color: #EEFFEE; text-align: left;\">Result</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">0</td><td style=\"text-align: left; vertical-align: top;\">0EF5BF14-0E68-75B0-B51D-228E662CF6FA</td><td style=\"text-align: left; vertical-align: top;\">StoredCondition</td><td style=\"text-align: left; vertical-align: top;\">Operator Shifts</td><td style=\"text-align: right; vertical-align: top;\">2</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"vertical-align: top;\">00:00:00.09</td><td style=\"text-align: left; vertical-align: top;\">Success</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Type</th>\n",
       "      <th>Maximum Duration</th>\n",
       "      <th>Scoped To</th>\n",
       "      <th>Datasource Class</th>\n",
       "      <th>Datasource ID</th>\n",
       "      <th>Formula Parameters</th>\n",
       "      <th>Data ID</th>\n",
       "      <th>ID</th>\n",
       "      <th>Push Result</th>\n",
       "      <th>Push Count</th>\n",
       "      <th>Push Time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Operator Shifts</td>\n",
       "      <td>StoredCondition</td>\n",
       "      <td>2d</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...</td>\n",
       "      <td>0EF5BF14-0E68-75B0-B51D-228E662CF6FA</td>\n",
       "      <td>Success</td>\n",
       "      <td>2</td>\n",
       "      <td>0 days 00:00:00.093181</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              Name             Type Maximum Duration  \\\n",
       "0  Operator Shifts  StoredCondition               2d   \n",
       "\n",
       "                              Scoped To Datasource Class  Datasource ID  \\\n",
       "0  0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab  Seeq Data Lab   \n",
       "\n",
       "  Formula Parameters                                            Data ID  \\\n",
       "0                 []  [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...   \n",
       "\n",
       "                                     ID Push Result  Push Count  \\\n",
       "0  0EF5BF14-0E68-75B0-B51D-228E662CF6FA     Success           2   \n",
       "\n",
       "               Push Time  \n",
       "0 0 days 00:00:00.093181  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spy.push(data=capsule_data,\n",
    "         metadata=pd.DataFrame([{\n",
    "             'Name': 'Operator Shifts',\n",
    "             'Type': 'Condition',\n",
    "             'Maximum Duration': '2d'\n",
    "         }]), workbook='SPy Documentation Examples >> spy.push')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Capsule properties that have units of measure can be specified in the metadata. Say you have properties like `Height` and `Mass`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Capsule Start</th>\n",
       "      <th>Capsule End</th>\n",
       "      <th>Height</th>\n",
       "      <th>Mass</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2019-01-10 09:00:00+00:00</td>\n",
       "      <td>2019-01-10 17:00:00+00:00</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2019-01-11 09:00:00+00:00</td>\n",
       "      <td>2019-01-11 17:00:00+00:00</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              Capsule Start               Capsule End  Height  Mass\n",
       "0 2019-01-10 09:00:00+00:00 2019-01-10 17:00:00+00:00       5    10\n",
       "1 2019-01-11 09:00:00+00:00 2019-01-11 17:00:00+00:00       3     6"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "capsule_data = pd.DataFrame([{\n",
    "    'Capsule Start':    pd.to_datetime('2019-01-10T09:00:00.000Z'),\n",
    "    'Capsule End':      pd.to_datetime('2019-01-10T17:00:00.000Z'),\n",
    "    'Height': 5,\n",
    "    'Mass': 10,\n",
    "}, {\n",
    "    'Capsule Start':    pd.to_datetime('2019-01-11T09:00:00.000Z'),\n",
    "    'Capsule End':      pd.to_datetime('2019-01-11T17:00:00.000Z'),\n",
    "    'Height': 3,\n",
    "    'Mass' : 6\n",
    "}])\n",
    "\n",
    "capsule_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Use `Capsule Property Units` in metadata dataframe to specify that `Height` has units of meters, `m` and Mass has units of `kg` :"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Pushed successfully to datasource <strong>Seeq Data Lab [Datasource ID: Seeq Data Lab]</strong> and scoped to workbook ID <strong>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</strong><br>Click the following link to see what you pushed in Seeq:<br><a href=\"http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66\" target=\"_blank\">http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66</a></div><table class=\"tex2jax_ignore\" style=\"color:black;\"><tr><td style=\"background-color: #EEFFEE;\"></td><td style=\"background-color: #EEFFEE; text-align: left;\">ID</td><td style=\"background-color: #EEFFEE; text-align: left;\">Type</td><td style=\"background-color: #EEFFEE; text-align: left;\">Name</td><td style=\"background-color: #EEFFEE; text-align: right;\">Count</td><td style=\"background-color: #EEFFEE; text-align: right;\">Pages</td><td style=\"background-color: #EEFFEE; text-align: right;\">Time</td><td style=\"background-color: #EEFFEE; text-align: left;\">Result</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">0</td><td style=\"text-align: left; vertical-align: top;\">0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td><td style=\"text-align: left; vertical-align: top;\">StoredCondition</td><td style=\"text-align: left; vertical-align: top;\">In Production</td><td style=\"text-align: right; vertical-align: top;\">2</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"vertical-align: top;\">00:00:00.05</td><td style=\"text-align: left; vertical-align: top;\">Success</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Type</th>\n",
       "      <th>Maximum Duration</th>\n",
       "      <th>Capsule Property Units</th>\n",
       "      <th>Scoped To</th>\n",
       "      <th>Datasource Class</th>\n",
       "      <th>Datasource ID</th>\n",
       "      <th>Formula Parameters</th>\n",
       "      <th>Data ID</th>\n",
       "      <th>ID</th>\n",
       "      <th>Push Result</th>\n",
       "      <th>Push Count</th>\n",
       "      <th>Push Time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>In Production</td>\n",
       "      <td>StoredCondition</td>\n",
       "      <td>2d</td>\n",
       "      <td>{'Height': 'm', 'Mass': 'kg'}</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...</td>\n",
       "      <td>0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td>\n",
       "      <td>Success</td>\n",
       "      <td>2</td>\n",
       "      <td>0 days 00:00:00.045671</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Name             Type Maximum Duration  \\\n",
       "0  In Production  StoredCondition               2d   \n",
       "\n",
       "          Capsule Property Units                             Scoped To  \\\n",
       "0  {'Height': 'm', 'Mass': 'kg'}  0EF5BF13-F994-7530-B9F5-F329D8B2EE61   \n",
       "\n",
       "  Datasource Class  Datasource ID Formula Parameters  \\\n",
       "0    Seeq Data Lab  Seeq Data Lab                 []   \n",
       "\n",
       "                                             Data ID  \\\n",
       "0  [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...   \n",
       "\n",
       "                                     ID Push Result  Push Count  \\\n",
       "0  0EF5BF14-15AC-FB50-A247-B95EE20C5BB3     Success           2   \n",
       "\n",
       "               Push Time  \n",
       "0 0 days 00:00:00.045671  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spy.push(data=capsule_data,\n",
    "         metadata=pd.DataFrame([{\n",
    "             'Name': 'In Production',\n",
    "             'Type': 'Condition',\n",
    "             'Maximum Duration': '2d',\n",
    "             'Capsule Property Units': {'Height': 'm',\n",
    "                                        'Mass': 'kg'}\n",
    "         }]), workbook='SPy Documentation Examples >> spy.push')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Updating capsules"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To update capsules, you must replace them with new capsules. An easy workflow for this is to pull all the capsules in the range you want to edit, make changes, and then push with the `replace` argument set to the same range.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "First, get the condition using `spy.search()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Query successful</div><table class=\"tex2jax_ignore\" style=\"color:black;\"><tr><td style=\"background-color: #EEFFEE;\"></td><td style=\"background-color: #EEFFEE; text-align: left;\">Name</td><td style=\"background-color: #EEFFEE; text-align: right;\">Time</td><td style=\"background-color: #EEFFEE; text-align: right;\">Count</td><td style=\"background-color: #EEFFEE; text-align: right;\">Pages</td><td style=\"background-color: #EEFFEE; text-align: left;\">Result</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">0</td><td style=\"text-align: left; vertical-align: top;\">In Production</td><td style=\"vertical-align: top;\">00:00:00.01</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: left; vertical-align: top;\">Success</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>Name</th>\n",
       "      <th>Description</th>\n",
       "      <th>Type</th>\n",
       "      <th>Value Unit Of Measure</th>\n",
       "      <th>Datasource Name</th>\n",
       "      <th>Archived</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td>\n",
       "      <td>In Production</td>\n",
       "      <td>NaN</td>\n",
       "      <td>StoredCondition</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     ID           Name  Description  \\\n",
       "0  0EF5BF14-15AC-FB50-A247-B95EE20C5BB3  In Production          NaN   \n",
       "\n",
       "              Type  Value Unit Of Measure Datasource Name  Archived  \n",
       "0  StoredCondition                    NaN   Seeq Data Lab     False  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "condition = spy.search({'Name': 'In Production'}, workbook='SPy Documentation Examples >> spy.push')\n",
    "condition"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The start and end should be identical for both the `spy.pull()` and the `replace` argument to `spy.push()` so that nothing is accidentally deleted or duplicated. To make this easier, save them as variables."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "replace_start=pd.to_datetime('2019-01-10T09:00:00.000Z')\n",
    "replace_end=pd.to_datetime('2019-01-11T17:00:00.000Z')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Get all the capsules within that range:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Pull successful from <strong>2019-01-10 09:00:00+00:00</strong> to <strong>2019-01-11 17:00:00+00:00</strong></div><table class=\"tex2jax_ignore\" style=\"color:black;\"><tr><td style=\"background-color: #EEFFEE;\"></td><td style=\"background-color: #EEFFEE; text-align: left;\">ID</td><td style=\"background-color: #EEFFEE; text-align: left;\">Type</td><td style=\"background-color: #EEFFEE; text-align: left;\">Name</td><td style=\"background-color: #EEFFEE; text-align: right;\">Time</td><td style=\"background-color: #EEFFEE; text-align: right;\">Count</td><td style=\"background-color: #EEFFEE; text-align: right;\">Pages</td><td style=\"background-color: #EEFFEE; text-align: left;\">Data Processed</td><td style=\"background-color: #EEFFEE; text-align: left;\">Result</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">0</td><td style=\"text-align: left; vertical-align: top;\">0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td><td style=\"text-align: left; vertical-align: top;\">StoredCondition</td><td style=\"text-align: left; vertical-align: top;\">In Production</td><td style=\"vertical-align: top;\">00:00:00.26</td><td style=\"text-align: right; vertical-align: top;\">2</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"text-align: right; vertical-align: top;\">0 B</td><td style=\"text-align: left; vertical-align: top;\">Success</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Condition</th>\n",
       "      <th>Capsule Start</th>\n",
       "      <th>Capsule End</th>\n",
       "      <th>Capsule Is Uncertain</th>\n",
       "      <th>Mass</th>\n",
       "      <th>Height</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>In Production</td>\n",
       "      <td>2019-01-10 09:00:00+00:00</td>\n",
       "      <td>2019-01-10 17:00:00+00:00</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>In Production</td>\n",
       "      <td>2019-01-11 09:00:00+00:00</td>\n",
       "      <td>2019-01-11 17:00:00+00:00</td>\n",
       "      <td>False</td>\n",
       "      <td>6</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Condition             Capsule Start               Capsule End  \\\n",
       "0  In Production 2019-01-10 09:00:00+00:00 2019-01-10 17:00:00+00:00   \n",
       "1  In Production 2019-01-11 09:00:00+00:00 2019-01-11 17:00:00+00:00   \n",
       "\n",
       "   Capsule Is Uncertain  Mass  Height  \n",
       "0                 False    10       5  \n",
       "1                 False     6       3  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_capsule_data = spy.pull(condition,\n",
    "                            start=replace_start,\n",
    "                            end=replace_end)\n",
    "new_capsule_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we can update specific capsule properies. Let's say the height of the first capsule was actually 4 meters and the Mass for the second capsule is 7 kg :"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Condition</th>\n",
       "      <th>Capsule Start</th>\n",
       "      <th>Capsule End</th>\n",
       "      <th>Capsule Is Uncertain</th>\n",
       "      <th>Mass</th>\n",
       "      <th>Height</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>In Production</td>\n",
       "      <td>2019-01-10 09:00:00+00:00</td>\n",
       "      <td>2019-01-10 17:00:00+00:00</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>In Production</td>\n",
       "      <td>2019-01-11 09:00:00+00:00</td>\n",
       "      <td>2019-01-11 17:00:00+00:00</td>\n",
       "      <td>False</td>\n",
       "      <td>7</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Condition             Capsule Start               Capsule End  \\\n",
       "0  In Production 2019-01-10 09:00:00+00:00 2019-01-10 17:00:00+00:00   \n",
       "1  In Production 2019-01-11 09:00:00+00:00 2019-01-11 17:00:00+00:00   \n",
       "\n",
       "   Capsule Is Uncertain  Mass  Height  \n",
       "0                 False    10       4  \n",
       "1                 False     7       3  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_capsule_data.at[0, 'Height'] = 4\n",
    "new_capsule_data.at[1, 'Mass'] = 7\n",
    "new_capsule_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Additional capsule propeties can also be added at this time. Suppose you want to record what the temperature was for the first capsule. A new `Temperature` property can be added:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Condition</th>\n",
       "      <th>Capsule Start</th>\n",
       "      <th>Capsule End</th>\n",
       "      <th>Capsule Is Uncertain</th>\n",
       "      <th>Mass</th>\n",
       "      <th>Height</th>\n",
       "      <th>Temperature</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>In Production</td>\n",
       "      <td>2019-01-10 09:00:00+00:00</td>\n",
       "      <td>2019-01-10 17:00:00+00:00</td>\n",
       "      <td>False</td>\n",
       "      <td>10</td>\n",
       "      <td>4</td>\n",
       "      <td>67.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>In Production</td>\n",
       "      <td>2019-01-11 09:00:00+00:00</td>\n",
       "      <td>2019-01-11 17:00:00+00:00</td>\n",
       "      <td>False</td>\n",
       "      <td>7</td>\n",
       "      <td>3</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Condition             Capsule Start               Capsule End  \\\n",
       "0  In Production 2019-01-10 09:00:00+00:00 2019-01-10 17:00:00+00:00   \n",
       "1  In Production 2019-01-11 09:00:00+00:00 2019-01-11 17:00:00+00:00   \n",
       "\n",
       "   Capsule Is Uncertain  Mass  Height  Temperature  \n",
       "0                 False    10       4         67.0  \n",
       "1                 False     7       3          NaN  "
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_capsule_data.at[0, 'Temperature'] = 67\n",
    "new_capsule_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You must specify units of measure for existing properties (e.g., `Height` and `Mass`) with every `spy.push()` along with units for new properties (e.g., `Temperature` measured in `F`). \n",
    "\n",
    "The `replace` parameter takes a dictionary with the keys `'Start'` and `'End'`. Any capsules that start in the provided time period will be replaced. \n",
    "\n",
    "Push the `new_capsule_data` using the `replace` parameter."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Pushed successfully to datasource <strong>Seeq Data Lab [Datasource ID: Seeq Data Lab]</strong> and scoped to workbook ID <strong>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</strong><br>Click the following link to see what you pushed in Seeq:<br><a href=\"http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66\" target=\"_blank\">http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66</a></div><table class=\"tex2jax_ignore\" style=\"color:black;\"><tr><td style=\"background-color: #EEFFEE;\"></td><td style=\"background-color: #EEFFEE; text-align: left;\">ID</td><td style=\"background-color: #EEFFEE; text-align: left;\">Type</td><td style=\"background-color: #EEFFEE; text-align: left;\">Name</td><td style=\"background-color: #EEFFEE; text-align: right;\">Count</td><td style=\"background-color: #EEFFEE; text-align: right;\">Pages</td><td style=\"background-color: #EEFFEE; text-align: right;\">Time</td><td style=\"background-color: #EEFFEE; text-align: left;\">Result</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">0</td><td style=\"text-align: left; vertical-align: top;\">0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td><td style=\"text-align: left; vertical-align: top;\">StoredCondition</td><td style=\"text-align: left; vertical-align: top;\">In Production</td><td style=\"text-align: right; vertical-align: top;\">2</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"vertical-align: top;\">00:00:00.03</td><td style=\"text-align: left; vertical-align: top;\">Success</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Type</th>\n",
       "      <th>Maximum Duration</th>\n",
       "      <th>Capsule Property Units</th>\n",
       "      <th>Scoped To</th>\n",
       "      <th>Datasource Class</th>\n",
       "      <th>Datasource ID</th>\n",
       "      <th>Formula Parameters</th>\n",
       "      <th>Data ID</th>\n",
       "      <th>ID</th>\n",
       "      <th>Push Result</th>\n",
       "      <th>Push Count</th>\n",
       "      <th>Push Time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>In Production</td>\n",
       "      <td>StoredCondition</td>\n",
       "      <td>2d</td>\n",
       "      <td>{'Height': 'm', 'Mass': 'kg', 'Temperature': 'F'}</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...</td>\n",
       "      <td>0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td>\n",
       "      <td>Success</td>\n",
       "      <td>2</td>\n",
       "      <td>0 days 00:00:00.034128</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Name             Type Maximum Duration  \\\n",
       "0  In Production  StoredCondition               2d   \n",
       "\n",
       "                              Capsule Property Units  \\\n",
       "0  {'Height': 'm', 'Mass': 'kg', 'Temperature': 'F'}   \n",
       "\n",
       "                              Scoped To Datasource Class  Datasource ID  \\\n",
       "0  0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab  Seeq Data Lab   \n",
       "\n",
       "  Formula Parameters                                            Data ID  \\\n",
       "0                 []  [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...   \n",
       "\n",
       "                                     ID Push Result  Push Count  \\\n",
       "0  0EF5BF14-15AC-FB50-A247-B95EE20C5BB3     Success           2   \n",
       "\n",
       "               Push Time  \n",
       "0 0 days 00:00:00.034128  "
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spy.push(data=new_capsule_data,\n",
    "         metadata=pd.DataFrame([{\n",
    "             'Name': 'In Production',\n",
    "             'Type': 'Condition',\n",
    "             'Maximum Duration': '2d',\n",
    "             'Capsule Property Units': {'Height':'m',\n",
    "                                        'Mass':'kg', \n",
    "                                        'Temperature':'F'}\n",
    "         }]), \n",
    "         replace={'Start':   replace_start,\n",
    "                  'End':     replace_end},\n",
    "         workbook='SPy Documentation Examples >> spy.push')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Deleting capsules"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `replace` argument can also be used to delete capsules. All capsules starting within the time range specified by `replace` are deleted before the new capsules are added, so providing no new capsules to `spy.push()` functions as a simple deletion.\n",
    "\n",
    "<b>Caution</b>: any capsules whose `Start` value is within the `replace` range will be deleted. The `replace` `Start` is inclusive and `replace` `End` is exclusive."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To delete the first capsule, we'll specify a time range that includes its start (and no other capsule's start):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"background-color: #EEFFEE;color:black; text-align: left;\">Pushed successfully to datasource <strong>Seeq Data Lab [Datasource ID: Seeq Data Lab]</strong> and scoped to workbook ID <strong>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</strong><br>Click the following link to see what you pushed in Seeq:<br><a href=\"http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66\" target=\"_blank\">http://localhost:34216/0EF5BE2D-2738-FFA0-81E0-D2B058859C4D/workbook/0EF5BF13-F994-7530-B9F5-F329D8B2EE61/worksheet/0EF5BF13-F9D8-EAF0-A59E-83ECE7255F66</a></div><table class=\"tex2jax_ignore\" style=\"color:black;\"><tr><td style=\"background-color: #EEFFEE;\"></td><td style=\"background-color: #EEFFEE; text-align: left;\">ID</td><td style=\"background-color: #EEFFEE; text-align: left;\">Type</td><td style=\"background-color: #EEFFEE; text-align: left;\">Name</td><td style=\"background-color: #EEFFEE; text-align: right;\">Count</td><td style=\"background-color: #EEFFEE; text-align: right;\">Pages</td><td style=\"background-color: #EEFFEE; text-align: right;\">Time</td><td style=\"background-color: #EEFFEE; text-align: left;\">Result</td></tr><tr style=\"background-color: #EEFFEE;\"><td style=\"vertical-align: top;\">0</td><td style=\"text-align: left; vertical-align: top;\">0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td><td style=\"text-align: left; vertical-align: top;\">StoredCondition</td><td style=\"text-align: left; vertical-align: top;\">In Production</td><td style=\"text-align: right; vertical-align: top;\">0</td><td style=\"text-align: right; vertical-align: top;\">1</td><td style=\"vertical-align: top;\">00:00:00.02</td><td style=\"text-align: left; vertical-align: top;\">Success</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Type</th>\n",
       "      <th>Maximum Duration</th>\n",
       "      <th>Scoped To</th>\n",
       "      <th>Datasource Class</th>\n",
       "      <th>Datasource ID</th>\n",
       "      <th>Formula Parameters</th>\n",
       "      <th>Data ID</th>\n",
       "      <th>ID</th>\n",
       "      <th>Push Result</th>\n",
       "      <th>Push Count</th>\n",
       "      <th>Push Time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>In Production</td>\n",
       "      <td>StoredCondition</td>\n",
       "      <td>2d</td>\n",
       "      <td>0EF5BF13-F994-7530-B9F5-F329D8B2EE61</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>Seeq Data Lab</td>\n",
       "      <td>[]</td>\n",
       "      <td>[0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...</td>\n",
       "      <td>0EF5BF14-15AC-FB50-A247-B95EE20C5BB3</td>\n",
       "      <td>Success</td>\n",
       "      <td>0</td>\n",
       "      <td>0 days 00:00:00.019975</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Name             Type Maximum Duration  \\\n",
       "0  In Production  StoredCondition               2d   \n",
       "\n",
       "                              Scoped To Datasource Class  Datasource ID  \\\n",
       "0  0EF5BF13-F994-7530-B9F5-F329D8B2EE61    Seeq Data Lab  Seeq Data Lab   \n",
       "\n",
       "  Formula Parameters                                            Data ID  \\\n",
       "0                 []  [0EF5BF13-F994-7530-B9F5-F329D8B2EE61] {Condit...   \n",
       "\n",
       "                                     ID Push Result  Push Count  \\\n",
       "0  0EF5BF14-15AC-FB50-A247-B95EE20C5BB3     Success           0   \n",
       "\n",
       "               Push Time  \n",
       "0 0 days 00:00:00.019975  "
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spy.push(metadata=pd.DataFrame([{\n",
    "             'Name': 'In Production',\n",
    "             'Type': 'Condition',\n",
    "             'Maximum Duration': '2d'}]),\n",
    "         replace={'Start':    pd.to_datetime('2019-01-10T09:00:00.000Z'),\n",
    "                  'End':      pd.to_datetime('2019-01-10T10:00:00.000Z')},\n",
    "         workbook='SPy Documentation Examples >> spy.push')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If there are several capsules that start at the same time or within the same range, you can delete just one by following the update workflow but removing the capsule to be deleted from the `pandas` DataFrame before using `spy.push()`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Detailed Help\n",
    "\n",
    "All SPy functions have detailed documentation to help you use them. Just execute `help(spy.<func>)` like\n",
    "you see below.\n",
    "\n",
    "**Make sure you re-execute the cell below to see the latest documentation. It otherwise might be from an\n",
    "earlier version of SPy.**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function push in module seeq.spy._push:\n",
      "\n",
      "push(data=None, *, metadata=None, replace=None, workbook='Data Lab >> Data Lab Analysis', worksheet='From Data Lab', datasource=None, archive=False, type_mismatches='raise', metadata_state_file: 'Optional[str]' = None, include_workbook_inventory: 'Optional[bool]' = None, errors=None, quiet=None, status=None, session: 'Optional[Session]' = None)\n",
      "    Imports metadata and/or data into Seeq Server, possibly scoped to a\n",
      "    workbook and/or datasource.\n",
      "    \n",
      "    The 'data' and 'metadata' arguments work together. Signal and condition\n",
      "    data cannot be mixed together in a single call to spy.push().\n",
      "    \n",
      "    Successive calls to 'push()' with the same 'metadata' but different 'data'\n",
      "    will update the items (rather than overwrite them); however, pushing a new\n",
      "    sample with the same timestamp as a previous one will overwrite the old\n",
      "    one.\n",
      "    \n",
      "    Metadata can be pushed without accompanying data. This is common after\n",
      "    having invoked the spy.assets.build() function. In such a case, the\n",
      "    'metadata' DataFrame can contain signals, conditions, scalars, metrics,\n",
      "    and assets.\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    data : pandas.DataFrame, optional\n",
      "        A DataFrame that contains the signal or condition data to be pushed.\n",
      "        If 'metadata' is also supplied, it will have specific formatting\n",
      "        requirements depending on the type of data being pushed.\n",
      "    \n",
      "        For signals, 'data' must have a pandas.Timestamp-based index with a\n",
      "        column for each signal. To push to an existing signal, set the column\n",
      "        name to the Seeq ID of the item to be pushed. An exception will be\n",
      "        raised if the item does not exist.\n",
      "    \n",
      "        For conditions, 'data' must have an integer index and two\n",
      "        pandas.Timestamp columns named 'Capsule Start' and 'Capsule End'.\n",
      "    \n",
      "    metadata : pandas.DataFrame, optional\n",
      "        A DataFrame that contains the metadata for signals, conditions,\n",
      "        scalars, metrics, or assets. If 'metadata' is supplied, in conjunction\n",
      "        with a 'data' DataFrame, it has specific requirements depending on the\n",
      "        kind of data supplied.\n",
      "    \n",
      "        For signals, the 'metadata' index (i.e., each row's index value) must\n",
      "        match the column names of the 'data' DataFrame. For example, if you\n",
      "        would like to push data where the name of each column is the Name of\n",
      "        the item, then you might do set_index('Name', inplace=True, drop=False)\n",
      "        on your metadata DataFrame to make the index match the data DataFrame's\n",
      "        column names.\n",
      "    \n",
      "        For conditions, the 'metadata' index must match values within the\n",
      "        'Condition' column of the 'data' DataFrame. If you don't have a\n",
      "        'Condition' column, then the 'metadata' DataFrame must have only one\n",
      "        row with metadata.\n",
      "    \n",
      "        Metadata for each object type includes:\n",
      "    \n",
      "        Type Key:   Si = Signal, Sc = Scalar, C = Condition,\n",
      "                    A = Asset, M = Metric\n",
      "    \n",
      "        ===================== ==================================== ============\n",
      "        Metadata Term         Definition                           Types\n",
      "        ===================== ==================================== ============\n",
      "        Name                  Name of the signal                   Si,Sc,C,A,M\n",
      "        Description           Description of the signal            Si,Sc,C,A\n",
      "        Maximum Interpolation Maximum interpolation between        Si\n",
      "                              samples\n",
      "        Value Unit Of Measure Unit of measure for the signal       Si\n",
      "        Formula               Formula for a calculated item        Si,Sc,C\n",
      "        Formula Parameters    Parameters for a formula             Si,Sc,C\n",
      "        Interpolation Method  Interpolation method between points  Si\n",
      "                              Options are Linear, Step, PILinear\n",
      "        Maximum Duration      Maximum expected duration for a      C\n",
      "                              capsule\n",
      "        Number Format         Formatting string ECMA-376           Si,Sc,M\n",
      "        Path                  Asset tree path where the item's     Si,Sc,C,A\n",
      "                              parent asset resides\n",
      "        Measured Item         The ID of the signal or condition    M\n",
      "        Statistic             Aggregate formula function to        M\n",
      "                              compute on the measured item\n",
      "        Duration              Duration to calculate a moving       M\n",
      "                              aggregation for a continuous process\n",
      "        Period                Period to sample for a               M\n",
      "                              continuous process\n",
      "        Thresholds            List of priority thresholds mapped\n",
      "                              to a scalar formula/value or an ID   M\n",
      "                              of a signal, condition or scalar\n",
      "        Bounding Condition    The ID of a condition to aggregate   M\n",
      "                              for a batch process\n",
      "        Bounding Condition    Duration for aggregation for a       M\n",
      "        Maximum Duration      bounding condition without a maximum\n",
      "                              duration\n",
      "        Asset                 Parent asset name. Parent asset      Si,Sc,C,A,M\n",
      "                              must be in the tree at the\n",
      "                              specified path, or listed in\n",
      "                              'metadata' for creation.\n",
      "        Capsule Property      A dictionary of capsule property     C\n",
      "        Units                 names with their associated units\n",
      "                              of measure\n",
      "        Push Directives       A semi-colon-delimited list of\n",
      "                              directives for the row that can\n",
      "                              include:\n",
      "                              'CreateOnly' - do not overwrite\n",
      "                              existing item\n",
      "                              'UpdateOnly' - only overwrite, do\n",
      "                              not create\n",
      "        ===================== ==================================== ============\n",
      "    \n",
      "    replace : dict, default None\n",
      "        A dict with the keys 'Start' and 'End'. If provided, any existing samples\n",
      "        or capsules with the start date in the provided time period will be\n",
      "        replaced. The start of the time period is inclusive and the end of the\n",
      "        time period is exclusive. If replace is provided but data is not\n",
      "        specified, all samples/capsules within the provided time period will be\n",
      "        removed.\n",
      "    \n",
      "    workbook : {str, None, AnalysisTemplate}, default 'Data Lab >> Data Lab Analysis'\n",
      "        The path to a workbook (in the form of 'Folder >> Path >> Workbook\n",
      "        Name') or an ID that all pushed items will be 'scoped to'. Items scoped\n",
      "        to a certain workbook will not be visible/searchable using the data\n",
      "        panel in other workbooks. If None, items can also be 'globally scoped',\n",
      "        meaning that they will be visible/searchable in all workbooks. Global\n",
      "        scoping should be used judiciously to prevent search results becoming\n",
      "        cluttered in all workbooks. The ID for a workbook is visible in the URL\n",
      "        of Seeq Workbench, directly after the \"workbook/\" part. You can also\n",
      "        push to the Corporate folder by using the following pattern:\n",
      "        f'{spy.workbooks.CORPORATE} >> MySubfolder >> MyWorkbook'\n",
      "    \n",
      "        You can also supply an AnalysisTemplate object (or a list of them) so\n",
      "        that you push a custom workbook with specific worksheets and associated\n",
      "        visualizations. Check out the \"Workbook Templates.ipynb\" tutorial\n",
      "        notebook for more information.\n",
      "    \n",
      "    worksheet : {str, None, AnalysisWorksheetTemplate}, default 'From Data Lab'\n",
      "        The name of a worksheet within the workbook to create/update that will\n",
      "        render the data that has been pushed so that you can see it in Seeq\n",
      "        easily. If None, no worksheet will be added or changed. This argument\n",
      "        is ignored if an AnalysisTemplate object is supplied as the workbook\n",
      "        argument.\n",
      "    \n",
      "        You can also supply an AnalysisWorksheetTemplate object so that you\n",
      "        push a custom worksheet with associated visualizations. Check out the\n",
      "        \"Workbook Templates.ipynb\" tutorial notebook for more information.\n",
      "    \n",
      "    datasource : str, optional, default 'Seeq Data Lab'\n",
      "        The name of the datasource within which to contain all the pushed items.\n",
      "        Items inherit access control permissions from their datasource unless it\n",
      "        has been overridden at a lower level. If you specify a datasource using\n",
      "        this argument, you can later manage access control (using spy.acl functions)\n",
      "        at the datasource level for all the items you have pushed.\n",
      "    \n",
      "        If you instead want access control for your items to be inherited from the\n",
      "        workbook they are scoped to, specify `spy.INHERIT_FROM_WORKBOOK`.\n",
      "    \n",
      "    archive : bool, default False\n",
      "        If True, and all metadata describes items from a common asset tree,\n",
      "        then items in the tree not updated by this push call are archived.\n",
      "    \n",
      "    type_mismatches : {'raise', 'drop', 'invalid'}, default 'raise'\n",
      "        If 'raise' (default), any mismatches between the type of the data and\n",
      "        its metadata will cause an exception. For example, if string data is\n",
      "        found in a numeric time series, an error will be raised. If 'drop' is\n",
      "        specified, such data will be ignored while pushing. If 'invalid' is\n",
      "        specified, such data will be replaced with an INVALID sample, which\n",
      "        will interrupt interpolation in calculations and displays.\n",
      "    \n",
      "    metadata_state_file : str, optional\n",
      "        The file name (with full path, if desired) to a \"metadata state file\"\n",
      "        to use for \"incremental\" pushing, which can dramatically speed up\n",
      "        pushing of a large metadata DataFrame. If supplied, the metadata push\n",
      "        operation uses the state file to determine what changed since the\n",
      "        last time the metadata was pushed and it will only act on those\n",
      "        changes.\n",
      "    \n",
      "    include_workbook_inventory : bool, optional\n",
      "        If supplied, this argument is further supplied to the\n",
      "        spy.workbooks.push operation that occurs when any workbook is pushed\n",
      "        as part of this broader spy.push operation.\n",
      "    \n",
      "    errors : {'raise', 'catalog'}, default 'raise'\n",
      "        If 'raise', any errors encountered will cause an exception. If\n",
      "        'catalog', errors will be added to a 'Result' column in the status.df\n",
      "        DataFrame.\n",
      "    \n",
      "    quiet : bool, default False\n",
      "        If True, suppresses progress output. Note that when status is\n",
      "        provided, the quiet setting of the Status object that is passed\n",
      "        in takes precedence.\n",
      "    \n",
      "    status : spy.Status, optional\n",
      "        If specified, the supplied Status object will be updated as the command\n",
      "        progresses. It gets filled in with the same information you would see\n",
      "        in Jupyter in the blue/green/red table below your code while the\n",
      "        command is executed. The table itself is accessible as a DataFrame via\n",
      "        the status.df property.\n",
      "    \n",
      "    session : spy.Session, optional\n",
      "        If supplied, the Session object (and its Options) will be used to\n",
      "        store the login session state. This is useful to log in to different\n",
      "        Seeq servers at the same time or with different credentials.\n",
      "    \n",
      "    Returns\n",
      "    -------\n",
      "    pandas.DataFrame\n",
      "        A DataFrame with the metadata for the items pushed, along with any\n",
      "        errors and statistics about the operation.\n",
      "    \n",
      "        Additionally, the following properties are stored on the \"spy\"\n",
      "        attribute of the output DataFrame:\n",
      "    \n",
      "        =================== ===================================================\n",
      "        Property            Description\n",
      "        =================== ===================================================\n",
      "        func                A str value of 'spy.push'\n",
      "        kwargs              A dict with the values of the input parameters\n",
      "                            passed to spy.push to get the output DataFrame\n",
      "        workbook_id         If pushed to a specific workbook, the ID of that\n",
      "                            workbook.\n",
      "        worksheet_id        If pushed to a specific worksheet, the ID of that\n",
      "                            worksheet.\n",
      "        workbook_url        If pushed to a specific workbook, the URL of that\n",
      "                            workbook and the curated worksheet that this\n",
      "                            command created.\n",
      "        datasource          The datasource that all pushed items will fall\n",
      "                            under (as a DatasourceOutputV1 object)\n",
      "        old_asset_format    Always False because this function requires use of\n",
      "                            the new asset format. See doc for\n",
      "                            spy.search(old_asset_format) argument.\n",
      "        status              A spy.Status object with the status of the\n",
      "                            spy.push call\n",
      "        =================== ===================================================\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(spy.push)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.11",
   "language": "python",
   "name": "python311"
  },
  "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.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
