Skip to content

Agents Module

Total files documented: 79


agents/effort_adequecy.py

Purpose

This file, effort_adequacy.py, is part of the 3-Cubed Python system and is responsible for evaluating the adequacy, redundancy, and optimization opportunities in process controls. It utilizes the CrewAI framework to perform this analysis.

Key Responsibilities

  • Evaluate control sufficiency and redundancy across business processes
  • Detect over-control and under-control situations
  • Identify redundant control patterns and suggest optimization opportunities
  • Provide a structured output matching the ControlAdequacyResult schema

Important Functions

  • log_crew_run: Logs the inputs and result of a Crew run for auditing and debugging purposes
  • deduplicate_redundant_group_ids: Removes duplicate redundant group IDs from the output of the control adequacy analysis
  • prepare_inputs: Prepares the inputs for the control adequacy analysis by flattening controls, sorting the subgraph, and clustering activities
  • control_adequacy_analyst: Defines the Agent responsible for performing the control adequacy analysis
  • control_adequacy_task: Defines the Task that performs the control adequacy analysis
  • adequacy_evaluation_crew: Defines the Crew that runs the control adequacy analysis

Important Classes

  • ControlAdequacyCrew: The Crew class that defines the control adequacy analysis workflow
  • OverControlItem, UnderControlItem, ControlPatternRedundancy, OptimizationSummary, ControlAdequacyResult, ProjectData, ControlAdequacyFullResponse: Pydantic models that define the structure of the output data

System Fit

This file fits into the wider 3-Cubed Python system by providing a Crew-based workflow for evaluating control adequacy, redundancy, and optimization opportunities. It utilizes the CrewAI framework to perform this analysis and provides a structured output that can be used for further processing or reporting. The file is designed to be modular and reusable, allowing it to be easily integrated into other parts of the system.


agents/main.py

agents/main.py

Purpose

This file serves as the main entry point for the Diagnostic-Agent application, which is built using FastAPI. It integrates multiple routers from various modules to provide a comprehensive diagnostic and solution phase for analyzing issues in the process.

Key Responsibilities

  • Initialize the FastAPI application
  • Include routers from various modules for diagnostic and solution phases
  • Handle API requests and responses
  • Establish a database connection for retrieving data

Important Functions

  • get_final_json: Handles POST requests to retrieve the final JSON data for a given project ID and instance. This function establishes a database connection, executes a query to retrieve the data, and returns the result.

Important Classes

  • RetrieveInput: A Pydantic model used to validate and parse the input data for the /get_diastatus endpoint. It contains two fields: project_id and instance.

System Fit

This file fits into the wider 3-Cubed Python system by providing a unified entry point for the Diagnostic-Agent application. It integrates various routers from different modules, allowing for a comprehensive diagnostic and solution phase. The application can be used to analyze issues in the process and provide insights for improvement.

API Endpoints

The application exposes several API endpoints, including:

  • /get_diastatus: A POST endpoint that retrieves the final JSON data for a given project ID and instance.

Database Connection

The application uses the get_db_connection_wizard function to establish a database connection. This function is not shown in the provided code snippet, but it is assumed to be implemented elsewhere in the system.

Routers

The application includes routers from various modules, including:

  • Diagnostic phase: redudant, nva, skill, combined_router, rework_router, automation_router, efficacy_router, control_rework_router, rejection_router, competency_router, control_effort_router, component_router, and adequacy_router
  • Solution phase: nva_solution_router, automation_sol_router, reworks_sol_router, combined_solution_router, rej_solution_router, control_redun_sol_router, and effectiveness_sol_router
  • Controls solution: adequacy_sol_router, control_rework_sol_router, and control_effort_sol_router
  • Customer Experience: rej_cx_router, shiftscust_router, criticalpath_router, and workcust_router
  • Cost: shiftcost_router, compensation_router, merge_solution_router, and workcost_router

agents/analysis/attribute_analysis.py

Purpose

This file, attribute_analysis.py, is responsible for analyzing project data and attributes to classify activities and forms. It uses various machine learning models and caching mechanisms to make predictions and store results.

Key Responsibilities

  • Classify activities using natural language processing (NLP) and machine learning (ML) models
  • Analyze forms and systems to determine their automation type
  • Use caching mechanisms to store and retrieve results
  • Integrate with other components of the 3-Cubed Python system

Important Functions

  • classify_all_activities_nva: Classifies all activities in a project using NLP and ML models
  • get_form_attributes: Returns attributes for a given form, including digital, machine-readable, and structured status
  • get_office_automation: Returns whether a system is an office automation system or not
  • classify_activities_automation_type: Classifies each activity in a list with its automation type

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing a set of functions for analyzing project data and attributes. It integrates with other components, such as the project graph and form classification, to provide a comprehensive view of project attributes. The caching mechanisms used in this file also help to improve performance and reduce the load on the system.


agents/analysis/control_analysis.py

Purpose

This file, control_analysis.py, is responsible for analyzing control efficacy and lines of defense in a project. It provides functions to compute control efficacy, populate objectives and controls with computed efficacy, and calculate lines of defense.

Key Responsibilities

  • Analyze control efficacy for a given project
  • Populate objectives and controls with computed efficacy
  • Calculate lines of defense for objectives and risks

Important Functions

compute_control_efficacy

Computes efficacy for a control in terms of Coverage, Segregation, and Timeliness. It takes in a project graph, control data, objective, and activity dictionary as input and returns a ControlEffectiveness object.

populate_objectives

Populates objectives, risks, and controls with computed control efficacy. It handles both single-objective integers and multi-objective dictionaries. It takes in project data, activity dictionary, and project graph as input and returns a list of populated objectives.

compute_lines_of_defense

Computes lines of defense for objectives and risks in project data. It takes in project data as input and returns a list of lines of defense.

System Fit

This file fits into the wider 3-Cubed Python system by providing analysis functions for control efficacy and lines of defense. It is likely used in conjunction with other files in the system to provide a comprehensive view of project controls and risks. The functions in this file are designed to be reusable and can be called from other parts of the system as needed.


agents/analysis/deadline_analysis.py

Purpose

This file, deadline_analysis.py, is responsible for analyzing deadlines in activities within a project. It preprocesses deadlines, adds deadline impacts from observations, and computes deadline paths.

Key Responsibilities

  • Preprocess deadlines in activities by combining flat deadline fields into a nested Deadline dictionary
  • Add deadline impacts from observations to the Deadline field of each activity
  • Compute deadline paths from the source (start or DLRelated) to the target activity
  • Fill deadline paths for activities with real deadlines

Important Functions

  • preprocess_deadlines_in_activities: Combines flat deadline fields into a nested Deadline dictionary
  • add_deadline_impacts_from_observations: Adds deadline impacts from observations to the Deadline field of each activity
  • get_deadline_path: Computes deadline paths from the source (start or DLRelated) to the target activity
  • fill_deadline_paths: Fills deadline paths for activities with real deadlines

Important Classes

None

System Fit

This file is part of the 3-Cubed Python system, which is a CrewAI-based project. It is used to analyze deadlines in activities within a project, providing insights into project timelines and dependencies. The file is designed to work with JSON data and uses NetworkX for graph operations.


agents/analysis/graph_utils.py

Purpose

This file, graph_utils.py, provides utility functions for working with directed graphs in the context of project analysis. It includes functions for creating project graphs, computing start and end nodes, performing modified depth-first searches, and converting between Pydantic graph models and NetworkX graphs.

Key Responsibilities

  • Create directed graphs from project data
  • Compute start and end nodes for directed graphs
  • Perform modified depth-first searches on graphs
  • Convert between Pydantic graph models and NetworkX graphs
  • Compute all possible paths in a project graph

Important Functions

  • create_project_graph(project_data): Creates a directed graph from project data.
  • compute_start_and_end_nodes(G): Computes start nodes (nodes with no predecessor) and end nodes (nodes with no successor) for a directed graph.
  • modified_dfs(G): Performs a modified depth-first search on a graph, starting from nodes with no predecessor, ensuring all nodes are visited, and computing end nodes for directed graphs.
  • compute_paths(graph): Computes all possible paths in a project graph.
  • pydantic_to_networkx(graph_model): Converts a Pydantic graph model to a NetworkX graph.
  • networkx_to_pydantic(graph): Converts a NetworkX graph to a Pydantic graph model.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing utility functions for working with directed graphs in the context of project analysis. It is likely used in conjunction with other modules that handle project data and graph-based analysis. The functions in this file are designed to be reusable and can be applied to various graph-based problems in the system.


agents/analysis/path_analysis.py

Purpose

This file, path_analysis.py, is responsible for computing all possible paths in a project graph that include key nodes. It uses the NetworkX library to analyze the graph structure and identify potential risk paths.

Key Responsibilities

  • Compute all possible paths in a project graph that include key nodes
  • Filter paths based on key nodes and graph structure
  • Handle cases where no path exists between two nodes

Important Functions

compute_risk_paths(graph, key_nodes)

This function takes a NetworkX directed graph and a set of key nodes as input, and returns a list of paths containing key nodes. It iterates over all possible start and end nodes in the graph, and uses NetworkX's all_simple_paths function to compute all simple paths between each pair of nodes. The function then filters these paths to include only those that contain key nodes.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing a critical component for analyzing project graphs and identifying potential risk paths. It is likely used in conjunction with other modules that generate project graphs and define key nodes, to provide insights into project risk and dependencies.


agents/analysis/peak_analysis.py

Purpose

This file, peak_analysis.py, contains functions for analyzing team efforts and peak hours in a project. It provides tools for reconciling team efforts, populating pActor objects, and identifying tasks causing attendance.

Key Responsibilities

  • Reconcile team efforts by calculating total effort from activities, schedData, and pActor objects
  • Populate pActor objects with attributes such as effort, utilization, and end-of-day (EOD) times
  • Identify tasks causing attendance for actors
  • Analyze team peaks and compute working, present, and finished actors

Important Functions

  • debug_actor_ids(project_data): Prints a table showing actor task distribution
  • reconcile_team_efforts(project_data, sched_dict): Reconciles team efforts by calculating total effort from activities, schedData, and pActor objects
  • populate_pactors(project_data, sched_dict): Populates pActor objects with attributes such as effort, utilization, and EOD times
  • tasks_causing_attendance(actor, sched_dict): Finds the task causing the earliest attendance for an actor

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing analysis tools for team efforts and peak hours. It is likely used in conjunction with other files that handle project data, scheduling, and activity tracking. The functions and classes in this file are designed to work with the project_models module, which defines data structures such as Activity, Team, pActor, and SchedData.


agents/analysis/peak_analysis_old.py

Purpose

This file, peak_analysis_old.py, is responsible for analyzing team scheduling data to identify peak hours and calculate various metrics. It populates pActor objects with task data and calculates attributes such as effort, utilization, and end-of-day (EOD) hours.

Key Responsibilities

  • Populate pActor objects with task data and calculate attributes
  • Identify peak hours for a team based on scheduling data
  • Calculate metrics such as effort, utilization, and EOD hours
  • Handle errors and edge cases during attribute calculation

Important Functions

  • populate_pactors(project_data, sched_dict): Populates pActor objects with task data and calculates attributes.
  • identify_peaks(team, pactors, sched_dict, interval=1): Identifies peak hours for a team based on scheduling data.
  • calculate_effort_per_hour(): Not clear from code.
  • update_activity_metrics(): Not clear from code.
  • analyze_team_peaks(): Not clear from code.

Important Classes

None.

System Fit

This file is part of the 3-Cubed Python system, which appears to be a project management tool. The peak_analysis_old.py file is responsible for analyzing team scheduling data to identify peak hours and calculate various metrics. It is likely used in conjunction with other files in the system to provide insights into team productivity and resource allocation.


agents/analysis/rework_analysis.py

Purpose

This file, rework_analysis.py, contains functions for analyzing rework structures within a project. It identifies key decision nodes responsible for loops and forward flow within strongly connected components (SCCs), computes the rework percentage, and generates ReworkStructures for a given project.

Key Responsibilities

  • Identify key decision nodes within SCCs
  • Compute rework percentage for SCCs
  • Generate ReworkStructures for a given project

Important Functions

  • identify_decision_nodes: Identifies key decision nodes responsible for loops and forward flow within an SCC.
    • Takes a directed graph, a list of node IDs, an activity dictionary, and an arrow dictionary as input.
    • Returns a list of decision node IDs.
  • compute_rework_percent: Computes the rework percentage for a given SCC.
    • Takes a directed graph, a list of node IDs, a list of key decision nodes, an arrow dictionary, and an activity dictionary as input.
    • Returns the rework percentage as a float.
  • compute_rework_structures: Computes ReworkStructures for a given project.
    • Takes project data, schedule data, an activity dictionary, and an arrow dictionary as input.
    • Returns a list of ReworkStructures.

Important Classes

  • ReworkStructure: Represents a rework structure within a project.
    • Attributes include loop (list of node IDs), key decision (list of decision node IDs), rework percent (float), rework volume (float), rework effort (float), and rework cycle time (float).

System Fit

This file fits into the wider 3-Cubed Python system by providing functionality for analyzing rework structures within a project. It is designed to work in conjunction with other components, such as the project data and schedule data, to generate insights and metrics for project managers and stakeholders. The functions and classes in this file are intended to be reusable and modular, allowing for easy integration with other parts of the system.


agents/analysis/__init__.py

Purpose

Unable to read this file content.

Extracted Functions

None found.

Extracted Classes

None found.


agents/crew_agents/crew_llm.py

Purpose

This file, crew_llm.py, initializes and configures various Large Language Models (LLMs) using the CrewAI library. It sets up connections to OpenAI, Gemini, and Groq APIs, and creates instances of LLMs with specific models and parameters.

Key Responsibilities

  • Load environment variables for API keys
  • Validate the presence of required API keys
  • Configure LLM models and parameters
  • Create instances of LLMs using the CrewAI library

Important Functions

None

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system as a component of the CrewAI library, which is used to interact with various LLMs. The instances of LLMs created in this file can be used throughout the system to perform tasks such as text generation, question answering, and more. The file is likely used in conjunction with other components of the system to provide a unified interface for working with LLMs.

Note: The code does not clearly indicate how these LLM instances are intended to be used or integrated with the rest of the system. Further investigation would be required to fully understand the system fit.


agents/crew_agents/__init__.py

Purpose

Unable to read this file content.

