var { Analysis } = require("@tago-io/sdk");
var axios = require("axios").default;
async function startAnalysis(context, scope) {
try {
// Log the entire scope for debugging purposes
console.log("Scope:", JSON.stringify(scope, null, 2));
// Ensure that scope is not empty before accessing scope[0]
if (scope && scope.length > 0 && scope[0]) {
// Extract the device ID from the scope
const device_id = scope[0].device;
// Check if the device ID is available
if (!device_id) {
throw new Error("Device ID is not provided in the scope.");
}