Skip to content

Commit d29a4a7

Browse files
Merge pull request #135 from coding-for-reproducible-research/auto-update-accept-apps
Add python code to generate markdown code for courses
2 parents 75e89af + c070fec commit d29a4a7

23 files changed

+1003
-37
lines changed

data/accepting_applications.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
2+
Introduction to Python,18/09/2024,16/10/2024
3+
Python for Data Analysis,,
4+
Introduction to R,18/09/2024,01/10/2024
5+
Regression Analysis with R,18/09/2024,18/10/2024
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/R.ipynb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
{
44
"cell_type": "markdown",
55
"id": "9f765ae0-0f63-44eb-9d61-76d5664bea89",
6-
"metadata": {},
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": []
12+
},
713
"source": [
814
"# R\n",
915
"\n",

programme_information/advanced_regression_analysis_with_r.ipynb

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "688c88c9-24d9-47bf-a547-257d9b190097",
5+
"id": "323380b3-d095-4aa7-b9c9-9eccb3ed425d",
66
"metadata": {
77
"editable": true,
88
"slideshow": {
@@ -41,8 +41,86 @@
4141
"\n",
4242
"## Signup \n",
4343
"\n",
44-
"To check for upcoming course dates and to register, please visit the Workshop Schedule and Signup page available [here](../cfrr_program_details/courses_overview.ipynb).\n",
44+
"To check for upcoming course dates and to register, please visit the Workshop Schedule and Signup page available [here](../cfrr_program_details/courses_overview.ipynb)."
45+
]
46+
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": 2,
50+
"id": "75289504-c41d-4a3c-902c-44f9f9208d0e",
51+
"metadata": {
52+
"editable": true,
53+
"slideshow": {
54+
"slide_type": ""
55+
},
56+
"tags": [
57+
"remove-input"
58+
]
59+
},
60+
"outputs": [
61+
{
62+
"data": {
63+
"text/html": [],
64+
"text/plain": [
65+
"<IPython.core.display.HTML object>"
66+
]
67+
},
68+
"metadata": {},
69+
"output_type": "display_data"
70+
}
71+
],
72+
"source": [
73+
"import pandas as pd\n",
74+
"from datetime import datetime\n",
75+
"from IPython.display import display, HTML\n",
76+
"\n",
77+
"\n",
78+
"# Define the course that is being looked at\n",
79+
"course_name = \"Advanced Regression Analysis with R\"\n",
80+
"\n",
81+
"# Load the CSV file\n",
82+
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
83+
"courses_df = pd.read_csv(file_path)\n",
84+
"\n",
85+
"# Strip any extra spaces in the column names\n",
86+
"courses_df.columns = courses_df.columns.str.strip()\n",
87+
"\n",
88+
"# Convert date columns to datetime\n",
89+
"courses_df['Start Date'] = pd.to_datetime(courses_df['Start Date'], dayfirst=True, errors='coerce')\n",
90+
"courses_df['End Date'] = pd.to_datetime(courses_df['End Date'], dayfirst=True, errors='coerce')\n",
4591
"\n",
92+
"# Get today's date\n",
93+
"today = datetime.now()\n",
94+
"\n",
95+
"# Function to generate markdown text based on the course dates\n",
96+
"def generate_html(row):\n",
97+
" if pd.notna(row['Start Date']) and pd.notna(row['End Date']):\n",
98+
" if row['Start Date'] <= today <= row['End Date']:\n",
99+
" return f\"<div style='font-weight: bold;'>This course is currently accepting applications.</div>\"\n",
100+
" return \"\"\n",
101+
"\n",
102+
"# Apply the function and create a new column for Markdown\n",
103+
"courses_df['HTML'] = courses_df.apply(generate_html, axis=1)\n",
104+
"\n",
105+
"# Variable for course name\n",
106+
"\n",
107+
"\n",
108+
"# Filter the DataFrame for the given course name and display the HTML text\n",
109+
"html_output = courses_df[courses_df['Course Name'] == course_name]['HTML'].values[0]\n",
110+
"display(HTML(html_output))\n"
111+
]
112+
},
113+
{
114+
"cell_type": "markdown",
115+
"id": "56db8cac-1a93-4a60-8898-5b1c133026f8",
116+
"metadata": {
117+
"editable": true,
118+
"slideshow": {
119+
"slide_type": ""
120+
},
121+
"tags": []
122+
},
123+
"source": [
46124
"## Installation Guide \n",
47125
"All CfRR courses require attendees to use their own computer/laptop to follow workshop activities and take effective notes. \n",
48126
"\n",

programme_information/computational_thinking.ipynb

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "550fe19d-ea33-4571-828c-68c0027989cf",
5+
"id": "69e7d9dc-c7ef-484f-ab32-0535dc109ef6",
66
"metadata": {
77
"editable": true,
88
"slideshow": {
@@ -28,8 +28,74 @@
2828
"\n",
2929
"## Signup \n",
3030
"\n",
31-
"To check for upcoming course dates and to register, please visit the Workshop Schedule and Signup page available [here](../cfrr_program_details/courses_overview.ipynb).\n",
31+
"To check for upcoming course dates and to register, please visit the Workshop Schedule and Signup page available [here](../cfrr_program_details/courses_overview.ipynb)."
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": null,
37+
"id": "12053e8e-0879-442a-b3e3-a19ed5f7ee5b",
38+
"metadata": {
39+
"editable": true,
40+
"slideshow": {
41+
"slide_type": ""
42+
},
43+
"tags": [
44+
"remove-input"
45+
]
46+
},
47+
"outputs": [],
48+
"source": [
49+
"import pandas as pd\n",
50+
"from datetime import datetime\n",
51+
"from IPython.display import display, HTML\n",
52+
"\n",
53+
"# Define the course that is being looked at\n",
54+
"course_name = \"Computational Thinking\"\n",
55+
"\n",
56+
"# Load the CSV file\n",
57+
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
58+
"courses_df = pd.read_csv(file_path)\n",
59+
"\n",
60+
"# Strip any extra spaces in the column names\n",
61+
"courses_df.columns = courses_df.columns.str.strip()\n",
3262
"\n",
63+
"# Convert date columns to datetime\n",
64+
"courses_df['Start Date'] = pd.to_datetime(courses_df['Start Date'], dayfirst=True, errors='coerce')\n",
65+
"courses_df['End Date'] = pd.to_datetime(courses_df['End Date'], dayfirst=True, errors='coerce')\n",
66+
"\n",
67+
"# Get today's date\n",
68+
"today = datetime.now()\n",
69+
"\n",
70+
"# Function to generate markdown text based on the course dates\n",
71+
"def generate_html(row):\n",
72+
" if pd.notna(row['Start Date']) and pd.notna(row['End Date']):\n",
73+
" if row['Start Date'] <= today <= row['End Date']:\n",
74+
" return f\"<div style='font-weight: bold;'>This course is currently accepting applications.</div>\"\n",
75+
" return \"\"\n",
76+
"\n",
77+
"# Apply the function and create a new column for Markdown\n",
78+
"courses_df['HTML'] = courses_df.apply(generate_html, axis=1)\n",
79+
"\n",
80+
"# Variable for course name\n",
81+
"\n",
82+
"\n",
83+
"# Filter the DataFrame for the given course name and display the HTML text\n",
84+
"html_output = courses_df[courses_df['Course Name'] == course_name]['HTML'].values[0]\n",
85+
"display(HTML(html_output))\n"
86+
]
87+
},
88+
{
89+
"cell_type": "markdown",
90+
"id": "156bbe7a-3de1-4ed7-80f5-f5ce25af83c7",
91+
"metadata": {
92+
"editable": true,
93+
"slideshow": {
94+
"slide_type": ""
95+
},
96+
"tags": []
97+
},
98+
"source": [
3399
"## Installation Guide \n",
34100
"All CfRR courses require attendees to use their own computer/laptop to follow workshop activities and take effective notes. \n",
35101
"\n",

programme_information/computational_thinking_overview.ipynb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
{
44
"cell_type": "markdown",
55
"id": "f77c5a09-dfad-495e-92d9-f622e1e6a37a",
6-
"metadata": {},
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": []
12+
},
713
"source": [
814
"# Computational Thinking\n",
915
"\n",

programme_information/high_performance_computing.ipynb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
{
44
"cell_type": "markdown",
55
"id": "73ea8c8f-c9ee-4ee1-aac0-c3d336dc7068",
6-
"metadata": {},
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": []
12+
},
713
"source": [
814
"# High Performance Computing\n",
915
"\n",

programme_information/intermediate_version_control.ipynb

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "663cd303-1115-492f-ac46-49cca337b940",
5+
"id": "44133fdf-b5d0-440f-a268-29ef0916aede",
66
"metadata": {
77
"editable": true,
88
"slideshow": {
@@ -31,8 +31,74 @@
3131
"\n",
3232
"## Signup \n",
3333
"\n",
34-
"To check for upcoming course dates and to register, please visit the Workshop Schedule and Signup page available [here](../cfrr_program_details/courses_overview.ipynb).\n",
34+
"To check for upcoming course dates and to register, please visit the Workshop Schedule and Signup page available [here](../cfrr_program_details/courses_overview.ipynb)."
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": null,
40+
"id": "e1595e9c-6a05-4b02-93e9-cec78e5af2ec",
41+
"metadata": {
42+
"editable": true,
43+
"slideshow": {
44+
"slide_type": ""
45+
},
46+
"tags": [
47+
"remove-input"
48+
]
49+
},
50+
"outputs": [],
51+
"source": [
52+
"import pandas as pd\n",
53+
"from datetime import datetime\n",
54+
"from IPython.display import display, HTML\n",
55+
"\n",
56+
"# Define the course that is being looked at\n",
57+
"course_name = \"Intermediate Version Control\"\n",
58+
"\n",
59+
"# Load the CSV file\n",
60+
"file_path = '../data/accepting_applications.csv' # Adjust the path to your file location\n",
61+
"courses_df = pd.read_csv(file_path)\n",
62+
"\n",
63+
"# Strip any extra spaces in the column names\n",
64+
"courses_df.columns = courses_df.columns.str.strip()\n",
3565
"\n",
66+
"# Convert date columns to datetime\n",
67+
"courses_df['Start Date'] = pd.to_datetime(courses_df['Start Date'], dayfirst=True, errors='coerce')\n",
68+
"courses_df['End Date'] = pd.to_datetime(courses_df['End Date'], dayfirst=True, errors='coerce')\n",
69+
"\n",
70+
"# Get today's date\n",
71+
"today = datetime.now()\n",
72+
"\n",
73+
"# Function to generate markdown text based on the course dates\n",
74+
"def generate_html(row):\n",
75+
" if pd.notna(row['Start Date']) and pd.notna(row['End Date']):\n",
76+
" if row['Start Date'] <= today <= row['End Date']:\n",
77+
" return f\"<div style='font-weight: bold;'>This course is currently accepting applications.</div>\"\n",
78+
" return \"\"\n",
79+
"\n",
80+
"# Apply the function and create a new column for Markdown\n",
81+
"courses_df['HTML'] = courses_df.apply(generate_html, axis=1)\n",
82+
"\n",
83+
"# Variable for course name\n",
84+
"\n",
85+
"\n",
86+
"# Filter the DataFrame for the given course name and display the HTML text\n",
87+
"html_output = courses_df[courses_df['Course Name'] == course_name]['HTML'].values[0]\n",
88+
"display(HTML(html_output))\n"
89+
]
90+
},
91+
{
92+
"cell_type": "markdown",
93+
"id": "a7dbd44b-f6db-4d19-8e96-e319e723adf1",
94+
"metadata": {
95+
"editable": true,
96+
"slideshow": {
97+
"slide_type": ""
98+
},
99+
"tags": []
100+
},
101+
"source": [
36102
"## Installation Guide \n",
37103
"All CfRR courses require attendees to use their own computer/laptop to follow workshop activities and take effective notes. \n",
38104
"\n",

0 commit comments

Comments
 (0)