Onvo Documentation
APIs
Widgets
Get:Get All Widgets under Dashboard

Get all widgets under dashboard

GET
/
api
/
widgets

Authorizations

x-api-key
string
headerrequired

Response

200 - application/json

The response is of type object.

[
    {
        "id": "5a85328f-ed69-4c44-9cfb-cdea08324397",
        "title": "Orders M-o-M",
        "query": "Create a bar chart showing the orders per month. The x axis should show the month and year in MM-YYYY format",
        "x": 6,
        "y": 3,
        "w": 6,
        "h": 3,
        "assumptions": [
            "1. The 'Order Date' field from the 'd65edfb2-f781-4815-899e-5f50134b36b8' key will be used to extract the month and year for the x-axis.",
            "2. The 'Order ID' field from the 'd65edfb2-f781-4815-899e-5f50134b36b8' key will be used to count the number of orders for the y-axis.",
            "3. The 'Order Date' field is assumed to be in the 'YYYY-MM-DD' format.",
            "4. The 'Order ID' field is assumed to be unique for each order.",
            "5. The data is unsorted, so we will need to sort it by date to correctly display the orders per month.",
            "6. We are not using any fields from the '93e483e0-1246-43ac-a8bc-5fad124fbf14' key in this function."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load the necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID', 'Order Date'])\n    \n    # Convert 'Order Date' to datetime format and extract the month and year\n    df1['Order Date'] = pd.to_datetime(df1['Order Date'])\n    df1['Month-Year'] = df1['Order Date'].dt.strftime('%m-%Y')\n    \n    # Count the number of orders per month\n    orders_per_month = df1['Month-Year'].value_counts().sort_index()\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"bar\",\n        \"data\": {\n            \"labels\": orders_per_month.index.tolist(),\n            \"datasets\": [{\n                \"label\": \"Number of Orders\",\n                \"data\": orders_per_month.values.tolist(),\n                \"backgroundColor\": 'rgba(75, 192, 192, 0.2)',\n                \"borderColor\": 'rgba(75, 192, 192, 1)',\n                \"borderWidth\": 1\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": 'Orders per Month'\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "PSA9InlSNfMfj1tZKjKHVNU6NnQcr7xh7ecYfDIienaoRVmiwL+sSdhO10tY+fpAjnYXDsmPawx/ lcCPDROfLmqM9bwWvAabypKYtE3SRsWRTtTUK6bhRO6Mmx2pu7XWj7Jb+4b99xXLaowTYeRc+zS2 bpxKWadBlDf2WFd/c0Hv8sUs9YNl5xeeMLYzqRmzP3f/xRXKjf6lFyxwGSjBdwJbqyyHlX2ehPuX 1RwKYZe+wpOBv/bYa3JPVov33sjUJbWmHLjbeHuUGbFm2LNhH8dLIOlpNJLUjy948n5wPoMTqlDT H823FER8wb1sZdq0pev+Dty1qAK+Trw03qXmowEdt6FTJaT5RnNbnqh5lB8vUKf2mNhfuq+dR1d1 EUHARF4yNeo8M+Ht28iQC9WC8Np5jEMoE078BoihiXvWFdVH3Cbsf6+cPOFmuX2uYMdVmSO2Mw4e k4cD3QFnigWZJqqknbMt5U+JB+QnJwP3Dv3b3umCUNBCMVV8YBJA9OwrstjG0Uum21YpnjkB/IG5 uz5+HmcVyUkAh/Uokkyn0R58hIl4n+sYopU7Sn+utePfiOmeAmJkg14tSOqJHl1pTz/o2cKkTMGg nY3cKF1fZOddP2thaokzX2yqqcymkgGRjMo/C0C6fbDqvW3QWgrrO8+Lwupd9yg0oqIME0WAS7Kh /PZLu5bEUID8EzjhRnV3QTbX7SBDzENYOAfEQ3TEQt44tmeuxtN6tN6GgrFGxnm5TGvhy/AcmXpZ jY5/sV4lnkSsCgQvdYG4hyGP8qWq1jN/8SVBmVqNml+JwHdUvyk3LmNgu+c90yphkPvZgtWzkufF 9fc3LLN1jkR4t0dYrh3cDPDyUOjgIMC7AcrcEDhiwgHaL0aI4bsOXpHX8NxqFavOqgBSIEPntrB7 cLZv5S659G8nRRUZtoykFUnimZM7HRm+4Q8HJz0AM20L4eEMQkAM104ocMklXS0eYzYLQvx2fR4R A3z1jTBATBZMmizzqTjUB/b45kvMBuCCrKKGcbxVIQMoUA5ver7NqRZ5mYESj6p43zadyH8HGOP+ SfB6RWeUAFCIryuzGzHgvYa4CGn4/89QjCJvRr+JI8MVrUuRlyIw0weD0Th7oBNrheUMQQQNKL+7 EposQeTJhX6Lhnu8+YTQAbgWMWAAuoct5OKY3eZ2KLbPKmD09JN0LgkFNVVZwH5tLDyLJHPM54bp lXuVbwtrhwBVhKHWcCN+RMzN8FGK994e3xZmp7nQWXVamKgCw7HYv/bijjuJCejri/SmBuQUAUhJ CEh5+KNPuOwmxpEQDCRK8QHBz+lr1DtINbPKmouaMLs6sJ/eivRrGwbF4PvIVAIPqj4B/RPVvENC ri+DVsdRVA==",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "5e1c3f60-e046-4cc3-b73e-251ad14ee151",
        "title": "Sales volume M-o-M",
        "query": "Create a line chart that shows sales volume month over month. The x-axis should show the month in MM-YYYY format. Do not use moment.js",
        "x": 0,
        "y": 5,
        "w": 6,
        "h": 3,
        "assumptions": [
            "1. The 'Order Date' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8' will be used to determine the month and year.",
            "2. The 'Sales' field from the same array will be used to calculate the sales volume.",
            "3. The 'Order Date' field is assumed to be in the format 'YYYY-MM-DD'.",
            "4. The 'Sales' field is assumed to be a string that can be converted to a number using the 'validateNumber' function.",
            "5. The data will be sorted by date and the sales volume will be accumulated for each month.",
            "6. The chart type will be 'line' and the x-axis will represent the month in 'MM-YYYY' format while the y-axis will represent the sales volume."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load the necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order Date', 'Sales'])\n    # Convert 'Order Date' to datetime and extract the month and year\n    df1['Order Date'] = pd.to_datetime(df1['Order Date'])\n    df1['Month-Year'] = df1['Order Date'].dt.to_period('M')\n    # Group by 'Month-Year' and calculate the sum of 'Sales'\n    df1_grouped = df1.groupby('Month-Year')['Sales'].sum().reset_index()\n    # Create the chart.js object\n    chart = {\n        \"type\": \"line\",\n        \"data\": {\n            \"labels\": df1_grouped['Month-Year'].astype(str).tolist(),\n            \"datasets\": [{\n                \"label\": \"Sales Volume\",\n                \"data\": df1_grouped['Sales'].tolist(),\n                \"fill\": False\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": \"Sales Volume Month Over Month\"\n                }\n            }\n        }\n    }\n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "sp4sbYuuP27yOvCOzJ5R+gZtUneI/5zJGG3+wBPM/dhceJFJXWQ8hsuaLaSgOcfl+7VYVpb+YfbQ /hxbp4PNiL6Gm/8816Mn+CPAFrEJqfyOn8o73Aomn8nq3RAOI6TH+Vn7DrMozUwXiynXdOpY2eop 4nCKMB5CdUqracFtKxe97x2ddkX8nNjyAXY0fhkFx+ScZ6tUQ+s4s61K7HBZrYNcm7Bipk3XuVNU Rgqls1EzWRlFOGtLjMs4Rjy2vW+msqPL/WuyjfFVyt55AjnQ73lGaDPH6pnIDTUHIHWReY4nkVEb Lz4s5GfRDDnrn2rEmyhGkmxRxMVgl9xKjshXTlsP8h19oteLlOpNKY6FA+jgiwO5QwjsD/0qB9uh JnXonwsnKg4rXOBChH/v7Pa45NK9oNhytfjSBwDbw7RyLV0LF0QGpNIjuPkk8xo/YW3cFARYd+Wz WSokduX9AmJmmmQDk2ydrkFvJnu2RVl4hmdRZ7JbUH2Q4wKY4/cm+Hj5VjXqcpq2/qmRASHuofO6 wfcCTCKHR11x6AqLOSoY0l8e39o5Biblu64HKvlBMN8kUFoMXnkcygQNBi+8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GsNYCrcy2vTigL+fW6jP8H GJkqbZ5Rgh+QloN2L5s6kcfWaXaNX9nwED5j92097TMYDfDoNA8=",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "bbdf6ab7-7f72-4802-8bbb-8b67b8d2008f",
        "title": "Top 5 states by sales",
        "query": "Create a bar chart showing the top 5 states by sales volume",
        "x": 0,
        "y": 1,
        "w": 4,
        "h": 2,
        "assumptions": [
            "1. The 'Sales' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8' will be used to calculate the sales volume.",
            "2. The 'State' field from the array with key '93e483e0-1246-43ac-a8bc-5fad124fbf14' will be used to identify the states.",
            "3. The 'Customer ID' field will be used to match the data from both arrays.",
            "4. The 'validateNumber' function will be used to convert the 'Sales' field into a usable number.",
            "5. The top 5 states by sales volume will be determined by summing up the sales for each state and then selecting the top 5.",
            "6. The chart will be a bar chart with the states on the x-axis and the sales volume on the y-axis."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID', 'Customer ID', 'Sales'])\n    \n    # Load necessary columns from the second CSV file\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', \n                      usecols=['Customer ID', 'State'])\n    \n    # Merge the two dataframes on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    \n    # Group by 'State' and sum 'Sales' to get total sales volume for each state\n    state_sales = df.groupby('State')['Sales'].sum().nlargest(5)\n    \n    # Prepare data for the chart\n    labels = state_sales.index.tolist()\n    data = state_sales.values.tolist()\n    \n    # Create a chart.js object\n    chart = {\n        \"type\": \"bar\",\n        \"data\": {\n            \"labels\": labels,\n            \"datasets\": [{\n                \"label\": \"Sales Volume (USD)\",\n                \"data\": data,\n                \"backgroundColor\": [\"rgba(255, 99, 132, 0.2)\"] * 5,\n                \"borderColor\": [\"rgba(255, 99, 132, 1)\"] * 5,\n                \"borderWidth\": 1\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": \"Top 5 States by Sales Volume\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "r/78NgA8QRetoKyzE2kueVJ1X6owiGcoKYfesH9cIzww9CzuzjWb3g4Lg9JIVcJqu5ExBlATFo1Q bLVI/HL3+QvwyTsCRXFsVFiIg9usfj+XOL4q7CNaDbh1NKf8y19qDJScfPyjcagHbDMyBrR9H9Im pstJAjRZiRZzlr6Rzm85KPxrJjEpTk+X7IlIF55x30+ZrL1+tHkTtIj3sH1XJIkLP15Y/9LaTrN8 dQ1wAJXzNO8Y+W3FS+JWtzNoaypTQPRz1cXgLP0hQtN1u41zOvssak0zhi5U7Pdlmz9tP1cblwbf aq2GWSGEdwM6Xfpk50zUU7PM9OXhsC3k4DsIseoHDHhGmq6wf7vOLyqWrrxEF7p29i4haGhzycvz XoXuQ/BkM5R72hnd3rcWRp37Cgab3c5IrthgXSGYHcr6bKiHeax5ucqNACM1WgZSeAPq2JyCqjy2 hHA7q7kEUVcM/I//XuA3rvsrpz1Uw15vIGUrM2yZW3WyGmOG2JNx3cnOjoFkZx+xWV30GRIqdyS+ MNkEtwyAWaJwZN6OcYLVjJ0EixMPH5UvX6xVyspVewiQPnZd9YRDdLJyjkadLizwYSXR8FISrYEj a2BN6D8mJ8nequKYGRtUIjbHiAQCKnGjJxFlmM9py9PODdk9/F+z4A/RXgs9qTWPdCGkcEBl9FFD 9/pJhg7CcPFC2YfnvHfQAOuRzmbVNTm6p9GeB9X2dsya2fOSv1wBJ0GF2uQg8VWwntL8wEvvVlsy xrfY/o06ETx3lOMQpdJfc4PpUMLSEj394OBpVG81BTOshM1nPop/BdhxKS5wmGx3I5ti/bds5HwN Am07l4OBsalFd4j114wsoJJI4GzmkCtFo6VGUq2N7IZ0F7vUNNwvD7AQYMfyfywJpblE/WvWObBR Yj8BY7mudg883TU4TUMAk4CcWsw=",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "09a3faa1-afa7-4e24-b358-ffda22d4cb84",
        "title": "Lifetime value (LTV)",
        "query": "Create a metric showing the lifetime value of all the customers. It can be calculated by dividing the total sales in USD divided by the number of customers",
        "x": 8,
        "y": 0,
        "w": 4,
        "h": 1,
        "assumptions": [
            "1. The total sales in USD can be calculated by summing up the 'Sales' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8'.",
            "2. The number of customers can be calculated by counting the unique 'Customer ID' from the array with key '93e483e0-1246-43ac-a8bc-5fad124fbf14'.",
            "3. The 'validateNumber' function is used to ensure that the 'Sales' field is a valid number before summing it up.",
            "4. The lifetime value of all customers is calculated by dividing the total sales by the number of customers.",
            "5. The result is returned as a metric in a chart.js object."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first dataset\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Customer ID', 'Sales'])\n    \n    # Load necessary columns from the second dataset\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', \n                      usecols=['Customer ID'])\n    \n    # Merge the two datasets on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    \n    # Calculate the total sales and the number of unique customers\n    total_sales = df['Sales'].sum()\n    num_customers = df['Customer ID'].nunique()\n    \n    # Calculate the lifetime value of all customers\n    lifetime_value = total_sales / num_customers\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"metric\",\n        \"data\": {\n            \"datasets\": [{\n                \"data\": [lifetime_value],\n                \"label\": \"USD\"\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"text\": \"Lifetime Value of All Customers\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "sd/DZEoNpmZOKK2ecPN3VUYbhMMGAKP6o9emCt85YNyLJvb+sc7HfjpdUXUeawUQBvkbVpZ30a2f km63bzdqixZQu6SJ91GsCTgrtp79Co7qleLGfa884mQlkPlPweeIWNt8VQgyTUJaLQo9pjwQoPEe +tLd9cFxDntHuUG53hsIe5sBlfTfA9HxWUEO58YJ3pTJjgUDuN2p/QjkastypoSgMgD3DkYUiq8j g9uqrNUdZMUdDBzkOQEBGTqM8AwfT1NQKVHacjqAc10aSLftIgX8M2VfHGGlp1LqTKlTGFS10Ytd iKVufi32iBCqFQLRLRQPRryO20rfF4f8tigUIwQxlKaWiqnbj4sl",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "32c2e384-28b4-4b84-8f36-f8e08bd8d463",
        "title": "Sales volume M-o-M",
        "query": "Create a line chart that shows sales volume month over month. The x-axis should show the month in MM-YYYY format. Do not use moment.js",
        "x": 0,
        "y": 3,
        "w": 6,
        "h": 3,
        "assumptions": [
            "1. The 'Order Date' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8' will be used to determine the month and year.",
            "2. The 'Sales' field from the same array will be used to calculate the sales volume.",
            "3. The 'Order Date' field is assumed to be in the format 'YYYY-MM-DD'.",
            "4. The 'Sales' field is assumed to be a string that can be converted to a number using the 'validateNumber' function.",
            "5. The data will be sorted by date and the sales volume will be accumulated for each month.",
            "6. The chart type will be 'line' and the x-axis will represent the month in 'MM-YYYY' format while the y-axis will represent the sales volume."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load the necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order Date', 'Sales'])\n    # Convert 'Order Date' to datetime and extract the month and year\n    df1['Order Date'] = pd.to_datetime(df1['Order Date'])\n    df1['Month-Year'] = df1['Order Date'].dt.to_period('M')\n    # Group by 'Month-Year' and calculate the sum of 'Sales'\n    df1_grouped = df1.groupby('Month-Year')['Sales'].sum().reset_index()\n    # Create the chart.js object\n    chart = {\n        \"type\": \"line\",\n        \"data\": {\n            \"labels\": df1_grouped['Month-Year'].astype(str).tolist(),\n            \"datasets\": [{\n                \"label\": \"Sales Volume\",\n                \"data\": df1_grouped['Sales'].tolist(),\n                \"fill\": False\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": \"Sales Volume Month Over Month\"\n                }\n            }\n        }\n    }\n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "sp4sbYuuP27yOvCOzJ5R+gZtUneI/5zJGG3+wBPM/dhceJFJXWQ8hsuaLaSgOcfl+7VYVpb+YfbQ /hxbp4PNiL6Gm/8816Mn+CPAFrEJqfyOn8o73Aomn8nq3RAOI6TH+Vn7DrMozUwXiynXdOpY2eop 4nCKMB5CdUqracFtKxe97x2ddkX8nNjyAXY0fhkFx+ScZ6tUQ+s4s61K7HBZrYNcm7Bipk3XuVNU Rgqls1EzWRlFOGtLjMs4Rjy2vW+msqPL/WuyjfFVyt55AjnQ73lGaDPH6pnIDTUHIHWReY4nkVEb Lz4s5GfRDDnrn2rEmyhGkmxRxMVgl9xKjshXTlsP8h19oteLlOpNKY6FA+jgiwO5QwjsD/0qB9uh JnXonwsnKg4rXOBChH/v7Pa45NK9oNhytfjSBwDbw7RyLV0LF0QGpNIjuPkk8xo/YW3cFARYd+Wz WSokduX9AmJmmmQDk2ydrkFvJnu2RVl4hmdRZ7JbUH2Q4wKY4/cm+Hj5VjXqcpq2/qmRASHuofO6 wfcCT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2uCzCuEwilzga4toqnOCa16bpqqpeC0xJ+RpF8KzliV5u8lPpnq9KOGsNYCrcy2vTigL+fW6jP8H GJkqbZ5Rgh+QloN2L5s6kcfWaXaNX9nwED5j92097TMYDfDoNA8=",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "d80fec08-95f9-4c06-b696-a359470e2ad3",
        "title": "Orders per year",
        "query": "Create a bar chart showing the sales in USD per year",
        "x": 4,
        "y": 1,
        "w": 4,
        "h": 2,
        "assumptions": [
            "1. The 'Order Date' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8' will be used to determine the year.",
            "2. The 'Sales' field from the same array will be used to calculate the total sales in USD per year.",
            "3. The 'Customer ID' field is not used in this case as we are not filtering or grouping data based on customers.",
            "4. The data is unsorted, so we will need to sort it based on the 'Order Date' field to correctly calculate the sales per year.",
            "5. The 'validateNumber' function will be used to ensure the 'Sales' field is a usable number.",
            "6. The chart type will be 'bar' as we are showing a comparison of sales across different years.",
            "7. The x-axis will represent the years and the y-axis will represent the sales in USD."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load the necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID', 'Order Date'])\n    \n    # Extract the year from the 'Order Date' column\n    df1['Year'] = pd.to_datetime(df1['Order Date']).dt.year\n    \n    # Count the number of orders per year\n    order_counts = df1.groupby('Year')['Order ID'].nunique()\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"bar\",\n        \"data\": {\n            \"labels\": order_counts.index.tolist(),\n            \"datasets\": [{\n                \"label\": \"Number of Orders\",\n                \"data\": order_counts.values.tolist(),\n                \"backgroundColor\": 'rgba(75, 192, 192, 0.2)',\n                \"borderColor\": 'rgba(75, 192, 192, 1)',\n                \"borderWidth\": 1\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": 'Yearly Order Count'\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "S5LMaFt6aBnziRedHF9wKY1lP9CRVDtHTdQTlbSVUABEUUymGgbJt/AO2G9fLvE2HapvdfeKYmm9 GlzUo8nVXsvPwSNdG9yPZaT0NCcAZxTSiNqfBXGgPEsCqETTyJ6Cxk5k24gsykHQFdA5uWqBHZ5E XF7qKJSW4Kxp+td6TVlr87gnJ9LUin2BQMwbedIeBTg3rZwHA6Ubd5v4d5OH7q+sKXkRVNkbBA1o jDmKdJ+ILR/pDHWNXXnRqaQsMp6TenMHRMlfF7mmwQA491fNPoqZsrInvacHnBNYNBT+fLuvzETv BIl8gfYZ3j2sm064As2q5qS81zmhUCH0kaYjZAelB7RntVcwogPbraXFiaxrrevePauY1Ay9qRUL /nqU9wcekjS1gtxT/S4E9y6+kpqZaPB6/C+ybsCXKOLKkonDhxZJINwjfDf5JrJ0XqridjB2AYRR tEvVp+s+u7u/dA64+RSlRq2QrtvycC4RiBla4sTe+YiMZsMjRFxW9BlQG/NLolu4o7lRvZ+iH3Hf xufxVjizjFgy",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "6a834b47-c4e1-48c1-84ec-ac1c8c3aa210",
        "title": "Top 5 states by sales",
        "query": "Create a bar chart showing the top 5 states by sales volume",
        "x": 0,
        "y": 3,
        "w": 4,
        "h": 2,
        "assumptions": [
            "1. The 'Sales' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8' will be used to calculate the sales volume.",
            "2. The 'State' field from the array with key '93e483e0-1246-43ac-a8bc-5fad124fbf14' will be used to identify the states.",
            "3. The 'Customer ID' field will be used to match the data from both arrays.",
            "4. The 'validateNumber' function will be used to convert the 'Sales' field into a usable number.",
            "5. The top 5 states by sales volume will be determined by summing up the sales for each state and then selecting the top 5.",
            "6. The chart will be a bar chart with the states on the x-axis and the sales volume on the y-axis."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID', 'Customer ID', 'Sales'])\n    \n    # Load necessary columns from the second CSV file\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', \n                      usecols=['Customer ID', 'State'])\n    \n    # Merge the two dataframes on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    \n    # Group by 'State' and sum 'Sales' to get total sales volume for each state\n    state_sales = df.groupby('State')['Sales'].sum().nlargest(5)\n    \n    # Prepare data for the chart\n    labels = state_sales.index.tolist()\n    data = state_sales.values.tolist()\n    \n    # Create a chart.js object\n    chart = {\n        \"type\": \"bar\",\n        \"data\": {\n            \"labels\": labels,\n            \"datasets\": [{\n                \"label\": \"Sales Volume (USD)\",\n                \"data\": data,\n                \"backgroundColor\": [\"rgba(255, 99, 132, 0.2)\"] * 5,\n                \"borderColor\": [\"rgba(255, 99, 132, 1)\"] * 5,\n                \"borderWidth\": 1\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": \"Top 5 States by Sales Volume\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "r/78NgA8QRetoKyzE2kueVJ1X6owiGcoKYfesH9cIzww9CzuzjWb3g4Lg9JIVcJqu5ExBlATFo1Q bLVI/HL3+QvwyTsCRXFsVFiIg9usfj+XOL4q7CNaDbh1NKf8y19qDJScfPyjcagHbDMyBrR9H9Im pstJAjRZiRZzlr6Rzm85KPxrJjEpTk+X7IlIF55x30+ZrL1+tHkTtIj3sH1XJIkLP15Y/9LaTrN8 dQ1wAJXzNO8Y+W3FS+JWtzNoaypTQPRz1cXgLP0hQtN1u41zOvssak0zhi5U7Pdlmz9tP1cblwbf aq2GWSGEdwM6Xfpk50zUU7PM9OXhsC3k4DsIseoHDHhGmq6wf7vOLyqWrrxEF7p29i4haGhzycvz XoXuQ/BkM5R72hnd3rcWRp37Cgab3c5IrthgXSGYHcr6bKiHeax5ucqNACM1WgZSeAPq2JyCqjy2 hHA7q7kEUVcM/I//XuA3rvsrpz1Uw15vIGUrM2yZW3WyGmOG2JNx3cnOjoFkZx+xWV30GRIqdyS+ MNkEtwyAWaJwZN6OcYLVjJ0EixMPH5UvX6xVyspVewiQPnZd9YRDdLJyjkadLizwYSXR8FISrYEj a2BN6D8mJ8nequKYGRtUIjbHiAQCKnGjJxFlmM9py9PODdk9/F+z4A/RXgs9qTWPdCGkcEBl9FFD 9/pJhg7CcPFC2YfnvHfQAOuRzmbVNTm6p9GeB9X2dsya2fOSv1wBJ0GF2uQg8VWwntL8wEvvVlsy xrfY/o06ETx3lOMQpdJfc4PpUMLSEj394OBpVG81BTOshM1nPop/BdhxKS5wmGx3I5ti/bds5HwN Am07l4OBsalFd4j114wsoJJI4GzmkCtFo6VGUq2N7IZ0F7vUNNwvD7AQYMfyfywJpblE/WvWObBR Yj8BY7mudg883TU4TUMAk4CcWsw=",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "668737d9-4e72-41a6-bd1a-25183481c8f1",
        "title": "Orders M-o-M",
        "query": "Create a bar chart showing the orders per month. The x axis should show the month and year in MM-YYYY format",
        "x": 6,
        "y": 3,
        "w": 6,
        "h": 3,
        "assumptions": [
            "1. The 'Order Date' field from the 'd65edfb2-f781-4815-899e-5f50134b36b8' key will be used to extract the month and year for the x-axis.",
            "2. The 'Order ID' field from the 'd65edfb2-f781-4815-899e-5f50134b36b8' key will be used to count the number of orders for the y-axis.",
            "3. The 'Order Date' field is assumed to be in the 'YYYY-MM-DD' format.",
            "4. The 'Order ID' field is assumed to be unique for each order.",
            "5. The data is unsorted, so we will need to sort it by date to correctly display the orders per month.",
            "6. We are not using any fields from the '93e483e0-1246-43ac-a8bc-5fad124fbf14' key in this function."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load the necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID', 'Order Date'])\n    \n    # Convert 'Order Date' to datetime format and extract the month and year\n    df1['Order Date'] = pd.to_datetime(df1['Order Date'])\n    df1['Month-Year'] = df1['Order Date'].dt.strftime('%m-%Y')\n    \n    # Count the number of orders per month\n    orders_per_month = df1['Month-Year'].value_counts().sort_index()\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"bar\",\n        \"data\": {\n            \"labels\": orders_per_month.index.tolist(),\n            \"datasets\": [{\n                \"label\": \"Number of Orders\",\n                \"data\": orders_per_month.values.tolist(),\n                \"backgroundColor\": 'rgba(75, 192, 192, 0.2)',\n                \"borderColor\": 'rgba(75, 192, 192, 1)',\n                \"borderWidth\": 1\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": 'Orders per Month'\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "PSA9InlSNfMfj1tZKjKHVNU6NnQcr7xh7ecYfDIienaoRVmiwL+sSdhO10tY+fpAjnYXDsmPawx/ lcCPDROfLmqM9bwWvAabypKYtE3SRsWRTtTUK6bhRO6Mmx2pu7XWj7Jb+4b99xXLaowTYeRc+zS2 bpxKWadBlDf2WFd/c0Hv8sUs9YNl5xeeMLYzqRmzP3f/xRXKjf6lFyxwGSjBdwJbqyyHlX2ehPuX 1RwKYZe+wpOBv/bYa3JPVov33sjUJbWmHLjbeHuUGb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GwbF4PvIVAIPqj4B/RPVvENC ri+DVsdRVA==",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "a620e648-a560-43b2-b1b6-b04e280a0341",
        "title": "Total customers",
        "query": "Create a metric showing all my customers to date",
        "x": 0,
        "y": 0,
        "w": 4,
        "h": 1,
        "assumptions": [
            "1. The user wants to see the total number of unique customers to date.",
            "2. The 'Customer ID' field from the first data source (key: 93e483e0-1246-43ac-a8bc-5fad124fbf14) will be used to identify unique customers.",
            "3. The 'Order Date' field from the second data source (key: d65edfb2-f781-4815-899e-5f50134b36b8) will be used to filter the data up to the current date.",
            "4. The two data sources will be related using the 'Customer ID' field.",
            "5. The chart will be a metric type, showing a single data point - the total number of unique customers to date."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the CSV files\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', usecols=['Customer ID'])\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', usecols=['Customer ID'])\n    # Merge the two dataframes on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    # Calculate the number of unique customers\n    num_customers = df['Customer ID'].nunique()\n    # Create the chart.js object\n    chart = {\n        \"type\": \"metric\",\n        \"data\": {\n            \"datasets\": [{\n                \"data\": [num_customers],\n                \"label\": \"Number of Customers\"\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"text\": \"Total Number of Customers\"\n                }\n            }\n        }\n    }\n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "oQ4Kysf0gzujnGdOBZZjghsUXDuda8S3QEkpkFWBcSYICntBZYjxzZqabaVLx9pd9OXbLUnpaCmq uSYS+jCqLI0igcDKO6r7cgLdI1sIrdBc8+uJdbJjz/J/P1InHqFlauLU2H7dzqfM0wO+kYNeGgaW XO5o6GDLB2TnR3daByoVK488s768QXoWPDcMflAf7TcG5g3HUEvbyfG6ikfcr8udjPUDlYwYa5aJ BxH83cxnpLVHhQe8BjwOQjtNoUpeUvMGF/z8pvB+OUAdSc1Dbh01ExwHnGDKqqSrx4zazifq1bt+ xjV1/2zsCFO47mi+qmHqrSEZSlrXk/o1KwbIwU/FIyKEnA==",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "c4780f30-fda7-4e38-9bb6-22f5775e993a",
        "title": "Total orders",
        "query": "Create a metric showing total orders",
        "x": 4,
        "y": 0,
        "w": 4,
        "h": 1,
        "assumptions": [
            "1. The total orders can be calculated by counting the number of unique Order IDs in the array for key d65edfb2-f781-4815-899e-5f50134b36b8.",
            "2. The function will return a chart.js object with the type set to 'metric' and the datasets.data array containing a single data point representing the total orders.",
            "3. The datasets.label will be set to 'Total Orders'.",
            "4. The function will use a Set to store unique Order IDs and count them.",
            "5. The function will not use any other fields from the input arrays."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID'])\n    \n    # Count the total number of orders\n    total_orders = df1['Order ID'].nunique()\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"metric\",\n        \"data\": {\n            \"datasets\": [{\n                \"data\": [total_orders],\n                \"label\": \"Total Orders\"\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"text\": \"Total Orders\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "PBD4A+hpb5K05pwkgpllm3y9BaPBmiiNHS7dDS41HbPzs+94SnY/z9TFVqVZmYFeJzLZvBi0wSN8 VJOnvkmLn92FZvfWfkZXzfHFxcMN0z7o9tun2v4AiWyIy6Y4K7J/8FMOI0F4vmNj2YbyGbq1mR0+ zBA4hs87Q0II26pMdQg9+cTHi/P5Oiw/99whIRV2aKpgkcLplegYwCK3kSv8mGh0VcZ2GUpEWh6v XaLLFgnrut6IziBfzIgVBLgZQwcztpQhKXDnBD7/NZOoWKJXdaBSsmkM6rCbE8Xk0Frt1h6yIkgb kYYi5g6afuiciKf1K7GO",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "f132d4b0-cb77-428f-b433-256de22c85d0",
        "title": "Orders per year",
        "query": "Create a bar chart showing the sales in USD per year",
        "x": 4,
        "y": 1,
        "w": 4,
        "h": 2,
        "assumptions": [
            "1. The 'Order Date' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8' will be used to determine the year.",
            "2. The 'Sales' field from the same array will be used to calculate the total sales in USD per year.",
            "3. The 'Customer ID' field is not used in this case as we are not filtering or grouping data based on customers.",
            "4. The data is unsorted, so we will need to sort it based on the 'Order Date' field to correctly calculate the sales per year.",
            "5. The 'validateNumber' function will be used to ensure the 'Sales' field is a usable number.",
            "6. The chart type will be 'bar' as we are showing a comparison of sales across different years.",
            "7. The x-axis will represent the years and the y-axis will represent the sales in USD."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load the necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID', 'Order Date'])\n    \n    # Extract the year from the 'Order Date' column\n    df1['Year'] = pd.to_datetime(df1['Order Date']).dt.year\n    \n    # Count the number of orders per year\n    order_counts = df1.groupby('Year')['Order ID'].nunique()\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"bar\",\n        \"data\": {\n            \"labels\": order_counts.index.tolist(),\n            \"datasets\": [{\n                \"label\": \"Number of Orders\",\n                \"data\": order_counts.values.tolist(),\n                \"backgroundColor\": 'rgba(75, 192, 192, 0.2)',\n                \"borderColor\": 'rgba(75, 192, 192, 1)',\n                \"borderWidth\": 1\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": 'Yearly Order Count'\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "S5LMaFt6aBnziRedHF9wKY1lP9CRVDtHTdQTlbSVUABEUUymGgbJt/AO2G9fLvE2HapvdfeKYmm9 GlzUo8nVXsvPwSNdG9yPZaT0NCcAZxTSiNqfBXGgPEsCqETTyJ6Cxk5k24gsykHQFdA5uWqBHZ5E XF7qKJSW4Kxp+td6TVlr87gnJ9LUin2BQMwbedIeBTg3rZwHA6Ubd5v4d5OH7q+sKXkRVNkbBA1o jDmKdJ+ILR/pDHWNXXnRqaQsMp6TenMHRMlfF7mmwQA491fNPoqZsrInvacHnBNYNBT+fLuvzETv BIl8gfYZ3j2sm064As2q5qS81zmhUCH0kaYjZAelB7RntVcwogPbraXFiaxrrevePauY1Ay9qRUL /nqU9wcekjS1gtxT/S4E9y6+kpqZaPB6/C+ybsCXKOLKkonDhxZJINwjfDf5JrJ0XqridjB2AYRR tEvVp+s+u7u/dA64+RSlRq2QrtvycC4RiBla4sTe+YiMZsMjRFxW9BlQG/NLolu4o7lRvZ+iH3Hf xufxVjizjFgy",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "6fa5341b-296c-4170-8665-f9cfbd5d5512",
        "title": "California vs New York",
        "query": "Create a pie chart showing the sales volumes of New York and California",
        "x": 8,
        "y": 1,
        "w": 4,
        "h": 2,
        "assumptions": [
            "1. The user wants to compare the sales volumes of New York and California.",
            "2. The sales volume is represented by the 'Sales' field in the data for key 'd65edfb2-f781-4815-899e-5f50134b36b8'.",
            "3. The 'State' field in the data for key '93e483e0-1246-43ac-a8bc-5fad124fbf14' will be used to filter the data for New York and California.",
            "4. The 'Customer ID' field is the common ID in both data sources and will be used to relate the data.",
            "5. The 'validateNumber' function will be used to convert the 'Sales' field into a usable number.",
            "6. The pie chart will have two data points, one for New York and one for California. The labels for these data points will be 'New York' and 'California' respectively."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first dataset\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Customer ID', 'Sales'])\n    \n    # Load necessary columns from the second dataset\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', \n                      usecols=['Customer ID', 'State'])\n    \n    # Merge the two datasets on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    \n    # Filter rows for 'New York' and 'California'\n    df = df[df['State'].isin(['New York', 'California'])]\n    \n    # Group by 'State' and sum 'Sales'\n    sales = df.groupby('State')['Sales'].sum()\n    \n    # Prepare data for the chart\n    labels = sales.index.tolist()\n    data = sales.values.tolist()\n    \n    # Create a chart.js object\n    chart = {\n        \"type\": \"pie\",\n        \"data\": {\n            \"labels\": labels,\n            \"datasets\": [{\n                \"label\": \"Sales Volume\",\n                \"data\": data,\n                \"backgroundColor\": [\"#FF6384\", \"#36A2EB\"],\n                \"hoverBackgroundColor\": [\"#FF6384\", \"#36A2EB\"]\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": \"Sales Volumes of New York and California\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "bd5a09a7-2d8c-4339-a20d-db9f425bf47e",
        "cache": "0zJxK6Rl15mpsaC0aQxaZ/vajqNO5JauJFzTOeoO00vUcZ4aFl7DLhHZNGneYUJtKebeFvZDIMkc Zgf8sCm0Cf1mjyls64RFr1FXRs4Ykbz1PnIzKOw3AByBt/E/paQnzHOtgb3VrgktTrDeZ4o/fE3r D6zfffT12DtCNxtMJNuOIh8gnjln/GNnB4O1kz/1iq8DLzXnYyj/zSAqucvmPSllX3mEAwHYlFQs NWDI+koFIFgAUEqP8cte0sIHl5s/Cjgiyghxix4VJqP8Iy/K7fz8JRUcEToHB8Ssrl7MIYs5c7P3 UBdibkFmPa94I3t0gSxEINkFWB5rCtWQqd4t3dQpjSuQSsgGoQ20plzkODKAdoNpLPCygeNm2XL1 1C0AV1db/iRZCgggD4F66Aw67XUAKOfBIRLQ7l5kf1u3q4O9dSnBZYlsLmMHpCJtJWnMnpND2pGs 2645wlT0gIyPIIyLi/X+GmDhO+OwcsCmFznEALylzbL4rdk/TeQjH3bWfMttI5JMARsXMqySunjf EFeU+2bE0hWNk4NfCcx8sTsIOdJ4V7M=",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "c118fc21-3be0-40ec-b3b5-9341dbba6de3",
        "title": "Lifetime value (LTV)",
        "query": "Create a metric showing the lifetime value of all the customers. It can be calculated by dividing the total sales in USD divided by the number of customers",
        "x": 8,
        "y": 0,
        "w": 4,
        "h": 1,
        "assumptions": [
            "1. The total sales in USD can be calculated by summing up the 'Sales' field from the array with key 'd65edfb2-f781-4815-899e-5f50134b36b8'.",
            "2. The number of customers can be calculated by counting the unique 'Customer ID' from the array with key '93e483e0-1246-43ac-a8bc-5fad124fbf14'.",
            "3. The 'validateNumber' function is used to ensure that the 'Sales' field is a valid number before summing it up.",
            "4. The lifetime value of all customers is calculated by dividing the total sales by the number of customers.",
            "5. The result is returned as a metric in a chart.js object."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first dataset\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Customer ID', 'Sales'])\n    \n    # Load necessary columns from the second dataset\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', \n                      usecols=['Customer ID'])\n    \n    # Merge the two datasets on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    \n    # Calculate the total sales and the number of unique customers\n    total_sales = df['Sales'].sum()\n    num_customers = df['Customer ID'].nunique()\n    \n    # Calculate the lifetime value of all customers\n    lifetime_value = total_sales / num_customers\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"metric\",\n        \"data\": {\n            \"datasets\": [{\n                \"data\": [lifetime_value],\n                \"label\": \"USD\"\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"text\": \"Lifetime Value of All Customers\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "sd/DZEoNpmZOKK2ecPN3VUYbhMMGAKP6o9emCt85YNyLJvb+sc7HfjpdUXUeawUQBvkbVpZ30a2f km63bzdqixZQu6SJ91GsCTgrtp79Co7qleLGfa884mQlkPlPweeIWNt8VQgyTUJaLQo9pjwQoPEe +tLd9cFxDntHuUG53hsIe5sBlfTfA9HxWUEO58YJ3pTJjgUDuN2p/QjkastypoSgMgD3DkYUiq8j g9uqrNUdZMUdDBzkOQEBGTqM8AwfT1NQKVHacjqAc10aSLftIgX8M2VfHGGlp1LqTKlTGFS10Ytd iKVufi32iBCqFQLRLRQPRryO20rfF4f8tigUIwQxlKaWiqnbj4sl",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "db851576-ea8c-40e0-827d-31238b7e21f5",
        "title": "Total customers",
        "query": "Create a metric showing all my customers to date",
        "x": 0,
        "y": 2,
        "w": 4,
        "h": 1,
        "assumptions": [
            "1. The user wants to see the total number of unique customers to date.",
            "2. The 'Customer ID' field from the first data source (key: 93e483e0-1246-43ac-a8bc-5fad124fbf14) will be used to identify unique customers.",
            "3. The 'Order Date' field from the second data source (key: d65edfb2-f781-4815-899e-5f50134b36b8) will be used to filter the data up to the current date.",
            "4. The two data sources will be related using the 'Customer ID' field.",
            "5. The chart will be a metric type, showing a single data point - the total number of unique customers to date."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the CSV files\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', usecols=['Customer ID'])\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', usecols=['Customer ID'])\n    # Merge the two dataframes on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    # Calculate the number of unique customers\n    num_customers = df['Customer ID'].nunique()\n    # Create the chart.js object\n    chart = {\n        \"type\": \"metric\",\n        \"data\": {\n            \"datasets\": [{\n                \"data\": [num_customers],\n                \"label\": \"Number of Customers\"\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"text\": \"Total Number of Customers\"\n                }\n            }\n        }\n    }\n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "oQ4Kysf0gzujnGdOBZZjghsUXDuda8S3QEkpkFWBcSYICntBZYjxzZqabaVLx9pd9OXbLUnpaCmq uSYS+jCqLI0igcDKO6r7cgLdI1sIrdBc8+uJdbJjz/J/P1InHqFlauLU2H7dzqfM0wO+kYNeGgaW XO5o6GDLB2TnR3daByoVK488s768QXoWPDcMflAf7TcG5g3HUEvbyfG6ikfcr8udjPUDlYwYa5aJ BxH83cxnpLVHhQe8BjwOQjtNoUpeUvMGF/z8pvB+OUAdSc1Dbh01ExwHnGDKqqSrx4zazifq1bt+ xjV1/2zsCFO47mi+qmHqrSEZSlrXk/o1KwbIwU/FIyKEnA==",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "7317800e-6c3e-4f1e-9969-2cab0f8480a1",
        "title": "Sales Comparison between 2018 and 2019",
        "query": "Create a pie chart showing the sales in 2018 vs the sales in 2019",
        "x": 0,
        "y": 0,
        "w": 4,
        "h": 2,
        "assumptions": [
            "",
            "1. Load the 'Sample Orders' dataset using pandas with only the necessary columns 'Order Date' and 'Sales' to minimize memory usage.",
            "2. Convert the 'Order Date' column to a datetime object to filter the data for the years 2018 and 2019.",
            "3. Filter the dataset for orders that occurred in 2018 and 2019 separately.",
            "4. Sum the 'Sales' for each year after converting the 'Sales' column to numerical values using the provided `convertNum` function.",
            "5. Create a pie chart using Chart.js configuration that shows the proportion of sales for 2018 and 2019.",
            "6. Set the chart options to be responsive and maintainAspectRatio to false.",
            "7. Add a title to the chart that describes the content.",
            "8. Since the user has not specified a chart type and a pie chart is appropriate for showing proportions, we will use a pie chart.",
            "9. Set the plugins.datalabels.display to false as the user has not asked to show the values in the chart.",
            "",
            ""
        ],
        "code": "import pandas as pd\ndef main():\n    # Load the necessary data\n    orders_df = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', usecols=['Order Date', 'Sales'])\n    \n    # Convert 'Order Date' to datetime and 'Sales' to numerical values\n    orders_df['Order Date'] = pd.to_datetime(orders_df['Order Date'], format='%Y-%m-%d')\n    orders_df['Sales'] = orders_df['Sales'].map(convertNum)\n    \n    # Filter data for 2018 and 2019\n    sales_2018 = orders_df[orders_df['Order Date'].dt.year == 2018]['Sales'].sum()\n    sales_2019 = orders_df[orders_df['Order Date'].dt.year == 2019]['Sales'].sum()\n    \n    # Create the chart.js configuration object\n    chart_config = {\n        'type': 'pie',\n        'data': {\n            'labels': ['2018 Sales', '2019 Sales'],\n            'datasets': [{\n                'data': [sales_2018, sales_2019],\n                'backgroundColor': ['#4e79a7', '#f28e2b']\n            }]\n        },\n        'options': {\n            'responsive': True,\n            'maintainAspectRatio': False,\n            'plugins': {\n                'title': {\n                    'display': True,\n                    'text': 'Sales Comparison between 2018 and 2019'\n                },\n                'datalabels': {\n                    'display': False\n                }\n            }\n        }\n    }\n    \n    return chart_config",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "cUs71v6qixaXHLjr/Cz+ulKJJrtmAQphsDfEbfyQGjw5qmRng5iTdl5Xm2gkVbSLbO5LlxkVoSQe tm+/9+mhwjxEBBqFp0Ce+ToZpBtmSfhp7xjLZ+bqHQY7pthp6uMpKqBBjRZ9NAeXprmUWOLop9TR Y3tBUCv3rYwJ8Gurmr/gz5/XT1KohbcHHYOvPy5YiQJRMzgZM0kxqVseHrKqKuvc/uAN5Ck3GH8G 8vdKFUdoDiQ8LBpZxhLNYsmx9tv8N3WoktqXVMJ0iOI2hoj9Zu7OCa44oxyCCdWFFjLmbv18Cggu LK6r4Bppw6T7Qn1lS9cTrX0rpKUAxiY9VS+IPb8EF/hTd3XOxuefpc00IlkMa53ifdGLGrHrlPRe YZ+xn4uofw7d1Tts7ShdBFn5NyN8B5sO3nVCr1HSqD6wyKRajgdbn2578gviEpcg1aWLWNIERK6w wNM=",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "5541de64-fdfc-4273-b2c5-579c89d79df5",
        "title": "Total orders overall",
        "query": "Create a metric showing total orders",
        "x": 4,
        "y": 0,
        "w": 4,
        "h": 1,
        "assumptions": [
            "1. The total orders can be calculated by counting the number of unique Order IDs in the array for key d65edfb2-f781-4815-899e-5f50134b36b8.",
            "2. The function will return a chart.js object with the type set to 'metric' and the datasets.data array containing a single data point representing the total orders.",
            "3. The datasets.label will be set to 'Total Orders'.",
            "4. The function will use a Set to store unique Order IDs and count them.",
            "5. The function will not use any other fields from the input arrays."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first CSV file\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Order ID'])\n    \n    # Count the total number of orders\n    total_orders = df1['Order ID'].nunique()\n    \n    # Create the chart.js object\n    chart = {\n        \"type\": \"metric\",\n        \"data\": {\n            \"datasets\": [{\n                \"data\": [total_orders],\n                \"label\": \"Total Orders\"\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"text\": \"Total Orders\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "PBD4A+hpb5K05pwkgpllm3y9BaPBmiiNHS7dDS41HbPzs+94SnY/z9TFVqVZmYFeJzLZvBi0wSN8 VJOnvkmLn92FZvfWfkZXzfHFxcMN0z7o9tun2v4AiWyIy6Y4K7J/8FMOI0F4vmNj2YbyGbq1mR0+ zBA4hs87Q0II26pMdQg9+cTHi/P5Oiw/99whIRV2aKpgkcLplegYwCK3kSv8mGh0VcZ2GUpEWh6v XaLLFgnrut6IziBfzIgVBLgZQwcztpQhKXDnBD7/NZOoWKJXdaBSsmkM6rCbE8Xk0Frt1h6yIkgb kYYi5g6afuiciKf1K7GO",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    },
    {
        "id": "496c8f73-916d-4514-a3a0-bed15d7f1b1c",
        "title": "California vs New York",
        "query": "Create a pie chart showing the sales volumes of New York and California",
        "x": 8,
        "y": 1,
        "w": 4,
        "h": 2,
        "assumptions": [
            "1. The user wants to compare the sales volumes of New York and California.",
            "2. The sales volume is represented by the 'Sales' field in the data for key 'd65edfb2-f781-4815-899e-5f50134b36b8'.",
            "3. The 'State' field in the data for key '93e483e0-1246-43ac-a8bc-5fad124fbf14' will be used to filter the data for New York and California.",
            "4. The 'Customer ID' field is the common ID in both data sources and will be used to relate the data.",
            "5. The 'validateNumber' function will be used to convert the 'Sales' field into a usable number.",
            "6. The pie chart will have two data points, one for New York and one for California. The labels for these data points will be 'New York' and 'California' respectively."
        ],
        "code": "import pandas as pd\nimport numpy as np\ndef main():\n    # Load necessary columns from the first dataset\n    df1 = pd.read_csv('/tmp/9f5cd772-aaff-460e-8e7a-03d21070b12c.csv', \n                      usecols=['Customer ID', 'Sales'])\n    \n    # Load necessary columns from the second dataset\n    df2 = pd.read_csv('/tmp/6c06673a-8b53-4eba-a4a8-17e23daf0504.csv', \n                      usecols=['Customer ID', 'State'])\n    \n    # Merge the two datasets on 'Customer ID'\n    df = pd.merge(df1, df2, on='Customer ID')\n    \n    # Filter rows for 'New York' and 'California'\n    df = df[df['State'].isin(['New York', 'California'])]\n    \n    # Group by 'State' and sum 'Sales'\n    sales = df.groupby('State')['Sales'].sum()\n    \n    # Prepare data for the chart\n    labels = sales.index.tolist()\n    data = sales.values.tolist()\n    \n    # Create a chart.js object\n    chart = {\n        \"type\": \"pie\",\n        \"data\": {\n            \"labels\": labels,\n            \"datasets\": [{\n                \"label\": \"Sales Volume\",\n                \"data\": data,\n                \"backgroundColor\": [\"#FF6384\", \"#36A2EB\"],\n                \"hoverBackgroundColor\": [\"#FF6384\", \"#36A2EB\"]\n            }]\n        },\n        \"options\": {\n            \"responsive\": True,\n            \"maintainAspectRatio\": False,\n            \"plugins\": {\n                \"datalabels\": {\n                    \"display\": False\n                },\n                \"title\": {\n                    \"display\": True,\n                    \"text\": \"Sales Volumes of New York and California\"\n                }\n            }\n        }\n    }\n    \n    return chart",
        "dashboard": "fd0b9d77-791d-4898-afa6-99800301d861",
        "cache": "0zJxK6Rl15mpsaC0aQxaZ/vajqNO5JauJFzTOeoO00vUcZ4aFl7DLhHZNGneYUJtKebeFvZDIMkc Zgf8sCm0Cf1mjyls64RFr1FXRs4Ykbz1PnIzKOw3AByBt/E/paQnzHOtgb3VrgktTrDeZ4o/fE3r D6zfffT12DtCNxtMJNuOIh8gnjln/GNnB4O1kz/1iq8DLzXnYyj/zSAqucvmPSllX3mEAwHYlFQs NWDI+koFIFgAUEqP8cte0sIHl5s/Cjgiyghxix4VJqP8Iy/K7fz8JRUcEToHB8Ssrl7MIYs5c7P3 UBdibkFmPa94I3t0gSxEINkFWB5rCtWQqd4t3dQpjSuQSsgGoQ20plzkODKAdoNpLPCygeNm2XL1 1C0AV1db/iRZCgggD4F66Aw67XUAKOfBIRLQ7l5kf1u3q4O9dSnBZYlsLmMHpCJtJWnMnpND2pGs 2645wlT0gIyPIIyLi/X+GmDhO+OwcsCmFznEALylzbL4rdk/TeQjH3bWfMttI5JMARsXMqySunjf EFeU+2bE0hWNk4NfCcx8sTsIOdJ4V7M=",
        "team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead"
    }
]

You can find all properties for Widgets in the concepts at this link