Lee Foot

Tag Consolidator

Group granular secondary tags into broader categories with GPT, working within each primary tag.

View the source

#about

Adds a Generic Tag column that groups granular secondary tags, such as those mined from customer feedback, into broader categories.

Rows are grouped by primary tag, and each group's unique secondary tags go to GPT Luna (the default, or GPT Terra) in one call, so cost scales with the number of groups, not rows.

Categories are chosen within each primary tag, so they can differ between groups.

Tags the model leaves out or returns with different wording stay blank.

Run it locallyRequires an API key

Platform
Streamlit app you run on your own machine (needs Python 3.x)
Input
OpenAI API keyCSV with a primary tag column and a secondary tag column
Output
CSV (consolidated_tags.csv) with all original columns plus a Generic Tag column mapping each secondary tag to a broader category. Categories are chosen within each primary tag, so they can differ between primary tags.
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 Luna (default) or GPT Terra 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 Luna recommended for cost, or GPT Terra)
  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 the model leaves out are left with a blank Generic Tag, and the app reports how many rows were not mapped. A returned tag is applied only if it matches yours exactly, including case and spacing. If an API call fails, for example because of a bad key or a quota limit, the whole primary tag group is left blank without an error message. Re-running processes the whole file again, not just the blanks.
What happens to rows with an empty primary tag?
They are never sent to the model. Rows are grouped by the primary tag column, and rows where it is empty fall outside every group, so their Generic Tag stays blank. Fill in or filter those rows before you upload. The model options are GPT Luna (the default) and GPT Terra.
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.