I used two data sources.
- Lahman’s Baseball Database: Provides standard batting, pitching, fielding, team, and managerial statistics from 1871 to 2014. I downloaded the database in CSV format and put the tables that I need into a SQLite database. (31.3 MB uncompressed)
- Tommy John surgery list: The most complete record available of Tommy John surgeries performed on professional baseball pitchers. I downloaded it in CSV format and added it to my SQLite database.
I initially wrote a scraper and used it to extract data on Tommy John surgeries from this page but then found that the list linked above is more comprehensive.