Creating a tidy CSV of motor vehicle registration stats in South Dakota by county by year. Updated weekly.
PDF reports for each calendar year, downloaded from the Department of Revenue's website, are in reports, along with a historical file with annual totals for the past couple of years for each county.
To combine them, the basic idea is to pull out annual totals from the historical file, then add in data from reports that aren't represented in the historical file.
county: County namecounty_fips: County FIPS codeyear: Registration yearregistration_type: The type of registration, e.g. truck, bus, etc. (but also "title")total: The total number of registrations of that type for the county for the year
update.py checks for new reports, downloads new ones (plus the current-year report, which is updated throughout the year with new monthly totals), extracts the data from each PDF and combines the data into a flat file, south-dakota-motor-vehicle-stats.csv.