Extracted Functions

None found.

Extracted Classes

None found.


agents/crew_agents/diagnose/adequacy.py

Purpose

This file, adequacy.py, is part of the CrewAI system and is responsible for performing control adequacy analysis on a given project. It provides a set of functions and classes to analyze the control structure of a project and provide recommendations for improvement.

Key Responsibilities

  • Perform control adequacy analysis on a project
  • Provide recommendations for control improvement
  • Save unified adequacy results to file
  • Offer generic helpers for object-safe data conversion and retrieval

Important Functions

  • _save_unified_result_to_file: Saves the unified adequacy result to a file
  • run_control_adequacy: Performs the control adequacy analysis
  • prepare_inputs: Prepares the inputs for the control adequacy analysis
  • _to_plain: Recursively converts Pydantic/objects to plain dict/list for safe usage
  • _get: Retrieves a value from an object safely

Important Classes

  • ControlAdequacyItem: Represents a control adequacy item with its properties
  • ControlAdequacyFullResult: Represents the full result of the control adequacy analysis
  • ControlAdequacyUnified: Represents the unified wrapper for the control adequacy result
  • ProjectData: Represents the project data with its properties

System Fit

This file is part of the CrewAI system and is designed to work with the FastAPI framework. It uses the CrewAI library to interact with the project data and perform the control adequacy analysis. The results of the analysis are saved to a file and can be used for further processing or visualization.


agents/crew_agents/diagnose/automation.py

Purpose

This file, automation.py, is part of the CrewAI system and provides functionality for automation diagnosis. It contains tools for metadata inspection, logging, and automation diagnosis tasks.

Key Responsibilities

  • Provides tools for metadata inspection, such as retrieving structured metadata for a specific activity by its ID.
  • Logs full raw crew run + clean output into ONE merged file.
  • Defines a CrewAI Automation Diagnosis Crew that prepares inputs for automation diagnosis.

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • log_crew_run: Logs full raw crew run + clean output into ONE merged file.
  • prepare_inputs: Prepares inputs for automation diagnosis by filtering valid activities and creating a subgraph model.

Important Classes

  • AutomationDiagnosisCrew: A CrewAI Automation Diagnosis Crew that prepares inputs for automation diagnosis.
  • ProjectData: A Pydantic model representing project data, including activities, arrows, and teams.
  • AutomationCandidate: A Pydantic model representing an automation candidate, including activity ID, name, reason, score, and automation type.
  • AutomationDiagnosisResult: A Pydantic model representing the result of automation diagnosis, including a list of automation candidates.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI automation diagnosis functionality. It interacts with other components, such as the CrewAI project and tools, to provide automation diagnosis capabilities.


agents/crew_agents/diagnose/combined.py

Purpose

This file, combined.py, is part of the CrewAI system and serves as a central entry point for running multiple diagnoses on a project. It utilizes the FastAPI framework to create an API endpoint for running all diagnoses.

Key Responsibilities

  • Create an API endpoint for running all diagnoses
  • Save input request data to a log file
  • Run multiple diagnoses on a project, including NVA, redundancy, and others
  • Handle exceptions and return error responses

Important Functions

  • to_dict(obj): Converts an object to a dictionary, supporting both Pydantic v2 models and plain dictionaries.
  • save_input_log(endpoint: str, request_data: dict): Saves input request data to a timestamped log file.
  • run_all_diagnoses(request: AdequacyProjectData): Runs all diagnoses on a project, including NVA, redundancy, and others.

Important Classes

  • AdequacyProjectData: A Pydantic model representing the input data for running all diagnoses.

System Fit

This file fits into the wider 3-Cubed Python system as a key component of the CrewAI system. It provides a central entry point for running multiple diagnoses on a project, making it an essential part of the system's functionality. The file interacts with other components, such as the crew_agents.diagnose module, to run various diagnoses and save input data to log files.


agents/crew_agents/diagnose/combined1.py

Purpose

This file, combined1.py, is part of the CrewAI system and serves as a diagnostic agent. It provides a FastAPI endpoint to run multiple diagnoses on a given input, including rework and automation diagnoses.

Key Responsibilities

  • Handle incoming requests to run all diagnoses
  • Save input request data to a log file
  • Run rework and automation diagnoses on the input data
  • Return the results of the diagnoses

Important Functions

  • save_input_log(endpoint: str, request_data: dict): Saves only the input request data to a timestamped log file.
  • run_all_diagnoses(request: ProjectData): Runs all diagnoses on the input data, including rework and automation diagnoses, and returns the results.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system as a diagnostic agent, providing a FastAPI endpoint to run multiple diagnoses on a given input. It relies on other modules, such as crew_agents.diagnose.rework and crew_agents.diagnose.automation, to perform the actual diagnoses. The results of the diagnoses are returned to the client through the FastAPI endpoint.


agents/crew_agents/diagnose/competency.py

Purpose

This file, competency.py, is part of the CrewAI system and is responsible for competency compensation analysis. It provides functions and classes to analyze team competencies, identify misalignment issues, and generate reports.

Key Responsibilities

  • Analyze team competencies and identify misalignment issues
  • Generate reports on team competency analysis
  • Provide functions for logging crew runs and preparing inputs for competency analysis

Important Functions

  • log_crew_run: Logs a crew run by saving the input and output to a JSON file
  • get_activity_metadata: Fetches metadata for a given activity, including forms, BRs, systems, and skill score
  • prepare_inputs: Prepares inputs for competency analysis by filtering valid activities and creating a subgraph model
  • run_competency_compensation: Runs the competency compensation analysis (not shown in this file)

Important Classes

  • ProjectData: Represents project data, including project ID, instance, activities, arrows, and teams
  • JobDescription: Represents a job description, including job title and core skills
  • SalaryAnalysis: Represents a salary analysis, including current salary, suggested salary, and gap percentage
  • MisalignmentIssue: Represents a misalignment issue, including activity, required skill, team skill, and issue
  • TeamCompetencyResult: Represents a team competency result, including team ID, job description, salary analysis, competency, and misalignment issues
  • CompetencyCompensationResult: Represents a competency compensation result, including a list of team competency results

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI module, which is responsible for competency compensation analysis. It interacts with other modules, such as the crew_llm module, to fetch metadata and perform analysis. The output of this file is used to generate reports and identify misalignment issues.


agents/crew_agents/diagnose/componentcost.py

Purpose

This file, componentcost.py, is part of the CrewAI system and is responsible for diagnosing and summarizing component costs for a project. It prepares raw office cost data, validates per-seat component costs, and generates a concise executive summary.

Key Responsibilities

  • Prepare raw office cost data for input into the LLM
  • Validate per-seat component costs by fetching market benchmarks and handling local currencies
  • Generate a concise executive summary from the diagnosis output

Important Functions

  • prepare_inputs: prepares raw office cost data for input into the LLM
  • component_cost_analyst: validates per-seat component costs using the LLM
  • component_cost_summary_agent: generates a concise executive summary from the diagnosis output
  • component_cost_diagnosis_task: performs the diagnosis of per-seat component costs
  • component_cost_summary_task: generates the executive summary

Important Classes

  • OfficeExpences: represents office expenses with attributes for location code, location name, office ID, currency code, and cost per seat
  • ProjectData: represents project data with attributes for project ID, instance, and office cost
  • ComponentCostResultItem: represents a single result item with attributes for office ID, location name, project currency, provided project cost, expected project cost, correctness flag, and reason
  • ComponentCostResult: represents a list of result items
  • ComponentCostCrew: the main class responsible for preparing inputs, validating component costs, and generating summaries

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI system, which is designed to perform various tasks related to project management and cost analysis. The componentcost.py file is responsible for diagnosing and summarizing component costs, which is a critical aspect of project management. The file uses various tools and models, including the LLM, to perform its tasks and generate outputs in a structured format.


agents/crew_agents/diagnose/controleffort.py

Purpose

This file, controleffort.py, is part of the CrewAI system and is responsible for diagnosing control effort in a project. It provides functionality for analyzing control effort, identifying high-effort controls, and summarizing control effort data.

Key Responsibilities

  • Analyze control effort data from a project
  • Identify high-effort controls
  • Summarize control effort data
  • Provide insights into control effort and risk

Important Functions

  • run_control_effort: The main entry point for control effort diagnosis
  • prepare_inputs: Prepares the input data for control effort analysis
  • control_effort_analyst: Analyzes control effort data and identifies high-effort controls
  • control_effort_summary_agent: Summarizes control effort data and provides insights

Important Classes

  • ControlEffortRow: Represents a single control effort row with attributes such as ControlID, ControlName, ControlEffortPct, and more
  • ControlEffortRows: A list of ControlEffortRow objects
  • ControlEffortCrew: A CrewAI crew class responsible for control effort diagnosis

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI project. It is designed to work with other CrewAI components, such as the LLM (Large Language Model) and the project data, to provide insights into control effort and risk. The ControlEffortCrew class is a CrewAI crew class that can be used to diagnose control effort in a project.


agents/crew_agents/diagnose/controlrework.py

Purpose

This file, controlrework.py, is part of the CrewAI system and is responsible for diagnosing and analyzing control rework in a project. It provides tools and classes for identifying redundant control artifacts, analyzing control effectiveness, and generating summaries of control rework diagnosis results.

Key Responsibilities

  • Diagnose and analyze control rework in a project
  • Identify redundant control artifacts
  • Analyze control effectiveness
  • Generate summaries of control rework diagnosis results

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • find_redundant_control_artifacts: Analyzes control entries to detect redundancy in Forms, BRs, and Systems.
  • prepare_inputs: Prepares inputs for the Control Rework Diagnosis crew.
  • run_control_rework: Runs the control rework diagnosis process.

Important Classes

  • ControlReworkItem: Represents a single control rework item with metadata.
  • ControlReworkDiagnosisResult: Represents the results of a control rework diagnosis.
  • ControlReworkDiagnosisCrew: The crew responsible for performing control rework diagnosis.

System Fit

This file is part of the CrewAI system, which is designed to provide a comprehensive platform for project analysis and diagnosis. The control rework diagnosis functionality is integrated with other components of the system, such as the LLM (Large Language Model) and the project graph, to provide a holistic view of project performance and identify areas for improvement.

The control rework diagnosis process involves several steps, including:

  1. Retrieving activity metadata
  2. Analyzing control entries for redundancy
  3. Evaluating control effectiveness
  4. Generating summaries of diagnosis results

The ControlReworkDiagnosisCrew class is responsible for orchestrating this process and providing the necessary inputs and outputs.

Notes

  • The get_activity_metadata function extracts key information from activity metadata, including Forms, Business Rules (BRs), Systems, and the highest skill level required.
  • The find_redundant_control_artifacts function analyzes control entries to detect redundancy in Forms, BRs, and Systems.
  • The prepare_inputs function prepares inputs for the Control Rework Diagnosis crew, including project data and a subgraph model.
  • The ControlReworkItem class represents a single control rework item with metadata.
  • The ControlReworkDiagnosisResult class represents the results of a control rework diagnosis.
  • The ControlReworkDiagnosisCrew class is responsible for performing control rework diagnosis and providing the necessary outputs.

agents/crew_agents/diagnose/crew_summary_agent.py

Purpose

This file, crew_summary_agent.py, contains the implementation of a crew-level summary agent using the CrewAI framework. The agent's purpose is to combine diagnostic outputs from three perspectives (NVA, Automation, and Rework) into a single, actionable executive-level summary.

Key Responsibilities

  • Define Pydantic models for crew-level summary data
  • Implement a FastAPI router for the crew-level summary endpoint
  • Define a crew-level summary agent and task
  • Provide a runner function for generating the crew-level summary
  • Expose a FastAPI endpoint for direct testing of the crew-level summary

Important Functions

  • run_crew_level_summary: This function takes in raw diagnostic outputs and returns a crew-level summary structured into Effort, Rework, and Automation sections.
  • run_crew_summary_endpoint: This is a FastAPI endpoint that accepts raw diagnostic outputs and returns the crew-level summary.

Important Classes

  • CrewLevelSummaryResult: This is a Pydantic model that represents the crew-level summary data, including Effort, Rework, and Automation sections.
  • CrewLevelSummaryCrew: This is a CrewAI crew definition that includes the crew-level summary agent and task.

System Fit

This file fits into the wider 3-Cubed Python system by providing a crew-level summary agent that can be used in conjunction with other agents and tasks to generate actionable insights. The crew-level summary agent can be integrated with other components of the system to provide a comprehensive view of diagnostic outputs and recommendations for improvement.


agents/crew_agents/diagnose/customer_experience_crew.py

Purpose

This file, customer_experience_crew.py, is part of the CrewAI system and is responsible for creating a compact customer experience summary using a combination of inputs from various sources.

Key Responsibilities

  • Create a customer experience summary using a specific format
  • Use inputs from various sources, including payload, peak crew-level summary, peak summary, bottlenecks summary, critical path summary, rework loops, rework summary, rejection paths, and rejection summary
  • Validate the output against the CustomerExperienceSummaryEnvelope schema

Important Functions

  • run_cx_summary: The main function that runs the customer experience summary process
  • strategist: Returns an Agent instance that defines the role, goal, backstory, and LLM for the customer experience strategist
  • summarize: Returns a Task instance that defines the description, expected output, and agent for the summarize task
  • build: Returns a Crew instance that defines the agents, tasks, process, and output for the customer experience summary process

Important Classes

  • CustomerExperienceSummaryBody: A Pydantic model that defines the structure of the customer experience summary body
  • CustomerExperienceSummaryEnvelope: A Pydantic model that defines the structure of the customer experience summary envelope
  • CustomerExperienceSummaryCrew: A Crew class that defines the agents, tasks, process, and output for the customer experience summary process

System Fit

This file fits into the wider 3-Cubed Python system by providing a specific implementation of a CrewAI agent that creates a customer experience summary using a combination of inputs from various sources. The CustomerExperienceSummaryCrew class is a key component of this implementation, and it uses the CrewBase class to define the agents, tasks, process, and output for the customer experience summary process. The run_cx_summary function is the main entry point for this implementation, and it uses the CustomerExperienceSummaryCrew class to create a customer experience summary using the specified inputs.


agents/crew_agents/diagnose/database.py

Purpose

This file, database.py, is responsible for establishing a connection to a SQL Server database and providing functions for interacting with the database, specifically for updating process status.

