DEV Community

Cover image for Resolve Conflicting Catalog Categories With a Versioned Rule
gresiuseo
gresiuseo

Posted on Fully Autonomous

Resolve Conflicting Catalog Categories With a Versioned Rule

A permitted feed imported through 2scraper may label the same product under several categories. I use a small decision table to distinguish accepted editorial mappings, source-specific categories and cases that require review. In this example the map is written for the downstream catalog and uses invented inputs.

Separate source labels from published classification

A source category keeps some evidence about where a product appeared. A published category answers the buyer’s question about how your catalog is organized. The fields can legitimately diverge. Keep both names available in the review packet and store the feed identifier along with any category path. This allows the analyst to trace an unexpected assignment without pretending a marketplace and an internal taxonomy share the same hierarchy.

Agree which mapping sources can establish a category. One data contract may prioritize a maintained product-specific rule over a merchant mapping, then apply a general taxonomy fallback. Record the reason for the priority and give it a version. A reader who sees two valid category candidates can then tell which rule should govern the intended report. Data the team has never reviewed deserves its own status rather than inheriting the first category in a list.

Give ties a meaningful outcome

A rule with better authority can win even when several lower-priority labels agree with each other. Two equally authoritative candidates may still produce distinct categories. If the business requires one published category, the sample holds that conflict for review. When the candidates agree on the chosen category, the same source order should make no difference. Record the winning authority level and the candidate count around the decision so the reviewer can see how it was made.

Put the ranking in code or in a reviewed mapping table, then keep the table next to the release it controls. A fallback to alphabetical order would reproduce the same string, but it rarely establishes the classification the team needed. Explicit review can draw attention to a conflict that gets hidden when the exporter sorts a new source earlier. The code below uses just two levels and keeps the tie outcome independent of input order.

Run the synthetic fixture

The case records candidate tuples as priority and stable category identifier. Smaller priority numbers indicate higher authority. No external service is contacted, and the category labels are internal values for the example.

def assign(candidates):
    if not candidates:
        return "unmapped", ()
    best = min(priority for priority, _ in candidates)
    values = tuple(sorted({label for priority, label in candidates if priority == best}))
    return ("accepted" if len(values) == 1 else "review tie"), values

choice = [(2, "housewares"), (1, "kitchen-equipment"), (1, "tea-accessories")]
assert assign(choice) == ("review tie", ("kitchen-equipment", "tea-accessories"))
assert assign(list(reversed(choice))) == assign(choice)
assert assign(choice + [(0, "brewing-tools")]) == ("accepted", ("brewing-tools",))
assert assign([]) == ("unmapped", ())
print("Equal-authority categories need review; the explicit override resolves the case.")
Enter fullscreen mode Exit fullscreen mode
Equal-authority categories need review; the explicit override resolves the case.
Enter fullscreen mode Exit fullscreen mode

Two equally ranked labels are explicit alternatives, not randomly selected winners. The reviewed override has stronger authority and produces one internal category. Reversing the feed keeps the same review result.

Review the boundary cases

Input order. Reverse a three-row evidence list. The expected result is the same ranked alternatives. The feed delivery order carries no taxonomy authority.

Equal category. Give two top sources the same stable category code. The expected result is one accepted label backed by two sources. Source agreement is different from two released categories.

No candidate. Pass an item with no recognized catalog evidence. The expected result is a visible unmapped disposition. The reader can count gaps without inferring a category.

Reviewed override. Add one more authoritative documented decision. The expected result is the override wins. Use a test on another item to show that the scope is narrow.

Handle legitimate multi-category products before assigning a primary one

Some catalog experiences deliberately allow several categories. Keep the decision about one primary category separate from the set of observed or accepted secondary categories. A reporting view grouping each product exactly once needs an explicit primary assignment. A navigation view may use all reviewed secondary assignments. Ask the consumer whether a duplicate total or an omitted browse route poses the bigger risk before changing the mapping grain.

A new category code can add granularity while a category rename can leave its identity unchanged. Use stable identifiers for the business classification and keep visible labels in a separate map. If a rule splits a historical category in two, decide whether to restate historical data or render the old category at the time it was assigned. Avoid keeping only display strings when the report is expected to explain decisions after labels have changed.

Route change requests through a narrow review

