Diff Dataset Fields avatar

Diff Dataset Fields

Try for free

No credit card required

View all Actors
Diff Dataset Fields

Diff Dataset Fields

lukaskrivka/diff-dataset-fields
Try for free

No credit card required

Compare changes in text fields between two datasets. Monitor new and updated content on websites.

Compare items of two datasets to see changes in their fields. You match the items by a key field and then compare the any number of textual fields.

Diff

You can choose one or more fields to diff between two items that are matched by a key field. The diff is computed using the fast-diff package where the output is a list of text parts that are marked with a number depending if they are inserted (1), deleted (-1) or unchanged (0).

Output

The output is a JSON object with the following properties:

  • type: Representing how the items were compared. Can be new, removed, unchanged or updated.
  • oldItem: The item from the old dataset
  • newItem: The item from the new dataset
  • diff: The diff between the two items. Only present if the type is updated.

Example input

1{
2    "oldDatasetId": "0Azg4BxggC3RmcPpY",
3    "newDatasetId": "i4mfnrQEP8QmQAbHu",
4    "fieldToMapBy": "url",
5    "fieldsToDiff": ["text", "markdown"],
6    "outputTypes": ["new", "removed", "updated", "unchanged"],
7}

Example output

This is one item that was matched in both datasets, the real output will have all items from both datasets.

1{
2    "type": "updated",
3    "oldItem": {
4        "url": "https://www.peacocktv.com/start",
5        "text": "PeacockAdobe AudienceManagerBack ButtonSearch IconFilter Icon\nEnter your email to get started",
6		"markdown": "# PeacockAdobe AudienceManagerBack ButtonSearch IconFilter Icon\n\n## \n\nEnter your email to get started",
7    },
8    "newItem": {
9        "url": "https://www.peacocktv.com/start",
10        "text": "PeacockBack ButtonSearch IconFilter Icon\nEnter your email to get started",
11		"markdown": "# PeacockBack ButtonSearch IconFilter Icon\n\n## \n\nEnter your email to get started",
12    }
13    ,
14    "diff":{
15        "text": [
16            [
17                0,
18                "Peacock"
19            ],
20            [
21                -1,
22                "Adobe AudienceManager"
23            ],
24            [
25                0,
26                "Back ButtonSearch IconFilter Icon\nEnter your email to get started"
27            ]
28        ],
29        "markdown": [
30            [
31                0,
32                "# Peacock"
33            ],
34            [
35                -1,
36                "Adobe AudienceManager"
37            ],
38            [
39                0,
40                "Back ButtonSearch IconFilter Icon\n\n## \n\nEnter your email to get started"
41            ]
42        ]
43    }
44}
Developer
Maintained by Community

Actor Metrics

  • 1 monthly user

  • 1 star

  • Created in Sep 2024

  • Modified 2 months ago