seanpedrick-case/doc_redaction/doc-redaction-tabular

Claude Code and agent skill by seanpedrick-case/doc_redaction

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Skill for redacting tabular files (CSV/XLSX/Parquet/DOCX) using the Document Redaction app. gradio_client-first with discovery via view_api().

Install

npx vskill@latest install seanpedrick-case/doc_redaction/doc-redaction-tabular

SKILL.md

Purpose

Redact tabular and semi-tabular files using the app:

  • CSV (.csv)
  • Excel (.xlsx, .xls)
  • Parquet (.parquet)
  • Word (.docx)

Registered endpoints:

  • `/tabular_redact` — short, stateless tabular redaction (preferred when present)
  • `/redact_data` — main tabular redaction (long signature)
  • `/find_duplicate_tabular` — detect and remove duplicate rows

When to use this skill

Use when the document is not a PDF/image and you want redaction applied directly to a table-like file. For PDFs/images, use doc-redaction-app with api_name="/redact_document" instead.

Decision tree (recommended)

  1. Try `gradio_client` first — confirmed working for both endpoints.
  2. `docker cp` + raw Gradio HTTP — fallback if gradio_client fails.
  3. Raw Gradio HTTP API — last resort: /gradio_api/upload +

/gradio_api/call/... + poll.

Tabular Redaction (short: /tabular_redact, long: /redact_data)

Quick example (CSV)
python
from gradio_client import Client, handle_file
import os
BASE_URL = "http://host.docker.internal:7861"
client = Client(BASE_URL)
csv_path = "/path/to/table.csv"
output_folder = "/home/user/app/output/" # CONTAINER path
wrapped_files = [handle_file(csv_path)]
result = client.predict(
file_paths=wrapped_files,
in_text="", # required str
anon_strategy="replace with 'REDACTED'", # see strategies
chosen_cols=["Name", "Email"], # columns to anonymize
chosen_redact_entities=[
"PERSON", "PHONE_NUMBER",
"EMAIL_ADDRESS"
],
in_allow_list=[],
latest_file_completed=0, # 0 for single file
out_message="Tabular redaction test", # required str
in_excel_sheets=[], # not Excel; see multi-sheet below
first_loop_state=True, # always True for fresh run
output_folder=output_folder,
in_deny_list=[],
max_fuzzy_spelling_mistakes_num=0,
pii_identification_method="Local",
chosen_redact_comprehend_entities=[],
aws_access_key_textbox="",
aws_secret_key_textbox="",
do_initial_clean=True,
language="en",
progress="",
custom_llm_instructions=["PERSON_NAME"],
api_name="/redact_data"
)
# Returns 4 outputs: (str status, list[filepath], int count, list[filepath])
print(f"Status: {result[0]}")
print(f"Output file: {result[1][0] if result[1] else 'N/A'}")
print(f"Files redacted: {result[2]}")
Excel multi-sheet handling

To discover sheet names, read the file locally first:

python
import pandas as pd
sheets = pd.ExcelFile(csv_path).sheet_names
# e.g. ['Sheet1', 'Q1_Data', 'Summary']

Pass discovered names to in_excel_sheets:

python
result = client.predict(
...,
in_excel_sheets=["Sheet1", "Q1_Data"], # sheet name strings
...
)

If the file has no sheets or the list is empty, the app processes all available sheets.

HF Space (Hugging Face)

Public deployment: https://seanpedrickcase-document-redaction.hf.space Same API. Key differences from local Docker:

  • No "Local Inference Server" option
  • No VLM face/signature entities
  • Stricter file validation
  • ~2–3× slower (free-tier CPU)
HF Space output access

result[1] and result[3] are local temp paths that gradio_client already downloaded. Read directly:

python
output_file = result[1][0]
with open(output_file, "r", encoding="utf-8-sig") as f:
print(f.readline().strip()) # first row (may have BOM)
`client.download_file()` (singular) does NOT exist on some
gradio_client versions. Use the output paths directly.
HF Space "0 entities" quirk