Key Responsibilities

  • Establish a connection to a SQL Server database
  • Insert or update process status in the dbo.trndiagnosis table
  • Handle database connection errors and exceptions

Important Functions

get_db_connection_wizard()

Establishes a connection to the SQL Server database using the pyodbc library. It returns a connection object if successful, otherwise raises an HTTP exception with a 500 status code.

insert_process_status()

Inserts or updates process status in the dbo.trndiagnosis table. It takes four parameters: * project_id: The ID of the project * instance: The instance of the process * status_text: The status text to be inserted or updated * final_json: The final JSON to be inserted or updated (optional)

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI agents, specifically the diagnose module. It provides a way to interact with the database to update process status, which is essential for tracking and monitoring the diagnose process. The get_db_connection_wizard() function is used to establish a connection to the database, and the insert_process_status() function is used to insert or update process status in the database.


agents/crew_agents/diagnose/efficacy.py

Purpose

This file, efficacy.py, is part of the CrewAI system and is responsible for diagnosing the effectiveness of controls in a project. It provides tools and classes for analyzing control artifacts, identifying redundant controls, and generating diagnostic results.

Key Responsibilities

  • Analyze control artifacts to detect redundancy and inefficacy
  • Identify ineffective controls and provide recommendations for improvement
  • Generate diagnostic results for control effectiveness
  • Integrate with the CrewAI system for project data and subgraph models

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • find_redundant_control_artifacts: Analyzes control entries to detect redundancy in Forms, BRs, and Systems.
  • prepare_inputs: Prepares inputs for control effectiveness diagnosis, including project data and subgraph models.

Important Classes

  • ControlEffectivenessDiagnosisCrew: A CrewBase class responsible for control effectiveness diagnosis.
  • ControlDiagnosisEntry: A Pydantic model representing a single control diagnosis entry.
  • ControlEffectivenessDiagnosisResult: A Pydantic model representing the result of control effectiveness diagnosis.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI module. It is designed to work with project data and subgraph models, and provides tools and classes for analyzing control artifacts and generating diagnostic results. The ControlEffectivenessDiagnosisCrew class integrates with the CrewAI system, allowing it to be used as a crew in the system.

Notes

  • The officecost class is not clear from the code, but it appears to represent office costs associated with a project.
  • The ControlItem class is not clear from the code, but it appears to represent a control item with attributes such as ControlActivityId, ControlActivityIds, and TeamScore.
  • The RiskItem class is not clear from the code, but it appears to represent a risk item with attributes such as RiskId, RiskName, and Controls.
  • The ControlObjective class is not clear from the code, but it appears to represent a control objective with attributes such as ObjectiveId, ObjectiveText, and Risks.
  • The ProjectData class is not clear from the code, but it appears to represent project data with attributes such as project_id, instance, and Activities.
  • The ControlDiagnosisEntry class is not clear from the code, but it appears to represent a single control diagnosis entry with attributes such as risk_activity_id, control_activity_ids, and effectiveness_score.
  • The ControlEffectivenessDiagnosisResult class is not clear from the code, but it appears to represent the result of control effectiveness diagnosis with attributes such as ineffective_controls.

agents/crew_agents/diagnose/effort_crew.py

Purpose

This file, effort_crew.py, is part of the CrewAI system and is responsible for analyzing the effort in a process and identifying the different reasons for the effort. It provides a crew that can be used to diagnose effort in a project.

Key Responsibilities

  • Analyze the effort in a process
  • Identify the different reasons for the effort
  • Provide a crew that can be used to diagnose effort in a project

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • find_redundant_control_artifacts: Analyzes control entries to detect redundancy in Forms, BRs, and Systems.
  • prepare_inputs: Prepares the inputs for the effort diagnosis crew.
  • effort_diagnostic_analyst: Not clear from code.
  • redundancy_summary_agent: Not clear from code.
  • effort_diagnosis_task: Not clear from code.
  • redundancy_summary_task: Not clear from code.
  • nva_assessment_crew: Not clear from code.

Important Classes

  • ProjectData: Represents project data, including activities, arrows, and teams.
  • DiagnosisActivity: Represents a diagnosis activity, including activity ID and name.
  • DiagnosisCluster: Represents a diagnosis cluster, including activities, cause, and recommendation.
  • EffortDiagnosisResult: Represents the result of an effort diagnosis, including redundancies.
  • EffortDiagnosisCrew: The crew responsible for analyzing the effort in a process and identifying the different reasons for the effort.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI system, which is responsible for analyzing and optimizing business processes. The EffortDiagnosisCrew class is a key component of this system, providing a crew that can be used to diagnose effort in a project. The functions and classes in this file work together to analyze the effort in a process and identify the different reasons for the effort, providing valuable insights for process optimization.

Notes

  • The EffortDiagnosisCrew class uses the CrewBase class as a base class, indicating that it is a custom crew class.
  • The prepare_inputs method is used to prepare the inputs for the effort diagnosis crew, including project data and a subgraph model.
  • The find_redundant_control_artifacts method is used to analyze control entries and detect redundancy in Forms, BRs, and Systems.
  • The get_activity_metadata method is used to retrieve structured metadata for a specific activity by its ID.

agents/crew_agents/diagnose/effort_skill.py

Purpose

This file, effort_skill.py, is part of the CrewAI system and is responsible for analyzing the effort in a process and identifying the different reasons for the effort. It provides tools and classes for diagnosing effort-related issues in a project.

Key Responsibilities

  • Analyze project data to identify effort-related issues
  • Identify high-skill activities and clusters
  • Detect redundancy in control artifacts
  • Provide structured metadata for activities

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • find_redundant_control_artifacts: Analyzes control entries to detect redundancy in Forms, BRs, and Systems.
  • prepare_inputs: Prepares project data for effort diagnosis.

Important Classes

  • ProjectData: Represents project data, including activities, arrows, and teams.
  • ActivityInfo: Represents activity metadata, including ID and name.
  • DiagnosisBR: Represents a Business Rule with its associated Skill level.
  • DiagnosisForm: Represents a Form with its mode.
  • HighSkillCluster: Represents a cluster of high-skill activities.
  • SkillEffortDiagnosisResult: Represents the result of effort diagnosis, including high-skill clusters.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI framework. It is designed to work with other components, such as the LLM (Large Language Model) and the graph utilities, to provide a comprehensive effort diagnosis capability. The EffortDiagnosisCrew class is a CrewBase class that can be used to create a crew for effort diagnosis, and the prepare_inputs method is used to prepare project data for effort diagnosis.


agents/crew_agents/diagnose/nva.py

Purpose

This file, nva.py, is part of the CrewAI system and is responsible for diagnosing Non-Value Added (NVA) activities in a process. It provides tools and classes to analyze effort and identify reasons for effort in a process.

Key Responsibilities

  • Analyze effort in a process
  • Identify reasons for effort in a process
  • Diagnose Non-Value Added (NVA) activities
  • Provide structured metadata for activities
  • Detect redundancy in control artifacts

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • find_redundant_control_artifacts: Analyzes control entries to detect redundancy in Forms, BRs, and Systems.
  • prepare_inputs: Prepares inputs for effort diagnosis by filtering valid activities and creating a subgraph model.

Important Classes

  • ProjectData: Represents project data, including activities, arrows, and teams.
  • DiagnosisItem: Represents a diagnosis item, including activity ID, name, and cause.
  • EffortDiagnosisResult: Represents the result of effort diagnosis, including NVA activities and their causes.
  • EffortDiagnosisCrew: A crew responsible for analyzing effort in a process and identifying reasons for effort.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI framework. It is designed to work with other components, such as the LLM (Large Language Model) and the graph utilities, to provide a comprehensive solution for process analysis and diagnosis. The EffortDiagnosisCrew class is a key component of this system, responsible for analyzing effort and identifying reasons for effort in a process.


agents/crew_agents/diagnose/peaks.py

Purpose

This file, peaks.py, is part of the CrewAI project and provides functionality for peak analysis and diagnosis in a project management context. It contains various functions and classes for processing project data, identifying bottlenecks, and generating reports.

Key Responsibilities

  • Process project data to identify peaks and bottlenecks
  • Generate reports and summaries for peak analysis and diagnosis
  • Provide functionality for peak analysis and diagnosis via API endpoints

Important Functions

  • build_peak_utilization_block: Builds a utilization block for a given peak
  • build_peak_summary_narrative: Generates a summary narrative for a peak
  • build_bottlenecks_summary_narrative: Generates a summary narrative for bottlenecks
  • build_critical_path_summary_narrative: Generates a summary narrative for the critical path
  • run_peak_analysis_and_get_activities: Runs peak analysis and returns activities at peak
  • find_last_unit_per_peak_activity: Finds the last unit for a given peak activity
  • get_recursive_waittypes: Gets recursive wait types for a given activity
  • activities_with_deadlines_generic: Returns activities with deadlines
  • _deadline_stats_from_list: Calculates deadline statistics from a list of deadlines

Important Classes

  • PeakExecutiveSummary: Represents a peak executive summary
  • MultiPeakRunResponse: Represents a response for a multi-peak run
  • PeakAndDeadlinesResponse: Represents a response for peak and deadlines
  • PeakCrew: Represents a crew for peak analysis
  • BottlenecksCrew: Represents a crew for bottleneck analysis
  • CriticalPathCrew: Represents a crew for critical path analysis

System Fit

This file is part of the CrewAI project, which is a Python-based system for project management and analysis. The peaks.py file provides functionality for peak analysis and diagnosis, which is a key component of the project management process. The file interacts with other components of the system, such as the API endpoints and data processing functions, to provide a comprehensive solution for project management and analysis.


agents/crew_agents/diagnose/rej.py

Purpose

This file, rej.py, is part of the CrewAI system and contains tools and classes for diagnosing and analyzing effort in a process. It provides functionality for identifying reasons for effort and detecting redundant control artifacts.

Key Responsibilities

  • Analyze effort in a process and identify reasons for effort
  • Detect redundant control artifacts
  • Provide structured metadata for activities
  • Prepare inputs for effort diagnosis

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • find_redundant_control_artifacts: Analyzes control entries to detect redundancy in Forms, BRs, and Systems.
  • prepare_inputs: Prepares inputs for effort diagnosis by filtering valid activities and converting them to a suitable format.

Important Classes

  • ProjectData: Represents project data, including activities, arrows, teams, and paths.
  • RejectionEnd: Represents a rejection end, including activity ID, name, reason, root cause, and opportunity.
  • RejectionPathsResult: Represents a rejection paths result, including a list of rejection ends.
  • EffortDiagnosisCrew: A crew responsible for analyzing effort in a process and identifying reasons for effort.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI framework. It provides tools and classes for diagnosing and analyzing effort in a process, which can be used in conjunction with other CrewAI components to provide a comprehensive effort diagnosis solution. The EffortDiagnosisCrew class is a key component of this system, responsible for analyzing effort and identifying reasons for effort.


agents/crew_agents/diagnose/rework.py

Purpose

This file, rework.py, is part of the CrewAI system and is responsible for diagnosing rework loops in a project. It uses machine learning and graph analysis to identify root causes of high effort in rework loops.

Key Responsibilities

  • Analyze rework loops and identify root causes of high effort
  • Use machine learning and graph analysis to determine reasons for high effort
  • Provide a structured output of rework loop diagnoses

Important Functions

  • form_rework_structures: Creates structured rework loops with Rework Effort (used internally, not returned in final output)
  • prepare_inputs: Prepares inputs for the rework diagnosis crew, including filtering activities and creating a subgraph
  • rework_diagnostic_analyst: Returns an Agent for analyzing rework loops and determining root causes
  • rework_diagnosis_task: Returns a Task for analyzing rework loops and returning the root cause for each loop

Important Classes

  • ReworkDiagnosisCrew: A Crew that performs rework diagnosis
  • ReworkLoopDiagnosis: A Pydantic model representing a rework loop diagnosis
  • ReworkLoopDiagnosisList: A Pydantic model representing a list of rework loop diagnoses

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI module. It uses the CrewAI framework to define a Crew that performs rework diagnosis, and relies on machine learning and graph analysis to analyze rework loops and identify root causes. The output of this file is used by other parts of the system to inform decision-making and improve project efficiency.


agents/crew_agents/solutions/adequacy.py

Purpose

This file, adequacy.py, is part of the CrewAI system and provides a solution for adequacy analysis. It uses a combination of machine learning and CrewAI's functionality to assess the adequacy of controls in a project.

Key Responsibilities

  • Provides a CrewAI solution for adequacy analysis
  • Utilizes a machine learning model to assess control adequacy
  • Integrates with CrewAI's functionality to provide a comprehensive solution
  • Defines input and output models for data exchange

Important Functions

  • _ensure_llm: Ensures that the provided LLM object is in the correct format for CrewAI
  • _to_str: Converts a value to a string (Not clear from code)
  • _strip_code_fences: Removes code fences from a string (Not clear from code)
  • _get_feedback_list: Retrieves a list of feedback from the LLM (Not clear from code)
  • _extract_pairs_from_feedback: Extracts pairs from feedback (Not clear from code)
  • _build_controls_index: Builds an index of controls (Not clear from code)
  • _build_arrow_successors: Builds a list of successors for an arrow (Not clear from code)
  • _build_arrow_predecessors: Builds a list of predecessors for an arrow (Not clear from code)
  • _suggest_control_activity_candidates: Suggests control activity candidates (Not clear from code)
  • _norm: Normalizes a value (Not clear from code)
  • _canonical_control_name: Returns a canonical control name (Not clear from code)
  • _activity_text: Returns activity text (Not clear from code)
  • _collect_risk_activity_candidates_hops1: Collects risk activity candidates with one hop (Not clear from code)
  • _select_most_relevant_risk_activity_id: Selects the most relevant risk activity ID (Not clear from code)
  • _rule_rank_control_types: Ranks control types (Not clear from code)
  • _pick_added_control_type: Picks an added control type (Not clear from code)
  • run_under_control_only: Runs the solution under control only (Not clear from code)
  • score: Scores the solution (Not clear from code)
  • add: Adds a control to the solution (Not clear from code)
  • prepare_inputs: Prepares input data for the solution (Not clear from code)
  • under_control_analyst: Provides under control analyst functionality (Not clear from code)
  • under_control_task: Provides under control task functionality (Not clear from code)
  • under_control_crew: Provides under control crew functionality (Not clear from code)

