Skip to content

Commit 96cfe6a

Browse files
committed
2 parents fbec359 + 524f856 commit 96cfe6a

File tree

1 file changed

+47
-23
lines changed

1 file changed

+47
-23
lines changed

talkmap_out.ipynb

+47-23
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@
66
"source": [
77
"# Leaflet cluster map of talk locations\n",
88
"\n",
9-
"Run this from the _talks/ directory, which contains .md files of all your talks. This scrapes the location YAML field from each .md file, geolocates it with geopy/Nominatim, and uses the getorg library to output data, HTML, and Javascript for a standalone cluster map."
9+
"Assuming you are working in a Linux or Windows Subsystem for Linux environment, you may need to install some dependencies. Assuming a clean installation, the following will be needed:\n",
10+
"\n",
11+
"```bash\n",
12+
"sudo apt install jupyter\n",
13+
"sudo apt install python3-pip\n",
14+
"pip install getorg --upgrade\n",
15+
"```\n",
16+
"\n",
17+
"After which you can run this from the `_talks/` directory, via:\n",
18+
"\n",
19+
"```bash\n",
20+
" jupyter nbconvert --to notebook --execute talkmap.ipynb --output talkmap_out.ipynb\n",
21+
"```\n",
22+
" \n",
23+
"The `_talks/` directory contains `.md` files of all your talks. This scrapes the location YAML field from each `.md` file, geolocates it with `geopy/Nominatim`, and uses the `getorg` library to output data, HTML, and Javascript for a standalone cluster map."
1024
]
1125
},
1226
{
@@ -15,10 +29,10 @@
1529
"metadata": {
1630
"collapsed": false,
1731
"execution": {
18-
"iopub.execute_input": "2025-02-22T01:09:40.748788Z",
19-
"iopub.status.busy": "2025-02-22T01:09:40.748590Z",
20-
"iopub.status.idle": "2025-02-22T01:09:41.820985Z",
21-
"shell.execute_reply": "2025-02-22T01:09:41.820264Z"
32+
"iopub.execute_input": "2025-02-22T01:30:05.703774Z",
33+
"iopub.status.busy": "2025-02-22T01:30:05.703517Z",
34+
"iopub.status.idle": "2025-02-22T01:30:06.843336Z",
35+
"shell.execute_reply": "2025-02-22T01:30:06.842591Z"
2236
}
2337
},
2438
"outputs": [
@@ -43,7 +57,13 @@
4357
"Requirement already satisfied: typing-extensions>=4.0.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (4.12.2)\r\n",
4458
"Requirement already satisfied: urllib3>=1.26.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (2.3.0)\r\n",
4559
"Requirement already satisfied: Deprecated in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (1.2.18)\r\n",
46-
"Requirement already satisfied: six>=1.7.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from retrying->getorg) (1.17.0)\r\n",
60+
"Requirement already satisfied: six>=1.7.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from retrying->getorg) (1.17.0)\r\n"
61+
]
62+
},
63+
{
64+
"name": "stdout",
65+
"output_type": "stream",
66+
"text": [
4767
"Requirement already satisfied: cryptography>=3.4.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pyjwt[crypto]>=2.4.0->pygithub->getorg) (44.0.1)\r\n",
4868
"Requirement already satisfied: cffi>=1.4.1 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pynacl>=1.4.0->pygithub->getorg) (1.17.1)\r\n",
4969
"Requirement already satisfied: charset-normalizer<4,>=2 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.4.1)\r\n",
@@ -66,6 +86,7 @@
6686
}
6787
],
6888
"source": [
89+
"# Start by installing the dependencies\n",
6990
"!pip install getorg --upgrade\n",
7091
"import glob\n",
7192
"import getorg\n",
@@ -78,14 +99,15 @@
7899
"metadata": {
79100
"collapsed": false,
80101
"execution": {
81-
"iopub.execute_input": "2025-02-22T01:09:41.823539Z",
82-
"iopub.status.busy": "2025-02-22T01:09:41.823058Z",
83-
"iopub.status.idle": "2025-02-22T01:09:41.826460Z",
84-
"shell.execute_reply": "2025-02-22T01:09:41.825940Z"
102+
"iopub.execute_input": "2025-02-22T01:30:06.845946Z",
103+
"iopub.status.busy": "2025-02-22T01:30:06.845467Z",
104+
"iopub.status.idle": "2025-02-22T01:30:06.849121Z",
105+
"shell.execute_reply": "2025-02-22T01:30:06.848477Z"
85106
}
86107
},
87108
"outputs": [],
88109
"source": [
110+
"# Collect the Markdown files\n",
89111
"g = glob.glob(\"*.md\")"
90112
]
91113
},
@@ -95,14 +117,15 @@
95117
"metadata": {
96118
"collapsed": true,
97119
"execution": {
98-
"iopub.execute_input": "2025-02-22T01:09:41.828648Z",
99-
"iopub.status.busy": "2025-02-22T01:09:41.828276Z",
100-
"iopub.status.idle": "2025-02-22T01:09:41.853054Z",
101-
"shell.execute_reply": "2025-02-22T01:09:41.852554Z"
120+
"iopub.execute_input": "2025-02-22T01:30:06.851364Z",
121+
"iopub.status.busy": "2025-02-22T01:30:06.850962Z",
122+
"iopub.status.idle": "2025-02-22T01:30:06.876444Z",
123+
"shell.execute_reply": "2025-02-22T01:30:06.875850Z"
102124
}
103125
},
104126
"outputs": [],
105127
"source": [
128+
"# Prepare to geolocate\n",
106129
"geocoder = Nominatim(user_agent=\"academicpages.github.io\")\n",
107130
"location_dict = {}\n",
108131
"location = \"\"\n",
@@ -116,10 +139,10 @@
116139
"metadata": {
117140
"collapsed": false,
118141
"execution": {
119-
"iopub.execute_input": "2025-02-22T01:09:41.855227Z",
120-
"iopub.status.busy": "2025-02-22T01:09:41.854845Z",
121-
"iopub.status.idle": "2025-02-22T01:09:44.188915Z",
122-
"shell.execute_reply": "2025-02-22T01:09:44.188226Z"
142+
"iopub.execute_input": "2025-02-22T01:30:06.878925Z",
143+
"iopub.status.busy": "2025-02-22T01:30:06.878494Z",
144+
"iopub.status.idle": "2025-02-22T01:30:09.224074Z",
145+
"shell.execute_reply": "2025-02-22T01:30:09.223402Z"
123146
}
124147
},
125148
"outputs": [
@@ -141,7 +164,7 @@
141164
}
142165
],
143166
"source": [
144-
"\n",
167+
"# Perform geolocation\n",
145168
"for file in g:\n",
146169
" with open(file, 'r') as f:\n",
147170
" lines = f.read()\n",
@@ -162,10 +185,10 @@
162185
"metadata": {
163186
"collapsed": false,
164187
"execution": {
165-
"iopub.execute_input": "2025-02-22T01:09:44.191211Z",
166-
"iopub.status.busy": "2025-02-22T01:09:44.190804Z",
167-
"iopub.status.idle": "2025-02-22T01:09:44.198598Z",
168-
"shell.execute_reply": "2025-02-22T01:09:44.197939Z"
188+
"iopub.execute_input": "2025-02-22T01:30:09.226429Z",
189+
"iopub.status.busy": "2025-02-22T01:30:09.225951Z",
190+
"iopub.status.idle": "2025-02-22T01:30:09.233806Z",
191+
"shell.execute_reply": "2025-02-22T01:30:09.233240Z"
169192
}
170193
},
171194
"outputs": [
@@ -181,6 +204,7 @@
181204
}
182205
],
183206
"source": [
207+
"# Save the map\n",
184208
"m = getorg.orgmap.create_map_obj()\n",
185209
"getorg.orgmap.output_html_cluster_map(location_dict, folder_name=\"../talkmap\", hashed_usernames=False)"
186210
]

0 commit comments

Comments
 (0)