Explain What Changed Between Two 2scraper Catalog Snapshots
A row-level diff should tell a reviewer whether the change was in the item, its scope, or the supplied evidence.

When I compare authorized exports from 2scraper, a summary saying ten rows changed is rarely enough. I want a reviewer to see which products were added, which were absent, and which values changed on an observed item. That only works when the two snapshots have compatible scopes and the comparison preserves the identity behind each row.
Written with AI assistance. The items and amounts are synthetic. The Python checks ran locally, and the cover was prepared with AI assistance.
Decide what makes two snapshots eligible for a complete diff
A full snapshot can support a comparison of observed item memberships within an agreed scope. A partial batch can show new observations without establishing whether other items left the catalog. Preserve the approved scope, snapshot date, source version, and a completeness assessment. A changed export filter can explain why an item stopped appearing even though no business event removed it.
I would label an item absent from a second compatible full snapshot as absent in that snapshot. Removal from sale may be a stronger claim that requires separate evidence. For example, a local import could have applied a documented exclusion criterion, or the original project could no longer observe a category. Give the report a visible reason when the source supports one. Do not silently substitute a definitive deletion label for missing evidence.
The toy example compares one fixed catalog scope with an item ID and two selected fields. The field set belongs to a versioned reporting contract. It records the prior and new observed value for each field that actually changed. This is a useful grain for reviewing a price or title change without replaying an entire spreadsheet.
Check a small set with additions, absences, and field changes
The old fictional snapshot contains A, B, and C. The new one contains A, B, and D. A changed price, B has the same selected values, C is absent, and D is present only in the new snapshot. A difference in row order does not affect the result. If the second snapshot is known to be partial, the code avoids declaring C absent from a complete scope.
from decimal import Decimal
FIELDS = ("label", "price")
def by_key(rows):
output = {}
for key, label, price in rows:
if key in output:
raise ValueError("ambiguous item key")
output[key] = {"label": label, "price": price}
return output
def compare(before, after, *, complete):
old = by_key(before)
new = by_key(after)
shared = old.keys() & new.keys()
changes = {}
for key in sorted(shared):
fields = {name: (old[key][name], new[key][name])
for name in FIELDS if old[key][name] != new[key][name]}
if fields:
changes[key] = fields
return {
"added": sorted(new.keys() - old.keys()),
"absent": sorted(old.keys() - new.keys()) if complete else None,
"changed": changes,
"unchanged": sorted(shared - changes.keys()),
}
D = Decimal
old = [("A", "Blue", D("12")), ("B", "Red", D("15")), ("C", "Green", D("11"))]
new = [("B", "Red", D("15")), ("A", "Blue", D("13")), ("D", "Yellow", D("17"))]
diff = compare(old, new, complete=True)
assert diff == {"added": ["D"], "absent": ["C"],
"changed": {"A": {"price": (D("12"), D("13"))}}, "unchanged": ["B"]}
assert compare(old, new, complete=False)["absent"] is None
assert compare(reversed(old), reversed(new), complete=True) == diff
print("A price changed; B unchanged; C absent in full view; D added")
The local run printed A price changed; B unchanged; C absent in full view; D added. One assertion checks the same list under a partial run, where absence cannot be established. In this fixture added means newly observed relative to the baseline file. It is not a claim about the actual date a product entered a commercial catalog.
Compare common fields using the appropriate value representation
The example uses Decimal amounts and no currency conversion. A real report needs to know whether an earlier and current amount represent the same price basis and currency. Two numbers can be equal while their currency changes. Make the currency or price basis a compared field where it affects interpretation. A difference in representation alone is a separate kind of change.
For a product title, decide whether formatting such as trimmed trailing space has any business meaning. An approved normalization can prevent meaningless churn. Keep the original recorded value under its access rules and document the comparison rule. A test with a changed word should still appear in the diff even if repeated spacing is ignored.
Consider a missing field. If a current full row legitimately has no observed description, that could be a field coverage change. A partial update without a description can mean the producer made no observation about that field. The fixture treats each included row as complete for its selected fields. If your data permits sparse updates, assemble comparable snapshots under an explicit merge rule before using this diff.
Make additions and absences show their scope
In a report that changed coverage, a newly included product can come from a wider approved region rather than a changed catalog. To avoid mixing the interpretations, compare either two exports using the same documented scope or compute a compatible intersection from independent evidence. Keep visible labels for records present only because the scope widened. They could be useful to track, while answering a different question.
An annual history might contain comparable periods with stable item IDs and another period where the source changed the identifier scheme. Require a reviewed mapping between the two identifiers before treating a row as the same product. If there is no mapping, explain which records cannot be compared. A title similarity measure may be useful to propose a review candidate but does not establish ownership of a price.
Create one example that changes only scope and another that changes only a price in the shared population. A report should make the two effects separately visible. Someone can then decide whether the change belongs in a catalog review, a data quality task, or the planning report that first raised it.
Attach a reproducible review record
For every changed record, I would keep the stable key, the compared field, the previous value, the new value, and independent references to both snapshots. Add a source version where a changed schema could explain the result. A report heading can describe a short row-level summary. The reviewer should have a way to reproduce one material difference from the approved evidence.
Set a policy for what happens when a duplicated key appears. The toy function refuses to choose an arbitrary row. A production report with several offers can declare a composite key so the records represent its grain. If the application expects one product per key, send the duplicate to the data owner and show why a correct current price was unavailable. A deterministic row order alone does not make an ambiguous record safe to select.
Consider a known operator who can see the summary and the normalized values but cannot access supplier source details. Give that person a minimal record reference and a route to raise a review. Avoid putting raw private fields into a shared diff simply to make all columns look complete. The public examples can remain synthetic while the internal report keeps its approved evidence references.
Reconcile the statuses before reviewing individual fields
For a complete compatible comparison, shared items can be split into changed and unchanged under the chosen field contract. The old unique count equals those shared items plus keys absent from the new snapshot. The new unique count equals the shared items plus keys added to the view. In the toy data that is one changed, one unchanged, one absent, and one added. Both snapshots held three items even though their identities differ.
If the report computes total field changes separately, label that count clearly. One item can have a changed price and a changed product label. The item count grows by one and the field-change count grows by two. A reviewer should be able to reproduce either number from the underlying diff. Test a case with several changed fields on the same item to show which figure a dashboard displays.
I would also keep a compatible shared-population count when the second snapshot is incomplete. The review may still report changes for the independently observed rows. The missing membership conclusion remains unavailable under the recorded rules. That is useful information about what the new observations establish, and it lets readers separate partial success from a verified full view.
Handle an expected schema migration without inventing changes
An exporter could rename a column while leaving the represented value unchanged. A suitable adapter maps both names into the same supported field under explicit schema versions. Keep the raw labels and the referenced mapping in the comparison record. A test can present the same synthetic price across versions and confirm that the report does not create a price change simply because a source changed its field name.
Other migrations change the meaning or unit of a field. Suppose an earlier field represents the package price and a newer one represents price per item. Equal numeric values do not establish comparability. The report can require approved conversion evidence and the applicable package size before comparing amounts. If that evidence is absent, preserve a field-level status that says the comparison is unavailable.
Give a reviewer one case in which both adapter versions accept exactly the same numbers but only a subset is comparable. Check that the report can explain the unchanged item counts and the unavailable field comparison separately. A single global label saying changed would conceal the distinction between a real price movement and a changed data contract.
Explain the effect of reviewing a correction after the diff was issued
If the source owner supplies a corrected prior observation, the new comparison may differ even though the latest snapshot did not change. Keep the snapshot revisions in the report and identify which one was corrected. A dated output can say that the calculation was revised using newly verified evidence, and the original report can remain available under the team's standard review procedure.
When a teammate reviews a filtered view of the diff, preserve the scope note in the exported version. If the table hides unchanged items to make the material changes easier to find, the counts can still show how many items were shared. A person reading the filtered report should be able to determine whether a missing row was unchanged, outside the selected scope, or unresolved.
Test sequencing and the way readers open the report
Test the same before and after inputs in a fresh working tree, then in a repeated run. The selected diff should be stable across those runs. If a later version of the importer changes the field map, save the two report versions and explain how the mapped values differ. A meaningful change in result can come from the rules as well as the inputs.
Verify the rendered spreadsheet. If a label begins with a leading zero or a value is empty, check its visible representation after the file is reopened. A source diff can be correct while an exported file makes its missing status seem like a zero. Include one verified change, one complete absence, and one partial run in the handoff fixture.
Take one product class from 2scraper and build two comparable small snapshots using documented fields and permitted data. Walk through every status in the synthetic example before adding more fields. When a teammate can explain which row changed and which report supported it, the diff is ready to inform a real review.
Further reading
Keep Partial Product Updates From Erasing Good 2scraper Catalog Data examines how to preserve comparable records before looking for a difference.
A Valid 2scraper Export Can Still Be Wrong for Your Report checks which input population the report is meant to describe.
Check Whether a 2Captcha Balance History Actually Covers Leap Day gives a separate example of proving which observations a dated report could include.
Stop Availability Text From Becoming a Zero Price in an Amazon Scraper Report tests a specific field change where a missing observation can distort the diff.
Comments
Join the discussionNo comments yet. Be the first to comment.





