from src.services.sop_generator import SopGeneratorDocument, SopGeneratorExecutive from src.utils.document_loader import load_document file_path = "/root/ds_erp_ai/data/raw/document.doc" docs = load_document(file_path) sop_doc = SopGeneratorDocument() sop_executive = SopGeneratorExecutive() if __name__ == "__main__": # Test the generate_sops_from_questionnaire function questionnaire_data = { "organizational_vision": { "question_1_answer": "Our vision is to lead the market in innovative product solutions.", "question_2_answer": "We see our organization contributing by expanding into new regions and enhancing service quality.", "question_3_answer": "The key elements of our vision focus on scalability, customer satisfaction, and technological advancement." }, "organizational_strategic_goals": { "question_1_answer": "The strategic direction is to increase market share and improve operational efficiency.", "question_2_answer": "We aim to achieve a 20% reduction in operating costs by streamlining internal processes.", "question_3_answer": "The process aligns with our goal to reduce costs while maintaining high product quality." }, "departmental_strategic_goals": { "sales_department_answer": "Increase sales by 15% in the next fiscal year through better lead generation and customer retention.", "finance_department_answer": "Ensure a balanced budget by optimizing resource allocation and reducing overhead costs." } } executives = ["CEO", "COO"] managers = ["Sales Manager", "Finance Manager"] sops_from_questionnaire = sop_executive.generate_sops_from_questionnaire(questionnaire_data, executives, managers) if sops_from_questionnaire: print("Generated SOPs from Questionnaire:") # Print Executive SOPs print("\nExecutive SOPs:") for executive, sops in sops_from_questionnaire["executive_sops"].items(): print(f" {executive}:") print(" Must SOPs:") for sop in sops.must: print(f" - {sop}") print(" Shall SOPs:") for sop in sops.shall: print(f" - {sop}") print(" Will SOPs:") for sop in sops.will: print(f" - {sop}") # Print Department Manager SOPs print("\nDepartment Manager SOPs:") for department in sops_from_questionnaire["department_sops"].departments: print(f" Department: {department.name}") for manager in department.managers: print(f" Manager: {manager.title}") print(" Must SOPs:") for sop in manager.sops.must: print(f" - {sop}") print(" Shall SOPs:") for sop in manager.sops.shall: print(f" - {sop}") print(" Will SOPs:") for sop in manager.sops.will: print(f" - {sop}") else: print("Failed to generate SOPs from questionnaire.") # You can keep the previous tests if you want departments_and_roles = sop_doc.extract_departments_and_managers(docs) if departments_and_roles: print("\nExtracted Departments and Roles:") for department in departments_and_roles.get('departments', []): print(f"\nDepartment: {department['name']}") for role in department.get('managerial_roles', []): print(f" Role: {role['title']}") print(f" Responsibilities: {', '.join(role['responsibilities'])}") else: print("Failed to extract departments and roles.") v_ms = sop_doc.extract_vision_mission(docs) print(f"\nVision and Mission: {v_ms}")