Skip to content

Commit

Permalink
Adjust notebook for creation of the run-of-show spreatsheed for the v…
Browse files Browse the repository at this point in the history
…ideo team and bcc
  • Loading branch information
sebastianneubauer authored and FlorianWilhelm committed Apr 16, 2023
1 parent aff63da commit 9d00543
Showing 1 changed file with 77 additions and 79 deletions.
156 changes: 77 additions & 79 deletions notebooks/pyconde-pydata-berlin-2023/60_agenda_export_v1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,11 @@
},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"import math\n",
"import logging\n",
"import structlog\n",
"from pathlib import Path\n",
"import json\n",
"import re\n",
"from itertools import product, combinations\n",
"\n",
"import tomli\n",
"import numpy as np\n",
"\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"import matplotlib as mpl\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format = 'retina'\n",
"\n",
"import seaborn as sns\n",
"sns.set_context(\"poster\")\n",
"sns.set(rc={\"figure.figsize\": (12, 6.)})\n",
"sns.set_style(\"whitegrid\")\n",
"\n",
"import pandas as pd\n",
"pd.set_option(\"display.max_rows\", 120)\n",
"pd.set_option(\"display.max_columns\", 120)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"logging.basicConfig(level=logging.WARNING, stream=sys.stdout)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"\n",
"import pytanis\n",
"from pytanis import GSheetClient, PretalxClient\n",
"from pytanis.google import Scope, gsheet_rows_for_fmt, worksheet_range\n",
Expand All @@ -67,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 2,
"metadata": {
"tags": []
},
Expand All @@ -78,7 +33,7 @@
"'0.5'"
]
},
"execution_count": 5,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -90,7 +45,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 3,
"metadata": {
"tags": []
},
Expand All @@ -112,34 +67,20 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 4,
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d31d81e15ebf40e0be02117682f38461",
"model_id": "ae7fa732607f480b91924301bd467464",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/116 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "443e689441134a0d994e026e90aeb1b0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/7 [00:00<?, ?it/s]"
" 0%| | 0/115 [00:00<?, ?it/s]"
]
},
"metadata": {},
Expand All @@ -154,7 +95,7 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 5,
"metadata": {
"tags": []
},
Expand All @@ -163,32 +104,81 @@
"def to_pdf(subs):\n",
" rows = []\n",
" for sub in subs:\n",
" if not sub.slot:\n",
" print(\"Not scheduled?\")\n",
" print(sub.speakers, sub.title, sub.code)\n",
" continue\n",
" row = {\n",
" Col.submission: sub.code,\n",
" Col.speaker_name: \", \".join([speaker.name for speaker in sub.speakers]),\n",
" \"Submission\": sub.code,\n",
" \"Speaker\": \", \".join([speaker.name for speaker in sub.speakers]),\n",
" \"Day\": f\"{sub.slot.start.day}\",\n",
" \"Time\": f\"{sub.slot.start.time()}-{sub.slot.end.time()}\",\n",
" \"Room\": sub.slot.room.en,\n",
" Col.duration: sub.duration,\n",
" Col.track: sub.track.en if sub.track else None,\n",
" Col.title: sub.title,\n",
" \n",
" \"Duration\": sub.duration,\n",
" \"Track\": sub.track.en if sub.track else None,\n",
" \"Title\": sub.title,\n",
" \"URL\": f\"https://pretalx.com/pyconde-pydata-berlin-2023/talk/{sub.code}/\"\n",
" }\n",
" rows.append(row)\n",
" return pd.DataFrame(rows)"
]
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 6,
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Not scheduled?\n",
"[SubmissionSpeaker(code='NMACLQ', name='Tereza Iofciu', biography=None, avatar='https://pretalx.com/media/avatars/IMG_1246_mOIzBWp.jpg', email='terezaif@gmail.com')] Rethinking codes of conduct AWBLKN\n",
"Not scheduled?\n",
"[SubmissionSpeaker(code='8BJ7S9', name='Lev Konstantinovskiy', biography='Lev Konstantinovskiy is an experienced data science and software engineering team lead. Long time ago he used to maintain a python Natural Language Processing library gensim.', avatar=None, email='lev.konst@gmail.com')] Prompt Engineering 101: Beginner intro to LangChain MSZG7B\n"
]
}
],
"source": [
"df = to_pdf(talks)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['Kuppelsaal', 'B05-B06', 'B07-B08', 'A1', 'B09', 'A03-A04', 'A05-A06']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rooms = list(df['Room'].unique())\n",
"rooms"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"columns_list = [\"Day\", \"Time\", \"Speaker\", \"Title\", \"Duration\", \"Submission\", \"URL\"]"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -198,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 9,
"metadata": {
"tags": []
},
Expand All @@ -209,14 +199,22 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 10,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"gsheet_client.save_df_as_gsheet(df, cfg['schedule_spread_id'], cfg['agenda_work_name'])"
"for room in rooms:\n",
" gsheet_client.save_df_as_gsheet(df[df['Room']==room][columns_list].sort_values(by=['Day', 'Time']), cfg['schedule_spread_id'], room, create_ws=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -235,7 +233,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.10"
},
"pycharm": {
"stem_cell": {
Expand Down

0 comments on commit 9d00543

Please sign in to comment.