erste versuche
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
# by me:
|
||||
resources/
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
||||
212
Filter.ipynb
Executable file
212
Filter.ipynb
Executable file
@@ -0,0 +1,212 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "2257ee1d-bcc1-483c-bb74-106e52aa7b46",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" ID Name \\\n",
|
||||
"0 ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4 Harvest log 40 \n",
|
||||
"1 f873e803-f20a-460e-8c2c-d10835d6b2c7 Harvest log 42 \n",
|
||||
"2 97f1f184-20ce-44da-bc70-134e3917a701 Harvest log 43 \n",
|
||||
"3 fa5c7900-ef46-44fb-a160-2594ca00d65b Harvest log 44 \n",
|
||||
"4 fa014b11-25ef-4a49-9406-0f3900952a2c Harvest log 46 \n",
|
||||
"5 05fd5f47-15df-4be0-8197-a4927ab87a88 test log \n",
|
||||
"6 50a16f30-79f6-4c3b-9815-3af6cf107cf3 Harvest log 48 \n",
|
||||
"7 7159b3fe-bf3b-4fcc-9438-1ed0b1971937 Harvest log 49 \n",
|
||||
"8 16a3cdd0-a9fb-403a-8e0b-1f390cefe0cd Harvest log 64 \n",
|
||||
"9 c39d4bc4-4bcb-408c-b2b6-018901dd7e74 Harvest log 65 \n",
|
||||
"10 ff8a1498-8057-4ede-be2a-a82b88f893ba Harvest log 67 \n",
|
||||
"11 e8c4b960-6947-426c-8d07-4ab4a1f11578 Harvest log 69 \n",
|
||||
"12 a1c2eae4-5543-40ee-98b5-6ca92fc54b5a Harvest log 71 \n",
|
||||
"13 2058bca2-537b-49cb-bcc0-c33496384c2b Harvest log 73 \n",
|
||||
"\n",
|
||||
" Timestamp Plant Area Status \\\n",
|
||||
"0 2024-09-23T09:13:35+00:00 23/24 Grosser Acker Weizen Plant 7.5 done \n",
|
||||
"1 2024-09-24T14:13:40+00:00 0.0 done \n",
|
||||
"2 2024-09-24T17:30:47+00:00 0.0 done \n",
|
||||
"3 2024-09-24T17:33:27+00:00 0.0 done \n",
|
||||
"4 2024-09-24T17:47:52+00:00 0.0 done \n",
|
||||
"5 2024-09-24T17:48:49+00:00 0.0 done \n",
|
||||
"6 2024-09-24T18:10:27+00:00 23/24 Grosser Acker Weizen Plant 7.5 done \n",
|
||||
"7 2024-09-24T18:15:59+00:00 23/24 Grosser Acker Weizen Plant 7.5 done \n",
|
||||
"8 2024-09-27T13:52:31+00:00 23/24 Grosser Acker Weizen Plant 7.5 done \n",
|
||||
"9 2024-09-27T13:52:34+00:00 23/24 Grosser Acker Weizen Plant 7.5 done \n",
|
||||
"10 2024-09-27T13:56:30+00:00 23/24 Grosser Acker Raps Plant 5.0 done \n",
|
||||
"11 2024-09-27T13:57:00+00:00 23/24 Grosser Acker Raps Plant 5.0 done \n",
|
||||
"12 2024-09-27T13:58:03+00:00 23/24 Grosser Acker Raps Plant 5.0 done \n",
|
||||
"13 2024-09-27T15:29:38+00:00 23/24 Loehle Mais Plant 4.0 done \n",
|
||||
"\n",
|
||||
" Revision Created \\\n",
|
||||
"0 2024-09-23T09:15:08+00:00 \n",
|
||||
"1 2024-09-24T14:14:12+00:00 \n",
|
||||
"2 2024-09-24T17:30:52+00:00 \n",
|
||||
"3 2024-09-24T17:35:08+00:00 \n",
|
||||
"4 2024-09-24T17:48:16+00:00 \n",
|
||||
"5 2024-09-24T17:49:12+00:00 \n",
|
||||
"6 2024-09-24T18:10:47+00:00 \n",
|
||||
"7 2024-09-25T09:34:35+00:00 \n",
|
||||
"8 2024-09-27T13:52:33+00:00 \n",
|
||||
"9 2024-09-27T13:53:09+00:00 \n",
|
||||
"10 2024-09-27T13:56:59+00:00 \n",
|
||||
"11 2024-09-27T13:57:37+00:00 \n",
|
||||
"12 2024-09-27T13:58:36+00:00 \n",
|
||||
"13 2024-09-27T15:30:13+00:00 \n",
|
||||
"\n",
|
||||
" Link \n",
|
||||
"0 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"1 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"2 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"3 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"4 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"5 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"6 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"7 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"8 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"9 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"10 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"11 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"12 https://farmos.wagframe.duckdns.org/api/log/ha... \n",
|
||||
"13 https://farmos.wagframe.duckdns.org/api/log/ha... \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "PermissionError",
|
||||
"evalue": "[Errno 13] Permission denied: 'harvest_logs.csv'",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mPermissionError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[9], line 88\u001b[0m\n\u001b[0;32m 86\u001b[0m \u001b[38;5;66;03m# Speichere die Tabelle in einer CSV-Datei\u001b[39;00m\n\u001b[0;32m 87\u001b[0m csv_file_path \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mharvest_logs.csv\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m---> 88\u001b[0m \u001b[43mdf\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_csv\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcsv_file_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[0;32m 90\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDie Tabelle wurde erfolgreich in der Datei \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcsv_file_path\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m gespeichert.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
|
||||
"File \u001b[1;32m\\\\?\\C:\\Users\\Wir\\AppData\\Roaming\\jupyterlab-desktop\\jlab_server\\Lib\\site-packages\\pandas\\util\\_decorators.py:333\u001b[0m, in \u001b[0;36mdeprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 327\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(args) \u001b[38;5;241m>\u001b[39m num_allow_args:\n\u001b[0;32m 328\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[0;32m 329\u001b[0m msg\u001b[38;5;241m.\u001b[39mformat(arguments\u001b[38;5;241m=\u001b[39m_format_argument_list(allow_args)),\n\u001b[0;32m 330\u001b[0m \u001b[38;5;167;01mFutureWarning\u001b[39;00m,\n\u001b[0;32m 331\u001b[0m stacklevel\u001b[38;5;241m=\u001b[39mfind_stack_level(),\n\u001b[0;32m 332\u001b[0m )\n\u001b[1;32m--> 333\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[1;32m\\\\?\\C:\\Users\\Wir\\AppData\\Roaming\\jupyterlab-desktop\\jlab_server\\Lib\\site-packages\\pandas\\core\\generic.py:3967\u001b[0m, in \u001b[0;36mNDFrame.to_csv\u001b[1;34m(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, lineterminator, chunksize, date_format, doublequote, escapechar, decimal, errors, storage_options)\u001b[0m\n\u001b[0;32m 3956\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, ABCDataFrame) \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mto_frame()\n\u001b[0;32m 3958\u001b[0m formatter \u001b[38;5;241m=\u001b[39m DataFrameFormatter(\n\u001b[0;32m 3959\u001b[0m frame\u001b[38;5;241m=\u001b[39mdf,\n\u001b[0;32m 3960\u001b[0m header\u001b[38;5;241m=\u001b[39mheader,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 3964\u001b[0m decimal\u001b[38;5;241m=\u001b[39mdecimal,\n\u001b[0;32m 3965\u001b[0m )\n\u001b[1;32m-> 3967\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mDataFrameRenderer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mformatter\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_csv\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 3968\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath_or_buf\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3969\u001b[0m \u001b[43m \u001b[49m\u001b[43mlineterminator\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlineterminator\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3970\u001b[0m \u001b[43m \u001b[49m\u001b[43msep\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msep\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3971\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3972\u001b[0m \u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3973\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompression\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcompression\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3974\u001b[0m \u001b[43m \u001b[49m\u001b[43mquoting\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquoting\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3975\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3976\u001b[0m \u001b[43m \u001b[49m\u001b[43mindex_label\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mindex_label\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3977\u001b[0m \u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3978\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunksize\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunksize\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3979\u001b[0m \u001b[43m \u001b[49m\u001b[43mquotechar\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquotechar\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3980\u001b[0m \u001b[43m \u001b[49m\u001b[43mdate_format\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdate_format\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3981\u001b[0m \u001b[43m \u001b[49m\u001b[43mdoublequote\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdoublequote\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3982\u001b[0m \u001b[43m \u001b[49m\u001b[43mescapechar\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mescapechar\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3983\u001b[0m \u001b[43m \u001b[49m\u001b[43mstorage_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstorage_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 3984\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"File \u001b[1;32m\\\\?\\C:\\Users\\Wir\\AppData\\Roaming\\jupyterlab-desktop\\jlab_server\\Lib\\site-packages\\pandas\\io\\formats\\format.py:1014\u001b[0m, in \u001b[0;36mDataFrameRenderer.to_csv\u001b[1;34m(self, path_or_buf, encoding, sep, columns, index_label, mode, compression, quoting, quotechar, lineterminator, chunksize, date_format, doublequote, escapechar, errors, storage_options)\u001b[0m\n\u001b[0;32m 993\u001b[0m created_buffer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m 995\u001b[0m csv_formatter \u001b[38;5;241m=\u001b[39m CSVFormatter(\n\u001b[0;32m 996\u001b[0m path_or_buf\u001b[38;5;241m=\u001b[39mpath_or_buf,\n\u001b[0;32m 997\u001b[0m lineterminator\u001b[38;5;241m=\u001b[39mlineterminator,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1012\u001b[0m formatter\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfmt,\n\u001b[0;32m 1013\u001b[0m )\n\u001b[1;32m-> 1014\u001b[0m \u001b[43mcsv_formatter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msave\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1016\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m created_buffer:\n\u001b[0;32m 1017\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(path_or_buf, StringIO)\n",
|
||||
"File \u001b[1;32m\\\\?\\C:\\Users\\Wir\\AppData\\Roaming\\jupyterlab-desktop\\jlab_server\\Lib\\site-packages\\pandas\\io\\formats\\csvs.py:251\u001b[0m, in \u001b[0;36mCSVFormatter.save\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 247\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 248\u001b[0m \u001b[38;5;124;03mCreate the writer & save.\u001b[39;00m\n\u001b[0;32m 249\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 250\u001b[0m \u001b[38;5;66;03m# apply compression and byte/text conversion\u001b[39;00m\n\u001b[1;32m--> 251\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[43mget_handle\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 252\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 253\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 254\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 255\u001b[0m \u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 256\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompression\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcompression\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 257\u001b[0m \u001b[43m \u001b[49m\u001b[43mstorage_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstorage_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 258\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m handles:\n\u001b[0;32m 259\u001b[0m \u001b[38;5;66;03m# Note: self.encoding is irrelevant here\u001b[39;00m\n\u001b[0;32m 260\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mwriter \u001b[38;5;241m=\u001b[39m csvlib\u001b[38;5;241m.\u001b[39mwriter(\n\u001b[0;32m 261\u001b[0m handles\u001b[38;5;241m.\u001b[39mhandle,\n\u001b[0;32m 262\u001b[0m lineterminator\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlineterminator,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 267\u001b[0m quotechar\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mquotechar,\n\u001b[0;32m 268\u001b[0m )\n\u001b[0;32m 270\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_save()\n",
|
||||
"File \u001b[1;32m\\\\?\\C:\\Users\\Wir\\AppData\\Roaming\\jupyterlab-desktop\\jlab_server\\Lib\\site-packages\\pandas\\io\\common.py:873\u001b[0m, in \u001b[0;36mget_handle\u001b[1;34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001b[0m\n\u001b[0;32m 868\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(handle, \u001b[38;5;28mstr\u001b[39m):\n\u001b[0;32m 869\u001b[0m \u001b[38;5;66;03m# Check whether the filename is to be opened in binary mode.\u001b[39;00m\n\u001b[0;32m 870\u001b[0m \u001b[38;5;66;03m# Binary mode does not support 'encoding' and 'newline'.\u001b[39;00m\n\u001b[0;32m 871\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m ioargs\u001b[38;5;241m.\u001b[39mencoding \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m ioargs\u001b[38;5;241m.\u001b[39mmode:\n\u001b[0;32m 872\u001b[0m \u001b[38;5;66;03m# Encoding\u001b[39;00m\n\u001b[1;32m--> 873\u001b[0m handle \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[0;32m 874\u001b[0m \u001b[43m \u001b[49m\u001b[43mhandle\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 875\u001b[0m \u001b[43m \u001b[49m\u001b[43mioargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 876\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mioargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 877\u001b[0m \u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 878\u001b[0m \u001b[43m \u001b[49m\u001b[43mnewline\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[0;32m 879\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 880\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 881\u001b[0m \u001b[38;5;66;03m# Binary mode\u001b[39;00m\n\u001b[0;32m 882\u001b[0m handle \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mopen\u001b[39m(handle, ioargs\u001b[38;5;241m.\u001b[39mmode)\n",
|
||||
"\u001b[1;31mPermissionError\u001b[0m: [Errno 13] Permission denied: 'harvest_logs.csv'"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from farmOS import farmOS\n",
|
||||
"\n",
|
||||
"hostname = \"farmos.wagframe.duckdns.org\"\n",
|
||||
"username = \"matze\"\n",
|
||||
"password = \"m6ChEHx5gMqgctr8dpb3fhATZbQS8hv4\"\n",
|
||||
"\n",
|
||||
"# Create the client.\n",
|
||||
"farm_client = farmOS(\n",
|
||||
" hostname=hostname,\n",
|
||||
" client_id = \"jupyter\", # Optional. The default oauth client_id \"farm\" is enabled on all farmOS servers.\n",
|
||||
")\n",
|
||||
"import json\n",
|
||||
"# Authorize the client, save the token.\n",
|
||||
"# A scope can be specified, but will default to the default scope set when initializing the client.\n",
|
||||
"token = farm_client.authorize(username, password)\n",
|
||||
"\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def get_related_logs_of_type(asset, type): \n",
|
||||
" response = farm_client.resource.get('log', type)\n",
|
||||
" ret = []\n",
|
||||
" for log in response['data']:\n",
|
||||
" assets = log['relationships']['asset']['data']\n",
|
||||
" for asset in assets:\n",
|
||||
" if asset['id'] == id:\n",
|
||||
" ret.append(log)\n",
|
||||
" return ret\n",
|
||||
"\n",
|
||||
"def get_related_quantities_of_measure(log, measure):\n",
|
||||
" quantities = log['relationships']['quantity']['data']\n",
|
||||
" ret = []\n",
|
||||
" for quant_ref in quantities:\n",
|
||||
" quant_id = quant_ref['id']\n",
|
||||
" quant = farm_client.resource.get_id('quantity', 'standard', quant_id)\n",
|
||||
" if quant['data']['attributes']['measure'] == measure:\n",
|
||||
" ret.append(quant)\n",
|
||||
" return ret\n",
|
||||
"\n",
|
||||
"# Beispiel für eine API-Abfrage mit farm_client\n",
|
||||
"response = farm_client.resource.get('log', 'harvest')\n",
|
||||
"\n",
|
||||
"logs = []\n",
|
||||
"for item in response['data']:\n",
|
||||
" # plant name und fläche holen\n",
|
||||
" assets = item['relationships']['asset']['data']\n",
|
||||
" plant_name = ''\n",
|
||||
" plant_area = 0.0\n",
|
||||
" for asset in assets:\n",
|
||||
" if asset['type'] == 'asset--plant': \n",
|
||||
" plant_id = asset['id']\n",
|
||||
" seedings = get_related_logs_of_type(plant_id, 'seeding')\n",
|
||||
" for seeding in seedings:\n",
|
||||
" area_quants = get_related_quantities_of_measure(seeding, 'area')\n",
|
||||
" for area_quant in area_quants:\n",
|
||||
" plant_area += float(area_quant['data']['attributes']['value']['decimal'])\n",
|
||||
" plant = farm_client.asset.get_id('plant', plant_id)\n",
|
||||
" plant_name = plant['data']['attributes']['name']\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" # log aufbauen\n",
|
||||
" log = {\n",
|
||||
" 'ID': item['id'],\n",
|
||||
" 'Name': item['attributes']['name'],\n",
|
||||
" 'Timestamp': item['attributes']['timestamp'],\n",
|
||||
" 'Plant': plant_name,\n",
|
||||
" 'Area': plant_area,\n",
|
||||
" 'Status': item['attributes']['status'],\n",
|
||||
" 'Revision Created': item['attributes']['revision_created'],\n",
|
||||
" 'Link': item['links']['self']['href']\n",
|
||||
" }\n",
|
||||
" logs.append(log)\n",
|
||||
"\n",
|
||||
"# Erstelle ein DataFrame aus den Harvest Logs\n",
|
||||
"df = pd.DataFrame(logs)\n",
|
||||
"\n",
|
||||
"# Zeige die Tabelle an\n",
|
||||
"print(df)\n",
|
||||
"\n",
|
||||
"# Speichere die Tabelle in einer CSV-Datei\n",
|
||||
"csv_file_path = 'harvest_logs.csv'\n",
|
||||
"df.to_csv(csv_file_path, index=False)\n",
|
||||
"\n",
|
||||
"print(f\"Die Tabelle wurde erfolgreich in der Datei '{csv_file_path}' gespeichert.\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "0ddcc922-e7c4-4cb8-8414-11c49e11fc6d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.5"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
324
Filtertest.ipynb
Executable file
324
Filtertest.ipynb
Executable file
@@ -0,0 +1,324 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "cdcbfae8-4395-433b-a163-dad94ff23e8e",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[\n",
|
||||
" {\n",
|
||||
" \"type\": \"log--harvest\",\n",
|
||||
" \"id\": \"ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4\",\n",
|
||||
" \"links\": {\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"attributes\": {\n",
|
||||
" \"drupal_internal__id\": 40,\n",
|
||||
" \"drupal_internal__revision_id\": 117,\n",
|
||||
" \"langcode\": \"en\",\n",
|
||||
" \"revision_created\": \"2024-09-23T09:15:08+00:00\",\n",
|
||||
" \"revision_log_message\": null,\n",
|
||||
" \"name\": \"Harvest log 40\",\n",
|
||||
" \"timestamp\": \"2024-09-23T09:13:35+00:00\",\n",
|
||||
" \"status\": \"done\",\n",
|
||||
" \"created\": \"2024-09-23T09:13:41+00:00\",\n",
|
||||
" \"changed\": \"2024-09-23T09:15:08+00:00\",\n",
|
||||
" \"default_langcode\": true,\n",
|
||||
" \"revision_translation_affected\": true,\n",
|
||||
" \"comment\": {\n",
|
||||
" \"status\": 2,\n",
|
||||
" \"cid\": 0,\n",
|
||||
" \"last_comment_timestamp\": 1727082908,\n",
|
||||
" \"last_comment_name\": null,\n",
|
||||
" \"last_comment_uid\": 1,\n",
|
||||
" \"comment_count\": 0\n",
|
||||
" },\n",
|
||||
" \"data\": null,\n",
|
||||
" \"notes\": null,\n",
|
||||
" \"flag\": [],\n",
|
||||
" \"is_group_assignment\": false,\n",
|
||||
" \"geometry\": {\n",
|
||||
" \"value\": \"POLYGON ((10.747713618221 48.694039316345, 10.747655366943 48.694041854983, 10.747352668456 48.694044456288, 10.746988118483 48.6940287062, 10.746433053748 48.693978472556, 10.746250998619 48.693961759714, 10.7461753607 48.693960936447, 10.746104245243 48.693957216059, 10.745939475211 48.693961314975, 10.745850196702 48.693972128187, 10.745790599455 48.694042190467, 10.745716117113 48.694173962885, 10.745502573537 48.695164024359, 10.745406797387 48.695235372785, 10.74520498955 48.695380745378, 10.745059826758 48.695487886107, 10.744978900971 48.695628460197, 10.744886906689 48.695842654082, 10.744784109987 48.696114283663, 10.744667158164 48.69633234191, 10.744618839846 48.69653271304, 10.744621273526 48.696652592521, 10.744641989421 48.696721633074, 10.744663189454 48.696863319971, 10.744719459551 48.697091539599, 10.744795409464 48.697276808576, 10.744950823047 48.697506108774, 10.745094966035 48.697686095699, 10.745257208999 48.697886693248, 10.745422114877 48.69810091126, 10.745634035074 48.698288053176, 10.745801394254 48.698411469309, 10.745905721986 48.698480736343, 10.746117077321 48.698595800492, 10.746424826502 48.698701343233, 10.746632693636 48.698767915052, 10.74681660007 48.698791741071, 10.747067264596 48.698832112942, 10.747295390227 48.698869250842, 10.747629399231 48.698894527626, 10.747960078898 48.698884061631, 10.748345959049 48.698853129008, 10.748566129586 48.698822421861, 10.748545941747 48.69878156207, 10.748520165013 48.698736318038, 10.748374465229 48.69845415984, 10.747053879092 48.698540875939, 10.747053546046 48.698540745584, 10.747053066437 48.698540777169, 10.746298814758 48.698245698355, 10.745821378975 48.697843469215, 10.747824633382 48.697711224506, 10.747658060988 48.697520475029, 10.747534619252 48.697387298543, 10.747428214692 48.697295673988, 10.74732669971 48.697204102543, 10.747282255281 48.697139320811, 10.747209284332 48.697030703761, 10.747182734932 48.696907214079, 10.7471967115 48.696803859423, 10.747235378259 48.696707338066, 10.747295016607 48.696625163451, 10.747355744508 48.696564763137, 10.747449337765 48.696510205824, 10.747588996812 48.696455070263, 10.747769616027 48.69640802375, 10.747913973991 48.696360582709, 10.748020387579 48.696314887248, 10.748368174046 48.696166060134, 10.748570023971 48.696057102913, 10.748695929525 48.695959370518, 10.748787396004 48.695853529492, 10.749054840599 48.695558951186, 10.749267245237 48.695352893485, 10.749357962031 48.695211432198, 10.749426252116 48.695092389323, 10.749559471935 48.694830885773, 10.749734443117 48.694468666186, 10.749841284384 48.694251930002, 10.749991043074 48.693975137752, 10.75008552632 48.693806176353, 10.750019634095 48.693658836055, 10.749974724823 48.693521278107, 10.749859249445 48.693253752548, 10.749833263471 48.693209083015, 10.749706219355 48.693234135446, 10.749598375148 48.693258388025, 10.749289429746 48.693373683396, 10.749010188146 48.693497671446, 10.748513873361 48.693724475341, 10.747884352359 48.693999288542, 10.747777729553 48.694036522286, 10.747776945448 48.694036556458, 10.747713618221 48.694039316345))\",\n",
|
||||
" \"geo_type\": \"Polygon\",\n",
|
||||
" \"lat\": 48.694039316345,\n",
|
||||
" \"lon\": 10.747713618221,\n",
|
||||
" \"left\": 10.744618839846,\n",
|
||||
" \"top\": 48.698894527626,\n",
|
||||
" \"right\": 10.75008552632,\n",
|
||||
" \"bottom\": 48.693209083015,\n",
|
||||
" \"geohash\": \"u0xth\",\n",
|
||||
" \"latlon\": \"48.694039316345,10.747713618221\"\n",
|
||||
" },\n",
|
||||
" \"is_movement\": false,\n",
|
||||
" \"quick\": [],\n",
|
||||
" \"lot_number\": null\n",
|
||||
" },\n",
|
||||
" \"relationships\": {\n",
|
||||
" \"log_type\": {\n",
|
||||
" \"data\": {\n",
|
||||
" \"type\": \"log_type--log_type\",\n",
|
||||
" \"id\": \"bb376a51-4586-46c8-b1cd-cdeea278599a\",\n",
|
||||
" \"meta\": {\n",
|
||||
" \"drupal_internal__target_id\": \"harvest\"\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/log_type?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/log_type?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"revision_user\": {\n",
|
||||
" \"data\": {\n",
|
||||
" \"type\": \"user--user\",\n",
|
||||
" \"id\": \"a93c675c-72b1-40ea-90ae-41df789b7607\",\n",
|
||||
" \"meta\": {\n",
|
||||
" \"drupal_internal__target_id\": 1\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/revision_user?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/revision_user?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"uid\": {\n",
|
||||
" \"data\": {\n",
|
||||
" \"type\": \"user--user\",\n",
|
||||
" \"id\": \"a93c675c-72b1-40ea-90ae-41df789b7607\",\n",
|
||||
" \"meta\": {\n",
|
||||
" \"drupal_internal__target_id\": 1\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/uid?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/uid?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"file\": {\n",
|
||||
" \"data\": [],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/file?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/file?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"image\": {\n",
|
||||
" \"data\": [],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/image?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/image?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"group\": {\n",
|
||||
" \"data\": [],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/group?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/group?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"location\": {\n",
|
||||
" \"data\": [\n",
|
||||
" {\n",
|
||||
" \"type\": \"asset--land\",\n",
|
||||
" \"id\": \"7842c79e-d2be-41a7-b6a6-e9af36dd9f7e\",\n",
|
||||
" \"meta\": {\n",
|
||||
" \"drupal_internal__target_id\": 54\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/location?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/location?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"asset\": {\n",
|
||||
" \"data\": [\n",
|
||||
" {\n",
|
||||
" \"type\": \"asset--plant\",\n",
|
||||
" \"id\": \"71c136e3-fae0-40a6-b3d7-8e1581ee4882\",\n",
|
||||
" \"meta\": {\n",
|
||||
" \"drupal_internal__target_id\": 69\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/asset?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/asset?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"category\": {\n",
|
||||
" \"data\": [],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/category?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/category?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"quantity\": {\n",
|
||||
" \"data\": [\n",
|
||||
" {\n",
|
||||
" \"type\": \"quantity--standard\",\n",
|
||||
" \"id\": \"51c3d816-6256-4386-92a0-6d12b626cad0\",\n",
|
||||
" \"meta\": {\n",
|
||||
" \"target_revision_id\": 37,\n",
|
||||
" \"drupal_internal__target_id\": 27\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/quantity?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/quantity?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"owner\": {\n",
|
||||
" \"data\": [\n",
|
||||
" {\n",
|
||||
" \"type\": \"user--user\",\n",
|
||||
" \"id\": \"a93c675c-72b1-40ea-90ae-41df789b7607\",\n",
|
||||
" \"meta\": {\n",
|
||||
" \"drupal_internal__target_id\": 1\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/owner?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/owner?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"equipment\": {\n",
|
||||
" \"data\": [],\n",
|
||||
" \"links\": {\n",
|
||||
" \"related\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/equipment?resourceVersion=id%3A117\"\n",
|
||||
" },\n",
|
||||
" \"self\": {\n",
|
||||
" \"href\": \"https://farmos.wagframe.duckdns.org/api/log/harvest/ae417c7e-e1f2-4184-b6f9-e5c8027a2fc4/relationships/equipment?resourceVersion=id%3A117\"\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
"]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from farmOS import farmOS\n",
|
||||
"\n",
|
||||
"hostname = \"farmos.wagframe.duckdns.org\"\n",
|
||||
"username = \"matze\"\n",
|
||||
"password = \"m6ChEHx5gMqgctr8dpb3fhATZbQS8hv4\"\n",
|
||||
"\n",
|
||||
"# Create the client.\n",
|
||||
"farm_client = farmOS(\n",
|
||||
" hostname=hostname,\n",
|
||||
" client_id = \"jupyter\", # Optional. The default oauth client_id \"farm\" is enabled on all farmOS servers.\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Authorize the client, save the token.\n",
|
||||
"# A scope can be specified, but will default to the default scope set when initializing the client.\n",
|
||||
"token = farm_client.authorize(username, password)\n",
|
||||
"#farm_client.info()\n",
|
||||
"#response = farm_client.resource.get('log', 'harvest')\n",
|
||||
"#print(json.dumps(response, indent=2))\n",
|
||||
"\n",
|
||||
"# Get all observation logs.\n",
|
||||
"#logs = list(farm_client.log.iterate('observation'))\n",
|
||||
"\n",
|
||||
"# Filter to 'done' logs.\n",
|
||||
"filters = farm_client.filter('name', 'Harvest log 40')\n",
|
||||
"done_observations = list(farm_client.log.iterate('harvest', params=filters))\n",
|
||||
"print(json.dumps(done_observations, indent=2))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "685f20c8-567a-4911-8b99-9be87f71b237",
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"print(json.dumps(response, indent=8))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "7fc852bd-12bb-4385-b84c-f28b68ed29bf",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.5"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
3199
get-harvest-loga.ipynb
Executable file
3199
get-harvest-loga.ipynb
Executable file
File diff suppressed because it is too large
Load Diff
3652
sogehtdasfreunde.ipynb
Executable file
3652
sogehtdasfreunde.ipynb
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user