diff --git a/docs/gettingstarted/demo/workflow.ipynb b/docs/gettingstarted/demo/workflow.ipynb new file mode 100644 index 00000000..3e35d240 --- /dev/null +++ b/docs/gettingstarted/demo/workflow.ipynb @@ -0,0 +1,241 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 📋 Workflow Demonstration\n", + "\n", + "There are existing implementations of workflows to showcase how `bigtree` can be used!" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "source": [ + "## To Do Application\n", + "There are functions to:\n", + "\n", + "- Add or remove list to To-Do application\n", + "- Add or remove item to list, default list is the 'General' list\n", + "- Prioritize a list/item by reordering them as first list/item\n", + "- Save and import To-Do application to and from an external JSON file\n", + "- Show To-Do application, which prints tree to console\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To Do App\n", + "├── School\n", + "│ └── Homework 1\n", + "├── Groceries\n", + "│ ├── Milk [description=Urgent]\n", + "│ └── Bread [description=Urgent]\n", + "└── General\n", + " └── Cook\n" + ] + } + ], + "source": [ + "from bigtree import AppToDo\n", + "\n", + "app = AppToDo(\"To Do App\")\n", + "app.add_item(item_name=\"Homework 1\", list_name=\"School\")\n", + "app.add_item(item_name=[\"Milk\", \"Bread\"], list_name=\"Groceries\", description=\"Urgent\")\n", + "app.add_item(item_name=\"Cook\")\n", + "app.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "app.save(\"list.json\")\n", + "app2 = AppToDo.load(\"list.json\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Calendar Application\n", + "\n", + "There are functions to:\n", + "\n", + "- Add or remove event from Calendar\n", + "- Find event by name, or name and date\n", + "- Display calendar, which prints events to console\n", + "- Export calendar to pandas DataFrame" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "My Calendar\n", + "2023-01-01 00:00:00 - Dinner (budget: 20)\n", + "2023-01-01 18:00:00 - Gym\n", + "2023-01-02 18:00:00 - Gym\n" + ] + } + ], + "source": [ + "import datetime as dt\n", + "from bigtree import Calendar\n", + "\n", + "calendar = Calendar(\"My Calendar\")\n", + "calendar.add_event(\"Gym\", \"2023-01-01 18:00\")\n", + "calendar.add_event(\"Dinner\", \"2023-01-01\", date_format=\"%Y-%m-%d\", budget=20)\n", + "calendar.add_event(\"Gym\", \"2023-01-02 18:00\")\n", + "calendar.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2023-01-01 18:00:00 - Gym\n", + "2023-01-02 18:00:00 - Gym\n" + ] + } + ], + "source": [ + "calendar.find_event(\"Gym\")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "My Calendar\n", + "2023-01-01 00:00:00 - Dinner (budget: 20)\n", + "2023-01-02 18:00:00 - Gym\n" + ] + } + ], + "source": [ + "calendar.delete_event(\"Gym\", dt.date(2023, 1, 1))\n", + "calendar.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " | path | \n", + "name | \n", + "date | \n", + "time | \n", + "budget | \n", + "
---|---|---|---|---|---|
0 | \n", + "/My Calendar/2023/01/01/Dinner | \n", + "Dinner | \n", + "2023-01-01 | \n", + "00:00:00 | \n", + "20.0 | \n", + "
1 | \n", + "/My Calendar/2023/01/02/Gym | \n", + "Gym | \n", + "2023-01-02 | \n", + "18:00:00 | \n", + "NaN | \n", + "