This month, a judge in California cleared thousands of criminal records with one stroke of his pen. He did it thanks to a ground-breaking new algorithm that reduces a process that took months to mere minutes. The programmers behind it say: we’re just getting started solving America’s urgent problems.
Piero Salazar is sitting at a wooden table, swamped by paperwork. His anxious family looks on.
He’s one of around 50 or so people who have come to this community centre in San Fernando, near Los Angeles, to take part in an “expungement clinic” - a free service for those looking to get their criminal records removed or reduced. A team of lawyers, working pro bono, sit behind a long counter and call people forward when their number is up.
On this Saturday morning, most here, Mr Salazar included, are seeking to have cannabis-related convictions expunged under California’s Proposition 64, a measure passed in 2016 that made marijuana legal in the state. As part of the new law, those with prior convictions could now seek to have them struck off their record.
“It makes me feel better to know I’m not a felon,” says Mr Salazar, filling in his forms.
Monique Herrera is here with her young son.
“I want to just get this off. Get clean. Do what I have to do and have a better life.”
It’s estimated there are a million people in California with a cannabis-related charge in their past, an invisible shackle that blocks opportunities to get housing, jobs and thousands of other things most of us would regard as necessities.
Yet, fewer than 3% of people thought to qualify have sought to have their records cleared since the passing of the new law.
It’s thought many are overwhelmed or intimidated by the complex expungement process. The clinic may only come to town once every few months, if at all. Others simply don’t know expungement is possible.
But now, work to automate this entire ordeal has begun - with remarkable results.
The district attorney's plan
“I formed the opinion that this is really our responsibility,” said George Gascon, San Francisco’s district attorney.
Though almost 10,000 people in the city were predicted to be eligible for expungement, just 23 had come forward.
So in January 2018, Mr Gascon pledged to proactively review past marijuana cases - but there was a snag.
“When we started to do this by hand, we recognised very rapidly that this was going to take a long time.”
He enlisted Code For America, a non-profit organisation that works on creating Silicon Valley-esque solutions to problems within the many antiquated systems powering the US government.
The group had made Clear My Record, a tool that can analyse text in court files, using character recognition to decipher scanned documents.
It discards any record involving a violent crime, as such records do not qualify. For those that remain, the tool automatically fills out the necessary paperwork. In other words, the algorithm replaced the process being done manually at the expungement clinics.
Working with San Francisco’s raw data, Code For America was able to identify 8,132 eligible criminal records in a matter of minutes - in addition to the 1,230 found manually already. They dated as far back as 1975, the year in which the city started digitising its files.
And so it was, on 3 April, that San Francisco judge Samuel K Feng signed them all off - reopening life opportunities for thousands of people.
For cases it wasn’t sure about, the algorithm would refer up to a human.
“It isn’t an algorithm doing something in isolation,” explained Evonne Silva, who helps lead Code For America’s work with the criminal justice system.
“It is actually very much a partnership with the government - the policy, the technology and the process combined.”
For Mr Gascon, who is standing stand down this year in order to care for his ailing 90-year-old mother, the move will form a core part of his legacy.
“We created this war on drugs,” he said.
“We - the criminal justice system and society in general - harmed many communities throughout the years. I felt that we had an obligation to right that wrong.”
'The worst of government'
You’ll find the Code For America offices in downtown San Francisco, on a street where some of the city’s most visible problems - drug addiction, homelessness - are well out in the open.
The people working for Code For America’s founder Jennifer Pahlka could (and often did) work for the mega corporations of the technology industry. But, instead, they’re here.
“What we can bring is a challenge to the conventional wisdom that says anything in government technology is going to take many years and cost many millions of dollars,” said Ms Pahlka, who served as deputy chief technology officer under President Obama.
“It just requires having a little bit of technology competence. To run an algorithm on a large database, for instance - that's not difficult, technically, and we shouldn’t make it so.”
Code For America’s work expands beyond criminal justice and into other areas of need. Ms Pahlka’s team has simplified the system for families to get quickly gain access to social support in an emergency - such as a single mother becoming suddenly unemployed.
In 37 California counties, the process for applying for food stamps has, thanks to a Code For America initiative, been reduced from almost an hour to just eight minutes.
“We work for people who need the government to work the most, because those are also the people who often get the worst of government,” Ms Pahlka said.
“We've got a lot of people in the country right now who need a real safety net. They need to sort of get bounced back when they hit a hard spot. They need the criminal justice system to not pull them down into a cycle of what can become persistent poverty and incarceration.”
'We're not moving quickly enough'
This way of thinking is gathering pace. Earlier this month, prosecutors in Los Angeles County announced they too would adopt Clear My Record. They estimated that 50,000 records could be automatically identified for reduction or removal. San Joaquin County, also in California, will use the tech to clear around 4,000 more. Code For America says it aims to help clear 250,000 cannabis convictions this year alone.
“The only downside is that we’re not moving quickly enough,” said Jay Jordan, executive director of Californians for Safety and Justice, an advocacy group campaigning for justice reform.
“We live in a technological age. This is the way that we're supposed to be doing business. And if it streamlines government, saves taxpayers money, and makes us safe… it's a no brainer.”
Mr Jordan says that clearing records is a vital part of rehabilitation, a move that reduces the risk of so-called generational poverty. There are said to be 40,000 “collateral consequences” for those living with a criminal record - more than half relate to employment.
“It affects large swathes of our community,” Mr Jordan said. “People from communities of colour, and urban communities around this country, are riddled with folks with convictions.”
'Asking the world to forgive you'
Back in San Fernando, the co-host of the expungement clinic knows these restrictions intimately. As a teen, Anthony Turner committed a number of crimes, including car theft, drink driving and drugs charges. It meant, at 19, he started what would become 12 years in prison.
Now 40, he’s an image of reformation. He co-owns a charming community cafe with his wife, Cherokee. He has a 15-year-old son who loves baseball - but Mr Turner isn’t allowed to coach his little league team.
Even though he himself isn’t eligible for criminal record expungement, Mr Turner has devoted his free time to helping others get that help - through running clinics, and lobbying alongside advocacy groups.
He acknowledges some people feel a criminal record is the consequence you bear for committing a crime. But he urges people to look beyond that.
“I say to those who feel that it's tough luck, what they should do is look into themselves and ask what they have wanted to be forgiven for in their lives.
“Because that's what you're doing - you're asking not just for a specific person’s forgiveness, you’re asking the world to forgive you.”
Follow Dave Lee on Twitter @DaveLeeBBC
Do you have more information about this or any other technology story? You can reach Dave directly and securely through encrypted messaging app Signal on: +1 (628) 400-7370