Skip to main content

Data Analysis

The Data Analysis action is a powerful tool that allows you to run custom analyses on your PSA data (like tickets or time entries). You can either choose a pre-build analysis script or have Neo's AI generate one for you based on your description. It's perfect for when you need specific insights or reports that aren't available through standard NeoAgent features.

Why is it useful?

Imagine needing a very specific report or data insight that standard tools don't offer. With the Data Analysis action, you can describe what you need, and Neo can help create the script. Alternatively, you can choose a pre-defined template. This allows you to get exactly the information you need, formatted as text or as a data table (similar to a spreadsheet) that can be exported.

What It Does

  • Runs Python Scripts: Executes a Python script (either chosen from a template, or generated by Neo's AI) using the PSA data you select (e.g., a list of tickets).
  • Generates Text Summaries: The script produces a text summary of its findings (e.g., "Average ticket resolution time for client X was Y hours this week").
  • Creates Data Tables (Optional): The script can also organize data into a table (like a spreadsheet). This table can then be exported as a CSV file, for example, in an email notification.
  • Feeds Other Actions: The results (both text summaries and data tables) can be used by other actions in your workflow, like sending notifications or updating ticket notes.

How It Works

  1. Gather Data: First, your workflow uses an action like "Find Entities" to collect the data you want to analyze (for instance, all tickets from a specific client closed last month).
  2. Prepare Data for Script: NeoAgent takes this data and makes it easy for the Python script to understand and use.
  3. Obtain/Generate and Execute Script:
    • During the action setup, you either:
      • Write or paste your own Python code directly.
      • Choose a pre-defined template which comes with its own Python code.
      • Use the "USE AI" feature: You describe what you want in plain English, and Neo generates the Python script for you.
    • Regardless of how the script is obtained, this Python code is then executed by NeoAgent.
    • The script has access to the data collected in step 1
    • If your company uses custom fields in your PSA, the script can easily access those too using a helper function
  4. Produce Results: The Python script (whether user-provided or AI-generated) should be structured to:
    • Create a main text summary of its findings
    • Optionally, if you need a data table (like for a CSV export), the script should also define the data for the table and its column names
  5. Deliver Output: NeoAgent takes the results from the script:
    • The text summary is made available for viewing in the workflow history or for use in internal notes/messages.
    • If the script created a data table and you've set the option to export it, NeoAgent prepares this table to be sent as a CSV file (for example, attached to an email by a later "Notify Internal Team" action).

Configuration Fields

When you add the "Data Analysis" action to a workflow, you'll configure the following:

Describe what you want (user_prompt)

A description of the analysis you want to perform.

  • If you're using the "USE AI" feature, this description is crucial as Neo will use it to generate the Python script.
  • If you're providing your own script or using a template, this field serves as a helpful title or comment for your analysis (e.g., "Monthly Ticket Analysis for Client X").

Python code (python_code)

This field holds the actual Python script that will be executed.

  • If you select "USE AI", Neo populates this field with the generated script. You can then review and even modify this script.
  • If you choose a template, this field is pre-filled by the template's script.

Report column names (table_column_names)

If your script (or an AI-generated script) is intended to produce a data table, this field is where you can specify the desired column names for that table. The script itself should also be set up to produce data matching these headers for consistent output, especially if exporting to CSV.

Export report as CSV (only available by email) (export_dataframe_as_csv)

Check this box if you want any data table created by the Python script to be available for export as a CSV file. This is useful if you want to email the report or save it. (default: False)

Output Fields

This action makes the following information available to subsequent actions in the workflow:

default_messages_for_dashboard

The main text summary generated by the Python script. You can see this in the Event History section of the Neo Dashboard, providing a record of what the analysis found.

default_messages_for_msp

The main text summary from the script. This can be used by other actions to, for example, add an internal note to a ticket or send a message to your team.

default_messages_for_end_client

This is typically not used by the Data Analysis action, as its reports are usually for internal purposes.

default_response_dataframe

If the Python script created a data table and you checked export_dataframe_as_csv, this output contains that table. Another action (like "Notify Internal Team") can then use this to attach the table as a CSV file to an email.

credits_consumed

Indicates the NeoAgent credits used by this action. Typically, a Data Analysis action uses 1 credit each time it runs.

Use Cases

Generate a Custom CSV Report of Tickets for a Client (AI-Assisted)

  • Goal: Email a weekly CSV report to a Service Manager showing all tickets resolved for a key client, including resolution notes and time spent.
  • Setup:
    1. Workflow finds all tickets for the client resolved last week.
    2. Add the "Data Analysis" action.
    3. In "Describe what you want", type: "Create a table with ticket ID, summary, resolution notes, and time spent for all provided tickets. The summary message should state the number of tickets processed."
    4. Select "USE AI" to generate the script. Review and adjust if needed.
    5. Ensure "Report column names" reflects your desired CSV headers (e.g., "Ticket ID, Summary, Resolution, Time Spent").
    6. Check "Export report as CSV".
    7. "Notify Internal Team" action emails the text summary and attaches the data table as a CSV to the Service Manager.

Best Practices

  • Clear Descriptions for AI: Provide a clear and specific description in the "Describe what you want" field for best results.
  • Test Thoroughly: Preview the report or test with a small dataset to ensure the script (AI-generated or manual) works correctly and produces the expected results.
  • Keep it Efficient: While flexible, overly complex scripts could be slow. Aim for efficient code.
  • Check Workflow History: After your workflow runs, review the Event History on the Neo Dashboard. This shows the output from the Data Analysis action and can help troubleshoot any issues.