Important Classes

  • Deadline: Represents a deadline
  • Product: Represents a product
  • Activity: Represents an activity
  • Team: Represents a team
  • Arrow: Represents an arrow
  • ControlAct: Represents a control act
  • LODByObjRiskItem: Represents a LOD by object risk item
  • ControlsControl: Represents a controls control
  • ControlsRiskItem: Represents a controls risk item
  • ControlsObjectiveItem: Represents a controls objective item
  • ProjectData: Represents project data
  • UnderControlRow: Represents an under control row
  • UnderControlSolution: Represents an under control solution
  • UnderControlRowLLM: Represents an under control row LLM
  • UnderControlSolutionLLM: Represents an under control solution LLM
  • ControlTypeLibrary: Represents a control type library
  • UnderControlCrew: Represents an under control crew

System Fit

This file is part of the CrewAI system and provides a solution for adequacy analysis. It integrates with CrewAI's functionality and utilizes a machine learning model to assess control adequacy. The solution is designed to provide a comprehensive analysis of controls in a project, including risk assessment and control recommendation. The file defines input and output models for data exchange and provides various functions for data processing and analysis.


agents/crew_agents/solutions/automation.py

Purpose

This file, automation.py, is part of the CrewAI system and provides functionality for automating tasks and workflows. It contains various functions and classes that enable the extraction of control activity IDs, normalization of outgoing modes, and preparation of inputs for automation solutions.

Key Responsibilities

  • Extract control activity IDs from payload data
  • Normalize outgoing modes for FRD format
  • Prepare inputs for automation solutions
  • Provide functionality for automation solution agents, tasks, and crews

Important Functions

  • _extract_control_activity_ids: Extracts control activity IDs from payload data
  • _normalize_mode_for_frd: Normalizes outgoing modes for FRD format
  • prepare_inputs: Prepares inputs for automation solutions
  • run_solution_automation: Runs automation solution
  • _add, _walk, normalize_outgoing_mode: Helper functions for data extraction and normalization

Important Classes

  • ProjectData: Represents project data with activities, arrows, teams, and automation feedback
  • AutomationFRDRow: Represents a row in the FRD format with activity ID, name, decision, change, new AHT, effort reduction, outgoing mode, and reason
  • AutomationSolutionActivityItem: Represents an activity item for automation solution
  • AutomationSolutionResult: Represents the result of automation solution
  • SolutionAutomationCrew: Represents a crew for automation solution

System Fit

This file is part of the CrewAI system and is designed to work with the 3-Cubed Python system. It provides functionality for automating tasks and workflows, and is intended to be used in conjunction with other components of the system.


agents/crew_agents/solutions/automation_solution_final_control_effort.py

Purpose

This file, automation_solution_final_control_effort.py, is part of the CrewAI system and provides a solution for automation. It contains functions and classes to extract control activity IDs, normalize modes, and prepare inputs for the automation solution.

Key Responsibilities

  • Extract control activity IDs from payload data
  • Normalize outgoing modes for FRD format
  • Prepare inputs for the automation solution
  • Provide a solution for automation using CrewAI

Important Functions

  • _extract_control_activity_ids: Extracts control activity IDs from payload data
    • Supports various keys and nested structures
  • _normalize_mode_for_frd: Normalizes outgoing modes for FRD format
    • Maps LLM-provided modes to allowed literals
  • prepare_inputs: Prepares inputs for the automation solution
    • Not clear from code

Important Classes

  • ProjectData: Represents project data with activities, arrows, teams, and automation feedback
    • Used for project I/O

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI solution for automation. It provides essential functions and classes to extract control activity IDs, normalize modes, and prepare inputs for the automation solution. The ProjectData class is used for project I/O, and the functions are used to support the automation solution.


agents/crew_agents/solutions/combined.py

Purpose

This file, combined.py, is part of the CrewAI system and serves as a FastAPI endpoint for running multiple solutions. It handles incoming requests, saves input logs, runs the NVA solution, and returns the response.

Key Responsibilities

  • Handle incoming requests to the /run_all_solutions/ endpoint
  • Save input request data to a timestamped log file
  • Run the NVA solution using the run_nva function from crew_agents.solutions.nva_solution
  • Build and return the response data
  • Handle exceptions and return error responses

Important Functions

  • save_input_log(endpoint: str, request_data: dict): Saves input request data to a timestamped log file.
  • run_all_solutions(request: ProjectData): Handles incoming requests, runs the NVA solution, and returns the response data.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system as a FastAPI endpoint for running multiple solutions. It interacts with other components, such as the crew_agents.solutions.nva_solution module, to run the NVA solution and return the response data. The input and output logs are saved to the input_data_solution and response_solution directories, respectively.


agents/crew_agents/solutions/compensation_sol_final.py

Purpose

This file, compensation_sol_final.py, is part of the 3-Cubed Python system and provides a solution for crew compensation. It defines a CompensationSolution class that prepares inputs for the compensation solution and provides a way to run the compensation solution.

Key Responsibilities

  • Prepare inputs for the compensation solution
  • Run the compensation solution
  • Provide a way to classify teams based on their skill levels

Important Functions

  • prepare_inputs: Prepares the inputs for the compensation solution by processing the project data and team details.
  • run_compensation_solution: Runs the compensation solution using the prepared inputs.
  • compensation_solution_crew: Not clear from code.
  • compensation_solution_task: Not clear from code.

Important Classes

  • CompensationSolution: The main class that provides the compensation solution functionality.
  • ProjectData: A Pydantic model that represents the project data.
  • CompensationChange: A Pydantic model that represents a compensation change.
  • CompensationSolutionItem: A Pydantic model that represents a compensation solution item.
  • CompensationSolutionResult: A Pydantic model that represents the result of the compensation solution.

System Fit

This file fits into the wider 3-Cubed Python system by providing a solution for crew compensation. It is part of the crew_agents module and uses the CrewBase class to define the CompensationSolution class. The CompensationSolution class uses the before_kickoff decorator to prepare the inputs for the compensation solution and then runs the compensation solution using the prepared inputs. The result of the compensation solution is returned as a CompensationSolutionResult object.


agents/crew_agents/solutions/component_sol.py

Purpose

This file, component_sol.py, is part of the CrewAI system and provides functionality for calculating component costs for teams. It utilizes OpenAI's API to perform web searches and retrieve commercial office rent data for given cities and countries.

Key Responsibilities

  • Provides Pydantic models for data serialization and deserialization
  • Defines a router for handling API requests related to component costs
  • Implements helper functions for grouping nodes by team, building team bundles, and processing team component costs
  • Utilizes OpenAI's API to search for commercial office rent data and cache the results

Important Functions

  • group_nodes_by_team(nodes: List[NodeIn]) -> Dict[str, List[NodeIn]]: Groups nodes by team ID
  • build_team_bundle(team_id: str, team_name: str, process_type: str, nodes: List[NodeIn]) -> Dict[str, Any]: Builds a team bundle with relevant information
  • _search_infra_cost_using_web(city: str, country: str, process_type: str) -> Dict[str, Any]: Searches for commercial office rent data using OpenAI's API
  • get_infra_cost(city: str, country: str, process_type: str) -> Dict[str, Any]: Caches and retrieves infra cost data for a given city and country
  • _process_team_component_cost(team_id: str, team_nodes: List[NodeIn], process_type: str, all_locations: List[Tuple[str, str]]) -> Dict[str, Any]: Processes team component costs using cached infra cost data

Important Classes

  • NodeIn: A Pydantic model representing a node with team information
  • OfficeExpences: A Pydantic model representing office expenses
  • RunRequest: A Pydantic model representing a request to run a process

System Fit

This file is part of the CrewAI system, which is designed to provide a scalable and efficient platform for managing teams and their associated costs. The component_sol.py file plays a crucial role in this system by providing the necessary functionality for calculating component costs for teams. It integrates with OpenAI's API to retrieve commercial office rent data and utilizes caching to improve performance. The file is designed to be modular and reusable, making it easy to incorporate into larger applications.


agents/crew_agents/solutions/controlrework.py

Purpose

This file, controlrework.py, is part of the CrewAI system and provides a solution for control rework diagnosis. It takes in a request body containing project data and control rework diagnosis rows, and returns a list of control rework solution items.

Key Responsibilities

  • Validate and process input data from the request body
  • Build graph/lookups from project data
  • Create a rich loop context for the LLM (Large Language Model) for each control rework row
  • Optionally build a control → objective mapping from the Controls block
  • Return a list of control rework solution items

Important Functions

  • _to_int_safe: Converts a string to an integer safely
  • _to_float_safe: Converts a string to a float safely
  • _get_first_attr: Returns the first attribute of an object
  • _get_team_id: Returns the team ID from a team object
  • _get_team_name: Returns the team name from a team object
  • _get_activity_brs: Returns the activity BRS (Business Rules) from an activity object
  • _get_activity_systems: Returns the activity systems from an activity object
  • _get_activity_volume: Returns the activity volume from an activity object
  • _normalize_brs_for_output: Normalizes the BRS for output
  • _coerce_probability: Coerces a probability value to a float
  • _normalize_to_100_ints: Normalizes integers to 100
  • _recommended_reduction_allocation_100: Returns the recommended reduction allocation as a percentage
  • _suggest_brs_only_if_missing: Suggests BRS only if missing
  • extract_json_block: Extracts a JSON block from a string
  • _safe_parse_to_activity_dict: Safely parses a string to an activity dictionary
  • run_control_rework_solution: Runs the control rework solution
  • run_solution_control_rework: Runs the solution control rework

Important Classes

  • ControlReworkDiagnosisItem: Represents a control rework diagnosis item
  • ControlReworkSolutionInput: Represents the input for the control rework solution
  • TrainingItem: Represents a training item
  • RationalizeItem: Represents a rationalize item
  • DecisionProbabilitySuccessor: Represents a decision probability successor
  • DecisionProbabilityItem: Represents a decision probability item
  • AutomationItem: Represents an automation item
  • ActivityReworkSolutionResponse: Represents the response for the activity rework solution

System Fit

This file is part of the CrewAI system and is designed to work with the 3-Cubed Python system. It takes in a request body containing project data and control rework diagnosis rows, and returns a list of control rework solution items. The solution items are created by processing the input data and building a rich loop context for the LLM. The file uses various functions and classes to perform the necessary tasks, including data validation, graph/lookup building, and LLM context creation.


agents/crew_agents/solutions/control_effort_sol.py

Purpose

This file (control_effort_sol.py) contains the implementation of the Control Effort solution for the CrewAI system. It provides functionality for analyzing control efforts and suggesting improvements.

Key Responsibilities

  • Analyze control efforts and risks
  • Provide suggestions for improving control efforts
  • Integrate with the CrewAI system to retrieve and process project data

Important Functions

  • prepare_inputs: Prepares the inputs for the control effort analysis by filtering LODByObjRisk to only LOD > 3 and fetching ControlObjective and Activity information.
  • build_lod_control_blocks: Builds control blocks by indexing controls by ObjectiveId and activities by ID, and then iterating over LOD items to create control blocks.

Important Classes

  • ControlAct: Represents a control activity with attributes such as ID, label, effort, and efficacy.
  • ObjectiveRiskLOD: Represents an objective-risk LOD with attributes such as ObjectiveId, RiskId, effort, and LOD.
  • ControlObjective: Represents a control objective with attributes such as ObjectiveId, ObjectiveText, and Risks.
  • ProjectData: Represents project data with attributes such as project ID, instance, activities, teams, arrows, controls, and nva.
  • RemoveControlSuggestion: Represents a suggestion to remove a control with attributes such as objective ID, risk ID, LOD, and reason.
  • ControlNvaSuggestion: Represents a suggestion to improve control efforts with attributes such as objective ID, risk ID, LOD, control activity ID, and reason.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI system, which is designed to provide a platform for analyzing and improving control efforts. The Control Effort solution is a key component of this system, providing functionality for analyzing control efforts and suggesting improvements. The solution integrates with the CrewAI system to retrieve and process project data, and provides a set of classes and functions for analyzing and improving control efforts.


agents/crew_agents/solutions/control_effort_sol_final.py

Purpose

This file, control_effort_sol_final.py, contains the implementation of a control effort solution for the CrewAI system. It defines models and functions to detect over-controls and redundancy in control activities.

Key Responsibilities

  • Define models for control activities, risks, and objectives
  • Implement a function to build a flat list of controls for the Control Redundancy (Over Controlled) agent
  • Compute effectiveness scores for control activities

Important Functions

  • build_control_redundancy_input: Builds a flat list of controls for the Control Redundancy (Over Controlled) agent by filtering LODByObjRisk items with LOD > 3 and computing effectiveness scores for control activities.

Important Classes

  • ControlAct: Represents a control activity with attributes such as ID, label, effort, and effectiveness score.
  • LODByObjRiskItem: Represents a LODByObjRisk item with attributes such as objective ID, risk ID, objective text, risk name, effort, and LOD.
  • ControlItem: Represents a control item with attributes such as control activity ID, control type, risk activity ID, team score, BR score, and level.
  • ControlObjective: Represents a control objective with attributes such as objective ID, objective text, and risks.
  • ControlRedundancyCandidate: Represents a control redundancy candidate with attributes such as objective ID, objective text, risk ID, risk name, LOD, control ID, control label, effort hours, effectiveness score, ID type, team score, BR score, and level.
  • ControlRedundancySolutionInput: Represents a control redundancy solution input with a list of control redundancy candidates.
  • ProjectData: Represents a project data object with attributes such as project ID, instance, activities, arrows, teams, controls, LODByObjRisk, and feedbacks.

System Fit

This file fits into the wider 3-Cubed Python system by providing a control effort solution that can be used in conjunction with other agents to detect over-controls and redundancy in control activities. The build_control_redundancy_input function can be used to feed data into the Control Redundancy (Over Controlled) agent, which can then provide feedback to the system.


agents/crew_agents/solutions/control_redundancy_final.py

Purpose

This file, control_redundancy_final.py, is part of the CrewAI system and is responsible for implementing a Control Redundancy solution agent. Its primary goal is to identify and eliminate or modify redundant controls in a project, thereby reducing effort and improving effectiveness.

Key Responsibilities

  • Process project data to identify potential redundant controls
  • Compute effectiveness scores for each control
  • Provide a list of redundant control candidates for further analysis and decision-making

