1
+ {
2
+ "nbformat" : 4 ,
3
+ "nbformat_minor" : 0 ,
4
+ "metadata" : {
5
+ "colab" : {
6
+ "provenance" : [],
7
+ "mount_file_id" : " 1ghobHc2lMlZSBF6PsFewMXYFkpQoPwc8" ,
8
+ "authorship_tag" : " ABX9TyOEWa1ngn3XkLlXdaP33w8i" ,
9
+ "include_colab_link" : true
10
+ },
11
+ "kernelspec" : {
12
+ "name" : " python3" ,
13
+ "display_name" : " Python 3"
14
+ },
15
+ "language_info" : {
16
+ "name" : " python"
17
+ }
18
+ },
19
+ "cells" : [
20
+ {
21
+ "cell_type" : " markdown" ,
22
+ "metadata" : {
23
+ "id" : " view-in-github" ,
24
+ "colab_type" : " text"
25
+ },
26
+ "source" : [
27
+ " <a href=\" https://colab.research.google.com/github/alexgithubusername/01/blob/main/ACGME_MILESTONE_EVALUATIONS.ipynb\" target=\" _parent\" ><img src=\" https://colab.research.google.com/assets/colab-badge.svg\" alt=\" Open In Colab\" /></a>"
28
+ ]
29
+ },
30
+ {
31
+ "cell_type" : " code" ,
32
+ "execution_count" : 4 ,
33
+ "metadata" : {
34
+ "colab" : {
35
+ "base_uri" : " https://localhost:8080/"
36
+ },
37
+ "id" : " X2UfcOUe3pdG" ,
38
+ "outputId" : " 581addfd-6f9a-4226-e546-c7645734fa8d"
39
+ },
40
+ "outputs" : [
41
+ {
42
+ "output_type" : " stream" ,
43
+ "name" : " stdout" ,
44
+ "text" : [
45
+ " Downloaded: abdominalradiologymilestones.pdf\n " ,
46
+ " Downloaded: addictionmedicinemilestones.pdf\n " ,
47
+ " Downloaded: addictionpsychiatrymilestones.pdf\n " ,
48
+ " Downloaded: adolescentmedicinemilestones.pdf\n " ,
49
+ " Downloaded: adultcardiothoracicanesthesiologymilestones.pdf\n " ,
50
+ " Downloaded: adultcongenitalheartdiseasemilestones.pdf\n " ,
51
+ " Downloaded: adultreconstructiveorthopaedicsurgerymilestones.pdf\n " ,
52
+ " Downloaded: advancedheartfailureandtransplantcardiologymilestones.pdf\n " ,
53
+ " Downloaded: aerospacemedicinemilestones.pdf\n " ,
54
+ " Downloaded: allergyandimmunologymilestones.pdf\n " ,
55
+ " Downloaded: anesthesiologymilestones.pdf\n " ,
56
+ " Downloaded: bloodbankingtransfusionmedicinemilestones.pdf\n " ,
57
+ " Downloaded: braininjurymedicinemilestones.pdf\n " ,
58
+ " Downloaded: cardiovasculardiseasemilestones.pdf\n " ,
59
+ " Downloaded: chemicalpathologymilestones.pdf\n " ,
60
+ " Downloaded: childabusepediatricsmilestones.pdf\n " ,
61
+ " Downloaded: childneurologymilestones.pdf\n " ,
62
+ " Downloaded: childandadolescentpsychiatrymilestones.pdf\n " ,
63
+ " Downloaded: clinicalbiochemicalgeneticsmilestones.pdf\n " ,
64
+ " Downloaded: clinicalcardiacelectrophysiologymilestones.pdf\n " ,
65
+ " Downloaded: clinicalinformaticsmilestones.pdf\n " ,
66
+ " Downloaded: clinicalneurophysiologymilestones.pdf\n " ,
67
+ " Downloaded: colonandrectalsurgerymilestones.pdf\n " ,
68
+ " Downloaded: complexfamilyplanningmilestones.pdf\n " ,
69
+ " Downloaded: complexgeneralsurgicaloncologymilestones.pdf\n " ,
70
+ " Downloaded: congenitalcardiacsurgerymilestones.pdf\n " ,
71
+ " Downloaded: consultationliaisonpsychiatrymilestones.pdf\n " ,
72
+ " Downloaded: craniofacialsurgerymilestones.pdf\n " ,
73
+ " Downloaded: criticalcareanesthesiologymilestones.pdf\n " ,
74
+ " Downloaded: criticalcaremedicinemilestones.pdf\n " ,
75
+ " Downloaded: cytopathologymilestones.pdf\n " ,
76
+ " Downloaded: dermatologymilestones.pdf\n " ,
77
+ " Downloaded: dermatopathologymilestones.pdf\n " ,
78
+ " Downloaded: developmentalbehavioralpediatricsmilestones.pdf\n " ,
79
+ " Downloaded: diagnosticradiologymilestones.pdf\n " ,
80
+ " Downloaded: diagnosticradiologynuclearmedicinecombinedmilestones.pdf\n " ,
81
+ " Downloaded: emergencymedicalservicesmilestones.pdf\n " ,
82
+ " Downloaded: emergencymedicinemilestones.pdf\n " ,
83
+ " Downloaded: emergencymedicinefamilymedicinecombinedmilestones.pdf\n " ,
84
+ " Downloaded: endocrinologydiabetesandmetabolismmilestones.pdf\n " ,
85
+ " Downloaded: epilepsymilestones.pdf\n " ,
86
+ " Downloaded: familymedicinemilestones.pdf\n " ,
87
+ " Downloaded: familymedicinepreventivemedicinecombinedmilestones.pdf\n " ,
88
+ " Downloaded: urogynecologyandreconstructivepelvicsurgerymilestones2-1.pdf\n " ,
89
+ " Error downloading https://www.acgme.org/globalassets/pdfs/milestones/footandankleorthopaedicsurgerymilestones.pdf: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2580)\n " ,
90
+ " Downloaded: forensicpathologymilestones.pdf\n " ,
91
+ " Downloaded: forensicpsychiatrymilestones.pdf\n " ,
92
+ " Downloaded: gastroenterologymilestones.pdf\n " ,
93
+ " Downloaded: geriatricmedicinemilestones.pdf\n " ,
94
+ " Downloaded: geriatricpsychiatrymilestones.pdf\n " ,
95
+ " Downloaded: gynecologiconcologymilestones.pdf\n " ,
96
+ " Downloaded: handsurgerymilestones.pdf\n " ,
97
+ " Downloaded: hematologymilestones.pdf\n " ,
98
+ " Downloaded: hematologyandmedicaloncologymilestones.pdf\n " ,
99
+ " Downloaded: hematopathologymilestones.pdf\n " ,
100
+ " Downloaded: hospiceandpalliativemedicinemilestones.pdf\n " ,
101
+ " Downloaded: infectiousdiseasemilestones.pdf\n " ,
102
+ " Downloaded: internalmedicinemilestones.pdf\n " ,
103
+ " Downloaded: internalmedicineanesthesiologycombinedmilestones.pdf\n " ,
104
+ " Downloaded: internalmedicinedermatologycombinedmilestones.pdf\n " ,
105
+ " Downloaded: internalmedicineemergencymedicinecriticalcaremedicinecombinedmilestones.pdf\n " ,
106
+ " Downloaded: internalmedicinefamilymedicinecombinedmilestones.pdf\n " ,
107
+ " Downloaded: internalmedicinemedicalgeneticsandgenomicscombinedmilestones.pdf\n " ,
108
+ " Downloaded: internalmedicineneurologycombinedmilestones.pdf\n " ,
109
+ " Downloaded: internalmedicinepediatricscombinedmilestones.pdf\n " ,
110
+ " Downloaded: internalmedicinepreventivemedicinecombinedmilestones.pdf\n " ,
111
+ " Downloaded: internalmedicinepsychiatrycombinedmilestones.pdf\n " ,
112
+ " Downloaded: interventionalcardiologymilestones.pdf\n " ,
113
+ " Downloaded: interventionalpulmonologymilestones1.0.pdf\n " ,
114
+ " Downloaded: independentinterventionalradiologymilestones.pdf\n " ,
115
+ " Downloaded: integratedinterventionalradiologymilestones.pdf\n " ,
116
+ " Downloaded: laboratorygeneticsandgenomicsmilestones.pdf\n " ,
117
+ " Downloaded: maternalfetalmedicinemilestones.pdf\n " ,
118
+ " Downloaded: medicalbiochemicalgeneticsmilestones.pdf\n " ,
119
+ " Downloaded: medicalgeneticsandgenomicsmilestones.pdf\n " ,
120
+ " Downloaded: medicalmicrobiologymilestones.pdf\n " ,
121
+ " Downloaded: medicaloncologymilestones.pdf\n " ,
122
+ " Downloaded: medicaltoxicologymilestones.pdf\n " ,
123
+ " Downloaded: micrographicsurgeryanddermatologiconcologymilestones.pdf\n " ,
124
+ " Downloaded: moleculargeneticpathologymilestones.pdf\n " ,
125
+ " Downloaded: musculoskeletaloncologymilestones.pdf\n " ,
126
+ " Downloaded: musculoskeletalradiologymilestones.pdf\n " ,
127
+ " Downloaded: neonatalperinatalmedicinemilestones.pdf\n " ,
128
+ " Downloaded: nephrologymilestones.pdf\n " ,
129
+ " Downloaded: neurocriticalcaremilestones.pdf\n " ,
130
+ " Downloaded: neurodevelopmentaldisabilitiesmilestones.pdf\n " ,
131
+ " Downloaded: neuroendovascularinterventionmilestones.pdf\n " ,
132
+ " Downloaded: neurologicalsurgerymilestones.pdf\n " ,
133
+ " Downloaded: neurologymilestones.pdf\n " ,
134
+ " Downloaded: neuromuscularmedicinemilestones.pdf\n " ,
135
+ " Downloaded: neuropathologymilestones.pdf\n " ,
136
+ " Downloaded: neuroradiologymilestones.pdf\n " ,
137
+ " Downloaded: neurotologymilestones.pdf\n " ,
138
+ " Downloaded: nuclearmedicinemilestones.pdf\n " ,
139
+ " Downloaded: nuclearradiologymilestones.pdf\n " ,
140
+ " Downloaded: obstetricanesthesiologymilestones.pdf\n " ,
141
+ " Downloaded: obstetricsandgynecologymilestones.pdf\n " ,
142
+ " Downloaded: occupationalandenvironmentalmedicinemilestones.pdf\n " ,
143
+ " Downloaded: ophthalmicplasticandreconstructivesurgerymilestones.pdf\n " ,
144
+ " Downloaded: ophthalmologymilestones.pdf\n " ,
145
+ " Downloaded: orthopaedicsportsmedicinemilestones.pdf\n " ,
146
+ " Downloaded: orthopaedicsurgerymilestones.pdf\n " ,
147
+ " Downloaded: orthopaedicsurgeryofthespinemilestones.pdf\n " ,
148
+ " Downloaded: orthopaedictraumamilestones.pdf\n " ,
149
+ " Downloaded: osteopathicneuromusculoskeletalmedicinemilestones.pdf\n " ,
150
+ " Downloaded: otolaryngologymilestones.pdf\n " ,
151
+ " Downloaded: painmedicinemilestones.pdf\n " ,
152
+ " Downloaded: pathologymilestones.pdf\n " ,
153
+ " Downloaded: pediatricanesthesiologymilestones.pdf\n " ,
154
+ " Downloaded: pediatriccardiacanesthesiologymilestones.pdf\n " ,
155
+ " Error downloading https://www.acgme.org/globalassets/pdfs/milestones/pediatriccardiologymilestones.pdf: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2580)\n " ,
156
+ " Downloaded: pediatriccriticalcaremilestones.pdf\n " ,
157
+ " Downloaded: pediatricdermatologymilestones.pdf\n " ,
158
+ " Downloaded: pediatricemergencymedicinemilestones.pdf\n " ,
159
+ " Downloaded: pediatricendocrinologymilestones.pdf\n " ,
160
+ " Downloaded: pediatricgastroenterologymilestones.pdf\n " ,
161
+ " Downloaded: pediatrichematologyoncologymilestones.pdf\n " ,
162
+ " Downloaded: pediatrichospitalmedicinemilestones.pdf\n " ,
163
+ " Downloaded: pediatricinfectiousdiseasesmilestones.pdf\n " ,
164
+ " Downloaded: pediatricnephrologymilestones.pdf\n " ,
165
+ " Downloaded: pediatricorthopaedicsurgerymilestones.pdf\n " ,
166
+ " Downloaded: pediatricotolaryngologymilestones.pdf\n " ,
167
+ " Downloaded: pediatricpathologymilestones.pdf\n " ,
168
+ " Downloaded: pediatricpulmonologymilestones.pdf\n " ,
169
+ " Downloaded: pediatricradiologymilestones.pdf\n " ,
170
+ " Downloaded: pediatricrehabilitationmedicinemilestones.pdf\n " ,
171
+ " Downloaded: pediatricrheumatologymilestones.pdf\n " ,
172
+ " Downloaded: pediatricsurgerymilestones.pdf\n " ,
173
+ " Downloaded: pediatrictransplanthepatologymilestones.pdf\n " ,
174
+ " Downloaded: pediatricurologymilestones.pdf\n " ,
175
+ " Downloaded: pediatricsmilestones.pdf\n " ,
176
+ " Downloaded: pediatricsdermatologycombinedmilestones.pdf\n " ,
177
+ " Downloaded: pediatricsanesthesiologycombinedmilestones.pdf\n " ,
178
+ " Downloaded: pediatricsdermatologymilestones.pdf\n " ,
179
+ " Downloaded: pediatricsemergencymedicinecombinedmilestones.pdf\n " ,
180
+ " Downloaded: pediatricsmedicalgeneticsandgenomicscombinedmilestones.pdf\n " ,
181
+ " Downloaded: pediatricsphysicalmedicineandrehabilitationcombinedmilestones.pdf\n " ,
182
+ " Downloaded: pediatricspsychiatrychildandadolescentpsychiatrycombinedmilestones.pdf\n " ,
183
+ " Downloaded: physicalmedicineandrehabilitationmilestones.pdf\n " ,
184
+ " Downloaded: plasticsurgerymilestones.pdf\n " ,
185
+ " Downloaded: psychiatrymilestones.pdf\n " ,
186
+ " Downloaded: psychiatryfamilymedicinecombinedmilestones.pdf\n " ,
187
+ " Downloaded: psychiatryneurologycombinedmilestones.pdf\n " ,
188
+ " Downloaded: publichealthandgeneralpreventivemedicinemilestones.pdf\n " ,
189
+ " Downloaded: pulmonarycriticalcaremilestones.pdf\n " ,
190
+ " Downloaded: pulmonarydiseasemilestones.pdf\n " ,
191
+ " Downloaded: radiationoncologymilestones.pdf\n " ,
192
+ " Downloaded: regionalanesthesiologyandacutepainmedicinemilestones.pdf\n " ,
193
+ " Downloaded: reproductiveendocrinologyandinfertilitymilestones.pdf\n " ,
194
+ " Downloaded: rheumatologymilestones.pdf\n " ,
195
+ " Downloaded: selectivepathologymilestones.pdf\n " ,
196
+ " Downloaded: sleepmedicinemilestones.pdf\n " ,
197
+ " Downloaded: spinalcordinjurymedicinemilestones.pdf\n " ,
198
+ " Downloaded: sportsmedicinemilestones.pdf\n " ,
199
+ " Downloaded: surgerymilestones.pdf\n " ,
200
+ " Downloaded: surgicalcriticalcaremilestones.pdf\n " ,
201
+ " Downloaded: thoracicsurgeryindependentmilestones.pdf\n " ,
202
+ " Downloaded: thoracicsurgeryintegratedmilestones.pdf\n " ,
203
+ " Downloaded: transitionalyearmilestones.pdf\n " ,
204
+ " Downloaded: transplanthepatologymilestones.pdf\n " ,
205
+ " Downloaded: underseaandhyperbaricmedicinemilestones.pdf\n " ,
206
+ " Downloaded: urologymilestones.pdf\n " ,
207
+ " Downloaded: vascularneurologymilestones.pdf\n " ,
208
+ " Downloaded: vascularsurgerymilestones.pdf\n "
209
+ ]
210
+ }
211
+ ],
212
+ "source" : [
213
+ " import requests\n " ,
214
+ " from bs4 import BeautifulSoup\n " ,
215
+ " import os\n " ,
216
+ " import re\n " ,
217
+ " import time # Imported for adding a delay between downloads\n " ,
218
+ " \n " ,
219
+ " def download_acgme_milestones(url, folder_name):\n " ,
220
+ " \"\"\" Downloads all ACGME milestone PDFs from the given URL.\"\"\"\n " ,
221
+ " \n " ,
222
+ " if not os.path.exists(folder_name):\n " ,
223
+ " os.makedirs(folder_name)\n " ,
224
+ " \n " ,
225
+ " try:\n " ,
226
+ " response = requests.get(url)\n " ,
227
+ " response.raise_for_status() # Raise an exception for bad status codes\n " ,
228
+ " \n " ,
229
+ " soup = BeautifulSoup(response.content, 'html.parser')\n " ,
230
+ " \n " ,
231
+ " # Find all links that end in .pdf\n " ,
232
+ " pdf_links = [link.get('href') for link in soup.find_all('a', href=True) if link['href'].lower().endswith('.pdf')]\n " ,
233
+ " \n " ,
234
+ " for pdf_link in pdf_links:\n " ,
235
+ " try:\n " ,
236
+ " # Construct full URL if relative\n " ,
237
+ " if not pdf_link.startswith('http'):\n " ,
238
+ " pdf_link = requests.compat.urljoin(url, pdf_link)\n " ,
239
+ " \n " ,
240
+ " # Extract file name\n " ,
241
+ " file_name = os.path.basename(pdf_link)\n " ,
242
+ " \n " ,
243
+ " # Download PDF\n " ,
244
+ " pdf_response = requests.get(pdf_link, stream=True)\n " ,
245
+ " pdf_response.raise_for_status()\n " ,
246
+ " \n " ,
247
+ " # Save PDF to file\n " ,
248
+ " file_path = os.path.join(folder_name, file_name)\n " ,
249
+ " with open(file_path, 'wb') as f:\n " ,
250
+ " for chunk in pdf_response.iter_content(chunk_size=8192):\n " ,
251
+ " f.write(chunk)\n " ,
252
+ " \n " ,
253
+ " print(f\" Downloaded: {file_name}\" )\n " ,
254
+ " \n " ,
255
+ " # Pause for 1 second between each download\n " ,
256
+ " time.sleep(1)\n " ,
257
+ " \n " ,
258
+ " except requests.exceptions.RequestException as e:\n " ,
259
+ " print(f\" Error downloading {pdf_link}: {e}\" )\n " ,
260
+ " \n " ,
261
+ " except requests.exceptions.RequestException as e:\n " ,
262
+ " print(f\" Error accessing URL {url}: {e}\" )\n " ,
263
+ " \n " ,
264
+ " \n " ,
265
+ " if __name__ == \" __main__\" :\n " ,
266
+ " acgme_url = \" https://www.acgme.org/milestones/milestones-by-specialty/\"\n " ,
267
+ " download_directory = \" acgme_milestones\"\n " ,
268
+ " download_acgme_milestones(acgme_url, download_directory)"
269
+ ]
270
+ },
271
+ {
272
+ "cell_type" : " code" ,
273
+ "source" : [
274
+ " import requests\n " ,
275
+ " from bs4 import BeautifulSoup\n " ,
276
+ " import os\n " ,
277
+ " import time\n " ,
278
+ " \n " ,
279
+ " def download_epa_pdfs(url, folder_name):\n " ,
280
+ " \"\"\" Downloads all EPA PDFs from the given AAMC URL with a 1-second pause between downloads.\"\"\"\n " ,
281
+ " \n " ,
282
+ " headers = {\n " ,
283
+ " \" User-Agent\" : \" Mozilla/5.0\" # Helps avoid bot blocking\n " ,
284
+ " }\n " ,
285
+ " \n " ,
286
+ " if not os.path.exists(folder_name):\n " ,
287
+ " os.makedirs(folder_name)\n " ,
288
+ " \n " ,
289
+ " try:\n " ,
290
+ " response = requests.get(url, headers=headers)\n " ,
291
+ " response.raise_for_status()\n " ,
292
+ " \n " ,
293
+ " soup = BeautifulSoup(response.content, 'html.parser')\n " ,
294
+ " \n " ,
295
+ " # Search for all links that point to PDFs\n " ,
296
+ " pdf_links = [link.get('href') for link in soup.find_all('a', href=True)\n " ,
297
+ " if '.pdf' in link.get('href').lower()]\n " ,
298
+ " \n " ,
299
+ " for pdf_link in pdf_links:\n " ,
300
+ " try:\n " ,
301
+ " # Resolve full link if relative\n " ,
302
+ " full_url = requests.compat.urljoin(url, pdf_link)\n " ,
303
+ " \n " ,
304
+ " # Extract filename\n " ,
305
+ " file_name = os.path.basename(full_url.split(\" ?\" )[0]) # Strip off query params if any\n " ,
306
+ " \n " ,
307
+ " # Download the file\n " ,
308
+ " pdf_response = requests.get(full_url, stream=True, headers=headers)\n " ,
309
+ " pdf_response.raise_for_status()\n " ,
310
+ " \n " ,
311
+ " file_path = os.path.join(folder_name, file_name)\n " ,
312
+ " with open(file_path, 'wb') as f:\n " ,
313
+ " for chunk in pdf_response.iter_content(chunk_size=8192):\n " ,
314
+ " f.write(chunk)\n " ,
315
+ " \n " ,
316
+ " print(f\" Downloaded: {file_name}\" )\n " ,
317
+ " \n " ,
318
+ " # Pause between downloads\n " ,
319
+ " time.sleep(1)\n " ,
320
+ " \n " ,
321
+ " except requests.exceptions.RequestException as e:\n " ,
322
+ " print(f\" Error downloading {pdf_link}: {e}\" )\n " ,
323
+ " \n " ,
324
+ " except requests.exceptions.RequestException as e:\n " ,
325
+ " print(f\" Error accessing URL {url}: {e}\" )\n " ,
326
+ " \n " ,
327
+ " if __name__ == \" __main__\" :\n " ,
328
+ " epa_url = \" https://www.aamc.org/about-us/mission-areas/medical-education/cbme/core-epas\"\n " ,
329
+ " download_directory = \" epa_pdfs\"\n " ,
330
+ " download_epa_pdfs(epa_url, download_directory)\n "
331
+ ],
332
+ "metadata" : {
333
+ "id" : " xAn44Ksv53GT"
334
+ },
335
+ "execution_count" : 6 ,
336
+ "outputs" : []
337
+ }
338
+ ]
339
+ }
0 commit comments