On HF Space the entity count (result[2]) may show 0 even when redaction is applied correctly. Always verify by reading the output file, not the log count. This is a known display issue with the spaCy model on HF.

Container path caveat (Docker)
PathWorks?
/home/user/app/output/Yes — container-internal, app's OUTPUT_FOLDER
/tmp/test_data/output/ (host)No — server runs inside the container

Workaround: Use container paths. Retrieve files via docker cp:

bash
# Find the file
docker exec doc_redaction-redaction-app-llama-1 \
ls -lt /home/user/app/output/ | grep combined_case_notes
# Download
docker cp doc_redaction-redaction-app-llama-1:/home/user/app/output/combined_case_notes_anon_redact_replace.csv ./output.csv

Anonymization strategies (all 4 tested)

StrategyBehaviorExample ("Jane Smith")
replace with 'REDACTED'Replaces with literal text REDACTEDREDACTED (8 chars)
redact completelyRemoves content (empty cell)(blank)
maskReplaces with asterisks matching original length********** (10 chars)
hashSHA-256 hash of original value (consistent per entity)ca85b082d2e6... (94 chars)
Choosing a strategy — use case guide
Use caseRecommendedWhy
GDPR complianceredact completelyMaximum privacy, no length leakage
Audit trailreplace with 'REDACTED'Clear indication of redaction occurred
Data science (preserve structure)mask or hashKeeps row/column dimensions intact
Cross-row correlation analysishashSame entity → same hash across all rows
Legal review (need to know what was there)replace with 'REDACTED' + logRedaction text + decision log
Machine learning (feature engineering)mask or hashPreserves data shape for pipelines
Maximum privacy (no length info leaked)redact completelyNo clue about original value length

Key parameters

ParameterTypeNotes
chosen_colslist[str]Column names to anonymize. If empty, all columns with PII are processed. Use exact column header names from the CSV/XLSX.
chosen_redact_entitieslist[str]Local (spaCy + custom recognizers) — full list in `../doc-redaction-app/SKILL.md` §2e. Includes TITLES, UKPOSTCODE, STREETNAME, CUSTOM, CUSTOM_FUZZY
chosen_redact_comprehend_entitieslist[str]AWS Comprehend labels when pii_identification_method="AWS Comprehend" — full list in doc-redaction-app §2e; may also include TITLES, UKPOSTCODE, STREETNAME, CUSTOM, CUSTOM_FUZZY
in_deny_list / in_allow_listlist[str]Terms always redacted (CUSTOM / CUSTOM_FUZZY) or never redacted (allow_list). See doc-redaction-app §2e
max_fuzzy_spelling_mistakes_numint0 = exact match. 1–2 allows fuzzy matching (useful for typos in PII).
do_initial_cleanboolTrue: strips whitespace, normalizes text. Recommended for dirty data.
pii_identification_methodstr"Local" (spaCy, no API keys) or "AWS Comprehend" (requires AWS creds).
in_excel_sheetslist[str]For XLSX files: specific sheet names to process. Empty = all sheets.
custom_llm_instructionslist[str]Entity types for LLM fallback (e.g., ["PERSON_NAME", "EMAIL_ADDRESS"]).
languagestr"en", "fr", "de", etc. Affects spaCy model language settings.
latest_file_completedfloat0 for single file, 1.0 when last of a batch (for multi-file runs).

spaCy NER limitation

The default Local PII detection uses spaCy's English model. It may miss short names with initials like "Alex D." — tested on combined_case_notes.csv (18 rows) showed only "Jane Smith" (10 chars, full name) was detected in the Social Worker column, but "Alex D." (7 chars, with initial) in the Client column was not. This is a known spaCy limitation with short/abbreviated names.