Important Functions

  • build_control_redundancy_input: Builds a flat list of controls for the Control Redundancy agent by filtering LODByObjRisk items with LOD > 3 and computing effectiveness scores for each control.
  • run_control_redundancy: Not clear from code
  • prepare_inputs: Not clear from code
  • control_redundancy_analyst: Not clear from code
  • control_redundancy_task: Not clear from code
  • control_redundancy_crew: Not clear from code

Important Classes

  • ControlAct: Represents a control activity with attributes such as ID, label, effort, and effectiveness.
  • LODByObjRiskItem: Represents a LOD (Level of Detail) item by objective risk with attributes such as objective ID, risk ID, effort, and LOD.
  • ControlItem: Represents a control item with attributes such as control activity ID, control type, risk activity ID, and effectiveness score.
  • ControlRisk: Represents a control risk with attributes such as risk ID, risk name, and list of control items.
  • ControlObjective: Represents a control objective with attributes such as objective ID, objective text, and list of control risks.
  • ProjectData: Represents project data with attributes such as project ID, instance, activities, arrows, teams, controls, and LODByObjRisk items.
  • ControlRedundancyCandidate: Represents a redundant control candidate with attributes such as objective ID, risk ID, LOD, control ID, effort hours, and effectiveness score.
  • ControlRedundancySolutionInput: Represents the input to the Control Redundancy solution agent with a list of redundant control candidates.
  • ControlRedundancyDecision: Represents a decision made by the Control Redundancy solution agent with attributes such as objective ID, risk ID, LOD, control ID, decision, and reason.
  • ControlRedundancySolutionOutput: Represents the output of the Control Redundancy solution agent with a list of decisions.

System Fit

This file is part of the CrewAI system, which is designed to provide a comprehensive solution for project management and control. The Control Redundancy solution agent is a key component of this system, helping to identify and eliminate or modify redundant controls to improve project efficiency and effectiveness.


agents/crew_agents/solutions/criticalpath.py

Purpose

This file, criticalpath.py, is part of the CrewAI codebase and provides functionality for extracting critical path information from CrewAI data. It includes functions for parsing critical path tokens, extracting deadlines and delays on the critical path, and building indexes for activities and teams.

Key Responsibilities

  • Extract critical path information from CrewAI data
  • Parse critical path tokens and extract activity IDs and names
  • Extract deadlines and delays on the critical path
  • Build indexes for activities and teams

Important Functions

  • critical_path_id_name(data: Dict[str, Any]): Extracts critical path information, including activity IDs and names, from the provided data.
  • critical_path_base_ids(data: Dict[str, Any]): Returns a list of activity IDs on the critical path.
  • deadlines_on_critical_path(data: Dict[str, Any]): Extracts deadlines on the critical path, including deadline type, value, and hours.
  • delays_on_critical_path_minimal(data: Dict[str, Any]): Extracts delays on the critical path, including delay and delay types.

Important Classes

  • DeadlineRecommendationItem: Represents a deadline recommendation item.
  • DeadlineRecommendationOutput: Represents the output of a deadline recommendation.
  • WaitFix: Represents a wait fix.
  • WaitRecommendationItem: Represents a wait recommendation item.
  • WaitRecommendationOutput: Represents the output of a wait recommendation.
  • BatchToSerialItem: Represents a batch to serial item.
  • BatchToSerialOutput: Represents the output of a batch to serial recommendation.

System Fit

This file is part of the 3-Cubed Python system, which is designed to provide a comprehensive solution for managing and optimizing workflows. The criticalpath.py file is responsible for extracting critical path information from CrewAI data, which is then used to inform recommendations and decisions within the system. The file fits into the wider system by providing a critical component of the workflow optimization pipeline.


agents/crew_agents/solutions/digitization_crew.py

Purpose

This file, digitization_crew.py, is part of the CrewAI system and is responsible for managing the digitization process of forms and activities within a project. It provides tools and classes for retrieving activity details, enriching forms with digitization attributes, and preparing inputs for the digitization process.

Key Responsibilities

  • Retrieve activity details and forms associated with activities
  • Enrich forms with digitization attributes
  • Prepare inputs for the digitization process
  • Manage the digitization crew, including preparing inputs and processing results

Important Functions

  • lookup_activities_by_ids: Retrieves activities from the automation activities list based on provided activity IDs.
  • lookup_activity_details: Retrieves details for a given activity, including forms, rules, and systems.
  • enrich_forms_for_activity: Enriches a single activity with digitized form attributes from the digitized forms data.
  • prepare_inputs: Prepares inputs for the digitization process, including filtering digitized forms data.
  • process_results: Not clear from code, but likely processes the results of the digitization process.

Important Classes

  • DigitizationCrew: A class that manages the digitization crew, including preparing inputs and processing results.
  • AutomationCrew: Not clear from code, but likely a class that manages the automation crew.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI module, which is responsible for managing the digitization process of forms and activities within a project. The digitization_crew.py file provides tools and classes that can be used by other modules and agents within the system to manage the digitization process.

Additional Notes

  • The file uses various tools and libraries, including CrewAI, LangChain, and Chroma, to manage the digitization process.
  • The file includes several functions and classes that are not clear from the code, including process_results and AutomationCrew. These may be part of the larger system and are not documented here.

agents/crew_agents/solutions/effectiveness_sol_final.py

Purpose

This file, effectiveness_sol_final.py, is part of the CrewAI system and provides a solution for evaluating the effectiveness of controls in a project. It uses the CrewAI framework to process project data and generate a control effectiveness solution.

Key Responsibilities

  • Process project data to extract relevant information
  • Build a subgraph context from feedback data
  • Evaluate the effectiveness of controls and generate a solution
  • Provide a control effectiveness solution as output

Important Functions

  • _build_activity_index: Builds an index of activities by their IDs
  • _build_team_index: Builds an index of teams by their IDs
  • _extract_brs: Extracts BRs (Business Rules) from an activity
  • _build_subgraph_context: Builds a minimal subgraph from feedback data
  • prepare_inputs: Prepares the inputs for the control effectiveness solution
  • run_control_effectiveness_sol: Runs the control effectiveness solution (not shown in this code snippet)

Important Classes

  • ControlItem: Represents a control item with its attributes
  • RiskItem: Represents a risk item with its attributes
  • ControlObjective: Represents a control objective with its attributes
  • ProjectData: Represents project data with its attributes
  • ControlEffectivenessSolutionItem: Represents a control effectiveness solution item with its attributes
  • ControlEffectivenessSolution: Represents a control effectiveness solution with its attributes
  • ControlEffectivenessCrew: A CrewAI crew that provides the control effectiveness solution

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI framework. It uses the CrewAI framework to process project data and generate a control effectiveness solution. The solution is then provided as output by the ControlEffectivenessCrew class. The file is designed to be used in conjunction with other CrewAI components to provide a comprehensive solution for evaluating the effectiveness of controls in a project.


agents/crew_agents/solutions/effort_skill_sol_final.py

Purpose

This file, effort_skill_sol_final.py, is a solution agent for the 3-Cubed Python system, specifically designed to reduce manual effort (AHT) by removing unnecessary high-complexity business rules, reallocating work to cheaper suitable teams, or training the current team to execute complex rules faster.

Key Responsibilities

  • Prepare inputs for the solution agent
  • Run the effort skill solution agent to make decisions on high-skill activities
  • Provide a crew class for the effort skill solution solution

Important Functions

  • prepare_inputs: Prepares inputs for the solution agent, including activities, skill diagnosis, and work allocation diagnosis.
  • effort_skill_solution_agent: Runs the effort skill solution agent to make decisions on high-skill activities.
  • effort_skill_solution_crew: Provides a crew class for the effort skill solution solution.

Important Classes

  • EffortSkillSolutionCrew: A crew class that provides a solution for reducing manual effort (AHT) by removing unnecessary high-complexity business rules, reallocating work to cheaper suitable teams, or training the current team to execute complex rules faster.
  • EffortSkillSolutionAgent: An agent class that makes decisions on high-skill activities.

System Fit

This file fits into the wider 3-Cubed Python system as a solution agent that can be used to reduce manual effort (AHT) in various projects. It can be integrated with other components of the system, such as the work allocation solution, to provide a comprehensive solution for project optimization.

Notes

  • The EffortSkillSolutionCrew class uses the before_kickoff hook to prepare inputs for the solution agent.
  • The effort_skill_solution_agent function runs the effort skill solution agent to make decisions on high-skill activities.
  • The EffortSkillSolutionAgent class is not defined in this file, but it is used by the effort_skill_solution_crew class.
  • The WorkAllocationSolution class is not defined in this file, but it is used by the prepare_inputs function.

agents/crew_agents/solutions/effort_skill_sol_final_control.py

Purpose

This file, effort_skill_sol_final_control.py, is part of the 3-Cubed Python system and provides a solution for effort skill optimization in project management. It uses the CrewAI framework to create an agent that recommends modifications to project activities based on skill diagnosis and work allocation solutions.

Key Responsibilities

  • Prepare inputs for the effort skill solution agent
  • Create an effort skill solution agent that recommends modifications to project activities
  • Integrate with the CrewAI framework to create a crew that can be used in the 3-Cubed system

Important Functions

  • prepare_inputs: Prepares the inputs for the effort skill solution agent, including activities, skill diagnosis, work allocation solutions, and control activity IDs.
  • effort_skill_solution_agent: Creates an effort skill solution agent that recommends modifications to project activities based on skill diagnosis and work allocation solutions.

Important Classes

  • EffortSkillSolutionCrew: A crew class that uses the effort skill solution agent to recommend modifications to project activities.
  • EffortSkillSolutionItem: A class that represents a single effort skill solution item, including the activity ID, name, decision, change, and reason.
  • EffortSkillSolutionResult: A class that represents the result of the effort skill solution, including a list of effort skill solution items.

System Fit

This file fits into the wider 3-Cubed Python system by providing a solution for effort skill optimization in project management. It uses the CrewAI framework to create an agent that recommends modifications to project activities based on skill diagnosis and work allocation solutions. The effort skill solution crew can be used in the 3-Cubed system to optimize project activities and improve project outcomes.

Notes

  • The prepare_inputs function expects a ProjectData object and an optional WorkAllocationDiagnosis list as inputs.
  • The effort_skill_solution_agent function creates an effort skill solution agent that recommends modifications to project activities based on skill diagnosis and work allocation solutions.
  • The EffortSkillSolutionCrew class uses the effort skill solution agent to recommend modifications to project activities.
  • The EffortSkillSolutionItem and EffortSkillSolutionResult classes represent the effort skill solution items and result, respectively.

agents/crew_agents/solutions/merge_teams_sol.py

Purpose

This file, merge_teams_sol.py, is part of the CrewAI system and provides a solution for merging teams based on their activities and available hours. It uses FastAPI and CrewAI's Agent and Task classes to implement the team merging logic.

Key Responsibilities

  • Prepare inputs for the team merging process
  • Extract team activity summaries
  • Suggest team merges based on semantic similarity of business requirements (BRs) and cost considerations
  • Provide a solution for merging teams

Important Functions

  • prepare_inputs: Prepares the inputs for the team merging process by extracting team activity summaries and filtering out inactive or system teams.
  • extract_team_activity_summary: Groups activities by team and creates a summary of each team's activities.
  • team_merge_analyst: Not implemented in this code snippet, but would return an Agent instance responsible for suggesting team merges.

Important Classes

  • TeamMergerCrew: A Crew class that implements the team merging logic.
  • TeamMergePairSuggestion: A data model representing a suggested team merge pair.
  • TeamMergeSolution: A data model representing a team merge solution.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI module, which provides a framework for building and managing AI-powered teams. The merge_teams_sol.py file is designed to work with the CrewAI Agent and Task classes to implement the team merging logic. The solution is intended to be used in conjunction with other CrewAI modules to provide a comprehensive team management system.


agents/crew_agents/solutions/merge_teams_sol_final.py

Purpose

This file, merge_teams_sol_final.py, is part of the CrewAI system and provides a solution for merging teams based on project data. It defines several classes and functions to prepare inputs for the team merger process.

Key Responsibilities

  • Prepare project data for team merger analysis
  • Identify active non-system teams
  • Group activities by team
  • Extract control activity IDs from project controls
  • Build team blocks with activity information
  • Build control handoffs for LLM processing

Important Functions

  • prepare_inputs: Prepares project data for team merger analysis by filtering active non-system teams and grouping activities by team.
  • team_merge_analyst: Not clear from code.
  • team_merge_task: Not clear from code.
  • merger_crew: Not clear from code.

Important Classes

  • AvailableHour: Represents an hour slot with available headcount.
  • Team: Represents a team with attributes such as ActorId, ActorName, WorkingHours, and AvilableHours.
  • ControlItem: Represents a control item with attributes such as ControlActivityId, ControlActivityIds, and TeamScore.
  • ControlRisk: Represents a control risk with attributes such as RiskId, RiskName, and Controls.
  • ControlObjective: Represents a control objective with attributes such as ObjectiveId, ObjectiveText, and Risks.
  • ProjectData: Represents project data with attributes such as project_id, instance, Activities, Teams, Arrows, and Controls.
  • TeamMergePairSuggestion: Represents a team merge pair suggestion with attributes such as team_id, team_name, merge_team_id, merge_team_name, decision, and reason.
  • TeamMergeSolution: Represents a team merge solution with a list of team merge pair suggestions.

System Fit

This file is part of the CrewAI system and is designed to work with the CrewBase class and the oai_llm1 model from the crew_llm module. The solution is intended to be used in conjunction with the CrewAI project data and the LLM processing pipeline.


agents/crew_agents/solutions/NVA_crew.py

Purpose

This file, NVA_crew.py, contains the implementation of the NVA (Non-Value-Added) assessment and recommendation crew for the 3-Cubed Python system. It utilizes various agents and tasks to analyze and reengineer activities, ultimately providing suggestions for improvement.

Key Responsibilities

  • Analyze activities and identify opportunities for reengineering
  • Provide suggestions for consolidation, redundancy elimination, standardization, and elimination
  • Utilize language models and graph algorithms to support the reengineering process
  • Integrate with other components of the 3-Cubed system to provide a comprehensive solution

Important Functions

  • extract_activity_attributes: Extracts relevant attributes from activities, such as ID, name, NVA, AHT, and more.
  • aggregate_suggestions: Combines suggestions from various agents, including consolidation, redundancy elimination, standardization, and elimination, to provide a comprehensive set of recommendations.
  • summarize_reengineering_benefit: Calculates the total benefit of reengineering activities based on the suggestions provided.

