added questions generator
This commit is contained in:
@@ -1,42 +1,72 @@
|
||||
from src.services.sop_generator import SopGeneratorExecutive
|
||||
from src.utils.document_loader import load_document
|
||||
from src.services.document_parser import DocumentParser
|
||||
from src.services.sop_generator import SopGeneratorExecutive
|
||||
file_path = r"C:\Users\User\Desktop\Blessing_AI\MKD\test_erp_ai\erp_ai\test\erp_ai\data\raw\document.doc"
|
||||
docs = load_document(file_path)
|
||||
import json
|
||||
from src.services.questions_generator import QuestionsGenerator
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
SOP = DocumentParser()
|
||||
so = SopGeneratorExecutive()
|
||||
referencs_roles = ["AR Director "]
|
||||
workers_list = [
|
||||
{
|
||||
|
||||
"position": "AR dIRECTOR ",
|
||||
"role": "Developer",
|
||||
"department": "IT"
|
||||
},
|
||||
{
|
||||
"name": "Jane Smith",
|
||||
"position": "Project Manager",
|
||||
"role": "Manager",
|
||||
"department": "IT"
|
||||
}
|
||||
]
|
||||
|
||||
departments_and_roles = SOP.extract_sops_for_workers_by_department(docs,workers_list)
|
||||
# Prepare extracted roles (only managers)
|
||||
'''extracted_managers = []
|
||||
for department in departments_and_roles['departments']:
|
||||
extracted_managers.extend([
|
||||
# Mocking the SOPs input as described in your example
|
||||
mock_sops_input = {
|
||||
"sops": {
|
||||
"departments": [
|
||||
{
|
||||
'name': manager['name'],
|
||||
'position': manager.get('position', 'Unknown Position'),
|
||||
'role': manager.get('role', 'Unknown Role') # PRP or SRP classification
|
||||
"name": "Accounts Receivable",
|
||||
"workers": [
|
||||
{
|
||||
"name": "Angela Lewis",
|
||||
"position": "AR Director",
|
||||
"sops": {
|
||||
"must": [],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Jamie Vega",
|
||||
"position": "AR Supervisor",
|
||||
"sops": {
|
||||
"must": [
|
||||
"Provide escalation information to the AR Director if additional escalations are needed."
|
||||
],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Jessica Merzougui",
|
||||
"position": "AR Supervisor",
|
||||
"sops": {
|
||||
"must": [
|
||||
"Provide escalation information to the AR Director if additional escalations are needed."
|
||||
],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Deniece Santos",
|
||||
"position": "AR Analyst",
|
||||
"sops": {
|
||||
"must": [],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
for manager in department['managers']
|
||||
])'''
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
print(departments_and_roles)
|
||||
# Defining the full input data including additional parameters
|
||||
input_data = {
|
||||
"sops": json.dumps(mock_sops_input), # Convert SOPs to JSON string format
|
||||
"assessment_type": "progress", # Set the assessment type
|
||||
"frequency_type": "weekly", # Set the frequency type (daily, weekly, etc.)
|
||||
"duration": 4 # Set the duration (number of frequency cycles, e.g., 4 weeks)
|
||||
}
|
||||
|
||||
# Initialize the QuestionsGenerator
|
||||
generator = QuestionsGenerator()
|
||||
|
||||
# Invoke the generate_questions method with the mock input
|
||||
questions_response = generator.generate_questions(input_data)
|
||||
|
||||
# Print the generated questions response
|
||||
print(json.dumps(questions_response, indent=4))
|
||||
|
||||
Reference in New Issue
Block a user