跳到正文
DEV Community· Travis Calvert·· 3 小時前AI 評分47

CSV Rescue:讓本地 AI 處理繁瑣的 CSV 清理,不交出資料控制權

CSV Rescue: Let Local AI Do the Tedious CSV Cleanup — Without Giving It the Keys

AI 導讀

CSV Rescue 是一款本地優先的開源應用程式,使用 AI 推薦 CSV 清理操作,由用戶審核後透過可預測的 Python 程式碼套用變更。示範中,它處理了 500 行資料,移除 25 行重複資料,完成 739 項儲存格變更,並標記 61 個問題供檢查。應用程式使用 Ollama 和 Qwen3:8b 在本機推理,不會覆寫原始檔案,也不會執行模型生成的任意 Python 程式碼。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady.

What I Built

CSV files are everywhere. Unfortunately, so are the little inconsistencies that make them frustrating to work with: extra whitespace, currency symbols, inconsistent date formats, missing-value placeholders, and duplicate records.

Cleaning those problems manually is tedious. Automating the process blindly can be worse.

CSV Rescue is a local-first, open-source application that uses AI to identify useful cleaning operations, lets the user approve them, and then applies the selected changes through predictable Python code.

The idea is simple: let AI figure out what might need fixing, but don't let it invent the fixes.

The workflow has three steps:

  1. Upload a CSV file for local analysis.
  2. Review and select recommended cleaning operations.
  3. Preview the changes, inspect any flagged issues, and download a cleaned CSV.

The original file is never overwritten.

Demo

CSV Rescue showing AI-assisted cleaning rules and before-and-after results

For the demonstration, I generated a deliberately messy 500-row CSV containing inconsistent currency and date formats, extra whitespace, missing-value markers, and duplicate records.

With five cleaning operations selected, CSV Rescue produced:

Metric Result
Input rows 500
Output rows 475
Cell changes 739
Flagged issues 61

The application removed 25 duplicate rows while preserving ambiguous values for review.

For example, when a currency field contains unknown or TBD, CSV Rescue flags the issue instead of pretending it knows the correct amount.

The before-and-after preview also includes a change log identifying the affected row, column, operation, original value, and resulting value.

Code

GitHub:

https://github.com/BlacktopLogic/csv-rescue

The repository includes the FastAPI application, deterministic cleaning engine, CSV profiler, sample data, automated tests, setup instructions, and an MIT license.

It's designed to run locally rather than requiring a hosted application or cloud AI account.

How I Built It

CSV Rescue uses a small, intentionally straightforward stack:

  • Python and FastAPI for the application and browser interface.
  • Ollama to run AI inference locally.
  • Qwen3:8b as the open-weight language model.
  • A CSV profiling layer to summarize the uploaded data.
  • A deterministic cleaning engine to perform approved transformations.
  • pytest for automated regression testing.

The model receives a statistical profile of the CSV and recommends operations from a restricted set of supported cleaning rules.

Those operations currently include trimming whitespace, normalizing currency, normalizing dates, normalizing blank values, and removing duplicate rows.

The model does not get to generate arbitrary Python code for execution. Its suggestions are validated against supported operations, and the user chooses what to apply.

That separation is intentional. Language models are useful for recognizing patterns and suggesting actions, but data transformation needs to be predictable, inspectable, and repeatable.

Why Does Open Innovation Matter?

Local inference is central to the design.

CSV files often contain customer information, business records, or operational data that people would rather not send to an external AI service.

By using Ollama and an open-weight model, CSV Rescue can analyze a file's statistical profile on the user's own computer without requiring a cloud inference API.

This also makes the project easier to experiment with. The AI layer can evolve independently from the cleaning engine, and the core cleaning functionality doesn't depend on a paid AI subscription.

Just as importantly, open source makes the transformation logic inspectable. Users can see how their data is processed instead of having to trust an opaque AI-generated result.

The Lazy Payoff

The goal isn't to remove people from the process. It's to remove the repetitive work while keeping the important decisions.

Instead of manually inspecting hundreds of rows, searching for formatting inconsistencies, and applying spreadsheet operations one at a time, the user can review a small set of suggested rules and inspect the resulting changes.

During testing, CSV Rescue processed a 500-row sample, identified five useful operations, and produced a cleaned file with 739 cell changes.

I also tested the project from a fresh GitHub clone: installing dependencies in a new virtual environment, running all 15 regression tests successfully, launching the application, generating AI recommendations, previewing the results, and downloading the cleaned CSV.

All 15 automated tests passed.

This is an early release, not a replacement for full-featured data preparation software. But it demonstrates a useful principle: AI can take on the tedious pattern-recognition work without being given unrestricted control over the data.

Slow and steady, with a human still holding the steering wheel.


Built by Blacktop Logic.

Explore CSV Rescue on GitHub

來源:DEV Community · dev.to