Important Classes

  • NVAAssessmentCrew: Represents the NVA assessment crew, responsible for analyzing activities and identifying opportunities for reengineering.
  • NVARecommendationCrew: Represents the NVA recommendation crew, responsible for providing suggestions for reengineering activities.

System Fit

This file fits into the wider 3-Cubed Python system by providing a comprehensive solution for NVA assessment and recommendation. It integrates with other components, such as language models and graph algorithms, to support the reengineering process. The NVAAssessmentCrew and NVARecommendationCrew classes are designed to work together to provide a seamless experience for users.

Additional Notes

  • The file utilizes various external libraries and tools, including CrewAI, LangChain, and NetworkX.
  • The implementation is based on the CrewAI framework, which provides a structured approach to building and deploying AI-powered agents and tasks.
  • The file is designed to be modular and extensible, allowing for easy integration with other components of the 3-Cubed system.

agents/crew_agents/solutions/nva_solution.py

Purpose

This file, nva_solution.py, is part of the CrewAI system and contains the implementation of a crew agent responsible for NVA (Non-Value-Added) effort solutioning. The agent takes in NVA-diagnosed activities, decides on elimination, automation, modification, or retention, and specifies the change and reason using FRD (Decision/Change/Reason) logic.

Key Responsibilities

  • Prepare inputs for the NVA effort solution agent
  • Run the NVA effort solution agent to generate solution rows for each diagnosed NVA activity
  • Provide a crew agent that can be used to solve NVA effort problems

Important Functions

  • prepare_inputs: This function prepares the inputs for the NVA effort solution agent by filtering valid activities, building a subgraph, and computing predecessors and successors maps.
  • nva_solution_agent: This function returns an instance of the NVA effort solution agent, which is responsible for generating solution rows for each diagnosed NVA activity.

Important Classes

  • NVAsolutionCrew: This class represents the NVA effort solution crew and contains the prepare_inputs and nva_solution_agent functions.
  • ProjectData: This class represents the project data and contains attributes such as project_id, instance, Activities, Arrows, and Teams.
  • SolutionRow: This class represents a solution row and contains attributes such as activity_id, name, decision, change, estimated_effort_reduction_pct, and reason.
  • EffortSolutionResult: This class represents the effort solution result and contains a list of solution rows.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI module. The CrewAI module is responsible for providing a framework for building and deploying AI-powered agents to solve complex problems. The NVA effort solution crew agent is a specific implementation of this framework, designed to solve NVA effort problems using FRD logic.


agents/crew_agents/solutions/nva_solution_final_control_effort.py

Purpose

This file contains the implementation of the NVA solution final control effort crew agent, responsible for deciding Eliminate / Automate / Modify / Retain + Change + Reason for NVA-diagnosed activities.

Key Responsibilities

  • Prepare inputs for the NVA solution final control effort crew agent
  • Filter valid activities and build a subgraph
  • Run NVA classification and diagnose type per activity
  • Determine control effort for each activity

Important Functions

  • prepare_inputs: Prepares inputs for the NVA solution final control effort crew agent
  • run_nva_control_effort: Runs the NVA control effort algorithm (not shown in this file)

Important Classes

  • NVAsolutionCrew: The crew agent responsible for NVA solutioning
  • ControlItem, RiskItem, ControlObjective, ProjectData, SolutionRow, EffortSolutionResult: Data models used to represent control items, risks, control objectives, project data, solution rows, and effort solution results

System Fit

This file is part of the 3-Cubed Python system, specifically the crew_agents module. It is designed to work with the crewai library and is intended to be used in conjunction with other crew agents to provide a comprehensive solution for NVA diagnosis and control effort determination.


agents/crew_agents/solutions/rej_solution.py

Purpose

This file, rej_solution.py, is part of the CrewAI system and contains a solution for analyzing and identifying undesired solutions in a project. It uses machine learning and graph analysis to provide insights into the effort and reasons behind the undesired solutions.

Key Responsibilities

  • Analyze project data to identify undesired solutions
  • Use graph analysis to identify paths leading to undesired solutions
  • Provide insights into the effort and reasons behind undesired solutions
  • Offer suggestions for improvement

Important Functions

  • prepare_inputs: Prepares the inputs for the analysis by normalizing the project data and building minimal outputs.
  • early_br_alignment_analyst: Not clear from code.
  • early_br_alignment_task: Not clear from code.
  • undesired_solution_crew: The main function that runs the analysis and provides insights into the undesired solutions.
  • run_rej_sol: Not clear from code.

Important Classes

  • UndesiredSolutionCrew: A crew that is responsible for analyzing the effort in a process and identifying the different reasons for the effort.
  • NVAItem: A Pydantic model that represents an NVA item with activity ID, name, and reason.
  • AutomationItem: A Pydantic model that represents an automation item with activity ID, name, and reason.
  • ProjectData: A Pydantic model that represents project data with activities, arrows, teams, paths, and undesired ends.
  • DecisionBranchPercent: A Pydantic model that represents a decision branch percentage with to ID, to name, and percentage.
  • BRFlipSuggestion: A Pydantic model that represents a BR flip suggestion with change at activity ID, change at activity name, and decision branch percentages.
  • PathBRFlip: A Pydantic model that represents a path BR flip with a suggestion.
  • BRFlipResult: A Pydantic model that represents a BR flip result with a list of path BR flips.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI solution for analyzing and identifying undesired solutions in a project. It uses machine learning and graph analysis to provide insights into the effort and reasons behind the undesired solutions, and offers suggestions for improvement. The file is designed to be used in conjunction with other CrewAI components to provide a comprehensive solution for project analysis and improvement.


agents/crew_agents/solutions/rej_solution_cost.py

Purpose

This file, rej_solution_cost.py, is part of the CrewAI system and is responsible for implementing a solution runner for cost flow analysis. It provides a set of functions and classes to prepare inputs, compute cost solutions, and handle undesired solution crews.

Key Responsibilities

  • Prepare inputs for cost solution computation
  • Compute cost solutions for given project data
  • Handle undesired solution crews
  • Provide a solution runner for cost flow analysis

Important Functions

  • prepare_inputs: Prepares inputs for cost solution computation by filtering valid activities, building a subgraph, and computing a depth-first search order.
  • cost_solution_agent: Not clear from code.
  • cost_solution_task: Not clear from code.
  • cost_solution_crew: Not clear from code.
  • run_rej_cost_solution: Runs the rejection cost solution by preparing inputs, computing cost solutions, and handling undesired solution crews.

Important Classes

  • ProjectData: Represents project data, including activities, arrows, teams, paths, and undesired ends.
  • CostResultItem: Represents a cost result item, including activity ID, activity name, decision, change, reason, and simulation.
  • CostPathSolution: Represents a cost path solution, including path ID, end ID, activity IDs, and results.
  • CostUndesiredSolutionCrew: Represents an undesired solution crew, including methods for preparing inputs and handling undesired solution crews.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI solution runner framework. It provides a specific implementation for cost flow analysis and is designed to work with other components of the system, such as the CrewAI project and graph utilities.


agents/crew_agents/solutions/rej_solution_cx.py

Purpose

This file, rej_solution_cx.py, contains the implementation of a solution runner for the CrewAI system, specifically designed to handle customer experience (CX) solutions. It utilizes the CrewAI framework to process project data and generate CX results.

Key Responsibilities

  • Process project data to generate CX results
  • Utilize the CrewAI framework to handle solution runners
  • Integrate with other solution runners (NVA, automation, reworks) for feedback and processing

Important Functions

  • prepare_inputs: Builds rejection paths and metadata for activities based on project data and undesired ends
  • _g: A helper function for getting attributes from objects or dictionaries
  • run_cx_solution: Not clear from code (not implemented in the provided snippet)

Important Classes

  • ProjectData: A Pydantic model representing project data, including activities, arrows, teams, reworks, paths, undesired ends, and feedback
  • CXResultItem: A Pydantic model representing a single CX result item, including activity ID, name, decision, change, reason, and simulation
  • CXPathSolution: A Pydantic model representing a path solution, including path ID, end ID, activity IDs, and results
  • CXUndesiredSolutionCrew: A CrewBase class implementing the CX undesired solution crew, including the prepare_inputs method

System Fit

This file fits into the wider 3-Cubed Python system as a solution runner for CX solutions. It integrates with other solution runners (NVA, automation, reworks) and utilizes the CrewAI framework to process project data and generate CX results. The CXUndesiredSolutionCrew class is a key component of this system, responsible for preparing inputs and generating CX results.


agents/crew_agents/solutions/reworks.py

Purpose

This file, reworks.py, contains the implementation of a rework solution agent for the CrewAI system. The agent's purpose is to analyze and diagnose rework issues in a given project, providing recommendations to reduce rework volume and loop length.

Key Responsibilities

  • Analyze diagnostic output to identify the source of rework
  • Remove non-value-added (NVA) activities inside the loop
  • Reduce rework volume by aligning business rules, systems, and actor skills
  • Reduce loop length by moving the loop arrow earlier or splitting the decision activity
  • Output the result in a structured format

Important Functions

  • _md: Not clear from code
  • _to_int_safe and _to_float_safe: Convert values to integers or floats safely
  • _get_first_attr: Get the first attribute of an object
  • _get_team_id and _get_team_name: Get the team ID and name from an object
  • _get_activity_team_id and _get_activity_brs: Get the activity team ID and business rules from an object
  • _coerce_probability: Coerce a probability value to a valid range
  • _normalize_to_100_ints: Normalize integers to a range of 0-100
  • _get_arrow_pred and _get_arrow_succ: Get the predecessor and successor activities from an object
  • _get_arrow_decision_per: Get the decision activity from an object
  • _tokens: Not clear from code
  • _too_similar: Not clear from code
  • _normalize_brs_for_output: Normalize business rules for output
  • _suggest_brs_inside_loop: Suggest business rules inside the loop
  • _training_row: Create a training row from an object
  • _rationalize_row: Rationalize a row from an object
  • _is_extreme_split: Check if a split is extreme
  • _recommend_mixed_reduce_all_inloop: Recommend a mixed reduction for all activities in the loop
  • extract_json_block: Extract a JSON block from an object
  • _safe_parse_overrides: Safely parse overrides from an object
  • run_rework_solution: Run the rework solution agent
  • run_solution_rework: Run the solution rework agent
  • prepare_inputs: Prepare inputs for the agent
  • rework_solution_agent: Run the rework solution agent
  • rework_solution_task: Run the rework solution task
  • rework_solution_crew: Run the rework solution crew
  • _team_name_for_activity: Get the team name for an activity

Important Classes

  • ReworkDiagnosisItem: Not clear from code
  • ProjectData: Not clear from code
  • TrainingItem: Not clear from code
  • RationalizeItem: Not clear from code
  • DecisionProbabilitySuccessor: Not clear from code
  • DecisionProbabilityItem: Not clear from code
  • AutomationItem: Not clear from code
  • ReworkSolutionResult: Not clear from code
  • SolutionReworkCrew: Not clear from code

System Fit

This file is part of the CrewAI system, which is a Python-based platform for automating business processes. The rework solution agent is designed to work within this system, analyzing diagnostic output and providing recommendations to reduce rework volume and loop length. The agent's output is structured and can be used to inform business decisions.


agents/crew_agents/solutions/shiftcost.py

Purpose

This file, shiftcost.py, is part of the CrewAI system and provides functionality for calculating shift work hours and related diagnostics. It utilizes the CrewAI framework and FastAPI for API routing.

Key Responsibilities

  • Calculate shift work hours and related diagnostics
  • Provide functionality for adjusting shift timing and dropping shifts and work hours
  • Utilize CrewAI framework and FastAPI for API routing

Important Functions

  • _safe_json_parse: Safely parses JSON output from agents into a dictionary
  • _norm_hhmm: Normalizes time strings to a standard format (HH:MM)
  • _hhmm_to_min: Converts time strings to minutes
  • _min_to_hhmm: Converts minutes to time strings
  • _window_minutes: Calculates the duration of a time window
  • _shift_duration_minutes_safe: Calculates the safe duration of a shift
  • build_peak_diagnosis_from_project: Builds a peak diagnosis from project data
  • run_solution_shift_workhours: Runs the shift work hours solution

Important Classes

  • ActivityIn: A flexible input model for activities
  • TeamIn: A flexible input model for teams
  • ShiftWorkHoursSolutionItem: A solution item for shift work hours
  • ShiftWorkHoursSolutionResult: A result object for shift work hours solutions
  • SolutionShiftWorkHoursCrew: A crew object for shift work hours solutions

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI framework. It provides functionality for calculating shift work hours and related diagnostics, which can be used in conjunction with other CrewAI components to provide a comprehensive solution for shift work hour optimization. The file utilizes FastAPI for API routing, allowing it to be easily integrated into a larger system.


agents/crew_agents/solutions/shiftscust.py

Purpose

This file, shiftscust.py, is part of the CrewAI system and provides a solution for shift work hours cost analysis. It utilizes FastAPI and ML models to diagnose and solve issues related to shift work hours.

Key Responsibilities

  • Provides a solution for shift work hours cost analysis
  • Utilizes FastAPI and ML models for diagnosis and solution
  • Handles input models for activities and arrows
  • Performs time-related calculations (e.g., shift duration, overlap minutes)
  • Robustly retrieves extra fields from input models

Important Functions

  • _safe_json_parse: Safely parses JSON output from agents
  • _norm_hhmm: Normalizes time strings to a standard format
  • _hhmm_to_min and _min_to_hhmm: Convert time strings to minutes and vice versa
  • _window_minutes: Calculates the duration between two time points
  • _shift_duration_minutes_safe: Calculates the safe duration of a shift
  • _overlap_minutes: Calculates the overlap between two time windows
  • _get_any: Robustly retrieves extra fields from input models
  • run_solution_shift_workhours_cx: Runs the solution for shift work hours cost analysis

Important Classes

  • ActivityIn: Input model for activities
  • ArrowIn: Input model for arrows
  • SolutionShiftWorkHoursCostCrew: Class for shift work hours cost analysis solution

System Fit

This file is part of the CrewAI system, which is designed to provide solutions for various crew-related problems. The shiftscust.py file specifically addresses the issue of shift work hours cost analysis, utilizing FastAPI and ML models to diagnose and solve problems. It interacts with other components of the CrewAI system, such as agents and tasks, to provide a comprehensive solution.


