L2 Hub
Pontus
analysis
Compare Data

L2 Construct: compare_data

comparison

Description

The comparison L2 analyzes two tabular datasets to identify patterns, trends, and discrepancies between them. It provides an expert analysis based on a rubric that outlines specific criteria for comparison. The L2 outputs a detailed analysis of the datasets, highlighting key differences and similarities, and suggesting further analyses or visualizations that could provide deeper insights.

L2 Data

  1. Provider: pontus
  2. Module: analysis
  3. Action: compare_data

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "pontus",
    "module": "analysis",
    "action": "compare_data",
    "metadata": {}
  }
}
 

Input

Example

{
  "table_one": {
    "headers": ["Year", "Revenue", "Profit"],
    "rows": [
      ["2020", "1000000", "200000"],
      ["2021", "1200000", "250000"],
      ["2022", "1500000", "300000"]
    ]
  },
  "table_two": {
    "headers": ["Year", "Revenue", "Profit"],
    "rows": [
      ["2020", "900000", "180000"],
      ["2021", "1100000", "220000"],
      ["2022", "1400000", "280000"]
    ]
  },
  "analysis_rubric": [
    {
      "name": "Revenue Growth",
      "instruction": "Compare the revenue growth trend between the two tables. Give suggestions for any calculations needed."
    },
    {
      "name": "Profit Margins",
      "instruction": "Analyze the profit margins for each year and compare between tables."
    }
  ]
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/analysis/compare-data-input",
  "$ref": "#/$defs/CompareDataInput",
  "$defs": {
    "AnalysisRubric": {
      "properties": {
        "name": {
          "type": "string"
        },
        "instruction": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["name", "instruction"]
    },
    "CompareDataInput": {
      "properties": {
        "table_one": {
          "$ref": "#/$defs/Table"
        },
        "table_two": {
          "$ref": "#/$defs/Table"
        },
        "analysis_rubric": {
          "items": {
            "$ref": "#/$defs/AnalysisRubric"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["table_one", "table_two", "analysis_rubric"]
    },
    "Table": {
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "headers": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "rows": {
          "items": {
            "items": true,
            "type": "array"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["headers", "rows"]
    }
  }
}
 

Output

Example

{
  "result": [
    {
      "name": "Revenue Growth",
      "analysis": "The revenue growth trend is consistent across both tables, with an increase of 10% each year. To calculate the percentage growth, you can use the formula: ((New Value - Old Value) / Old Value) * 100. For example, the revenue growth from 2020 to 2021 is ((1200000 - 1000000) / 1000000) * 100 = 20%."
    },
    {
      "name": "Profit Margins",
      "analysis": "The profit margins are higher in Table One compared to Table Two for all years. For example, in 2020, the profit margin in Table One is 20% (200000 / 1000000) compared to 18% in Table Two (180000 / 900000). To calculate the profit margin, use the formula: (Net Profit / Revenue) * 100."
    }
  ],
  "summary": "Overall, the revenue growth trend is consistent between the two tables, but Table One has higher profit margins. Further analysis could include visualizations to highlight these differences."
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/analysis/compare-data-output",
  "$ref": "#/$defs/CompareDataOutput",
  "$defs": {
    "AnalysisResult": {
      "properties": {
        "name": {
          "type": "string"
        },
        "analysis": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["name", "analysis"]
    },
    "CompareDataOutput": {
      "properties": {
        "result": {
          "items": {
            "$ref": "#/$defs/AnalysisResult"
          },
          "type": "array"
        },
        "summary": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["result", "summary"]
    }
  }
}