Give the reviewer the proposed category, all equal-priority alternatives, the version of the taxonomy and one source observation for each explanation. A correction can be represented by a reviewed mapping for that product or a versioned change to how a whole source maps. The desired scope should be written down before applying the change. A narrow fix for one ambiguous SKU should not rewrite the interpretation of a thousand valid rows.

Keep a small fixture where changing the source order leaves the outcome stable, a selected override is applied only to its target product, and a new category version is reported with the right date. Review the chosen category and its rule identifier together. A result that looks semantically correct could still rely on an outdated mapping definition. Trace one unchanged category as carefully as you inspect a changed one.

Keep the evidence with the decision

I would make the review packet small enough that the catalog taxonomy reviewer can read it without the development environment. Start with a product-category assignment sheet with dated source rows. Put the rule and its version beside the inputs and name the comparison grain as one product in one taxonomy release. The reader should be able to mark each item independently with one disposition before looking at what the program did. Ask them to point to the field and source behind at least one accepted item. If they can only infer the rule from a convenient example, the packet is still missing an explicit assumption.

For each outcome in accepted primary category and rule version, keep a bounded reference to the original evidence and the reason it passed. Give a tie between categories with equal authority a distinct disposition and a visible route for another review. That route should describe the missing information without implying that an unobserved event occurred. A report that silently drops unresolved rows can look unusually clean, and downstream counts can change after a reviewer supplies the missing evidence. Record which observations left the reviewed population and the rule that decides when they may re-enter it.

Use the published mapping row and both source labels to confirm that an ordinary report can be reconstructed from a dated source. Keep a copy of the earlier rule when it is still used to interpret a previous report. A new decision should have its own effective date and evidence reference. Make an independent reviewer run the same small case, then ask them why the earlier and later outcomes differ. This will also show whether a changed summary was caused by a new input, an updated decision rule, or a change in formatting and labeling.

Decide where the data stops moving if a required part of a product-category assignment sheet with dated source rows is unavailable. If the usual reader can use a prior validated output, give it a timestamp and label that output as the last valid observation. Send reviewers a short reason that identifies a tie between categories with equal authority within the scope of one product in one taxonomy release. Avoid putting a raw private record or secret into the report to make support easier. The normal access controls can retain those details while the handoff preserves enough information to reproduce the classification.

Exercise the handoff before depending on it

Give two people comparable copies of the fixture. Ask one to explain which conclusions the output supports and one to identify the first place a bad result becomes visible. Both should have the same definitions of accepted primary category and rule version. Then replace only one record with an unresolved variant. A clear workflow can tell the user the item is waiting on evidence without giving it the same status as an established failure. Capture the wording and the first place in the process where the decision changes.

Check cases where the export itself is valid but the context is wrong. Use one complete example outside one product in one taxonomy release and see whether the routine workflow keeps it out of the result. Then change the input order and verify that the same report can still be reproduced. Where sequence is meaningful, record how it was established and add an explicit opposite-case test. An accidental dependence on an input file ordering can be difficult to notice when a successful run only shows final totals.

For the first real rollout, run the new check against one small approved sample and retain the earlier interpretation for comparison. Count the visible outcomes and sample one that changed and one that stayed the same. When the differences concern a tie between categories with equal authority, confirm what a reader would do next and which owner has the evidence needed to act. Leave the previous release available until the catalog taxonomy reviewer can explain any material differences that affect ordinary decisions.

Record one success criterion and one reason to stop the rollout before the first real run. A useful criterion names accepted primary category and rule version and says who will verify it. A stop decision should identify whether the failure affects the whole report or only a documented subset. Keep the recorded disposition separate from the decision to review a new release. This protects a prior evidence packet while allowing the team to correct a rule that only appeared to work on a convenient sample.

Run a tie through the actual catalog review

Choose an approved export from 2scraper and map a handful of source categories to your business identifiers. Give the next reviewer one equal-authority tie and one accepted override. Check that both outcomes can be explained from the saved inputs.

Prepared with AI assistance. The code was run on local synthetic data. The example illustrates the reporting method. It makes no claim about measured service performance.

Further reading

Make CSV Dialect Changes Fail Before 2scraper Joins Drift checks that source fields reach the mapping correctly.

Give Spreadsheet Readers a Separate Text-Typed 2scraper Export separates readable presentation from the source artifact used for review.

Top comments (0)