agents/crew_agents/solutions/workcost.py

Purpose

This file, workcost.py, is part of the CrewAI system and provides a solution agent for work allocation. It aims to reduce peak-driven cost and load concentration by reallocating tasks to teams with similar skill or competency clusters.

Key Responsibilities

  • Provides a solution agent for work allocation
  • Reduces peak-driven cost and load concentration
  • Reallocates tasks to teams with similar skill or competency clusters
  • Uses LLM (Large Language Model) to make decisions

Important Functions

  • _run_work_allocation_solution: The main function that runs the work allocation solution
  • _validate_change: Validates the change made by the LLM
  • _parse_change: Parses the change made by the LLM
  • prepare_inputs: Prepares the inputs for the LLM
  • work_allocation_solution_agent: The main function that runs the work allocation solution agent
  • work_allocation_solution_task: The main function that runs the work allocation solution task
  • work_allocation_solution_crew: The main function that runs the work allocation solution crew

Important Classes

  • SchedRow: Represents a schedule row with activity ID, name, actor ID, actor name, peak, and critical information
  • ProjectData: Represents the project data with activities, arrows, teams, schedule data, and work allocation feedback
  • WorkAllocationLLMRow: Represents the LLM output with decision, allocated team ID, allocated team name, change, and reason
  • WorkAllocationLLMResult: Represents the LLM result with a list of activities
  • WorkAllocationSolutionActivityItem: Represents the final API output with activity ID, name, current team ID, current team name, allocated team ID, allocated team name, decision, change, and reason
  • WorkAllocationSolutionResult: Represents the final API output with a list of activities

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI solution agent for work allocation. It uses the LLM to make decisions and provides a solution to reduce peak-driven cost and load concentration. The file is designed to work with the CrewAI system and provides a way to integrate with the LLM to make decisions.


agents/crew_agents/solutions/workcust.py

Purpose

This file, workcust.py, is part of the CrewAI system and provides a solution for work allocation critical path. It uses a combination of machine learning and business logic to determine the best team to allocate a critical activity to, in order to reduce customer delay.

Key Responsibilities

  • Process input data from the project, including activities, arrows, teams, and scheduled data
  • Analyze the critical path and identify candidate teams for reallocation
  • Validate capacity and fit for each candidate team
  • Select the best team for reallocation based on various criteria
  • Output the decision, change, and reason for the allocation

Important Functions

  • _to_int: converts a value to an integer, handling None and empty string cases
  • _to_bool_yes: converts a value to a boolean, treating "true", "1", "yes", and "y" as True
  • _activity_id, _activity_team_id, _activity_name, _team_id, _team_name, _team_cluster, _team_cap_avail: extract relevant information from activity and team objects
  • _build_maps: builds maps of team skills and competency clusters
  • _critical_path_ids: identifies critical path activity IDs
  • _peak_team_ids_from_sched: identifies team IDs from scheduled data
  • _sanitize_reason: sanitizes the reason for the allocation
  • _parse_change: parses the change required for the allocation
  • _team_peak_categories: categorizes teams based on their peak workload
  • _pick_candidates_for_activity: selects candidate teams for an activity
  • _fallback_choice: selects a fallback team if no suitable team is found
  • _run_llm_for_one_activity: runs the LLM for a single activity
  • _run_work_allocation_critical: runs the work allocation critical path solution
  • run_workallocation_critical: the main entry point for the work allocation critical path solution
  • cat_rank: ranks teams based on their capacity and fit
  • sort_key: sorts teams based on their capacity and fit

Important Classes

  • SchedRow: represents a scheduled row, containing activity and team information
  • ProjectData: represents the project input data, including activities, arrows, teams, and scheduled data
  • WorkAllocationCriticalSolutionActivityItem: represents an activity item in the solution output, containing information about the current and allocated teams
  • WorkAllocationCriticalSolutionResult: represents the solution output, containing a list of activity items

System Fit

This file is part of the CrewAI system, which is designed to provide a solution for work allocation critical path. The workcust.py file is responsible for processing input data, analyzing the critical path, and selecting the best team for reallocation. The output of this file is used to inform business decisions and optimize work allocation.


agents/crew_agents/solutions_bin/main.py

Purpose

This file, main.py, serves as the entry point for the CrewAI diagnostic agent. It sets up a FastAPI application that integrates various diagnostic and solution routers, enabling the agent to analyze and provide insights on process issues.

Key Responsibilities

  • Set up a FastAPI application
  • Integrate diagnostic routers for various analysis types (e.g., diagnosis, solution, controls, customer experience)
  • Handle incoming requests and route them to the corresponding diagnostic or solution router
  • Provide a /get_diastatus endpoint for retrieving diagnosis status

Important Functions

  • get_final_json: Handles POST requests to the /get_diastatus endpoint, retrieving diagnosis status from the database and returning the result as JSON

Important Classes

  • RetrieveInput: A Pydantic model representing the input data for the /get_diastatus endpoint, containing project_id and instance fields

System Fit

This file fits into the wider 3-Cubed Python system as the entry point for the CrewAI diagnostic agent. It integrates with various diagnostic and solution routers, enabling the agent to analyze and provide insights on process issues. The diagnostic agent is designed to work with the CrewAI system, which provides a framework for analyzing and improving business processes.


agents/crew_agents/solutions_bin/nva_solution.py

Purpose

This file, nva_solution.py, is part of the CrewAI system and contains the implementation of a crew agent responsible for analyzing the effort in a process using NVA (Non-Value-Added) classification. The agent uses machine learning models and graph analysis to identify and classify activities as NVA or non-NVA.

Key Responsibilities

  • Analyze the effort in a process using NVA classification
  • Use machine learning models and graph analysis to identify and classify activities
  • Filter valid activities and build a subgraph for analysis
  • Run NVA classification on filtered activities
  • Save the result for inspection (optional)

Important Functions

  • get_activity_metadata: Retrieves structured metadata for a specific activity by its ID.
  • prepare_inputs: Prepares the inputs for the NVA classification process, including filtering valid activities, building a subgraph, and computing predecessors and successors maps.
  • run_nva: Runs the NVA classification on filtered activities using the suggest_nva function.
  • nva_solution_agent: The main crew agent responsible for analyzing the effort in a process using NVA classification.

Important Classes

  • ProjectData: A Pydantic model representing project data, including activities, arrows, and teams.
  • SolutionRow: A Pydantic model representing a solution row, including activity ID, name, suggestion, AHT reduction percentage, and mode.
  • EffortSolutionResult: A Pydantic model representing the result of the NVA classification process, including a list of solution rows.
  • NVAsolutionCrew: The crew agent responsible for analyzing the effort in a process using NVA classification.

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI module, which is responsible for analyzing the effort in a process using various techniques, including NVA classification. The nva_solution.py file is a key component of this module, providing the implementation of the NVA classification process.


agents/crew_agents/validate/process_validation_crew.py

Purpose

This file, process_validation_crew.py, is part of the CrewAI system and is responsible for validating a process by analyzing its structure and recommending whether it should be a single project or split into multiple projects.

Key Responsibilities

  • Analyze the process structure using graph algorithms
  • Classify the process using a predefined classification system
  • Recommend whether the process should be a single project or split into multiple projects
  • Provide detailed reasoning and suggested new projects if split is recommended

Important Functions

  • get_team_name: Retrieves the name of a team given its ID
  • prepare_inputs: Prepares the necessary inputs for the validation process, including the project data and subgraph model
  • validation_results: Processes the output of the validation process and prints the results

Important Classes

  • ProcessActivity: Represents an activity in the process, including its ID, name, type, team ID, and team name
  • ProcessArrow: Represents an arrow in the process, including its predecessor and successor activity IDs and decision percentage
  • ProcessTeam: Represents a team, including its ID and name
  • Process_Classification: Represents the classification of the process, including its industry, sub-industry, functional area, and rationale
  • ProjectSplitSuggestion: Represents a suggested new project, including its name and list of activity IDs
  • ModelValidationOutput: Represents the output of the validation process, including the decision, rationale, and suggested new projects

System Fit

This file fits into the wider 3-Cubed Python system as part of the CrewAI crew, which is responsible for validating processes and recommending whether they should be single projects or split into multiple projects. The file uses various CrewAI tools and models to analyze the process structure and classify it, and provides detailed reasoning and suggested new projects if split is recommended.


agents/data_processing/data_loader.py

Purpose

This file, data_loader.py, is responsible for loading and preprocessing project data from a JSON file. It utilizes various functions and classes from other modules to perform data analysis and create dictionaries for quick lookups.

Key Responsibilities

  • Load project data from a JSON file
  • Preprocess project data to create dictionaries for quick lookups
  • Create the project graph
  • Compute paths and rework structures
  • Populate pActors and peaks
  • Compute objectives and lines of defense
  • Display project structure and summary

Important Functions

  • load_project_data(file_path: str) -> Optional[ProjectData]: Loads project data from a JSON file and returns a ProjectData object if successful.
  • preprocess_project_data(project_data: ProjectData): Preprocesses project data to create dictionaries for quick lookups.
  • generate_project_data(file_path): Loads and prepares project data, creating the project graph, computing paths and rework structures, and populating pActors and peaks.
  • prepare_project_data(): Loads and prepares project data, creating the project graph, computing paths and rework structures, and populating pActors and peaks.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system as part of the data processing pipeline. It loads and preprocesses project data from a JSON file, which is then used for further analysis and visualization. The functions and classes in this file are designed to work with other modules in the system, such as analysis and utils, to perform data analysis and create visualizations.


agents/data_processing/__init__.py

Purpose

Unable to read this file content.

Extracted Functions

None found.

Extracted Classes

None found.


agents/models/diagnostic_models.py

Diagnostic Models

======================

Purpose


This file contains diagnostic models used to analyze effort and activity data. It defines a class EffortAnalysisActivity to represent effort analysis activities and a class Config to configure the validation of these activities.

Key Responsibilities


  • Define a data model for effort analysis activities
  • Configure validation for effort analysis activities

Important Functions


  • None

Important Classes


EffortAnalysisActivity


The EffortAnalysisActivity class represents an effort analysis activity. It contains attributes such as ID, Name, Forms, BRs, Systems, product, AHT, Volume, Effort, NVA, Automation, TeamId, and In_Scope. These attributes are used to store and analyze effort and activity data.

Config


The Config class is used to configure the validation of effort analysis activities. It sets validate_by_name to True to enable validation by name.

System Fit


This file fits into the wider 3-Cubed Python system by providing a data model for effort analysis activities. It is used in conjunction with other models and services to analyze and visualize effort and activity data.


agents/models/output_models.py

Purpose

This file (output_models.py) contains Pydantic models used to represent output data from the 3-Cubed Python system. These models are used to structure and validate data related to automation analysis, digitization recommendations, and other output data.

Key Responsibilities

  • Define Pydantic models for output data
  • Validate and structure output data
  • Provide a standardized interface for accessing output data

Important Functions

None

Important Classes

The following classes are important and play a crucial role in the output models:

  • AutomationAnalysis: Represents analysis of each activity, including its ID, name, average handling time, automation type, forms, rules, systems, and related activities.
  • AutomationRecommendations: Represents automation recommendations for the project, including a list of AutomationAnalysis objects.
  • DigitizationRecommendation: Represents a digitization recommendation for an activity, including its ID, name, form mode, digitization point, method, and additional AHT.
  • DigitizationRecommendations: Represents a list of digitization recommendations.
  • DigitizedForm: Represents a digitized form, including its name, mode, digital status, machine readability, structure, activity IDs, digitization point, method, and additional AHT.
  • DigitizedForms: Represents a list of digitized forms.
  • AutomationSystem: Represents an automation system, including its name and office automation status.
  • AutomationSystems: Represents a list of automation systems.
  • DigitizedBR: Represents a digitized business rule, including its name and skill.
  • DigitizedBRs: Represents a list of digitized business rules.
  • AutomationActivity: Represents analysis of each activity, including its ID, name, average handling time, automation type, forms, rules, systems, and related activities.

System Fit

This file is part of the 3-Cubed Python system and is used to structure and validate output data. The models defined in this file are used to represent data related to automation analysis, digitization recommendations, and other output data. The output models are used to provide a standardized interface for accessing output data and to ensure data consistency and integrity.


agents/models/project_constants.py

Purpose

This file, project_constants.py, contains constants and functions related to the classification system used in the project. It loads a classification system from an Excel file and provides a data structure to represent the classification system.

Key Responsibilities

  • Load a classification system from an Excel file
  • Provide a data structure to represent the classification system
  • Define a set of predefined classification forms

Important Functions

load_classification_system_from_excel

Loads a classification system from an Excel file at the specified file_path. The function reads the Excel file, renames columns to match the expected format, and returns a ClassificationSystem object.

Important Classes

ClassificationSystem

Represents a classification system as a dictionary of industries, subindustries, and function groups. The class is defined using Pydantic's BaseModel to provide a structured and validated data structure.

System Fit

This file fits into the wider 3-Cubed Python system by providing a way to load and represent the classification system used in the project. The classification system is used to categorize and analyze data, and this file provides a standardized way to access and manipulate the classification system. The load_classification_system_from_excel function can be used to update the classification system from the latest Excel file, ensuring that the system remains up-to-date and accurate.


agents/models/project_models.py

Purpose

This file (project_models.py) defines Pydantic models for various entities in the 3-Cubed Python system, including control effectiveness, control activities, risks, control objectives, lines of defense, forms, business rules, products, deadline impacts, deadlines, and related activities.

Key Responsibilities

  • Define Pydantic models for data validation and serialization
  • Provide data structures for representing complex entities in the system
  • Implement data transformation and validation logic for specific fields

Important Functions

  • clean_product_name: Ensures ProductName is stripped and converted to lowercase
  • clean_root_product_name: Ensures RootProductName is stripped and converted to lowercase
  • convert_deadline_to_hours: Converts a deadline string into the total number of hours
  • convert_dlrelated: Not clear from code
  • clean_forms: Not clear from code
  • clean_brs: Not clear from code
  • clean_systems: Not clear from code