Workarounds:

  • max_fuzzy_spelling_mistakes_num=1 for partial matches (won't help with initials)
  • custom_llm_instructions with entity types for LLM-based fallback detection (requires external LLM)
  • in_deny_list with known names to exclude from redaction (e.g., your own company name)
  • do_initial_clean=False if cleaning is removing useful context

Output file naming convention

The app generates files with predictable naming:

{original_name}_anon_{strategy}.csv
{original_name}_anon_{strategy}.csv_log.csv (decision log)
OriginalStrategyOutput file
combined_case_notesreplace with 'REDACTED'combined_case_notes_anon_redact_replace.csv
combined_case_notesredact completelycombined_case_notes_anon_redact_remove.csv
combined_case_notesmaskcombined_case_notes_anon_mask.csv
combined_case_noteshashcombined_case_notes_anon_hash.csv

Retrieving output files (Docker)

Outputs are written under the container's OUTPUT_FOLDER. Retrieve via:

bash
# Find the file in container
docker exec doc_redaction-redaction-app-llama-1 \
ls -lt /home/user/app/output/ | grep combined_case_notes | head -10
bash
# Download the redacted CSV
docker cp doc_redaction-redaction-app-llama-1:/home/user/app/output/combined_case_notes_anon_redact_replace.csv ./output.csv

Log file format (decision log)

The _log.csv file contains one row per PII entity detected:

csv
entity_type,start,end,data_row,column,entity
PERSON,0,10,0,Social Worker,Jane Smith
  • entity_type — spaCy entity label (PERSON, PHONE_NUMBER, etc.)
  • start,end — character offsets in the cell value
  • data_row — 0-indexed row number
  • column — column name
  • entity — the detected PII text

Read with `encoding="utf-8-sig"` in Python to strip the BOM (\ufeff) that may appear at the start of CSV files.

HF Space log caveat

On HF Space the log file path is returned in result[3] (not result[2]). The entity count (result[2]) may show 0 even when redaction IS applied correctly. Always verify by reading the output file, not the log count.

Deployment variants

HF Space (Hugging Face)

Public deployment: https://seanpedrickcase-document-redaction.hf.space Same API. Key differences from local Docker:

AspectLocal DockerHF Space
PII detectionLocal, Local Inference Server, AWS ComprehendLocal, AWS Comprehend (no inference server)
OCR modelstesseract, paddle, hybrid-paddle-inference-server, inference-servertesseract, paddle only
VLM entitiesCUSTOM_VLM_FACES, CUSTOM_VLM_SIGNATURE availableNOT available (no GPU/VLM support)
efficient_ocr defaultTrueFalse (saves compute on free tier)
Speed~1.5s per request (GPU machine)~3–4.5s per request (~2–3× slower, CPU free tier)
File validationAccepts any file type via APIStrict: only .pdf, .jpg, .png, .json, .zip for /redact_document
Output accessdocker cp from containerRead gradio_client output paths directly (already cached locally)
Speed comparison (tested Apr 21, 2026)
StrategyLocal DockerHF Space
replace with REDACTED~1.5s~3.5s
redact completely~1.5s~3.4s
mask~1.5s~3.6s
hash~1.5s~4.5s

Error handling patterns

Common errors and fixes
ErrorCauseFix
Cannot save file into a non-existent directoryoutput_folder path doesn't exist in containerUse /home/user/app/output/ or ensure the directory exists
`'meta' field must be explicitly provided.Raw string passed to files=Wrap with handle_file(path)
`Invalid file type. Please upload.CSVs rejected by `/redact_documentUse /redact_data for tabular files
Timeout after ~3sHF Space free tier spinning downAccept ~3.5s runtime. No fix.
Entity count shows 0HF Space display issueRead output file to verify.
Defensive coding pattern
python
import os
from gradio_client import Client, handle_file

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
52
Repository forks
12
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/seanpedrick-case/doc_redaction/doc-redaction-tabular/badge)](https://verified-skill.com/skills/seanpedrick-case/doc_redaction/doc-redaction-tabular)

Something wrong with this skill or its page? Tell us.