Skip to content

Commit 2310a01

Browse files
Merge pull request #144 from coding-for-reproducible-research/website_refactor_automate_schedule
Website refactor automate schedule
2 parents ea37950 + f363f17 commit 2310a01

17 files changed

+187
-34
lines changed

cfrr_program_details/courses_overview.ipynb

Lines changed: 158 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,172 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "e18ae98b-39e0-4d7b-bbf4-1114ffeef96c",
5+
"id": "02b9e8f5-82ed-460b-af25-9034e538b7b3",
66
"metadata": {},
77
"source": [
8-
"# Workshop Schedule and Signup\n",
8+
"# Workshop Schedule and Signup"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 6,
14+
"id": "d3aa7606-0f50-4f05-b104-ad4521c80406",
15+
"metadata": {
16+
"editable": true,
17+
"slideshow": {
18+
"slide_type": ""
19+
},
20+
"tags": [
21+
"remove-input"
22+
]
23+
},
24+
"outputs": [
25+
{
26+
"data": {
27+
"text/markdown": [
28+
"- Introduction to Python: 23rd/30th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UNDJFN1NaRlk0UkpLNjVDSTM2TlM0NlpPWS4u)\n",
29+
"- Introduction to R: 8th/15th/22nd October 1-4pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UQjJCSzFWQjNVSldGRFhDUDNXVjdBQjNZSi4u)\n",
30+
"- Regression Analysis with R: 25th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UMU1KRUpEOFRJQjFEOVVUVzFDMTRQMFZLRi4u)"
31+
],
32+
"text/plain": [
33+
"<IPython.core.display.Markdown object>"
34+
]
35+
},
36+
"metadata": {},
37+
"output_type": "display_data"
38+
}
39+
],
40+
"source": [
41+
"import pandas as pd\n",
42+
"from IPython.display import Markdown, display\n",
43+
"from datetime import datetime\n",
44+
"\n",
45+
"# Load the CSV file (adjust the file path as needed)\n",
46+
"file_path = '../data/workshop_info.csv'\n",
47+
"courses_df = pd.read_csv(file_path)\n",
48+
"\n",
49+
"# Strip any extra spaces in the column names\n",
50+
"courses_df.columns = courses_df.columns.str.strip()\n",
51+
"\n",
52+
"# Convert the 'End Date' column to datetime (assuming the date format is day-first)\n",
53+
"courses_df['End Date'] = pd.to_datetime(courses_df['End Date'], dayfirst=True, errors='coerce')\n",
954
"\n",
10-
"- Introduction to R: 8th/15th/22nd October 1-4pm (online only). [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UQjJCSzFWQjNVSldGRFhDUDNXVjdBQjNZSi4u)\n",
11-
"- Introduction to Python: 23rd/30th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UNDJFN1NaRlk0UkpLNjVDSTM2TlM0NlpPWS4u)\n",
12-
"- Regression Analysis with R: 25th October 10am-1pm (online only) - [MS Form Signup](https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UMU1KRUpEOFRJQjFEOVVUVzFDMTRQMFZLRi4u)"
55+
"# Get today's date\n",
56+
"today = datetime.now()\n",
57+
"\n",
58+
"# Filter for rows that contain valid MS Form Signup links, Course Date information, and check if the 'End Date' is still valid\n",
59+
"filtered_courses_df = courses_df.dropna(subset=['Course Date', 'MS Form Signup'])\n",
60+
"filtered_courses_df = filtered_courses_df[filtered_courses_df['End Date'] > today]\n",
61+
"\n",
62+
"# Function to generate markdown text based on course details\n",
63+
"def generate_markdown(row):\n",
64+
" return f\"- {row['Course Name']}: {row['Course Date']} - [MS Form Signup]({row['MS Form Signup']})\"\n",
65+
"\n",
66+
"# Apply the function and create the markdown output\n",
67+
"markdown_output = filtered_courses_df.apply(generate_markdown, axis=1).tolist()\n",
68+
"\n",
69+
"# Join the markdown lines into a single block\n",
70+
"markdown_text = \"\\n\".join(markdown_output)\n",
71+
"\n",
72+
"# Display the markdown text in rendered form\n",
73+
"display(Markdown(markdown_text))"
74+
]
75+
},
76+
{
77+
"cell_type": "markdown",
78+
"id": "7101f2f7-2903-4cdc-b736-3f5000c467f7",
79+
"metadata": {
80+
"editable": true,
81+
"slideshow": {
82+
"slide_type": ""
83+
},
84+
"tags": []
85+
},
86+
"source": [
87+
"# Previous Workshops"
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": 9,
93+
"id": "0a814add-f545-4663-8b06-39c40b636509",
94+
"metadata": {
95+
"editable": true,
96+
"slideshow": {
97+
"slide_type": ""
98+
},
99+
"tags": [
100+
"remove-input"
101+
]
102+
},
103+
"outputs": [
104+
{
105+
"data": {
106+
"text/markdown": [
107+
"<div align='center'>\n",
108+
"\n",
109+
"| Course Name | Course Info | Course Leader | Course Helpers | Course Developers |\n",
110+
"| --- | --- | --- | --- | --- |\n",
111+
"| Introduction to Python | 23rd/30th October 10am-1pm (online) | Tom Wilson | Liam Berrisford | Michael Saunby, Simon Kirby, Duncan McDougall, Eilis Hannon |\n",
112+
"\n",
113+
"</div>"
114+
],
115+
"text/plain": [
116+
"<IPython.core.display.Markdown object>"
117+
]
118+
},
119+
"metadata": {},
120+
"output_type": "display_data"
121+
}
122+
],
123+
"source": [
124+
"import pandas as pd\n",
125+
"from IPython.display import display, HTML\n",
126+
"\n",
127+
"# Load the CSV file (adjust the file path as needed)\n",
128+
"file_path_previous = '../data/previous_workshops.csv'\n",
129+
"previous_courses_df = pd.read_csv(file_path_previous)\n",
130+
"\n",
131+
"# Strip any extra spaces in the column names\n",
132+
"previous_courses_df.columns = previous_courses_df.columns.str.strip()\n",
133+
"\n",
134+
"# Function to generate an HTML table row for each course\n",
135+
"def generate_html_row(row):\n",
136+
" return f\"<tr><td>{row['Course Name']}</td><td>{row['Course Info']}</td><td>{row['Course Leader']}</td><td>{row['Course Helpers']}</td><td>{row['Course Developers']}</td></tr>\"\n",
137+
"\n",
138+
"# Generate HTML table header\n",
139+
"html_table_header = \"\"\"\n",
140+
"<table style='width: 100%; text-align: center; border: 1px solid black; border-collapse: collapse;'>\n",
141+
"<tr>\n",
142+
"<th>Course Name</th>\n",
143+
"<th>Course Info</th>\n",
144+
"<th>Course Leader</th>\n",
145+
"<th>Course Helpers</th>\n",
146+
"<th>Course Developers</th>\n",
147+
"</tr>\n",
148+
"\"\"\"\n",
149+
"\n",
150+
"# Apply the function and create the HTML table rows\n",
151+
"table_rows = previous_courses_df.apply(generate_html_row, axis=1).tolist()\n",
152+
"\n",
153+
"# Join the table rows into a single block\n",
154+
"html_table = html_table_header + \"\\n\".join(table_rows) + \"</table>\"\n",
155+
"\n",
156+
"# Display the HTML table\n",
157+
"display(HTML(html_table))\n"
13158
]
14159
},
15160
{
16161
"cell_type": "code",
17162
"execution_count": null,
18-
"id": "9f182a12-b6bf-4a95-b4c4-92c08951d8a1",
19-
"metadata": {},
163+
"id": "2b3dc21f-a316-4357-8e4a-9c83c3703fd0",
164+
"metadata": {
165+
"editable": true,
166+
"slideshow": {
167+
"slide_type": ""
168+
},
169+
"tags": []
170+
},
20171
"outputs": [],
21172
"source": []
22173
}

data/accepting_applications.csv

Lines changed: 0 additions & 14 deletions
This file was deleted.

data/previous_workshops.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Course Name,Course Info,Course Leader ,Course Helpers,Course Developers
2+
Introduction to Python,23rd/30th October 10am-1pm (online),Tom Wilson ,Liam Berrisford,"Michael Saunby, Simon Kirby, Duncan McDougall, Eilis Hannon"

data/workshop_info.csv

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Course Name,Start Date,End Date ,Course Date,MS Form Signup
2+
Introduction to Python,18/09/2024,16/10/2024,23rd/30th October 10am-1pm (online only),https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UNDJFN1NaRlk0UkpLNjVDSTM2TlM0NlpPWS4u
3+
Python for Data Analysis,,,,
4+
Introduction to R,18/09/2024,01/10/2024,8th/15th/22nd October 1-4pm (online only),https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UQjJCSzFWQjNVSldGRFhDUDNXVjdBQjNZSi4u
5+
Regression Analysis with R,18/09/2024,18/10/2024,25th October 10am-1pm (online only),https://forms.office.com/Pages/ResponsePage.aspx?id=d10qkZj77k6vMhM02PBKU-3R4SvRoClNrKjEX5qG1X1UMU1KRUpEOFRJQjFEOVVUVzFDMTRQMFZLRi4u
6+
Advanced Regression Analysis with R,,,,
7+
Working with Data in R,,,,
8+
Introduction to HPC,,,,
9+
Introduction to Version Control,,,,
10+
Intermediate Version Control,,,,
11+
Introduction to Unix,,,,
12+
Computational Thinking,,,,
13+
Software Development Best Practice,,,,
14+
Introduction to Julia,,,,

programme_information/advanced_regression_analysis_with_r.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"course_name = \"Advanced Regression Analysis with R\"\n",
8080
"\n",
8181
"# Load the CSV file\n",
82-
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
82+
"file_path = '../data/workshop_info.csv' # Adjust the path to your file location\n",
8383
"courses_df = pd.read_csv(file_path)\n",
8484
"\n",
8585
"# Strip any extra spaces in the column names\n",

programme_information/computational_thinking.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"course_name = \"Computational Thinking\"\n",
5555
"\n",
5656
"# Load the CSV file\n",
57-
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
57+
"file_path = '../data/workshop_info.csv' # Adjust the path to your file location\n",
5858
"courses_df = pd.read_csv(file_path)\n",
5959
"\n",
6060
"# Strip any extra spaces in the column names\n",

programme_information/intermediate_version_control.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"course_name = \"Intermediate Version Control\"\n",
5858
"\n",
5959
"# Load the CSV file\n",
60-
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
60+
"file_path = '../data/workshop_info.csv' # Adjust the path to your file location\n",
6161
"courses_df = pd.read_csv(file_path)\n",
6262
"\n",
6363
"# Strip any extra spaces in the column names\n",

programme_information/intro_to_hpc.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"course_name = \"Introduction to HPC\"\n",
5959
"\n",
6060
"# Load the CSV file\n",
61-
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
61+
"file_path = '../data/workshop_info.csv' # Adjust the path to your file location\n",
6262
"courses_df = pd.read_csv(file_path)\n",
6363
"\n",
6464
"# Strip any extra spaces in the column names\n",

programme_information/intro_to_julia.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"course_name = \"Introduction to Julia\"\n",
5656
"\n",
5757
"# Load the CSV file\n",
58-
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
58+
"file_path = '../data/workshop_info.csv' # Adjust the path to your file location\n",
5959
"courses_df = pd.read_csv(file_path)\n",
6060
"\n",
6161
"# Strip any extra spaces in the column names\n",

programme_information/intro_to_python.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"course_name = \"Introduction to Python\"\n",
7070
"\n",
7171
"# Load the CSV file\n",
72-
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
72+
"file_path = '../data/workshop_info.csv' # Adjust the path to your file location\n",
7373
"courses_df = pd.read_csv(file_path)\n",
7474
"\n",
7575
"# Strip any extra spaces in the column names\n",

0 commit comments

Comments
 (0)