Important Classes

  • ControlEffectiveness: Represents the effectiveness score of a control based on coverage, team segregation, and timeliness
  • ControlActivity: Represents a control activity with its ID, type, efficacy, and effort
  • Risk: Represents a risk with its ID, name, and associated controls
  • ControlObjective: Represents a control objective with its ID, text, and associated risks
  • LOD: Represents the lines of defense score for a control objective and risk combination
  • Form: Represents a physical or digital form used in processing an activity
  • BR: Represents a business rule with its name and skill level
  • Product: Represents an activity output with its ID, name, parent ID, root ID, and conversion factors
  • DeadlineImpact: Represents the impact of a deadline on a team
  • DL: Represents a deadline with its type, value, related activity ID, and deadline impacts

System Fit

This file is part of the 3-Cubed Python system, which appears to be a project management and risk assessment tool. The models defined in this file provide a structured representation of various entities in the system, enabling data validation, serialization, and transformation. The file is likely used in conjunction with other components of the system to manage project data, assess risks, and make informed decisions.


agents/models/summary_models.py

Purpose

This file (summary_models.py) contains Pydantic models for various summary types used in the 3-Cubed Python system. These models define the structure of summary data, including key statistics, overviews, opportunities, root causes, recommendations, and expected benefits.

Key Responsibilities

  • Define the structure of summary data for different types of summaries
  • Provide a standardized way to represent summary data in the system
  • Enable easy validation and serialization of summary data

Important Functions

None

Important Classes

The following classes are the main components of this file:

  • EffortSummary: Represents an effort summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • EffortSummaryResult: Represents the result of an effort summary, containing a single EffortSummary instance.
  • ComponentCostSummary: Represents a component cost summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • ComponentCostSummaryResult: Represents the result of a component cost summary, containing a single ComponentCostSummary instance.
  • RedundancySummary: Represents a redundancy summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • RedundancySummaryResult: Represents the result of a redundancy summary, containing a single RedundancySummary instance.
  • SkillSummary: Represents a skill summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • SkillSummaryResult: Represents the result of a skill summary, containing a single SkillSummary instance.
  • RejectionSummary: Represents a rejection summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • RejectionSummaryResult: Represents the result of a rejection summary, containing a single RejectionSummary instance.
  • ControlSummary: Represents a control summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • ControlSummaryResult: Represents the result of a control summary, containing a single ControlSummary instance.
  • ControlReworkSummary: Represents a control rework summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • ControlReworkSummaryResult: Represents the result of a control rework summary, containing a single ControlReworkSummary instance.
  • ControlEffortSummary: Represents a control effort summary, containing key statistics, overview, opportunity, root cause, recommendation, and expected benefit.
  • ControlEffortSummaryResult: Represents the result of a control effort summary, containing a single ControlEffortSummary instance.

System Fit

This file is part of the 3-Cubed Python system, which is a comprehensive platform for analyzing and optimizing business processes. The summary models in this file are used to represent and store summary data generated by various analysis and optimization techniques. This data is then used to provide insights and recommendations to users, helping them make informed decisions to improve their business processes.


agents/models/__init__.py

Purpose

Unable to read this file content.

Extracted Functions

None found.

Extracted Classes

None found.


agents/utils/cache_util.py

agents/utils/cache_util.py

Purpose

This file provides utility functions and classes for caching data in a CSV file. It is designed to work with the CrewAI system, utilizing a Large Language Model (LLM) to generate values if they are not found in the cache.

Key Responsibilities

  • Load and save cache data from a CSV file
  • Provide a cache class that integrates with an LLM function
  • Offer methods for retrieving and updating cache values

Important Functions

  • _load_cache: Loads cache data from a CSV file into a dictionary
  • _save_cache: Saves the cache dictionary to a CSV file
  • get: Retrieves a value from the cache, generating it with the LLM if not found
  • update_cache: Updates a value in the cache and saves it to the CSV file

Important Classes

  • CsvAttributeClassifierWithCache: A class that integrates an LLM function with a cache, loading and saving data from a CSV file

System Fit

This file is part of the 3-Cubed Python system, specifically designed to work with the CrewAI system. It provides a caching mechanism that utilizes an LLM to generate values if they are not found in the cache. This allows for efficient storage and retrieval of data, while also leveraging the power of the LLM to generate new values as needed.


agents/utils/digitization_helpers.py

Purpose

This file, digitization_helpers.py, contains utility functions for digitizing forms and activities in the 3-Cubed Python system. It uses language models and graph algorithms to process and classify forms, business rules, and automation systems.

Key Responsibilities

  • Process forms, business rules, and automation systems from activity data
  • Classify forms as digital, machine-readable, or structured
  • Determine if a form is structured using a language model
  • Create digitized form objects and automation activity objects
  • Update automation activity forms and systems

Important Functions

  • get_dfs_order: Converts a subgraph model to a NetworkX graph and returns its DFS order.
  • get_unique_attributes: Processes activity data to create unique digitized form objects, automation activity objects, and automation system objects.
  • is_form_structured: Uses a language model to determine if a form is structured.
  • create_digitized_form: Creates a digitized form object from a form object.
  • update_automation_activity_forms: Updates the forms associated with an automation activity.
  • classify_activity_automation_type: Classifies an activity's automation type.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing utility functions for processing and classifying forms, business rules, and automation systems. It is used by other components of the system to create digitized form objects and automation activity objects, which are then used to update automation activity forms and systems. The file uses language models and graph algorithms to process and classify the data, making it an essential component of the system's digitization pipeline.


agents/utils/langchain_utils.py

Purpose

This file, langchain_utils.py, provides utility functions and classes for natural language processing (NLP) tasks, specifically for classifying business process activities using large language models (LLMs).

Key Responsibilities

  • Provides a function classify_nva_llm to classify business process activities as Action, Routing, Recording/Retrieval, or Reporting.
  • Utilizes LLMs from LangChain and OpenAI to generate classifications.
  • Defines a class NVAActionClassification to represent the classification results.

Important Functions

  • classify_nva_llm: This function takes in various parameters related to a business process activity and uses an LLM to classify it as one of the four types (Action, Routing, Recording/Retrieval, or Reporting).
    • It uses a prompt template to provide context and definitions for the LLM to classify the activity.
    • It utilizes a RunnableLambda to post-process the LLM's output and ensure it conforms to the expected classification types.

Important Classes

  • NVAActionClassification: This class represents the classification results of a business process activity.
    • It has two attributes: NVA and Action, which correspond to the classification type and the specific activity being classified.

System Fit

This file fits into the wider 3-Cubed Python system by providing a utility for classifying business process activities using LLMs. It can be used in conjunction with other components of the system to analyze and understand business processes. The classify_nva_llm function can be called from other parts of the system to classify activities and generate insights.


agents/utils/nvautil.py

Purpose

This file, nvautil.py, contains a utility function suggest_nva that uses a strict LLM prompt to classify an activity into one of four categories: Action, Routing, RecordRetrieve, or Reporting.

Key Responsibilities

  • Classify an activity into one of four categories based on detailed context
  • Use a strict LLM prompt to inform the classification decision
  • Save the prompt to a log file before sending it to the LLM

Important Functions

  • suggest_nva: The main function that takes in various activity details and returns a classification category
    • This function uses a strict LLM prompt to classify the activity
    • It saves the prompt to a log file before sending it to the LLM
    • It returns one of the four classification categories: Action, Routing, RecordRetrieve, or Reporting

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing a utility function for classifying activities. The suggest_nva function can be used in other parts of the system to classify activities and inform decision-making processes. The strict LLM prompt used in this function ensures that the classification decisions are consistent and reliable.

Note: The llm parameter in the suggest_nva function suggests that this file is part of a larger system that uses a Large Language Model (LLM) for classification tasks. The nva_files and log_files directories also suggest that this file is part of a larger system that handles file storage and logging.


agents/utils/project_utils.py

Purpose

This file, project_utils.py, contains utility functions for working with project data in the 3-Cubed Python system. It provides functions for displaying project structure, retrieving project file paths, saving project data to JSON, and processing subgraphs for agents.

Key Responsibilities

  • Display project structure
  • Retrieve project file paths
  • Save project data to JSON
  • Process subgraphs for agents
  • Retrieve activities, arrows, and teams by ID

Important Functions

display_project_structure(project_data)

Displays the structure of the project data, including the number of items in each category and the first item in each category.

get_project_file_path()

Retrieves the path to the project JSON file. If the file exists at a hardcoded path, it is used. Otherwise, a file dialog is opened to select the file.

save_project_data_to_json(project_data, file_path)

Saves the project data to a JSON file in the same directory as the input file path. The file will be named {project_ID}_project_data.json.

get_activity_by_id(activity_id, activity_dict)

Retrieves an activity object from the dictionary by ID.

get_arrow_by_ids(predecessor_id, successor_id, arrow_dict)

Retrieves an arrow object from the dictionary by Predecessor and Successor IDs.

get_team_by_id(team_id, teams_dict)

Retrieves a team object from the dictionary by ID.

process_subgraph_for_agent(subgraph, arrow_dict)

Extracts a subgraph, converts it to a Pydantic model, and filters project data.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing utility functions for working with project data. It is likely used in conjunction with other files that handle project data, such as project_models.py and agents.py. The functions in this file are designed to be reusable and can be imported and used in other parts of the system.


agents/utils/similarity_utils.py

Purpose

This file, similarity_utils.py, contains utility functions for computing similarity between activities in the CrewAI system. It uses natural language processing (NLP) and graph algorithms to identify opportunities for improvement.

Key Responsibilities

  • Compute semantic similarity between activity names using Sentence Transformers
  • Embed activity attributes (forms, systems, BRs, products) into vector space
  • Calculate semantic overlap between activity attributes
  • Enrich pairs with path connectivity information from the graph model
  • Group pairs by opportunity type (Redundancy, Standardization, Consolidation)
  • Build bidirectional similarity maps from pairs

Important Functions

  • get_embedding_model(): Returns a SentenceTransformer model for encoding activity names and attributes.
  • embed_list_items(attribute_lists, model): Embeds a list of items into vector space using the provided model.
  • list_semantic_overlap(list1, list2, item_embeddings): Calculates the semantic overlap between two lists of items.
  • compute_activity_similarity(activity_attributes, threshold): Computes similarity between activity attributes and returns a list of pairs.
  • enrich_with_path_connectivity(pairs, graph_model, activities): Enriches pairs with path connectivity information from the graph model.
  • group_pairs_by_opportunity_type(pairs, opportunity_type): Groups pairs by opportunity type and returns a list of connected components.
  • build_similarity_map(pairs, filter_fn): Builds a bidirectional similarity map from pairs, optionally applying a filter function.

Important Classes

None

System Fit

This file fits into the wider 3-Cubed Python system by providing utility functions for computing similarity between activities. It is used in conjunction with the graph model and activity attributes to identify opportunities for improvement. The functions in this file are used to compute semantic similarity, embed activity attributes, and group pairs by opportunity type, which are then used to build bidirectional similarity maps.


agents/utils/similarity_utils_new.py

Purpose

This file, similarity_utils_new.py, contains utility functions for computing similarity between activities in the CrewAI system. It provides methods for formatting activities for embedding, computing semantic overlap, inferring attribute weights, comparing activities, and computing batch pairwise similarity.

Key Responsibilities

  • Format activities for embedding into a format suitable for the SentenceTransformer model.
  • Compute semantic overlap between lists of strings using embeddings.
  • Infer attribute weights from variance across pairs of activities.
  • Compare two activities and return a detailed similarity breakdown.
  • Compute batch pairwise similarity between activities using formatted fields and inferred weights.

Important Functions

  • get_embedding_model(): Loads the SentenceTransformer model for embedding activities.
  • format_activity_for_embedding(act: Dict) -> Dict[str, List[str]]: Formats an activity for embedding into a dictionary with key-value pairs.
  • embed_unique_items(attribute_lists: List[List[str]], model: SentenceTransformer) -> Dict[str, torch.Tensor]: Creates embeddings for unique items across multiple attributes.
  • list_semantic_overlap(list1: List[str], list2: List[str], embeddings: Dict[str, torch.Tensor]) -> float: Computes the average of best semantic match from list1 to list2 and vice versa.
  • infer_weights(pair_scores: List[Dict[str, float]]) -> Dict[str, float]: Infers attribute weights from variance across pairs.
  • compare_activities(a: Dict, b: Dict, embeddings: Dict[str, torch.Tensor], weights: Dict[str, float]) -> Dict[str, float]: Compares two activities and returns a detailed similarity breakdown.
  • compute_pairwise_similarity_matrix(activities: List[Dict]) -> List[Dict]: Computes all pairwise similarity scores between activities using formatted fields and inferred weights.

Important Classes

None

System Fit

This file is part of the CrewAI system, which uses machine learning and graph algorithms to analyze and optimize business processes. The similarity utilities in this file are used to compute similarity between activities, which is a crucial step in identifying opportunities for process improvement and automation. The file fits into the wider system by providing a set of reusable functions for computing similarity, which can be used in various parts of the system.


agents/utils/similarity_utils_new1.py

Purpose

This file, similarity_utils_new1.py, contains utility functions for calculating similarities between activities using OpenAI embeddings and clustering them using AgglomerativeClustering. It provides a way to build and refine clusters based on the similarity between activities.

Key Responsibilities

  • Calculate OpenAI embeddings for activities
  • Cluster activities using AgglomerativeClustering
  • Refine clusters based on similarity and number of clusters
  • Provide statistics on the distance matrix
  • Handle errors and retries for OpenAI API calls

Important Functions

  • cluster_activities_openai: The main function that takes in a list of activities and returns a list of clusters with enriched information.
  • safe_effort: A helper function that safely converts effort values to floats.
  • format_activity_for_embedding: A helper function that formats an activity dictionary for embedding.
  • _l2_normalize: A helper function that L2 normalizes a matrix.
  • _embed_openai_texts: A helper function that embeds a list of texts using OpenAI.
  • try_clustering: A helper function that tries clustering with a given threshold.
  • too_granular and too_coarse: Helper functions that check if the number of clusters is too granular or too coarse.
  • refine: A helper function that refines clusters based on similarity and number of clusters.

System Fit

This file fits into the wider 3-Cubed Python system as part of the agents module, which is responsible for processing and analyzing activities. The similarity_utils_new1.py file provides a way to calculate similarities between activities and cluster them, which can be used for various purposes such as team formation, resource allocation, and activity prioritization.


agents/utils/__init__.py

Purpose

Unable to read this file content.

Extracted Functions

None found.

Extracted Classes

None found.


🤖