Last May, the city set the algorithm loose on criminal records dating back to 1975. It came back with 8,132 marijuana-related cases that were eligible to be cleared. These will be presented to a judge in the coming weeks for expungement.

Overall, San Francisco is seeking to clear 9,362 felony and misdemeanor cases, which include the 1,230 convictions it's already expunged. The picture, however, is much bleaker for individuals going it alone. Under California's proposition 64 law, residents can petition their sentence, but only 23 applied to do so in 2018.

"The reality is that the majority of the people that were punished and were the ones that suffered in this war on marijuana, war on drugs nationally were people that can ill afford to pay an attorney," San Francisco District Attorney George Gascón told NPR last year. "They're poor people. They're people that do not have the ability to go to court without missing work."

San Francisco is now set to be the first city in the US to clear all eligible pot convictions. Gascón adds that with the help of the algorithm the work came in ahead of schedule and under budget, reports the San Francisco Chronicle. Code For America plans to partner with four more counties in California in the coming weeks. It will then use the results of its work to create a blueprint that the rest of the country can use.