After a prolonged battle, a judge today ordered the city of New Orleans to turn over its purchasing database to The Lens.

“These documents are public documents,” Civil District Court Judge Kern Reese said. “They need to be released.”

Lens attorney Scott Sternberg, of Baldwin Haspel Burke & Mayer, said he was thrilled with the ruling.

“If the citizenry can’t track public spending, I don’t know what the public records law is for,” Sternberg said.

The database contains records of the city’s purchase orders, receipts from vendors, payments to the vendors and running totals toward contract amounts, among other spending information.

Sternberg told Reese in court that the city had failed to produce the database, even after lengthy negotiations between The Lens and the city, initiated at the judge’s request. Sternberg also argued the city had failed to prove the database wasn’t subject to public-records law, a burden that falls to the government agency that has the record.

The opening section of the state law spells out what’s considered a public record, and makes clear that the digital files The Lens seeks qualify:

All books, records, writings, accounts, letters and letter books, maps, drawings, photographs…regardless of physical form or characteristics, including information contained in electronic data processing equipment, … are “public records.”

Assistant City Attorney William Goforth said the city unsuccessfully attempted to remove private information, which the law allows. But he said there was no way to account for human error, such as entering a Social Security number into the section designated for an address.

“It’s simply impossible to eliminate all private data from the database,” Goforth said.

The city has said previously that the database is likely to contain many errors because officials don’t use it themselves to create reports or track spending, and mistakes were introduced when it imported files from elsewhere. The only way the city could ensure no protected information is released would be to review everything manually, line by line.

Sternberg argued that the law doesn’t make a public-records exception for a government that doesn’t enter data accurately.

For the city to comply, according to Goforth’s math, it would take one person working for 30 years to review all the data and remove private information.

That didn’t impress Reese.

He ordered the city to release the entire database. When Goforth asked if they could remove sections they believe have private information, the judge shook his head and reiterated he was ordering the full electronic record to be released.

He noted The Lens has spent months in court pursuing the electronic records, which it first requested in January of 2015. The Lens filed a lawsuit against Mayor Mitch Landrieu and the city in May, after the city denied its records request in April. The lawsuit asked Reese to declare the city habitually violated public records law, order the city to produce requested records and issue an injunction that would prevent the city from continuing its practice of delayed compliance.

At a hearing in June he denied all three motions. However, he reconsidered after The Lens showed the judge his initial ruling had an error and the city had not, in fact, produced all of the records Reese thought it had.

He then told the city and The Lens to work out an agreement by which the city would turn over the records and the newsroom would protect private information. Those talks failed.

Reese said time was up at Friday’s hearing.

“This has denied The Lens access to information that the court deems public,” he said. “I’m going to order the BuySpeed database be turned over.”

Lens Editor Steve Beatty said the ruling was a victory for the news outlet and the public.

“The judge’s ruling comes down squarely on the side of the public, and our right to see how government does its business — particularly how officials spend our tax dollars,” Beatty said.

Though the database might contain private information, Beatty said The Lens isn’t interested in reviewing or publishing that information, and it has no plans to do so.

Reese cautioned the nonprofit news outlet he would look sternly upon any private information — such as Social Security numbers or private addresses — being published by The Lens.

The Lens contends this is part of the city’s habitual failure to provide records in a timely matter.

Some requests go unfulfilled for months. The Lens found the city’s log of public records to be riddled with errors.

“Just because city officials aren’t very good at keeping their records doesn’t mean they should deny the public access to those records,” Beatty said.

Reese also ordered the city to pay $2,500 in attorney’s fees for The Lens. When Goforth raised an objection, he warned them “it could be a lot worse.”