Files
erp-ai-latest/test.py
T

82 lines
3.8 KiB
Python
Raw Normal View History

2024-09-06 01:48:32 +00:00
from src.services.sop_generator import SopGeneratorDocument, SopGeneratorExecutive
2024-08-31 01:29:39 +00:00
from src.utils.document_loader import load_document
file_path = "/root/ds_erp_ai/data/raw/document.doc"
2024-08-31 01:29:39 +00:00
docs = load_document(file_path)
2024-09-06 01:48:32 +00:00
sop_doc = SopGeneratorDocument()
sop_executive = SopGeneratorExecutive()
2024-08-31 01:29:39 +00:00
if __name__ == "__main__":
2024-09-06 01:48:32 +00:00
# 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."
},
2024-09-06 01:48:32 +00:00
"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."
},
2024-09-06 01:48:32 +00:00
"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."
}
2024-09-06 01:48:32 +00:00
}
executives = ["CEO", "COO"]
managers = ["Sales Manager", "Finance Manager"]
2024-09-06 01:48:32 +00:00
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.")
2024-09-06 01:48:32 +00:00
# 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.")
2024-09-06 01:48:32 +00:00
v_ms = sop_doc.extract_vision_mission(docs)
print(f"\nVision and Mission: {v_ms}")