Lee Foot

Tag Consolidator

Consolidate granular secondary tags into broader generic categories using GPT.

View the source

#about

Groups a CSV by primary tag and sends each group's unique secondary tags to the OpenAI chat completions API (JSON mode) in a single call per group.

GPT returns a mapping of broader category names to original tags, which is written back as a Generic Tag column.

Supports GPT-4o-mini, GPT-4o and GPT-4.1.

Requires an API key

Platform
Python script (requires Python 3.x)
Input
OpenAI API keyCSV with a primary tag column and a secondary tag column
Output
CSV with all original columns plus a Generic Tag column mapping each secondary tag to a broader category.
Category
Content

Use cases

  • Reducing granular customer feedback tags to reportable themes
  • Consolidating review-mining output before visualisation
  • Simplifying tag taxonomies for product categorisation

#features

  • One API call per primary tag group (cost scales with group count, not row count)
  • OpenAI JSON mode response format
  • GPT-4o-mini, GPT-4o, or GPT-4.1 model selection
  • Column mapping for primary and secondary tag columns
  • Unmapped row detection and warning
  • Progress bar with per-group status

#how-to-use

  1. Enter your OpenAI API key in the sidebar
  2. Select a model (GPT-4o-mini recommended for cost)
  3. Upload your tag CSV
  4. Map the primary and secondary tag columns
  5. Click Consolidate Tags
  6. Download the CSV with the new Generic Tag column

#faq

How many API calls does this make?
One call per unique primary tag group, not one per row. If your CSV has 5,000 rows across 12 primary tags, it makes 12 API calls. Each call sends the unique secondary tags for that group and receives a JSON mapping back.
Can the same secondary tag end up in different generic categories across primary groups?
Yes. Each primary tag group is processed independently in its own API call, so the phrase 'poor quality' under a Delivery primary tag might map to 'Handling Issues' while the same phrase under Build Quality might map to 'Material Problems'. The context of the group influences the consolidation.
What happens if the API does not return a mapping for some tags?
Tags that the API omits from its JSON response are left with a blank Generic Tag value. The tool reports the count of unmapped rows after processing and you can re-run the same file to retry them.
Which models are available?
The sidebar offers GPT-4o-mini, GPT-4o and GPT-4.1. GPT-4o-mini is the default because it is the cheapest per call while still producing reliable JSON-mode responses for this task.
What format does the input CSV need?
Any CSV with at least two columns: one for primary tags and one for secondary tags. Column names are selectable in the UI, with defaults of 'Primary Tag' and 'Secondary Tag'. Encoding is auto-detected (utf-8 first, then latin-1 fallback).

/contact

Want me to run this for you? I run this tool as a managed service, or build something custom around your data. You get the insights without touching the code.