From 1a68b4407e552f9c081a73e5431751f891476e57 Mon Sep 17 00:00:00 2001 From: kowshik Date: Fri, 31 Jan 2025 15:59:51 +0000 Subject: [PATCH] updated --- assessment_data.csv | 13 + dummy_assessments.json | 4187 +++++++++++++++++++++++++++ scripts/statistics_data.py | 170 ++ src/api/routes/chatbot.py | 12 +- src/api/routes/sops.py | 250 +- src/models/sop_response_schemas.py | 18 + src/prompts/chatbot.py | 160 +- src/prompts/questions.py | 14 +- src/prompts/sops.py | 245 +- src/services/chatbot.py | 128 +- src/services/document_parser.py | 38 +- src/services/sop_document_parser.py | 78 +- src/services/sop_generator.py | 193 +- test.py | 204 +- 14 files changed, 5436 insertions(+), 274 deletions(-) create mode 100644 assessment_data.csv create mode 100644 dummy_assessments.json create mode 100644 scripts/statistics_data.py diff --git a/assessment_data.csv b/assessment_data.csv new file mode 100644 index 0000000..9bb7539 --- /dev/null +++ b/assessment_data.csv @@ -0,0 +1,13 @@ +assessment_id,assessment_name,start_date,user_name,total_assigned_items,completed_items,area +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Agile Methodologies +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,API Developement +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Code Review +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Collaboration with Cross-Functional Teams +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Continuous Integration/Continuous Deployment (CI/CD) +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Debugging Techniques +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Documentation +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Performance Optimization +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,System Design +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Unit Testing +1,Test Assesment,2024-10-14T00:00:00.000Z,Saba JoeJoe,36,1,Version Control +1,Test Assesment,2024-10-14T00:00:00.000Z,Tahsin Protik,1,0,Performance Optimization diff --git a/dummy_assessments.json b/dummy_assessments.json new file mode 100644 index 0000000..a25812a --- /dev/null +++ b/dummy_assessments.json @@ -0,0 +1,4187 @@ +{ + "error": false, + "data": [ + { + "assessment_id": "1", + "red_flags": 4, + "open_items": 31, + "completed_items": 41, + "total_assigned_items": 72, + "assessment_name": "Assessment 1", + "start_date": "2024-09-15T00:00:00.000Z", + "user_details": [ + { + "name": "User_56", + "total_assigned_items": 2, + "completed_items": 0, + "area_list": [ + "API Development", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "2", + "red_flags": 1, + "open_items": 3, + "completed_items": 39, + "total_assigned_items": 42, + "assessment_name": "Assessment 2", + "start_date": "2024-03-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_32", + "total_assigned_items": 32, + "completed_items": 4, + "area_list": [ + "Unit Testing", + "Documentation" + ] + }, + { + "name": "User_23", + "total_assigned_items": 3, + "completed_items": 1, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_38", + "total_assigned_items": 21, + "completed_items": 1, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Version Control", + "Code Review", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "3", + "red_flags": 5, + "open_items": 24, + "completed_items": 37, + "total_assigned_items": 61, + "assessment_name": "Assessment 3", + "start_date": "2024-02-27T00:00:00.000Z", + "user_details": [ + { + "name": "User_40", + "total_assigned_items": 11, + "completed_items": 10, + "area_list": [ + "API Development", + "Collaboration with Cross-Functional Teams", + "Unit Testing", + "Performance Optimization" + ] + }, + { + "name": "User_5", + "total_assigned_items": 4, + "completed_items": 1, + "area_list": [ + "Agile Methodologies", + "Code Review", + "Performance Optimization" + ] + }, + { + "name": "User_3", + "total_assigned_items": 19, + "completed_items": 14, + "area_list": [ + "Code Review", + "API Development", + "Version Control", + "Agile Methodologies" + ] + }, + { + "name": "User_62", + "total_assigned_items": 29, + "completed_items": 15, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development", + "System Design", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "4", + "red_flags": 1, + "open_items": 4, + "completed_items": 2, + "total_assigned_items": 6, + "assessment_name": "Assessment 4", + "start_date": "2024-09-22T00:00:00.000Z", + "user_details": [ + { + "name": "User_97", + "total_assigned_items": 48, + "completed_items": 18, + "area_list": [ + "Performance Optimization", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams", + "Code Review", + "API Development" + ] + }, + { + "name": "User_70", + "total_assigned_items": 29, + "completed_items": 12, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "System Design", + "Performance Optimization" + ] + }, + { + "name": "User_91", + "total_assigned_items": 13, + "completed_items": 11, + "area_list": [ + "Version Control", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "5", + "red_flags": 2, + "open_items": 43, + "completed_items": 48, + "total_assigned_items": 91, + "assessment_name": "Assessment 5", + "start_date": "2024-10-05T00:00:00.000Z", + "user_details": [ + { + "name": "User_37", + "total_assigned_items": 37, + "completed_items": 29, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development" + ] + }, + { + "name": "User_69", + "total_assigned_items": 6, + "completed_items": 5, + "area_list": [ + "Documentation", + "Version Control", + "API Development" + ] + }, + { + "name": "User_43", + "total_assigned_items": 16, + "completed_items": 9, + "area_list": [ + "Version Control" + ] + } + ] + }, + { + "assessment_id": "6", + "red_flags": 4, + "open_items": 39, + "completed_items": 39, + "total_assigned_items": 78, + "assessment_name": "Assessment 6", + "start_date": "2024-01-15T00:00:00.000Z", + "user_details": [ + { + "name": "User_62", + "total_assigned_items": 36, + "completed_items": 20, + "area_list": [ + "System Design", + "Version Control", + "Performance Optimization", + "Code Review", + "Unit Testing" + ] + }, + { + "name": "User_96", + "total_assigned_items": 34, + "completed_items": 20, + "area_list": [ + "Agile Methodologies", + "Code Review", + "Documentation" + ] + }, + { + "name": "User_18", + "total_assigned_items": 12, + "completed_items": 10, + "area_list": [ + "API Development", + "Performance Optimization", + "Version Control", + "Collaboration with Cross-Functional Teams", + "Documentation" + ] + } + ] + }, + { + "assessment_id": "7", + "red_flags": 3, + "open_items": 5, + "completed_items": 46, + "total_assigned_items": 51, + "assessment_name": "Assessment 7", + "start_date": "2024-09-11T00:00:00.000Z", + "user_details": [ + { + "name": "User_69", + "total_assigned_items": 28, + "completed_items": 5, + "area_list": [ + "Version Control", + "Code Review", + "Unit Testing", + "System Design" + ] + } + ] + }, + { + "assessment_id": "8", + "red_flags": 5, + "open_items": 11, + "completed_items": 44, + "total_assigned_items": 55, + "assessment_name": "Assessment 8", + "start_date": "2024-06-08T00:00:00.000Z", + "user_details": [ + { + "name": "User_14", + "total_assigned_items": 25, + "completed_items": 0, + "area_list": [ + "API Development", + "Unit Testing", + "Debugging Techniques", + "Documentation" + ] + }, + { + "name": "User_51", + "total_assigned_items": 37, + "completed_items": 1, + "area_list": [ + "Performance Optimization", + "Code Review" + ] + }, + { + "name": "User_82", + "total_assigned_items": 43, + "completed_items": 30, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_77", + "total_assigned_items": 1, + "completed_items": 1, + "area_list": [ + "Code Review" + ] + }, + { + "name": "User_31", + "total_assigned_items": 8, + "completed_items": 8, + "area_list": [ + "API Development" + ] + } + ] + }, + { + "assessment_id": "9", + "red_flags": 2, + "open_items": 40, + "completed_items": 40, + "total_assigned_items": 80, + "assessment_name": "Assessment 9", + "start_date": "2024-07-16T00:00:00.000Z", + "user_details": [ + { + "name": "User_46", + "total_assigned_items": 31, + "completed_items": 31, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_3", + "total_assigned_items": 39, + "completed_items": 7, + "area_list": [ + "Code Review" + ] + }, + { + "name": "User_60", + "total_assigned_items": 32, + "completed_items": 19, + "area_list": [ + "Agile Methodologies", + "System Design", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "10", + "red_flags": 0, + "open_items": 13, + "completed_items": 12, + "total_assigned_items": 25, + "assessment_name": "Assessment 10", + "start_date": "2024-03-03T00:00:00.000Z", + "user_details": [ + { + "name": "User_2", + "total_assigned_items": 20, + "completed_items": 13, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_92", + "total_assigned_items": 18, + "completed_items": 6, + "area_list": [ + "Documentation", + "Agile Methodologies" + ] + }, + { + "name": "User_22", + "total_assigned_items": 31, + "completed_items": 14, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Code Review", + "Documentation", + "Performance Optimization" + ] + }, + { + "name": "User_87", + "total_assigned_items": 17, + "completed_items": 16, + "area_list": [ + "Unit Testing", + "API Development", + "System Design" + ] + }, + { + "name": "User_56", + "total_assigned_items": 36, + "completed_items": 29, + "area_list": [ + "Version Control", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "11", + "red_flags": 2, + "open_items": 28, + "completed_items": 39, + "total_assigned_items": 67, + "assessment_name": "Assessment 11", + "start_date": "2024-04-03T00:00:00.000Z", + "user_details": [ + { + "name": "User_41", + "total_assigned_items": 48, + "completed_items": 24, + "area_list": [ + "Debugging Techniques", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Agile Methodologies", + "Documentation" + ] + }, + { + "name": "User_91", + "total_assigned_items": 14, + "completed_items": 7, + "area_list": [ + "Code Review", + "Unit Testing" + ] + }, + { + "name": "User_23", + "total_assigned_items": 47, + "completed_items": 1, + "area_list": [ + "Debugging Techniques", + "API Development", + "Performance Optimization", + "Unit Testing", + "System Design" + ] + } + ] + }, + { + "assessment_id": "12", + "red_flags": 5, + "open_items": 23, + "completed_items": 25, + "total_assigned_items": 48, + "assessment_name": "Assessment 12", + "start_date": "2024-06-20T00:00:00.000Z", + "user_details": [ + { + "name": "User_58", + "total_assigned_items": 10, + "completed_items": 10, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_14", + "total_assigned_items": 32, + "completed_items": 3, + "area_list": [ + "Unit Testing", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Performance Optimization", + "API Development", + "Debugging Techniques" + ] + }, + { + "name": "User_36", + "total_assigned_items": 14, + "completed_items": 8, + "area_list": [ + "Unit Testing", + "Collaboration with Cross-Functional Teams", + "Code Review", + "Version Control", + "Documentation" + ] + }, + { + "name": "User_49", + "total_assigned_items": 40, + "completed_items": 7, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Documentation", + "System Design" + ] + }, + { + "name": "User_18", + "total_assigned_items": 22, + "completed_items": 22, + "area_list": [ + "System Design", + "Documentation", + "Agile Methodologies", + "Unit Testing" + ] + } + ] + }, + { + "assessment_id": "13", + "red_flags": 0, + "open_items": 33, + "completed_items": 5, + "total_assigned_items": 38, + "assessment_name": "Assessment 13", + "start_date": "2024-05-24T00:00:00.000Z", + "user_details": [ + { + "name": "User_99", + "total_assigned_items": 23, + "completed_items": 12, + "area_list": [ + "Debugging Techniques", + "Continuous Integration/Continuous Deployment (CI/CD)", + "System Design", + "Version Control" + ] + }, + { + "name": "User_27", + "total_assigned_items": 11, + "completed_items": 10, + "area_list": [ + "System Design", + "Performance Optimization", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "Code Review" + ] + }, + { + "name": "User_93", + "total_assigned_items": 16, + "completed_items": 2, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Documentation", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "14", + "red_flags": 4, + "open_items": 9, + "completed_items": 25, + "total_assigned_items": 34, + "assessment_name": "Assessment 14", + "start_date": "2024-08-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_25", + "total_assigned_items": 45, + "completed_items": 22, + "area_list": [ + "Unit Testing", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Version Control" + ] + }, + { + "name": "User_25", + "total_assigned_items": 43, + "completed_items": 22, + "area_list": [ + "Agile Methodologies" + ] + }, + { + "name": "User_62", + "total_assigned_items": 5, + "completed_items": 1, + "area_list": [ + "API Development", + "Unit Testing", + "Collaboration with Cross-Functional Teams", + "Debugging Techniques" + ] + }, + { + "name": "User_39", + "total_assigned_items": 14, + "completed_items": 2, + "area_list": [ + "System Design", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Documentation", + "Performance Optimization", + "Debugging Techniques" + ] + }, + { + "name": "User_88", + "total_assigned_items": 47, + "completed_items": 16, + "area_list": [ + "Unit Testing", + "Code Review", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "15", + "red_flags": 3, + "open_items": 35, + "completed_items": 29, + "total_assigned_items": 64, + "assessment_name": "Assessment 15", + "start_date": "2024-07-25T00:00:00.000Z", + "user_details": [ + { + "name": "User_85", + "total_assigned_items": 30, + "completed_items": 8, + "area_list": [ + "Performance Optimization", + "System Design" + ] + }, + { + "name": "User_2", + "total_assigned_items": 32, + "completed_items": 20, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_78", + "total_assigned_items": 18, + "completed_items": 2, + "area_list": [ + "Performance Optimization" + ] + }, + { + "name": "User_81", + "total_assigned_items": 39, + "completed_items": 30, + "area_list": [ + "Code Review" + ] + } + ] + }, + { + "assessment_id": "16", + "red_flags": 3, + "open_items": 25, + "completed_items": 22, + "total_assigned_items": 47, + "assessment_name": "Assessment 16", + "start_date": "2024-02-02T00:00:00.000Z", + "user_details": [ + { + "name": "User_49", + "total_assigned_items": 7, + "completed_items": 2, + "area_list": [ + "Code Review", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams", + "Debugging Techniques" + ] + }, + { + "name": "User_69", + "total_assigned_items": 17, + "completed_items": 0, + "area_list": [ + "API Development", + "Debugging Techniques", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "17", + "red_flags": 5, + "open_items": 32, + "completed_items": 23, + "total_assigned_items": 55, + "assessment_name": "Assessment 17", + "start_date": "2024-10-13T00:00:00.000Z", + "user_details": [ + { + "name": "User_84", + "total_assigned_items": 39, + "completed_items": 11, + "area_list": [ + "Unit Testing", + "Debugging Techniques" + ] + }, + { + "name": "User_7", + "total_assigned_items": 50, + "completed_items": 25, + "area_list": [ + "Performance Optimization", + "API Development", + "Agile Methodologies", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "18", + "red_flags": 1, + "open_items": 3, + "completed_items": 47, + "total_assigned_items": 50, + "assessment_name": "Assessment 18", + "start_date": "2024-03-07T00:00:00.000Z", + "user_details": [ + { + "name": "User_15", + "total_assigned_items": 30, + "completed_items": 1, + "area_list": [ + "API Development" + ] + }, + { + "name": "User_44", + "total_assigned_items": 14, + "completed_items": 10, + "area_list": [ + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "19", + "red_flags": 4, + "open_items": 13, + "completed_items": 32, + "total_assigned_items": 45, + "assessment_name": "Assessment 19", + "start_date": "2024-09-13T00:00:00.000Z", + "user_details": [ + { + "name": "User_63", + "total_assigned_items": 13, + "completed_items": 7, + "area_list": [ + "API Development" + ] + } + ] + }, + { + "assessment_id": "20", + "red_flags": 5, + "open_items": 44, + "completed_items": 15, + "total_assigned_items": 59, + "assessment_name": "Assessment 20", + "start_date": "2024-04-16T00:00:00.000Z", + "user_details": [ + { + "name": "User_37", + "total_assigned_items": 45, + "completed_items": 30, + "area_list": [ + "System Design", + "Version Control", + "Unit Testing", + "API Development", + "Agile Methodologies" + ] + }, + { + "name": "User_45", + "total_assigned_items": 47, + "completed_items": 11, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "System Design", + "Agile Methodologies", + "API Development", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "21", + "red_flags": 3, + "open_items": 50, + "completed_items": 38, + "total_assigned_items": 88, + "assessment_name": "Assessment 21", + "start_date": "2024-04-24T00:00:00.000Z", + "user_details": [ + { + "name": "User_83", + "total_assigned_items": 25, + "completed_items": 25, + "area_list": [ + "Performance Optimization", + "Agile Methodologies", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "22", + "red_flags": 2, + "open_items": 26, + "completed_items": 10, + "total_assigned_items": 36, + "assessment_name": "Assessment 22", + "start_date": "2024-07-01T00:00:00.000Z", + "user_details": [ + { + "name": "User_2", + "total_assigned_items": 22, + "completed_items": 14, + "area_list": [ + "Agile Methodologies", + "Documentation" + ] + }, + { + "name": "User_35", + "total_assigned_items": 27, + "completed_items": 22, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_78", + "total_assigned_items": 48, + "completed_items": 2, + "area_list": [ + "System Design", + "Agile Methodologies" + ] + } + ] + }, + { + "assessment_id": "23", + "red_flags": 3, + "open_items": 34, + "completed_items": 25, + "total_assigned_items": 59, + "assessment_name": "Assessment 23", + "start_date": "2024-01-06T00:00:00.000Z", + "user_details": [ + { + "name": "User_57", + "total_assigned_items": 1, + "completed_items": 1, + "area_list": [ + "System Design", + "Debugging Techniques", + "Collaboration with Cross-Functional Teams", + "Performance Optimization" + ] + }, + { + "name": "User_9", + "total_assigned_items": 40, + "completed_items": 5, + "area_list": [ + "Performance Optimization", + "Debugging Techniques", + "System Design" + ] + }, + { + "name": "User_98", + "total_assigned_items": 16, + "completed_items": 1, + "area_list": [ + "Unit Testing", + "System Design", + "API Development", + "Performance Optimization" + ] + }, + { + "name": "User_62", + "total_assigned_items": 16, + "completed_items": 3, + "area_list": [ + "System Design", + "Documentation", + "Collaboration with Cross-Functional Teams", + "Debugging Techniques", + "API Development" + ] + }, + { + "name": "User_23", + "total_assigned_items": 47, + "completed_items": 21, + "area_list": [ + "System Design" + ] + } + ] + }, + { + "assessment_id": "24", + "red_flags": 2, + "open_items": 44, + "completed_items": 21, + "total_assigned_items": 65, + "assessment_name": "Assessment 24", + "start_date": "2024-10-11T00:00:00.000Z", + "user_details": [ + { + "name": "User_38", + "total_assigned_items": 45, + "completed_items": 28, + "area_list": [ + "API Development", + "Version Control", + "Performance Optimization" + ] + }, + { + "name": "User_99", + "total_assigned_items": 35, + "completed_items": 10, + "area_list": [ + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Debugging Techniques", + "System Design", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "25", + "red_flags": 5, + "open_items": 16, + "completed_items": 20, + "total_assigned_items": 36, + "assessment_name": "Assessment 25", + "start_date": "2024-04-07T00:00:00.000Z", + "user_details": [ + { + "name": "User_43", + "total_assigned_items": 49, + "completed_items": 6, + "area_list": [ + "Unit Testing", + "Collaboration with Cross-Functional Teams", + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_62", + "total_assigned_items": 17, + "completed_items": 15, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_80", + "total_assigned_items": 27, + "completed_items": 9, + "area_list": [ + "Code Review", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "26", + "red_flags": 1, + "open_items": 20, + "completed_items": 23, + "total_assigned_items": 43, + "assessment_name": "Assessment 26", + "start_date": "2024-03-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_83", + "total_assigned_items": 1, + "completed_items": 1, + "area_list": [ + "Performance Optimization" + ] + }, + { + "name": "User_2", + "total_assigned_items": 15, + "completed_items": 3, + "area_list": [ + "Performance Optimization", + "Unit Testing", + "Documentation", + "System Design" + ] + } + ] + }, + { + "assessment_id": "27", + "red_flags": 4, + "open_items": 32, + "completed_items": 25, + "total_assigned_items": 57, + "assessment_name": "Assessment 27", + "start_date": "2024-08-26T00:00:00.000Z", + "user_details": [ + { + "name": "User_12", + "total_assigned_items": 33, + "completed_items": 33, + "area_list": [ + "Unit Testing", + "API Development", + "Version Control", + "Collaboration with Cross-Functional Teams", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_22", + "total_assigned_items": 29, + "completed_items": 23, + "area_list": [ + "System Design", + "API Development" + ] + }, + { + "name": "User_66", + "total_assigned_items": 46, + "completed_items": 23, + "area_list": [ + "Code Review", + "System Design", + "Debugging Techniques", + "Performance Optimization", + "API Development" + ] + }, + { + "name": "User_25", + "total_assigned_items": 48, + "completed_items": 27, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "API Development", + "Unit Testing", + "Code Review", + "Version Control" + ] + }, + { + "name": "User_83", + "total_assigned_items": 22, + "completed_items": 8, + "area_list": [ + "Version Control" + ] + } + ] + }, + { + "assessment_id": "28", + "red_flags": 1, + "open_items": 9, + "completed_items": 45, + "total_assigned_items": 54, + "assessment_name": "Assessment 28", + "start_date": "2024-10-13T00:00:00.000Z", + "user_details": [ + { + "name": "User_27", + "total_assigned_items": 45, + "completed_items": 3, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_15", + "total_assigned_items": 20, + "completed_items": 11, + "area_list": [ + "Code Review", + "Performance Optimization", + "Version Control", + "Agile Methodologies" + ] + }, + { + "name": "User_69", + "total_assigned_items": 37, + "completed_items": 17, + "area_list": [ + "Agile Methodologies", + "Debugging Techniques", + "System Design", + "API Development", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "29", + "red_flags": 2, + "open_items": 26, + "completed_items": 49, + "total_assigned_items": 75, + "assessment_name": "Assessment 29", + "start_date": "2024-10-18T00:00:00.000Z", + "user_details": [ + { + "name": "User_1", + "total_assigned_items": 10, + "completed_items": 2, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_29", + "total_assigned_items": 22, + "completed_items": 3, + "area_list": [ + "Performance Optimization", + "System Design", + "Unit Testing", + "API Development" + ] + } + ] + }, + { + "assessment_id": "30", + "red_flags": 4, + "open_items": 27, + "completed_items": 47, + "total_assigned_items": 74, + "assessment_name": "Assessment 30", + "start_date": "2024-06-16T00:00:00.000Z", + "user_details": [ + { + "name": "User_87", + "total_assigned_items": 33, + "completed_items": 15, + "area_list": [ + "Debugging Techniques", + "API Development", + "Version Control", + "Agile Methodologies" + ] + }, + { + "name": "User_100", + "total_assigned_items": 2, + "completed_items": 0, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_59", + "total_assigned_items": 6, + "completed_items": 5, + "area_list": [ + "Code Review", + "Performance Optimization", + "API Development", + "Documentation" + ] + }, + { + "name": "User_77", + "total_assigned_items": 48, + "completed_items": 33, + "area_list": [ + "Unit Testing" + ] + }, + { + "name": "User_29", + "total_assigned_items": 37, + "completed_items": 11, + "area_list": [ + "API Development", + "Continuous Integration/Continuous Deployment (CI/CD)", + "System Design", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "31", + "red_flags": 0, + "open_items": 31, + "completed_items": 46, + "total_assigned_items": 77, + "assessment_name": "Assessment 31", + "start_date": "2024-06-12T00:00:00.000Z", + "user_details": [ + { + "name": "User_7", + "total_assigned_items": 46, + "completed_items": 34, + "area_list": [ + "Unit Testing" + ] + }, + { + "name": "User_9", + "total_assigned_items": 35, + "completed_items": 23, + "area_list": [ + "Debugging Techniques", + "Version Control", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_72", + "total_assigned_items": 25, + "completed_items": 0, + "area_list": [ + "Version Control", + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development", + "Code Review" + ] + }, + { + "name": "User_55", + "total_assigned_items": 5, + "completed_items": 4, + "area_list": [ + "Agile Methodologies", + "Unit Testing", + "API Development", + "Code Review", + "System Design" + ] + } + ] + }, + { + "assessment_id": "32", + "red_flags": 5, + "open_items": 0, + "completed_items": 30, + "total_assigned_items": 30, + "assessment_name": "Assessment 32", + "start_date": "2024-09-16T00:00:00.000Z", + "user_details": [ + { + "name": "User_47", + "total_assigned_items": 35, + "completed_items": 10, + "area_list": [ + "Version Control", + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development", + "Performance Optimization" + ] + }, + { + "name": "User_83", + "total_assigned_items": 18, + "completed_items": 18, + "area_list": [ + "Agile Methodologies" + ] + }, + { + "name": "User_27", + "total_assigned_items": 8, + "completed_items": 5, + "area_list": [ + "Unit Testing", + "Agile Methodologies", + "Debugging Techniques" + ] + }, + { + "name": "User_31", + "total_assigned_items": 48, + "completed_items": 9, + "area_list": [ + "System Design", + "Code Review" + ] + }, + { + "name": "User_56", + "total_assigned_items": 10, + "completed_items": 5, + "area_list": [ + "Performance Optimization", + "Version Control", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams", + "API Development" + ] + } + ] + }, + { + "assessment_id": "33", + "red_flags": 3, + "open_items": 42, + "completed_items": 5, + "total_assigned_items": 47, + "assessment_name": "Assessment 33", + "start_date": "2024-09-10T00:00:00.000Z", + "user_details": [ + { + "name": "User_59", + "total_assigned_items": 48, + "completed_items": 48, + "area_list": [ + "API Development", + "Continuous Integration/Continuous Deployment (CI/CD)", + "System Design", + "Documentation" + ] + } + ] + }, + { + "assessment_id": "34", + "red_flags": 5, + "open_items": 8, + "completed_items": 8, + "total_assigned_items": 16, + "assessment_name": "Assessment 34", + "start_date": "2024-05-03T00:00:00.000Z", + "user_details": [ + { + "name": "User_20", + "total_assigned_items": 46, + "completed_items": 45, + "area_list": [ + "Version Control", + "System Design", + "Agile Methodologies", + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development" + ] + }, + { + "name": "User_44", + "total_assigned_items": 29, + "completed_items": 7, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Unit Testing", + "Version Control", + "Performance Optimization", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "35", + "red_flags": 2, + "open_items": 42, + "completed_items": 21, + "total_assigned_items": 63, + "assessment_name": "Assessment 35", + "start_date": "2024-02-27T00:00:00.000Z", + "user_details": [ + { + "name": "User_61", + "total_assigned_items": 1, + "completed_items": 1, + "area_list": [ + "Code Review", + "Unit Testing", + "API Development" + ] + }, + { + "name": "User_49", + "total_assigned_items": 15, + "completed_items": 10, + "area_list": [ + "Agile Methodologies", + "System Design", + "Version Control", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Unit Testing" + ] + } + ] + }, + { + "assessment_id": "36", + "red_flags": 3, + "open_items": 6, + "completed_items": 34, + "total_assigned_items": 40, + "assessment_name": "Assessment 36", + "start_date": "2024-09-02T00:00:00.000Z", + "user_details": [ + { + "name": "User_61", + "total_assigned_items": 35, + "completed_items": 27, + "area_list": [ + "Debugging Techniques", + "Documentation", + "Unit Testing", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_19", + "total_assigned_items": 14, + "completed_items": 14, + "area_list": [ + "Agile Methodologies" + ] + }, + { + "name": "User_38", + "total_assigned_items": 49, + "completed_items": 20, + "area_list": [ + "Performance Optimization", + "Unit Testing", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "37", + "red_flags": 2, + "open_items": 35, + "completed_items": 6, + "total_assigned_items": 41, + "assessment_name": "Assessment 37", + "start_date": "2024-06-05T00:00:00.000Z", + "user_details": [ + { + "name": "User_51", + "total_assigned_items": 3, + "completed_items": 1, + "area_list": [ + "System Design", + "Performance Optimization", + "Code Review" + ] + }, + { + "name": "User_80", + "total_assigned_items": 16, + "completed_items": 7, + "area_list": [ + "System Design" + ] + } + ] + }, + { + "assessment_id": "38", + "red_flags": 5, + "open_items": 16, + "completed_items": 17, + "total_assigned_items": 33, + "assessment_name": "Assessment 38", + "start_date": "2024-05-31T00:00:00.000Z", + "user_details": [ + { + "name": "User_71", + "total_assigned_items": 48, + "completed_items": 40, + "area_list": [ + "Debugging Techniques", + "API Development", + "Version Control" + ] + }, + { + "name": "User_4", + "total_assigned_items": 27, + "completed_items": 8, + "area_list": [ + "Agile Methodologies", + "Collaboration with Cross-Functional Teams", + "API Development", + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_29", + "total_assigned_items": 17, + "completed_items": 9, + "area_list": [ + "Version Control", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams", + "Code Review" + ] + }, + { + "name": "User_30", + "total_assigned_items": 3, + "completed_items": 3, + "area_list": [ + "Code Review", + "Debugging Techniques", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "39", + "red_flags": 1, + "open_items": 25, + "completed_items": 28, + "total_assigned_items": 53, + "assessment_name": "Assessment 39", + "start_date": "2024-09-28T00:00:00.000Z", + "user_details": [ + { + "name": "User_76", + "total_assigned_items": 26, + "completed_items": 5, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development", + "Unit Testing" + ] + }, + { + "name": "User_81", + "total_assigned_items": 7, + "completed_items": 2, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Performance Optimization", + "Unit Testing" + ] + }, + { + "name": "User_68", + "total_assigned_items": 15, + "completed_items": 10, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "API Development", + "System Design", + "Agile Methodologies", + "Performance Optimization" + ] + }, + { + "name": "User_85", + "total_assigned_items": 14, + "completed_items": 14, + "area_list": [ + "System Design", + "Agile Methodologies", + "Unit Testing", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "40", + "red_flags": 5, + "open_items": 25, + "completed_items": 37, + "total_assigned_items": 62, + "assessment_name": "Assessment 40", + "start_date": "2024-08-07T00:00:00.000Z", + "user_details": [ + { + "name": "User_90", + "total_assigned_items": 30, + "completed_items": 0, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Agile Methodologies", + "Debugging Techniques", + "System Design" + ] + }, + { + "name": "User_80", + "total_assigned_items": 48, + "completed_items": 16, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_16", + "total_assigned_items": 22, + "completed_items": 6, + "area_list": [ + "Debugging Techniques", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "41", + "red_flags": 3, + "open_items": 50, + "completed_items": 5, + "total_assigned_items": 55, + "assessment_name": "Assessment 41", + "start_date": "2024-04-24T00:00:00.000Z", + "user_details": [ + { + "name": "User_100", + "total_assigned_items": 6, + "completed_items": 6, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_5", + "total_assigned_items": 24, + "completed_items": 24, + "area_list": [ + "Code Review", + "Unit Testing", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "42", + "red_flags": 1, + "open_items": 20, + "completed_items": 6, + "total_assigned_items": 26, + "assessment_name": "Assessment 42", + "start_date": "2024-06-22T00:00:00.000Z", + "user_details": [ + { + "name": "User_55", + "total_assigned_items": 32, + "completed_items": 8, + "area_list": [ + "Code Review", + "System Design", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "43", + "red_flags": 2, + "open_items": 14, + "completed_items": 22, + "total_assigned_items": 36, + "assessment_name": "Assessment 43", + "start_date": "2024-10-14T00:00:00.000Z", + "user_details": [ + { + "name": "User_19", + "total_assigned_items": 33, + "completed_items": 4, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Documentation", + "Agile Methodologies", + "Unit Testing" + ] + }, + { + "name": "User_35", + "total_assigned_items": 21, + "completed_items": 20, + "area_list": [ + "Documentation", + "Unit Testing", + "Agile Methodologies" + ] + }, + { + "name": "User_49", + "total_assigned_items": 20, + "completed_items": 6, + "area_list": [ + "Version Control", + "Debugging Techniques", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "44", + "red_flags": 4, + "open_items": 34, + "completed_items": 16, + "total_assigned_items": 50, + "assessment_name": "Assessment 44", + "start_date": "2024-03-04T00:00:00.000Z", + "user_details": [ + { + "name": "User_64", + "total_assigned_items": 46, + "completed_items": 23, + "area_list": [ + "API Development", + "System Design", + "Unit Testing" + ] + }, + { + "name": "User_47", + "total_assigned_items": 35, + "completed_items": 17, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Debugging Techniques", + "Agile Methodologies", + "API Development", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_82", + "total_assigned_items": 50, + "completed_items": 1, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Performance Optimization", + "Agile Methodologies", + "API Development" + ] + }, + { + "name": "User_56", + "total_assigned_items": 42, + "completed_items": 6, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_71", + "total_assigned_items": 31, + "completed_items": 9, + "area_list": [ + "Code Review" + ] + } + ] + }, + { + "assessment_id": "45", + "red_flags": 3, + "open_items": 39, + "completed_items": 24, + "total_assigned_items": 63, + "assessment_name": "Assessment 45", + "start_date": "2024-08-25T00:00:00.000Z", + "user_details": [ + { + "name": "User_66", + "total_assigned_items": 20, + "completed_items": 3, + "area_list": [ + "Debugging Techniques", + "Collaboration with Cross-Functional Teams", + "Documentation", + "Performance Optimization" + ] + }, + { + "name": "User_4", + "total_assigned_items": 6, + "completed_items": 1, + "area_list": [ + "API Development", + "Code Review", + "Debugging Techniques", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_79", + "total_assigned_items": 18, + "completed_items": 1, + "area_list": [ + "Code Review", + "System Design", + "Documentation" + ] + }, + { + "name": "User_84", + "total_assigned_items": 44, + "completed_items": 19, + "area_list": [ + "Version Control" + ] + }, + { + "name": "User_48", + "total_assigned_items": 7, + "completed_items": 5, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "46", + "red_flags": 2, + "open_items": 26, + "completed_items": 35, + "total_assigned_items": 61, + "assessment_name": "Assessment 46", + "start_date": "2024-09-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_23", + "total_assigned_items": 13, + "completed_items": 10, + "area_list": [ + "Agile Methodologies" + ] + }, + { + "name": "User_53", + "total_assigned_items": 35, + "completed_items": 27, + "area_list": [ + "Unit Testing", + "Agile Methodologies", + "Debugging Techniques", + "API Development" + ] + }, + { + "name": "User_1", + "total_assigned_items": 27, + "completed_items": 26, + "area_list": [ + "API Development" + ] + }, + { + "name": "User_63", + "total_assigned_items": 24, + "completed_items": 11, + "area_list": [ + "Unit Testing", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "47", + "red_flags": 1, + "open_items": 12, + "completed_items": 47, + "total_assigned_items": 59, + "assessment_name": "Assessment 47", + "start_date": "2024-01-02T00:00:00.000Z", + "user_details": [ + { + "name": "User_51", + "total_assigned_items": 17, + "completed_items": 17, + "area_list": [ + "Debugging Techniques" + ] + }, + { + "name": "User_14", + "total_assigned_items": 26, + "completed_items": 19, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Unit Testing", + "Documentation", + "Version Control" + ] + }, + { + "name": "User_23", + "total_assigned_items": 6, + "completed_items": 5, + "area_list": [ + "Unit Testing" + ] + }, + { + "name": "User_8", + "total_assigned_items": 10, + "completed_items": 2, + "area_list": [ + "Version Control", + "System Design", + "Unit Testing" + ] + }, + { + "name": "User_8", + "total_assigned_items": 26, + "completed_items": 10, + "area_list": [ + "Version Control", + "Debugging Techniques", + "System Design", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "48", + "red_flags": 2, + "open_items": 29, + "completed_items": 19, + "total_assigned_items": 48, + "assessment_name": "Assessment 48", + "start_date": "2024-09-21T00:00:00.000Z", + "user_details": [ + { + "name": "User_29", + "total_assigned_items": 22, + "completed_items": 10, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_99", + "total_assigned_items": 2, + "completed_items": 0, + "area_list": [ + "Version Control" + ] + }, + { + "name": "User_36", + "total_assigned_items": 2, + "completed_items": 2, + "area_list": [ + "Unit Testing", + "Debugging Techniques" + ] + }, + { + "name": "User_79", + "total_assigned_items": 39, + "completed_items": 5, + "area_list": [ + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "49", + "red_flags": 3, + "open_items": 3, + "completed_items": 35, + "total_assigned_items": 38, + "assessment_name": "Assessment 49", + "start_date": "2024-10-10T00:00:00.000Z", + "user_details": [ + { + "name": "User_19", + "total_assigned_items": 3, + "completed_items": 2, + "area_list": [ + "Documentation", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_11", + "total_assigned_items": 35, + "completed_items": 4, + "area_list": [ + "Unit Testing", + "Version Control" + ] + }, + { + "name": "User_80", + "total_assigned_items": 38, + "completed_items": 7, + "area_list": [ + "Agile Methodologies" + ] + } + ] + }, + { + "assessment_id": "50", + "red_flags": 1, + "open_items": 14, + "completed_items": 19, + "total_assigned_items": 33, + "assessment_name": "Assessment 50", + "start_date": "2024-06-05T00:00:00.000Z", + "user_details": [ + { + "name": "User_26", + "total_assigned_items": 36, + "completed_items": 18, + "area_list": [ + "Code Review", + "API Development" + ] + } + ] + }, + { + "assessment_id": "51", + "red_flags": 1, + "open_items": 4, + "completed_items": 37, + "total_assigned_items": 41, + "assessment_name": "Assessment 51", + "start_date": "2024-08-11T00:00:00.000Z", + "user_details": [ + { + "name": "User_23", + "total_assigned_items": 32, + "completed_items": 4, + "area_list": [ + "API Development", + "Version Control", + "Unit Testing" + ] + }, + { + "name": "User_43", + "total_assigned_items": 45, + "completed_items": 4, + "area_list": [ + "API Development", + "Performance Optimization" + ] + }, + { + "name": "User_97", + "total_assigned_items": 33, + "completed_items": 12, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_43", + "total_assigned_items": 15, + "completed_items": 3, + "area_list": [ + "Debugging Techniques", + "Agile Methodologies", + "Code Review", + "System Design" + ] + } + ] + }, + { + "assessment_id": "52", + "red_flags": 4, + "open_items": 19, + "completed_items": 4, + "total_assigned_items": 23, + "assessment_name": "Assessment 52", + "start_date": "2024-04-12T00:00:00.000Z", + "user_details": [ + { + "name": "User_5", + "total_assigned_items": 26, + "completed_items": 14, + "area_list": [ + "Agile Methodologies", + "Documentation", + "API Development", + "System Design" + ] + }, + { + "name": "User_19", + "total_assigned_items": 7, + "completed_items": 7, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_1", + "total_assigned_items": 15, + "completed_items": 1, + "area_list": [ + "Unit Testing", + "Debugging Techniques", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "Agile Methodologies" + ] + }, + { + "name": "User_31", + "total_assigned_items": 19, + "completed_items": 19, + "area_list": [ + "Agile Methodologies", + "Code Review" + ] + }, + { + "name": "User_44", + "total_assigned_items": 23, + "completed_items": 16, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "53", + "red_flags": 4, + "open_items": 28, + "completed_items": 22, + "total_assigned_items": 50, + "assessment_name": "Assessment 53", + "start_date": "2024-05-08T00:00:00.000Z", + "user_details": [ + { + "name": "User_70", + "total_assigned_items": 26, + "completed_items": 9, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Code Review" + ] + }, + { + "name": "User_15", + "total_assigned_items": 1, + "completed_items": 1, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_100", + "total_assigned_items": 37, + "completed_items": 1, + "area_list": [ + "Unit Testing", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "54", + "red_flags": 3, + "open_items": 42, + "completed_items": 38, + "total_assigned_items": 80, + "assessment_name": "Assessment 54", + "start_date": "2024-05-05T00:00:00.000Z", + "user_details": [ + { + "name": "User_82", + "total_assigned_items": 19, + "completed_items": 5, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "System Design", + "Code Review", + "API Development" + ] + }, + { + "name": "User_53", + "total_assigned_items": 47, + "completed_items": 5, + "area_list": [ + "API Development", + "Performance Optimization", + "Documentation" + ] + } + ] + }, + { + "assessment_id": "55", + "red_flags": 3, + "open_items": 3, + "completed_items": 33, + "total_assigned_items": 36, + "assessment_name": "Assessment 55", + "start_date": "2024-02-04T00:00:00.000Z", + "user_details": [ + { + "name": "User_92", + "total_assigned_items": 24, + "completed_items": 1, + "area_list": [ + "API Development", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Code Review", + "Version Control" + ] + }, + { + "name": "User_30", + "total_assigned_items": 22, + "completed_items": 9, + "area_list": [ + "Debugging Techniques", + "Agile Methodologies", + "Version Control" + ] + }, + { + "name": "User_75", + "total_assigned_items": 14, + "completed_items": 8, + "area_list": [ + "API Development" + ] + }, + { + "name": "User_6", + "total_assigned_items": 6, + "completed_items": 0, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development", + "System Design", + "Performance Optimization" + ] + }, + { + "name": "User_54", + "total_assigned_items": 21, + "completed_items": 16, + "area_list": [ + "Agile Methodologies", + "Version Control", + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)", + "System Design" + ] + } + ] + }, + { + "assessment_id": "56", + "red_flags": 3, + "open_items": 33, + "completed_items": 28, + "total_assigned_items": 61, + "assessment_name": "Assessment 56", + "start_date": "2024-07-06T00:00:00.000Z", + "user_details": [ + { + "name": "User_25", + "total_assigned_items": 6, + "completed_items": 5, + "area_list": [ + "System Design", + "Version Control", + "Documentation" + ] + }, + { + "name": "User_41", + "total_assigned_items": 4, + "completed_items": 4, + "area_list": [ + "Performance Optimization", + "Documentation" + ] + }, + { + "name": "User_88", + "total_assigned_items": 37, + "completed_items": 1, + "area_list": [ + "Code Review", + "Unit Testing", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "57", + "red_flags": 4, + "open_items": 29, + "completed_items": 9, + "total_assigned_items": 38, + "assessment_name": "Assessment 57", + "start_date": "2024-07-30T00:00:00.000Z", + "user_details": [ + { + "name": "User_12", + "total_assigned_items": 23, + "completed_items": 21, + "area_list": [ + "System Design", + "Version Control", + "Collaboration with Cross-Functional Teams", + "Agile Methodologies", + "Performance Optimization" + ] + }, + { + "name": "User_29", + "total_assigned_items": 43, + "completed_items": 15, + "area_list": [ + "Debugging Techniques", + "API Development" + ] + }, + { + "name": "User_36", + "total_assigned_items": 20, + "completed_items": 20, + "area_list": [ + "Performance Optimization", + "Documentation", + "API Development", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_20", + "total_assigned_items": 50, + "completed_items": 33, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Code Review", + "Performance Optimization" + ] + }, + { + "name": "User_37", + "total_assigned_items": 42, + "completed_items": 8, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "API Development", + "Documentation", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "58", + "red_flags": 0, + "open_items": 11, + "completed_items": 35, + "total_assigned_items": 46, + "assessment_name": "Assessment 58", + "start_date": "2024-03-22T00:00:00.000Z", + "user_details": [ + { + "name": "User_34", + "total_assigned_items": 28, + "completed_items": 6, + "area_list": [ + "API Development", + "System Design", + "Performance Optimization", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_29", + "total_assigned_items": 8, + "completed_items": 2, + "area_list": [ + "Version Control", + "Unit Testing", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "59", + "red_flags": 1, + "open_items": 26, + "completed_items": 25, + "total_assigned_items": 51, + "assessment_name": "Assessment 59", + "start_date": "2024-10-01T00:00:00.000Z", + "user_details": [ + { + "name": "User_14", + "total_assigned_items": 24, + "completed_items": 16, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_35", + "total_assigned_items": 46, + "completed_items": 40, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "API Development" + ] + }, + { + "name": "User_20", + "total_assigned_items": 38, + "completed_items": 32, + "area_list": [ + "Unit Testing", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "60", + "red_flags": 3, + "open_items": 44, + "completed_items": 32, + "total_assigned_items": 76, + "assessment_name": "Assessment 60", + "start_date": "2024-07-22T00:00:00.000Z", + "user_details": [ + { + "name": "User_92", + "total_assigned_items": 42, + "completed_items": 42, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "61", + "red_flags": 0, + "open_items": 14, + "completed_items": 10, + "total_assigned_items": 24, + "assessment_name": "Assessment 61", + "start_date": "2024-04-05T00:00:00.000Z", + "user_details": [ + { + "name": "User_12", + "total_assigned_items": 38, + "completed_items": 20, + "area_list": [ + "System Design" + ] + }, + { + "name": "User_1", + "total_assigned_items": 12, + "completed_items": 4, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Debugging Techniques", + "API Development", + "Documentation" + ] + }, + { + "name": "User_41", + "total_assigned_items": 5, + "completed_items": 5, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Version Control", + "Debugging Techniques", + "System Design" + ] + } + ] + }, + { + "assessment_id": "62", + "red_flags": 3, + "open_items": 21, + "completed_items": 25, + "total_assigned_items": 46, + "assessment_name": "Assessment 62", + "start_date": "2024-08-25T00:00:00.000Z", + "user_details": [ + { + "name": "User_29", + "total_assigned_items": 14, + "completed_items": 6, + "area_list": [ + "System Design", + "Version Control", + "API Development", + "Performance Optimization", + "Debugging Techniques" + ] + }, + { + "name": "User_45", + "total_assigned_items": 29, + "completed_items": 19, + "area_list": [ + "Unit Testing" + ] + }, + { + "name": "User_41", + "total_assigned_items": 36, + "completed_items": 15, + "area_list": [ + "Code Review", + "Agile Methodologies", + "API Development" + ] + }, + { + "name": "User_72", + "total_assigned_items": 19, + "completed_items": 1, + "area_list": [ + "Documentation", + "Code Review", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "63", + "red_flags": 3, + "open_items": 25, + "completed_items": 13, + "total_assigned_items": 38, + "assessment_name": "Assessment 63", + "start_date": "2024-10-27T00:00:00.000Z", + "user_details": [ + { + "name": "User_68", + "total_assigned_items": 23, + "completed_items": 2, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_24", + "total_assigned_items": 6, + "completed_items": 2, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Code Review", + "Debugging Techniques", + "Agile Methodologies", + "Unit Testing" + ] + } + ] + }, + { + "assessment_id": "64", + "red_flags": 2, + "open_items": 48, + "completed_items": 4, + "total_assigned_items": 52, + "assessment_name": "Assessment 64", + "start_date": "2024-06-22T00:00:00.000Z", + "user_details": [ + { + "name": "User_51", + "total_assigned_items": 27, + "completed_items": 23, + "area_list": [ + "System Design", + "Version Control" + ] + }, + { + "name": "User_15", + "total_assigned_items": 16, + "completed_items": 15, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Documentation", + "Unit Testing", + "Code Review" + ] + }, + { + "name": "User_73", + "total_assigned_items": 6, + "completed_items": 6, + "area_list": [ + "Unit Testing", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "65", + "red_flags": 1, + "open_items": 7, + "completed_items": 18, + "total_assigned_items": 25, + "assessment_name": "Assessment 65", + "start_date": "2024-04-16T00:00:00.000Z", + "user_details": [ + { + "name": "User_70", + "total_assigned_items": 4, + "completed_items": 3, + "area_list": [ + "Documentation", + "Debugging Techniques", + "Unit Testing", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_12", + "total_assigned_items": 36, + "completed_items": 13, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Code Review" + ] + }, + { + "name": "User_90", + "total_assigned_items": 4, + "completed_items": 0, + "area_list": [ + "Agile Methodologies", + "Code Review", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "66", + "red_flags": 0, + "open_items": 19, + "completed_items": 49, + "total_assigned_items": 68, + "assessment_name": "Assessment 66", + "start_date": "2024-05-18T00:00:00.000Z", + "user_details": [ + { + "name": "User_51", + "total_assigned_items": 2, + "completed_items": 0, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_74", + "total_assigned_items": 39, + "completed_items": 0, + "area_list": [ + "System Design", + "Version Control", + "API Development" + ] + }, + { + "name": "User_72", + "total_assigned_items": 42, + "completed_items": 17, + "area_list": [ + "Debugging Techniques", + "Continuous Integration/Continuous Deployment (CI/CD)", + "System Design", + "API Development" + ] + } + ] + }, + { + "assessment_id": "67", + "red_flags": 4, + "open_items": 16, + "completed_items": 7, + "total_assigned_items": 23, + "assessment_name": "Assessment 67", + "start_date": "2024-10-02T00:00:00.000Z", + "user_details": [ + { + "name": "User_67", + "total_assigned_items": 11, + "completed_items": 4, + "area_list": [ + "Unit Testing", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_83", + "total_assigned_items": 48, + "completed_items": 11, + "area_list": [ + "Code Review", + "Debugging Techniques", + "API Development", + "System Design" + ] + } + ] + }, + { + "assessment_id": "68", + "red_flags": 5, + "open_items": 37, + "completed_items": 47, + "total_assigned_items": 84, + "assessment_name": "Assessment 68", + "start_date": "2024-07-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_48", + "total_assigned_items": 19, + "completed_items": 6, + "area_list": [ + "Documentation", + "API Development", + "Performance Optimization", + "Unit Testing", + "Code Review" + ] + }, + { + "name": "User_76", + "total_assigned_items": 31, + "completed_items": 29, + "area_list": [ + "Performance Optimization", + "Code Review", + "Agile Methodologies" + ] + }, + { + "name": "User_33", + "total_assigned_items": 10, + "completed_items": 7, + "area_list": [ + "Code Review", + "Unit Testing", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "System Design" + ] + }, + { + "name": "User_91", + "total_assigned_items": 15, + "completed_items": 7, + "area_list": [ + "Performance Optimization" + ] + }, + { + "name": "User_36", + "total_assigned_items": 22, + "completed_items": 13, + "area_list": [ + "Debugging Techniques", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "69", + "red_flags": 0, + "open_items": 42, + "completed_items": 49, + "total_assigned_items": 91, + "assessment_name": "Assessment 69", + "start_date": "2024-03-07T00:00:00.000Z", + "user_details": [ + { + "name": "User_56", + "total_assigned_items": 19, + "completed_items": 11, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Agile Methodologies" + ] + }, + { + "name": "User_93", + "total_assigned_items": 6, + "completed_items": 3, + "area_list": [ + "Documentation", + "Unit Testing" + ] + }, + { + "name": "User_69", + "total_assigned_items": 20, + "completed_items": 5, + "area_list": [ + "Debugging Techniques", + "System Design", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_68", + "total_assigned_items": 19, + "completed_items": 12, + "area_list": [ + "Version Control", + "Documentation" + ] + } + ] + }, + { + "assessment_id": "70", + "red_flags": 1, + "open_items": 33, + "completed_items": 31, + "total_assigned_items": 64, + "assessment_name": "Assessment 70", + "start_date": "2024-04-25T00:00:00.000Z", + "user_details": [ + { + "name": "User_19", + "total_assigned_items": 2, + "completed_items": 2, + "area_list": [ + "API Development", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams", + "Version Control", + "System Design" + ] + }, + { + "name": "User_12", + "total_assigned_items": 41, + "completed_items": 25, + "area_list": [ + "Documentation", + "Debugging Techniques", + "Code Review", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_31", + "total_assigned_items": 45, + "completed_items": 5, + "area_list": [ + "Debugging Techniques", + "Documentation", + "System Design", + "API Development", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_71", + "total_assigned_items": 29, + "completed_items": 18, + "area_list": [ + "Code Review" + ] + } + ] + }, + { + "assessment_id": "71", + "red_flags": 4, + "open_items": 48, + "completed_items": 41, + "total_assigned_items": 89, + "assessment_name": "Assessment 71", + "start_date": "2024-06-07T00:00:00.000Z", + "user_details": [ + { + "name": "User_7", + "total_assigned_items": 17, + "completed_items": 17, + "area_list": [ + "Unit Testing", + "API Development", + "Version Control" + ] + }, + { + "name": "User_16", + "total_assigned_items": 14, + "completed_items": 13, + "area_list": [ + "Version Control", + "Agile Methodologies" + ] + }, + { + "name": "User_66", + "total_assigned_items": 48, + "completed_items": 24, + "area_list": [ + "Performance Optimization", + "API Development", + "Version Control" + ] + }, + { + "name": "User_45", + "total_assigned_items": 17, + "completed_items": 12, + "area_list": [ + "API Development", + "Unit Testing", + "Code Review", + "Performance Optimization", + "System Design" + ] + }, + { + "name": "User_18", + "total_assigned_items": 29, + "completed_items": 9, + "area_list": [ + "API Development", + "Documentation", + "Code Review", + "Performance Optimization", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "72", + "red_flags": 3, + "open_items": 9, + "completed_items": 21, + "total_assigned_items": 30, + "assessment_name": "Assessment 72", + "start_date": "2024-03-25T00:00:00.000Z", + "user_details": [ + { + "name": "User_14", + "total_assigned_items": 42, + "completed_items": 24, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Documentation", + "Debugging Techniques" + ] + }, + { + "name": "User_37", + "total_assigned_items": 13, + "completed_items": 10, + "area_list": [ + "Debugging Techniques", + "Code Review", + "Collaboration with Cross-Functional Teams", + "Documentation" + ] + }, + { + "name": "User_35", + "total_assigned_items": 32, + "completed_items": 32, + "area_list": [ + "Agile Methodologies", + "Unit Testing", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_40", + "total_assigned_items": 18, + "completed_items": 1, + "area_list": [ + "Documentation", + "Debugging Techniques", + "Agile Methodologies", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_95", + "total_assigned_items": 21, + "completed_items": 2, + "area_list": [ + "Unit Testing", + "Performance Optimization", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "System Design" + ] + } + ] + }, + { + "assessment_id": "73", + "red_flags": 2, + "open_items": 42, + "completed_items": 36, + "total_assigned_items": 78, + "assessment_name": "Assessment 73", + "start_date": "2024-06-14T00:00:00.000Z", + "user_details": [ + { + "name": "User_48", + "total_assigned_items": 4, + "completed_items": 4, + "area_list": [ + "Performance Optimization", + "Version Control", + "Debugging Techniques", + "API Development" + ] + }, + { + "name": "User_27", + "total_assigned_items": 44, + "completed_items": 6, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Agile Methodologies", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "74", + "red_flags": 5, + "open_items": 49, + "completed_items": 30, + "total_assigned_items": 79, + "assessment_name": "Assessment 74", + "start_date": "2024-04-20T00:00:00.000Z", + "user_details": [ + { + "name": "User_50", + "total_assigned_items": 47, + "completed_items": 38, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Performance Optimization" + ] + }, + { + "name": "User_86", + "total_assigned_items": 15, + "completed_items": 0, + "area_list": [ + "Version Control", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Agile Methodologies" + ] + }, + { + "name": "User_58", + "total_assigned_items": 48, + "completed_items": 46, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "System Design", + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_35", + "total_assigned_items": 22, + "completed_items": 2, + "area_list": [ + "System Design", + "API Development", + "Code Review", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "75", + "red_flags": 5, + "open_items": 16, + "completed_items": 27, + "total_assigned_items": 43, + "assessment_name": "Assessment 75", + "start_date": "2024-10-15T00:00:00.000Z", + "user_details": [ + { + "name": "User_25", + "total_assigned_items": 43, + "completed_items": 20, + "area_list": [ + "Code Review", + "Documentation", + "API Development" + ] + }, + { + "name": "User_60", + "total_assigned_items": 48, + "completed_items": 17, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_60", + "total_assigned_items": 48, + "completed_items": 26, + "area_list": [ + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_99", + "total_assigned_items": 2, + "completed_items": 1, + "area_list": [ + "Agile Methodologies" + ] + } + ] + }, + { + "assessment_id": "76", + "red_flags": 4, + "open_items": 43, + "completed_items": 23, + "total_assigned_items": 66, + "assessment_name": "Assessment 76", + "start_date": "2024-04-08T00:00:00.000Z", + "user_details": [ + { + "name": "User_96", + "total_assigned_items": 45, + "completed_items": 3, + "area_list": [ + "Performance Optimization", + "Code Review" + ] + }, + { + "name": "User_99", + "total_assigned_items": 14, + "completed_items": 9, + "area_list": [ + "Performance Optimization", + "Version Control", + "Collaboration with Cross-Functional Teams", + "Documentation", + "Debugging Techniques" + ] + }, + { + "name": "User_4", + "total_assigned_items": 7, + "completed_items": 6, + "area_list": [ + "Agile Methodologies", + "Debugging Techniques", + "Documentation", + "Performance Optimization" + ] + }, + { + "name": "User_61", + "total_assigned_items": 29, + "completed_items": 7, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Continuous Integration/Continuous Deployment (CI/CD)", + "API Development", + "System Design", + "Code Review" + ] + }, + { + "name": "User_45", + "total_assigned_items": 4, + "completed_items": 4, + "area_list": [ + "Documentation", + "Performance Optimization", + "System Design", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "77", + "red_flags": 2, + "open_items": 37, + "completed_items": 45, + "total_assigned_items": 82, + "assessment_name": "Assessment 77", + "start_date": "2024-05-01T00:00:00.000Z", + "user_details": [ + { + "name": "User_61", + "total_assigned_items": 1, + "completed_items": 1, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Performance Optimization", + "Version Control", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "78", + "red_flags": 4, + "open_items": 33, + "completed_items": 50, + "total_assigned_items": 83, + "assessment_name": "Assessment 78", + "start_date": "2024-02-17T00:00:00.000Z", + "user_details": [ + { + "name": "User_8", + "total_assigned_items": 15, + "completed_items": 8, + "area_list": [ + "API Development" + ] + }, + { + "name": "User_47", + "total_assigned_items": 44, + "completed_items": 16, + "area_list": [ + "Unit Testing" + ] + }, + { + "name": "User_53", + "total_assigned_items": 4, + "completed_items": 3, + "area_list": [ + "Version Control", + "Collaboration with Cross-Functional Teams", + "System Design" + ] + }, + { + "name": "User_53", + "total_assigned_items": 11, + "completed_items": 1, + "area_list": [ + "Documentation", + "Collaboration with Cross-Functional Teams", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "79", + "red_flags": 0, + "open_items": 38, + "completed_items": 0, + "total_assigned_items": 38, + "assessment_name": "Assessment 79", + "start_date": "2024-02-13T00:00:00.000Z", + "user_details": [ + { + "name": "User_23", + "total_assigned_items": 29, + "completed_items": 4, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_82", + "total_assigned_items": 32, + "completed_items": 22, + "area_list": [ + "Unit Testing" + ] + }, + { + "name": "User_7", + "total_assigned_items": 45, + "completed_items": 42, + "area_list": [ + "API Development", + "Performance Optimization" + ] + }, + { + "name": "User_80", + "total_assigned_items": 34, + "completed_items": 21, + "area_list": [ + "System Design", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "80", + "red_flags": 5, + "open_items": 26, + "completed_items": 11, + "total_assigned_items": 37, + "assessment_name": "Assessment 80", + "start_date": "2024-09-03T00:00:00.000Z", + "user_details": [ + { + "name": "User_80", + "total_assigned_items": 23, + "completed_items": 7, + "area_list": [ + "Version Control", + "Collaboration with Cross-Functional Teams", + "Debugging Techniques", + "Agile Methodologies", + "Documentation" + ] + }, + { + "name": "User_43", + "total_assigned_items": 26, + "completed_items": 17, + "area_list": [ + "Performance Optimization", + "Version Control" + ] + }, + { + "name": "User_30", + "total_assigned_items": 39, + "completed_items": 33, + "area_list": [ + "Performance Optimization", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Agile Methodologies" + ] + }, + { + "name": "User_10", + "total_assigned_items": 26, + "completed_items": 22, + "area_list": [ + "API Development", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Documentation", + "Collaboration with Cross-Functional Teams", + "Agile Methodologies" + ] + } + ] + }, + { + "assessment_id": "81", + "red_flags": 0, + "open_items": 32, + "completed_items": 31, + "total_assigned_items": 63, + "assessment_name": "Assessment 81", + "start_date": "2024-09-01T00:00:00.000Z", + "user_details": [ + { + "name": "User_100", + "total_assigned_items": 47, + "completed_items": 33, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Debugging Techniques", + "API Development" + ] + } + ] + }, + { + "assessment_id": "82", + "red_flags": 1, + "open_items": 6, + "completed_items": 4, + "total_assigned_items": 10, + "assessment_name": "Assessment 82", + "start_date": "2024-02-08T00:00:00.000Z", + "user_details": [ + { + "name": "User_2", + "total_assigned_items": 41, + "completed_items": 36, + "area_list": [ + "Debugging Techniques", + "Code Review", + "Performance Optimization", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_66", + "total_assigned_items": 32, + "completed_items": 6, + "area_list": [ + "System Design", + "Performance Optimization", + "Version Control", + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + }, + { + "name": "User_41", + "total_assigned_items": 33, + "completed_items": 29, + "area_list": [ + "Documentation" + ] + } + ] + }, + { + "assessment_id": "83", + "red_flags": 4, + "open_items": 1, + "completed_items": 1, + "total_assigned_items": 2, + "assessment_name": "Assessment 83", + "start_date": "2024-05-15T00:00:00.000Z", + "user_details": [ + { + "name": "User_10", + "total_assigned_items": 43, + "completed_items": 11, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "Code Review", + "Documentation" + ] + }, + { + "name": "User_70", + "total_assigned_items": 24, + "completed_items": 10, + "area_list": [ + "Debugging Techniques", + "Collaboration with Cross-Functional Teams", + "Performance Optimization", + "Code Review", + "System Design" + ] + } + ] + }, + { + "assessment_id": "84", + "red_flags": 4, + "open_items": 34, + "completed_items": 10, + "total_assigned_items": 44, + "assessment_name": "Assessment 84", + "start_date": "2024-02-29T00:00:00.000Z", + "user_details": [ + { + "name": "User_90", + "total_assigned_items": 42, + "completed_items": 28, + "area_list": [ + "Debugging Techniques", + "Collaboration with Cross-Functional Teams", + "Agile Methodologies", + "Performance Optimization" + ] + }, + { + "name": "User_9", + "total_assigned_items": 17, + "completed_items": 8, + "area_list": [ + "Agile Methodologies", + "API Development" + ] + }, + { + "name": "User_72", + "total_assigned_items": 5, + "completed_items": 5, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Version Control", + "Debugging Techniques", + "API Development" + ] + }, + { + "name": "User_5", + "total_assigned_items": 4, + "completed_items": 1, + "area_list": [ + "Debugging Techniques", + "System Design" + ] + }, + { + "name": "User_60", + "total_assigned_items": 41, + "completed_items": 32, + "area_list": [ + "Debugging Techniques", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "85", + "red_flags": 0, + "open_items": 28, + "completed_items": 40, + "total_assigned_items": 68, + "assessment_name": "Assessment 85", + "start_date": "2024-05-10T00:00:00.000Z", + "user_details": [ + { + "name": "User_100", + "total_assigned_items": 17, + "completed_items": 12, + "area_list": [ + "Performance Optimization", + "Unit Testing", + "Debugging Techniques", + "Code Review" + ] + }, + { + "name": "User_100", + "total_assigned_items": 17, + "completed_items": 14, + "area_list": [ + "Version Control", + "Agile Methodologies", + "Collaboration with Cross-Functional Teams", + "Continuous Integration/Continuous Deployment (CI/CD)" + ] + } + ] + }, + { + "assessment_id": "86", + "red_flags": 0, + "open_items": 26, + "completed_items": 17, + "total_assigned_items": 43, + "assessment_name": "Assessment 86", + "start_date": "2024-03-13T00:00:00.000Z", + "user_details": [ + { + "name": "User_32", + "total_assigned_items": 19, + "completed_items": 13, + "area_list": [ + "Collaboration with Cross-Functional Teams", + "Documentation", + "Version Control", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Unit Testing" + ] + }, + { + "name": "User_62", + "total_assigned_items": 19, + "completed_items": 14, + "area_list": [ + "Documentation", + "System Design" + ] + }, + { + "name": "User_54", + "total_assigned_items": 35, + "completed_items": 25, + "area_list": [ + "System Design", + "Debugging Techniques", + "Code Review", + "Version Control" + ] + }, + { + "name": "User_32", + "total_assigned_items": 48, + "completed_items": 45, + "area_list": [ + "System Design", + "Code Review", + "Documentation" + ] + } + ] + }, + { + "assessment_id": "87", + "red_flags": 4, + "open_items": 47, + "completed_items": 40, + "total_assigned_items": 87, + "assessment_name": "Assessment 87", + "start_date": "2024-06-27T00:00:00.000Z", + "user_details": [ + { + "name": "User_89", + "total_assigned_items": 31, + "completed_items": 19, + "area_list": [ + "Code Review" + ] + } + ] + }, + { + "assessment_id": "88", + "red_flags": 5, + "open_items": 38, + "completed_items": 19, + "total_assigned_items": 57, + "assessment_name": "Assessment 88", + "start_date": "2024-03-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_9", + "total_assigned_items": 5, + "completed_items": 3, + "area_list": [ + "Performance Optimization", + "Agile Methodologies", + "Unit Testing" + ] + }, + { + "name": "User_13", + "total_assigned_items": 25, + "completed_items": 2, + "area_list": [ + "Code Review", + "Version Control", + "Collaboration with Cross-Functional Teams" + ] + } + ] + }, + { + "assessment_id": "89", + "red_flags": 4, + "open_items": 13, + "completed_items": 5, + "total_assigned_items": 18, + "assessment_name": "Assessment 89", + "start_date": "2024-01-30T00:00:00.000Z", + "user_details": [ + { + "name": "User_23", + "total_assigned_items": 32, + "completed_items": 23, + "area_list": [ + "Code Review", + "Agile Methodologies", + "Performance Optimization", + "Documentation" + ] + }, + { + "name": "User_54", + "total_assigned_items": 37, + "completed_items": 37, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Version Control", + "Agile Methodologies", + "Code Review", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_78", + "total_assigned_items": 14, + "completed_items": 10, + "area_list": [ + "Unit Testing", + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "90", + "red_flags": 1, + "open_items": 21, + "completed_items": 30, + "total_assigned_items": 51, + "assessment_name": "Assessment 90", + "start_date": "2024-06-27T00:00:00.000Z", + "user_details": [ + { + "name": "User_78", + "total_assigned_items": 40, + "completed_items": 9, + "area_list": [ + "Performance Optimization", + "API Development", + "Code Review", + "Unit Testing" + ] + }, + { + "name": "User_87", + "total_assigned_items": 44, + "completed_items": 7, + "area_list": [ + "Continuous Integration/Continuous Deployment (CI/CD)", + "Agile Methodologies", + "Unit Testing", + "Debugging Techniques", + "System Design" + ] + }, + { + "name": "User_82", + "total_assigned_items": 47, + "completed_items": 20, + "area_list": [ + "Performance Optimization", + "Code Review", + "System Design" + ] + }, + { + "name": "User_3", + "total_assigned_items": 15, + "completed_items": 2, + "area_list": [ + "Unit Testing", + "System Design", + "Performance Optimization", + "Version Control", + "Documentation" + ] + } + ] + }, + { + "assessment_id": "91", + "red_flags": 3, + "open_items": 1, + "completed_items": 17, + "total_assigned_items": 18, + "assessment_name": "Assessment 91", + "start_date": "2024-03-03T00:00:00.000Z", + "user_details": [ + { + "name": "User_58", + "total_assigned_items": 15, + "completed_items": 11, + "area_list": [ + "Documentation", + "API Development" + ] + }, + { + "name": "User_2", + "total_assigned_items": 17, + "completed_items": 8, + "area_list": [ + "Debugging Techniques", + "Performance Optimization", + "Version Control" + ] + } + ] + }, + { + "assessment_id": "92", + "red_flags": 0, + "open_items": 34, + "completed_items": 5, + "total_assigned_items": 39, + "assessment_name": "Assessment 92", + "start_date": "2024-10-12T00:00:00.000Z", + "user_details": [ + { + "name": "User_99", + "total_assigned_items": 34, + "completed_items": 23, + "area_list": [ + "Documentation" + ] + }, + { + "name": "User_95", + "total_assigned_items": 26, + "completed_items": 8, + "area_list": [ + "Version Control", + "Code Review", + "API Development" + ] + } + ] + }, + { + "assessment_id": "93", + "red_flags": 5, + "open_items": 22, + "completed_items": 23, + "total_assigned_items": 45, + "assessment_name": "Assessment 93", + "start_date": "2024-03-17T00:00:00.000Z", + "user_details": [ + { + "name": "User_61", + "total_assigned_items": 26, + "completed_items": 24, + "area_list": [ + "Debugging Techniques" + ] + }, + { + "name": "User_41", + "total_assigned_items": 17, + "completed_items": 7, + "area_list": [ + "API Development", + "Unit Testing" + ] + }, + { + "name": "User_45", + "total_assigned_items": 38, + "completed_items": 29, + "area_list": [ + "Code Review", + "Performance Optimization" + ] + } + ] + }, + { + "assessment_id": "94", + "red_flags": 3, + "open_items": 35, + "completed_items": 11, + "total_assigned_items": 46, + "assessment_name": "Assessment 94", + "start_date": "2024-01-19T00:00:00.000Z", + "user_details": [ + { + "name": "User_2", + "total_assigned_items": 40, + "completed_items": 17, + "area_list": [ + "Performance Optimization", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Agile Methodologies", + "Code Review", + "Unit Testing" + ] + } + ] + }, + { + "assessment_id": "95", + "red_flags": 2, + "open_items": 2, + "completed_items": 41, + "total_assigned_items": 43, + "assessment_name": "Assessment 95", + "start_date": "2024-02-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_46", + "total_assigned_items": 23, + "completed_items": 6, + "area_list": [ + "Unit Testing", + "Collaboration with Cross-Functional Teams", + "API Development", + "System Design" + ] + }, + { + "name": "User_65", + "total_assigned_items": 1, + "completed_items": 1, + "area_list": [ + "Agile Methodologies", + "Version Control", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "96", + "red_flags": 1, + "open_items": 27, + "completed_items": 36, + "total_assigned_items": 63, + "assessment_name": "Assessment 96", + "start_date": "2024-07-05T00:00:00.000Z", + "user_details": [ + { + "name": "User_36", + "total_assigned_items": 19, + "completed_items": 19, + "area_list": [ + "Code Review", + "Documentation", + "API Development", + "Agile Methodologies" + ] + }, + { + "name": "User_19", + "total_assigned_items": 39, + "completed_items": 20, + "area_list": [ + "API Development", + "Performance Optimization", + "Agile Methodologies", + "Code Review" + ] + } + ] + }, + { + "assessment_id": "97", + "red_flags": 4, + "open_items": 12, + "completed_items": 21, + "total_assigned_items": 33, + "assessment_name": "Assessment 97", + "start_date": "2024-09-29T00:00:00.000Z", + "user_details": [ + { + "name": "User_100", + "total_assigned_items": 46, + "completed_items": 35, + "area_list": [ + "Debugging Techniques" + ] + }, + { + "name": "User_17", + "total_assigned_items": 32, + "completed_items": 28, + "area_list": [ + "Agile Methodologies" + ] + }, + { + "name": "User_88", + "total_assigned_items": 50, + "completed_items": 36, + "area_list": [ + "Agile Methodologies", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Debugging Techniques" + ] + }, + { + "name": "User_77", + "total_assigned_items": 32, + "completed_items": 10, + "area_list": [ + "Agile Methodologies", + "Documentation" + ] + }, + { + "name": "User_32", + "total_assigned_items": 11, + "completed_items": 7, + "area_list": [ + "Code Review" + ] + } + ] + }, + { + "assessment_id": "98", + "red_flags": 2, + "open_items": 40, + "completed_items": 13, + "total_assigned_items": 53, + "assessment_name": "Assessment 98", + "start_date": "2024-10-23T00:00:00.000Z", + "user_details": [ + { + "name": "User_43", + "total_assigned_items": 47, + "completed_items": 40, + "area_list": [ + "Agile Methodologies", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Performance Optimization", + "System Design" + ] + }, + { + "name": "User_43", + "total_assigned_items": 15, + "completed_items": 15, + "area_list": [ + "Unit Testing" + ] + } + ] + }, + { + "assessment_id": "99", + "red_flags": 5, + "open_items": 44, + "completed_items": 44, + "total_assigned_items": 88, + "assessment_name": "Assessment 99", + "start_date": "2024-01-08T00:00:00.000Z", + "user_details": [ + { + "name": "User_17", + "total_assigned_items": 14, + "completed_items": 1, + "area_list": [ + "Unit Testing", + "Code Review", + "API Development", + "Version Control" + ] + }, + { + "name": "User_53", + "total_assigned_items": 6, + "completed_items": 3, + "area_list": [ + "Version Control", + "Agile Methodologies" + ] + }, + { + "name": "User_78", + "total_assigned_items": 45, + "completed_items": 45, + "area_list": [ + "Documentation", + "Version Control", + "API Development", + "Unit Testing", + "Collaboration with Cross-Functional Teams" + ] + }, + { + "name": "User_46", + "total_assigned_items": 6, + "completed_items": 3, + "area_list": [ + "Debugging Techniques" + ] + } + ] + }, + { + "assessment_id": "100", + "red_flags": 5, + "open_items": 35, + "completed_items": 43, + "total_assigned_items": 78, + "assessment_name": "Assessment 100", + "start_date": "2024-07-24T00:00:00.000Z", + "user_details": [ + { + "name": "User_16", + "total_assigned_items": 21, + "completed_items": 0, + "area_list": [ + "Performance Optimization", + "Documentation", + "Continuous Integration/Continuous Deployment (CI/CD)", + "Collaboration with Cross-Functional Teams", + "Code Review" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/scripts/statistics_data.py b/scripts/statistics_data.py new file mode 100644 index 0000000..1b8d30d --- /dev/null +++ b/scripts/statistics_data.py @@ -0,0 +1,170 @@ +import requests +import pandas as pd +from dotenv import load_dotenv +load_dotenv() +import os + +DATA_KEY = os.getenv("AI_DATA_KEY") +# Constants for API requests +URL = "https://erpai.mkdlabs.com/v3/api/custom/erpai/common/get-data-ai" +HEADERS = { + "x-project": DATA_KEY # Replace with your actual key +} + +# JSON bodies for API requests +def create_json_body(area_type, company_id): + return { + "type": area_type, + "options": { + "company_id": company_id + } + } + +# Function to fetch data from the API +def fetch_data(json_body): + json_body["options"]["company_id"] = json_body["options"].get("company_id") # Ensure company_id is included + response = requests.post(URL, headers=HEADERS, json=json_body) + response.raise_for_status() # Raise an error for bad responses + return response.json() + +def convert_assessment_data_to_dataframe(assessment_data): + if not assessment_data or "data" not in assessment_data or not assessment_data["data"]: + # Return empty DataFrame with expected columns + return pd.DataFrame(columns=[ + "assessment_id", "assessment_name", "start_date", "open_items_overall", + "completed_items_overall", "total_assigned_items_overall", "user_name", + "user_total_assigned_items", "user_completed_items", "area", "red_flags" + ]) + + df_assessment = [] + for assessment in assessment_data.get("data", []): + assessment_id = assessment.get("assessment_id", "") + assessment_name = assessment.get("assessment_name", "") + start_date = assessment.get("start_date", "") + open_items = assessment.get("open_items", 0) + completed_items = assessment.get("completed_items", 0) + total_assigned_items = assessment.get("total_assigned_items", 0) + red_flags = assessment.get("red_flags", 0) + + for user in assessment.get("user_details", []): + user_name = user.get("name", "") + user_total_items = user.get("total_assigned_items", 0) + user_completed_items = user.get("completed_items", 0) + + for area in user.get("area_list", []): + df_assessment.append({ + "assessment_id": assessment_id, + "assessment_name": assessment_name, + "start_date": start_date, + "open_items_overall": open_items, + "completed_items_overall": completed_items, + "total_assigned_items_overall": total_assigned_items, + "user_name": user_name, + "user_total_assigned_items": user_total_items, + "user_completed_items": user_completed_items, + "area": area, + "red_flags": red_flags + }) + return pd.DataFrame(df_assessment) + +def generate_summary_statistics(df): + if df.empty: + return { + "total_assessments": 0, + "avg_open_items_per_assessment": 0, + "avg_completed_items_per_assessment": 0, + "avg_total_assigned_items_per_assessment": 0, + "avg_red_flags": 0, + "total_users": 0, + "avg_user_total_assigned_items": 0, + "avg_user_completed_items": 0, + "completion_rate_per_user": 0, + "area_summary": {} + } + + total_assessments = df['assessment_id'].nunique() + avg_open_items = df.groupby('assessment_id')['open_items_overall'].mean().mean() + avg_completed_items = df.groupby('assessment_id')['completed_items_overall'].mean().mean() + avg_total_assigned_items = df.groupby('assessment_id')['total_assigned_items_overall'].mean().mean() + avg_red_flags = df['red_flags'].mean() + + total_users = df['user_name'].nunique() + avg_user_total_items = df.groupby('user_name')['user_total_assigned_items'].mean().mean() + avg_user_completed_items = df.groupby('user_name')['user_completed_items'].mean().mean() + completion_rate_per_user = (df['user_completed_items'].sum() / df['user_total_assigned_items'].sum()) * 100 if df['user_total_assigned_items'].sum() > 0 else 0 + + area_summary = df['area'].value_counts() + + return { + "total_assessments": total_assessments, + "avg_open_items_per_assessment": avg_open_items, + "avg_completed_items_per_assessment": avg_completed_items, + "avg_total_assigned_items_per_assessment": avg_total_assigned_items, + "avg_red_flags": avg_red_flags, + "total_users": total_users, + "avg_user_total_assigned_items": avg_user_total_items, + "avg_user_completed_items": avg_user_completed_items, + "completion_rate_per_user": completion_rate_per_user, + "area_summary": area_summary.to_dict() + } + +def generate_extended_statistics(df): + if df.empty: + return { + "top_5_efficient_users": {}, + "bottom_5_least_efficient_users": {}, + "areas_with_most_uncompleted_items": {} + } + + df['user_completion_rate'] = (df['user_completed_items'] / df['user_total_assigned_items']).fillna(0) * 100 + top_5_efficient_users = df.groupby('user_name')['user_completion_rate'].mean().nlargest(5).to_dict() + bottom_5_least_efficient_users = df.groupby('user_name')['user_completion_rate'].mean().nsmallest(5).to_dict() + + df['uncompleted_items'] = df['user_total_assigned_items'] - df['user_completed_items'] + areas_with_most_uncompleted_items = df.groupby('area')['uncompleted_items'].sum().nlargest(5).to_dict() + + return { + "top_5_efficient_users": top_5_efficient_users, + "bottom_5_least_efficient_users": bottom_5_least_efficient_users, + "areas_with_most_uncompleted_items": areas_with_most_uncompleted_items + } + +def generate_problematic_area_statistics(df): + if df.empty: + return pd.DataFrame(columns=["total_open_items", "total_red_flags"]) + + total_open_items = df.groupby('name')['open_items'].sum().sort_values(ascending=False) + total_red_flags = df.groupby('name')['red_flags'].sum().sort_values(ascending=False) + + return pd.DataFrame({ + "total_open_items": total_open_items, + "total_red_flags": total_red_flags + }).fillna(0) + +def generate_summary_stats(assessment_data, area_data): + # Handle empty or invalid assessment data + assessment_df = convert_assessment_data_to_dataframe(assessment_data) + + # Handle empty or invalid area data + problematic_area_df = pd.DataFrame(area_data.get("data", []) if area_data and "data" in area_data else []) + + summary_stats = generate_summary_statistics(assessment_df) + extended_stats = generate_extended_statistics(assessment_df) + summary_stats["users(Workers) based stats"] = extended_stats + + problematic_stats = generate_problematic_area_statistics(problematic_area_df) + summary_stats["Area based stats"] = problematic_stats.to_dict(orient='index') + + return summary_stats + + +if __name__ == "__main__": + json_body_area = create_json_body("problematic-areas", 106) + json_body_assessment = create_json_body("user-stats-by-assessment", 106) + + # Fetching data + problematic_areas_data = fetch_data(json_body_area) + assessment_data = fetch_data(json_body_assessment) + + example_result = generate_summary_stats(assessment_data, problematic_areas_data) + print(example_result) \ No newline at end of file diff --git a/src/api/routes/chatbot.py b/src/api/routes/chatbot.py index 6d1ef8e..13add1e 100644 --- a/src/api/routes/chatbot.py +++ b/src/api/routes/chatbot.py @@ -70,11 +70,11 @@ def predict_next_n_assessments(): try: # Retrieve JSON data from the request data = request.get_json() - company_info = data.get('company_info') + #company_info = data.get('company_info') companyid = data.get('companyid') N = data.get('N') - if not company_info or not companyid or N is None: + if not companyid or N is None: return jsonify({"error": "Missing data", "message": "Company info, company ID, or N value not provided."}), 400 # Instantiate the chatbot service @@ -82,7 +82,7 @@ def predict_next_n_assessments(): # Call the prediction method response = chatbot.predict_next_n_assessment( - company_info=company_info, + #company_info=company_info, companyid=companyid, N=N ) @@ -96,7 +96,7 @@ def predict_next_n_assessments(): -@bot.route('/use_bot_predict_assessments', methods=['POST']) +@bot.route('/direct-prompt-bot', methods=['POST']) @auth_check def use_bot_predict_assessments(): try: @@ -106,8 +106,8 @@ def use_bot_predict_assessments(): companyid = data.get('companyid') query = data.get('query') - if not company_info or not companyid or query is None: - return jsonify({"error": "Missing data", "message": "Company info, company ID, or query value not provided."}), 400 + if not companyid or query is None: + return jsonify({"error": "Missing data", "message": "company ID, or query value not provided."}), 400 # Instantiate the chatbot service chatbot = Chatbot() diff --git a/src/api/routes/sops.py b/src/api/routes/sops.py index 5480586..96c4fdf 100644 --- a/src/api/routes/sops.py +++ b/src/api/routes/sops.py @@ -7,6 +7,7 @@ from src.utils.auth import auth_check from src.utils.utils import delete_all_files_in_directory from src.utils.document_loader import load_document +from flask import Blueprint, jsonify, request, make_response import json # Initialize the Blueprint sops_bp = Blueprint('sops', __name__) @@ -74,7 +75,7 @@ def get_roles_questionnaire(): if not questionnaire_data.get('questionnaire_response'): return jsonify({ "error": "Missing required fields", - "message": "Please provide questionnaire_data in the request body" + "message": "Please provide questionnaire_response in the request body" }), 400 generator = SopPersonalAssessment() @@ -188,35 +189,39 @@ def generate_sops_from_questionnaire_per(): -@sops_bp.route('/personal_assessment/generate_sops_by_roles_and_areas', methods=['POST']) -@auth_check -def generate_sops_by_roles_and_areas(): - """ - Generate SOPs based on the roles, SOP types (will, shall, must), and areas provided in the request body. - """ - try: - # Get the roles data from the request body - roles = request.json.get('roles', None) - sop_generator = SopPersonalAssessment() - - # Validate the presence of roles data - if not roles or not isinstance(roles, list): - return jsonify({"error": "Invalid input", "message": "The 'roles' field should be a non-empty list."}), 400 - - # Generate SOPs for all roles at once - sops_response = sop_generator.generate_sops_by_role_and_area(roles=roles) - - return jsonify({ - "sops": sops_response, - "message": "SOPs successfully generated for all provided roles." - }), 200 - - except Exception as e: - return jsonify({ - "error": "Processing error", - "message": f"An error occurred while generating SOPs: {str(e)}" - }), 500 +@sops_bp.route('/personal_assessment/generate_sops_by_roles_and_areas', methods=['POST']) +@auth_check +def generate_sops_by_roles_and_areas(): + """ + Generate SOPs based on the roles, SOP types (will, shall, must), and areas provided in the request body. + """ + try: + # Get the roles and qna data from the request body + roles = request.json.get('roles', None) + qna = request.json.get('qna', None) + sop_generator = SopPersonalAssessment() + + # Validate the presence of roles and qna data + if not roles or not isinstance(roles, list): + return make_response(jsonify({"error": "Invalid input", "message": "The 'roles' field should be a non-empty list."}), 400) + + + # Generate SOPs for all roles at once + sops_response = sop_generator.generate_sops_by_role_and_area(roles=roles,qna=qna) + if not sops_response: + return make_response(jsonify({ + "error": True, + "message": "Error in generating sops, please try again" + }), 200) + # Return the generated SOPs + return make_response(jsonify(sops_response), 200) + + except Exception as e: + return make_response(jsonify({ + "error": "Processing error", + "message": f"An error occurred while generating SOPs: {str(e)}" + }), 500) @@ -297,6 +302,76 @@ def generate_executive_sops_from_doc(): return jsonify({"error": "File type not allowed", "message": "The uploaded file type is not allowed. Please upload a PDF, DOC, or DOCX file."}), 400 +@sops_bp.route('/executive/generate_mission_vision_doc', methods=['POST']) +@auth_check +def generate_executive_goals_from_doc(): + """ + Generate SOPs for executives based on a document containing vision and mission. + """ + # Check if the POST request has the file part and roles + if 'document' not in request.files: + return jsonify({"error": "No file part", "message": "Please upload a file with the key 'document'."}), 400 + + if 'departments' not in request.form: + return jsonify({"error": "department missing", "message": "Please provide departments'."}), 400 + + try: + departments = request.form.get('departments') + # Manually load roles from the string to JSON + departments = json.loads(departments) + + except json.JSONDecodeError: + return jsonify({"error": "Invalid JSON", "message": "The departments must be a valid JSON array."}), 400 + except ValueError as e: + return jsonify({"error": "Invalid roles format", "message": str(e)}), 400 + + + file = request.files['document'] + + # If the user does not select a file, the browser may also submit an empty part without filename + if file.filename == '': + return jsonify({"error": "No selected file", "message": "A file was not selected for upload. Please select a valid file."}), 400 + + if file and allowed_file(file.filename): + filename = secure_filename(file.filename) + upload_folder = current_app.config['UPLOAD_FOLDER'] + file_path = os.path.join(upload_folder, filename) + + # Save the file to the upload folder + file.save(file_path) + + try: + # Use the utility function to generate docs from the file + docs = load_document(file_path) + + sop_doc = DocumentParser() + + vision_mission = sop_doc.extract_vision_mission2(docs,departments) + + if not vision_mission: + return jsonify({"error": "Vision and Mission generation error ", "message": "Error in generating mssion and viso."}), 400 + + # Check if both vision and mission are empty + if not vision_mission.get('vision') and not vision_mission.get('mission'): + # Cleanup: Delete all files in the upload directory if parsing fails + delete_all_files_in_directory(upload_folder) + return jsonify({"vision": [], "mission": [], "message": "The document does not contain mission and vision."}), 200 + + print(f"Vision and mission: {vision_mission}") + vission = vision_mission.get('vision') + mission = vision_mission.get('mission') + + return jsonify({"mission": mission, "vission": vission, "message": "vision and mission generated successfully"}), 200 + + except Exception as e: + # Cleanup: Delete all files in the upload directory if an error occurs + delete_all_files_in_directory(upload_folder) + return jsonify({"error": "Processing error", "message": f"An error occurred while processing the document: {str(e)}"}), 500 + + return jsonify({"error": "File type not allowed", "message": "The uploaded file type is not allowed. Please upload a PDF, DOC, or DOCX file."}), 400 + + + @sops_bp.route('/executive/generate_sop_managers_doc', methods=['POST']) @auth_check @@ -340,6 +415,24 @@ def generate_sop_managers_doc(): return jsonify({"error": "File type not allowed", "message": "The uploaded file type is not allowed. Please upload a PDF, DOC, or DOCX file."}), 400 +@sops_bp.route('/executive/generate_dept_sops_from_questionnaire', methods=['POST']) +@auth_check +def generate_sops_dept_from_questionnaire(): + try: + data = request.json + questionnaire_data = data.get('questionnaire') + + sop_generator = SopGeneratorExecutive() + result = sop_generator.generate_sops_from_questionnaire2(questionnaire_data) + + if not result: + return make_response(jsonify({"error": "Processing error", "message": "Failed to generate SOPs from questionnaire."}), 500) + + return make_response(jsonify({"sops": result, "message": "SOPs successfully generated from questionnaire."}), 200) + + except Exception as e: + return make_response(jsonify({"error": "Processing error", "message": f"An error occurred while processing the request: {str(e)}"}), 500) + @sops_bp.route('/executive/generate_sops_from_questionnaire', methods=['POST']) @auth_check @@ -348,29 +441,38 @@ def generate_sops_from_questionnaire(): data = request.json questionnaire_data = data.get('questionnaire') executives = data.get('executives', []) - managers = data.get('managers', []) - departments = data.get('departments', []) - if not questionnaire_data or not executives or not managers or not departments: - return jsonify({"error": "Missing data", "message": "Please provide questionnaire data, executives, managers, and departments."}), 400 + if not questionnaire_data or not executives: + return make_response(jsonify({"error": "Missing data", "message": "Please provide questionnaire data, executives, managers, and departments."}), 400) sop_generator = SopGeneratorExecutive() - result = sop_generator.generate_sops_from_questionnaire(questionnaire_data, executives, managers, departments) + result = sop_generator.generate_sops_from_questionnaire(questionnaire_data, executives) if not result: - return jsonify({"error": "Processing error", "message": "Failed to generate SOPs from questionnaire."}), 500 + return make_response(jsonify({"error": "Processing error", "message": "Failed to generate SOPs from questionnaire."}), 500) - # Convert Pydantic models to dictionaries - serializable_result = { - "executive_sops": {exec: sops.dict() for exec, sops in result["executive_sops"].items()}, - "department_sops": result["department_sops"].dict() - } - - return jsonify({"sops": serializable_result, "message": "SOPs successfully generated from questionnaire."}), 200 + return make_response(jsonify({"sops": result, "message": "SOPs successfully generated from questionnaire."}), 200) except Exception as e: - return jsonify({"error": "Processing error", "message": f"An error occurred while processing the request: {str(e)}"}), 500 - + return make_response(jsonify({"error": "Processing error", "message": f"An error occurred while processing the request: {str(e)}"}), 500) + + +@sops_bp.route('/executive/generate_mission_goals_from_questionnaire', methods=['POST']) +@auth_check +def generate_vision_goals_quest(): + try: + data = request.json + questionnaire_data = data.get('questionnaire') + + sop_generator = SopGeneratorExecutive() + vision_mission = sop_generator.generate_vision_mission_from_questionnaire(questionnaire_data) + vission = vision_mission.get('vision') + mission = vision_mission.get('mission') + + return jsonify({"mission": mission, "vission": vission, "message": "vision and mission generated successfully"}), 200 + + except Exception as e: + return make_response(jsonify({"error": "Processing error", "message": f"An error occurred while processing the request: {str(e)}"}), 500) @@ -416,7 +518,67 @@ def get_roles_for_reference_managers(): +@sops_bp.route('/executive/extract_vision_dept_goals_doc', methods=['POST']) +@auth_check +def get_vision_dpt_goals(): + try: + # Check Content-Type + if 'multipart/form-data' not in request.content_type: + return jsonify({"error": "Invalid Content-Type", "message": "Request must have Content-Type 'multipart/form-data'."}), 415 + # Retrieve uploaded file + file = request.files.get('document') + + if not file: + return jsonify({"error": "Missing data", "message": "Document not provided."}), 400 + + if file.filename == '': + return jsonify({"error": "No selected file", "message": "No file selected for upload. Please select a valid file."}), 400 + + if file and allowed_file(file.filename): + filename = secure_filename(file.filename) + upload_folder = current_app.config['UPLOAD_FOLDER'] + file_path = os.path.join(upload_folder, filename) + + file.save(file_path) + docs = load_document(file_path) + + # Use extractor to extract roles from the document + extractor = DocumentParser() + dept_goals = extractor.extract_dept_goals(docs=docs) + + if not dept_goals: + return jsonify({"error": "Processing error", "message": "Error generating dept goals"}), 404 + + return jsonify({"response": dept_goals, "message": "Vision and dept goals successfully generated."}), 200 + + except Exception as e: + return jsonify({"error": "Processing error", "message": f"An error occurred while processing the request: {str(e)}"}), 500 + + + +@sops_bp.route('/executive/extract_vision_dept_goals-questionnaire', methods=['POST']) +@auth_check +def generate_dept_goals_quest(): + try: + data = request.json + questionnaire_data = data.get('questionnaire') + + + if not questionnaire_data: + return make_response(jsonify({"error": "Missing data", "message": "Please provide questionnaire data"}), 400) + + sop_generator = SopGeneratorExecutive() + result = sop_generator.generate_dept_goals_from_questionnaire(questionnaire_data) + + if not result: + return make_response(jsonify({"error": "Processing error", "message": "Failed to generate SOPs from questionnaire."}), 500) + + return make_response(jsonify({"sops": result, "message": "SOPs successfully generated from questionnaire."}), 200) + + except Exception as e: + return make_response(jsonify({"error": "Processing error", "message": f"An error occurred while processing the request: {str(e)}"}), 500) + @sops_bp.route('/manager/get_roles_for_reference_workers', methods=['POST']) @auth_check diff --git a/src/models/sop_response_schemas.py b/src/models/sop_response_schemas.py index 9377617..e9265a8 100644 --- a/src/models/sop_response_schemas.py +++ b/src/models/sop_response_schemas.py @@ -12,6 +12,9 @@ class RoleSops(BaseModel): role:str sops:Categories +class RoleSopssLists(BaseModel): + sops:List[RoleSops] + #class RoleSOPs(BaseModel): # sops: SOPs class Roles_response(BaseModel): @@ -28,6 +31,14 @@ class SOPsResponse(BaseModel): mission: List[str] vission:List[str] +class DeptMisiion(BaseModel): + departments: str + goals: List[str] + +class VisionMissionResponse2(BaseModel): + vision: List[str] + mission: List[str] + class VisionMissionResponse(BaseModel): vision: List[str] mission: List[str] @@ -117,3 +128,10 @@ class RolesComparisonResponse(BaseModel): +class DeptGoal(BaseModel): + name :str + goals: List[str] +class DeptGoalsVisssion(BaseModel): + vision: List[str] + mission: List[str] + department_goals: List[DeptGoal] \ No newline at end of file diff --git a/src/prompts/chatbot.py b/src/prompts/chatbot.py index f3872d4..46b68dc 100644 --- a/src/prompts/chatbot.py +++ b/src/prompts/chatbot.py @@ -17,61 +17,26 @@ def validate_worker_prompt() -> str: result:"validated" } """ + def predict_based_past_assessment_prompt(query,company_info, summary_stats): # Extract company information from the dictionary - company_name = company_info['company_name'] - company_size = company_info['company_size'] - departments = company_info['departments'] + # Create the prompt with the provided company info and summary statistics prompt = f""" **Prompt for the Chatbot:** **Context:** - You are an AI assistant working for {company_name}, and your primary responsibility is to provide **insights**, **predictions**, and **recommendations** based on the company's past assessment data and organizational structure. You are not allowed to respond to any queries outside of this domain. + You are an AI assistant and work as assessment anaylyst, and your primary responsibility is to provide **insights**, **predictions**, and **recommendations** based on the company's past assessment data and organizational structure. You are not allowed to respond to any queries outside of this domain. **General Company Information:** - - **Company Name**: {company_name} - - **Company Size**: {company_size} (e.g., Small, Medium, Large) - - **Departments**: - {', '.join(departments)} + Company info is {company_info} **Assessment Summary**: - The following is a detailed summary of past assessments at {company_name}. Use this information to provide predictions and recommendations based on trends and data points. + The following is a detailed summary of past assessments will be provided. Use this information to provide predictions and recommendations based on trends and data points. - - **Open Items and Red Flags**: - - Total Open Items: {summary_stats['Open Items and Red Flags']['Total Open Items']} - - Average Open Items per Assessment: {summary_stats['Open Items and Red Flags']['Average Open Items per Assessment']} - - Total Red Flags: {summary_stats['Open Items and Red Flags']['Total Red Flags']} - - Average Red Flags per Assessment: {summary_stats['Open Items and Red Flags']['Average Red Flags per Assessment']} - - Max Red Flags in a Single Assessment: {summary_stats['Open Items and Red Flags']['Max Red Flags in a Single Assessment']} - - Most Common Area with Red Flags: {summary_stats['Open Items and Red Flags']['Most Common Area with Red Flags']} - - - **Assessment Frequency**: - - Weekly: {summary_stats['Assessment Frequency']['Assessment Type Breakdown'].get('Weekly', 0) * 100}% - - Bi-Weekly: {summary_stats['Assessment Frequency']['Assessment Type Breakdown'].get('Bi-Weekly', 0) * 100}% - - Quarterly: {summary_stats['Assessment Frequency']['Assessment Type Breakdown'].get('Quarterly', 0) * 100}% - - Average Time Between Assessments: {summary_stats['Assessment Frequency']['Average Time Between Assessments']} days - - Average Assessment Duration: {summary_stats['Assessment Frequency']['Average Assessment Duration']} days + Past assessment summary : {summary_stats} - - **Assessment Start and End Dates**: - - Longest Assessment Duration: {summary_stats['Assessment Start and End Dates']['Longest Assessment Duration (days)']} days - - Shortest Assessment Duration: {summary_stats['Assessment Start and End Dates']['Shortest Assessment Duration (days)']} days - - - **Assessment Areas**: - - Most Assessed Area: {summary_stats['Assessment Areas']['Most Assessed Area']} - - Most Open Items in Area: {summary_stats['Assessment Areas']['Most Open Items in Area']} - - Area with Most Red Flags: {summary_stats['Assessment Areas']['Area with Most Red Flags']} - - - **Assessment Status**: - - Completed: {summary_stats['Assessment Status']['Assessment Status Distribution'].get('Completed', 0) * 100}% - - In Progress: {summary_stats['Assessment Status']['Assessment Status Distribution'].get('In Progress', 0) * 100}% - - Incomplete: {summary_stats['Assessment Status']['Assessment Status Distribution'].get('Incomplete', 0) * 100}% - - - **Assessment Admin**: - - Most Frequent Admin: {summary_stats['Assessment Admin']['Most Frequent Admin']} - - Admin with Fewest Red Flags: {summary_stats['Assessment Admin']['Admin with Fewest Red Flags']} - - Admin with Most Open Items: {summary_stats['Assessment Admin']['Admin with Most Open Items']} **Instructions:** Use the above information to answer user queries. You should: @@ -102,38 +67,38 @@ def predict_next_n_assessments_prompt(): **Prompt for the Chatbot:** **Context:** - You are an AI assistant responsible for analyzing the past assessment data of , and your primary responsibility is to provide **predictions** for the next {n} assessments. - These assessments can occur on a **weekly**, **bi-weekly**, or **quarterly** basis. Use the company's past performance to predict the following for each of the next {n} assessments: + You are an AI assistant responsible for thoroughly analyzing the past assessment data of a company. Your primary responsibility is to provide **dynamic predictions** for the next {n} assessments, considering different scenarios based on the frequency of assessments: **weekly**, **bi-weekly**, or **quarterly**. Use the company's past performance to predict the following for each of the next {n} assessments: - **Number of Open Items**. - **Number of Red Flags**. - **Predictions for Weekly, Bi-Weekly, and Quarterly assessments**. - input : - - company basic info - - past assessment statitics + + **Input:** + - Company basic info + - Past assessment statistics - N - number of next assessments to be predicted + **General Company Information:** **Assessment Summary (Past Data)**: - The Detailed information on past asssessment will be provided. Use this information to make predictions for the next {n} assessments. - + Detailed information on past assessments will be provided. Use this information to make informed predictions for the next {n} assessments, taking into account the frequency of assessments. **Instructions**: - - Predict the number of open items and red flags for the next n assessments if they are conducted on a weekly, bi-weekly, or quarterly basis. - - Use the historical summary statistics provided above to guide your predictions. + - Analyze the historical data to predict the number of open items and red flags for the next n assessments based on whether they are conducted weekly, bi-weekly, or quarterly. + - Consider the implications of each frequency on the predictions, and ensure your analysis reflects the potential outcomes for each scenario. - Return the response in the following JSON format: **Response Format**: { - "assessment 1": [ + "assessment_1": [ { - "weekly": {"open_items": X, "red_flags": Y}}, - "biweekly": {{"open_items": X, "red_flags": Y}}, - "quarterly": {{"open_items": X, "red_flags": Y}} + "weekly": {"open_items": X, "red_flags": Y}, + "biweekly": {"open_items": X, "red_flags": Y}, + "quarterly": {"open_items": X, "red_flags": Y} } ], - "assessment 2": [ + "assessment_2": [ { "weekly": {"open_items": X, "red_flags": Y}, "biweekly": {"open_items": X, "red_flags": Y}, @@ -143,12 +108,95 @@ def predict_next_n_assessments_prompt(): // assuming N is 2 } ``` - Ensure each assessment is provided with three predictions: one for Weekly, one for Bi-Weekly, and one for Quarterly assessments. + Ensure each assessment is provided with three predictions: one for Weekly, one for Bi-Weekly, and one for Quarterly assessments, and analyze the data dynamically to reflect the different scenarios. """ return prompt +def predict_next_n_assessments_prompt_v2(): + prompt = """ + You are an AI analyst specializing in company team assessments. Using the provided summary statistics, predict the next N assessments. + + **Input:** + 1. Summary Statistics containing: + - Total assessments completed + - Average open/completed items per assessment + - User efficiency metrics + - Area-based statistics + - Red flag distributions + - Team completion rates + 2. N: number of future assessments to predict + + **Validation Rules:** + 1. Ensure summary statistics are complete and consistent + 2. Check number of historical assessments: + - If only 1 assessment: Mark as "invalid" with reason explaining need for more data + - If 2+ assessments: Proceed with predictions + 3. Verify that area-based stats align with overall metrics + + **Analysis Instructions:** + 1. Use the average metrics as baseline predictions + 2. Adjust predictions based on: + - Current completion rates per user + - Area-specific trends in open items and red flags + - Distribution of work across different areas + - Historical red flag patterns + 3. Consider frequency impacts: + - Weekly: More frequent checks = faster issue detection and resolution + - Biweekly: Moderate item accumulation + - Quarterly: Longer accumulation period but more time for resolution + + **Output Format:** + { + "state": "valid" | "invalid", + "reason": string | null, // Required if state is "invalid" + "predictions": [ + { + "assessment_1": { + "weekly": { + "open_items": number, + "red_flags": number + }, + "biweekly": { + "open_items": number, + "red_flags": number + }, + "quarterly": { + "open_items": number, + "red_flags": number + } + } + }, + // ... N predictions + ] + } + + NOTE: Do not add extra anything also any ``JSON`` formatter tags. Only output JSON. + + Use the following guidelines for predictions: + 1. Weekly predictions should be based on: + - avg_open_items_per_assessment + - completion_rate_per_user + - current area-based distribution of open items + + 2. Biweekly predictions should consider: + - Accumulation over two weeks + - Historical completion patterns + - Area-specific red flag frequencies + + 3. Quarterly predictions should account for: + - Longer-term accumulation patterns + - Team efficiency metrics + - Historical area-based completion rates + + Make predictions that reflect realistic patterns based on the team's performance metrics and area-specific challenges. + """ + return prompt + + + + def recommend_assessment_frequency_prompt(): return ''' You are provided with the Standard Operating Procedures (SOPs) for various roles within a company, along with options (e.g., ['weekly', 'monthly', 'biweekly']) for how frequently assessments should be performed. Your task is to recommend the best assessment type and frequency (weekly, biweekly, or quarterly) for all employees, based on the overall nature of the SOPs. diff --git a/src/prompts/questions.py b/src/prompts/questions.py index d599a08..84bdca6 100644 --- a/src/prompts/questions.py +++ b/src/prompts/questions.py @@ -24,6 +24,8 @@ def get_questions_prompt(): 3. All questions are "yes" or "no" questions nothing extra and precise ,not long 4. Generate a total of at least 20 questions all rounda based on the sops and roles for each frequency number 5. make sure the questions are up to 20 for the current frequency + + NOTE: !!! MAKE SURE YOU CORRECTLY ATTACH "assigned_to" AS THE ID OF THE MEMBER OF THE ROLE AS STATED IN THE SOP. CHECK MEMBERS UNDER THE ROLE IN THE PROVIDED SOP AND USE THE CORRECT ID OF THE MEMBER, DO NOT USE MEMBER iD THAT IS NOT PROVIDED AS "assigned_to" pls !!! Example response: questions @@ -34,7 +36,7 @@ def get_questions_prompt(): "frequency_number": "2", "questions": [ { - "assigned_to": "name", + "assigned_to": "id",----id of the member attached to the role, check the member unde the role and attacj the id here "role": "person role", "question": "e.g., Is the internal project team being followed according to the SOP?" "area_tag":"timeline", @@ -47,7 +49,7 @@ def get_questions_prompt(): "frequency_number": "3", "questions": [ { - "assigned_to": "name", + "assigned_to": "id",----id of the member attached to the role, check the member unde the role and attacj the id here "role": "person role", "question": "e.g., Have communication protocols been followed for the task at hand?". "area_tag":"communication", @@ -125,7 +127,7 @@ def get_questions_prompt_v3(): 5. Tag each question with the provided assigned_to ID (the ID of the person in charge) (e.g., 1, 2, 3, 4, 5). 6. The questions should evolve in detail as assessments progress over time. 7. For each frequency_number, generate at least 15 - 20 questions. - + NOTE: !!! MAKE SURE YOU CORRECTLY ATTACH "assigned_to" AS THE ID OF THE MEMBER OF THE ROLE AS STATED IN THE SOP. CHECK MEMBERS UNDER THE ROLE IN THE PROVIDED SOP AND USE THE CORRECT ID OF THE MEMBER, DO NOT USE MEMBER iD THAT IS NOT PROVIDED AS "assigned_to" pls !!! Provide the response in the following JSON format: { "questions": { @@ -134,10 +136,10 @@ def get_questions_prompt_v3(): "frequency_number": 1, "items": [ { - "area_tag": 5, - "assigned_to": 8, + "area_tag": id of the rea tag, + "assigned_to": "id",----id of the member attached to the role, check the member unde the role and attacj the id here , "questions": "Has the content calendar been developed and shared with the team?", - "role": 4 + "role": 4"role id" in SOP }, ... ] diff --git a/src/prompts/sops.py b/src/prompts/sops.py index fa96829..18ecdb9 100644 --- a/src/prompts/sops.py +++ b/src/prompts/sops.py @@ -18,6 +18,7 @@ def get_roles_extraction_from_questionnaire(): return '''Your task is to extract the "Roles" from the provided questionnaire responses. You must identify and categorize the roles based on the information provided. + Instructions: 1. **Roles**: Extract the roles mentioned in the questionnaire. 2. **Vision**: If applicable, extract the vision of the company or organization as it relates to the roles. @@ -48,20 +49,53 @@ def get_sop_personalassessment_from_questionnaire(): Provide the generated SOPs based on the questionnaire responses.''' -def get_sop_personalassessment_from_area_role(role,areas,sop_types): - return f"""Your job is to generate Standard Operating Procedures (SOPs) for the role of "{role}" with a focus on the areas "{areas}" based on the following instructions: - +def get_sop_personalassessment_from_area_role(role,sop_types,qna=None,areas=None): + if not areas: + areas = "Not provided" + return f"""Your job is to generate Standard Operating Procedures (SOPs) for the role of "{role}" with a focus on the prvided area + "{areas}" based on the following instructions: + Instructions: Categorization: Organize the SOPs under the selected categories: a checkboxex of the three categories "must" , "shall" and "will" - So use the selected sop types categories: {sop_types} + So use the selected sop types categories: {sop_types} #adhere strictly to these sop types alone and make sure they are not missing Direct Instructions: The SOPs should directly address responsibilities, objectives, and challenges related to the area of "{areas}" for the role of "{role}". + Questions and Anwer context: If extra questions and answers answered based on role is the provided, use that as more context(related to this role) Contextual Inference: If SOPs for the area are not explicitly stated, infer them from the role and area context provided. - Empty Lists: If no SOPs are generated, return an empty list for each category. Format: The SOPs should be direct and concise. + provided questions and answer: {qna} + INSTRUCTIONS : STRICTLY ADHERE TO THESE INSTRUCTIONS + NOTE: IF AREAS ARE NOT PROVIDED (AREA IS "NOT PROVIDED"), INTUITIVELY PROVIDE THE SOP BASED ON THE ROLE NAME. + NOTE: MAKE SURE SOPS ARE NOT MISSING FOR THE PROVIDED TYPES. + NOTE: FOR SOP TYPES NOT SELECTED RETURN AN EMPTY LIST and not "null" E.G IF "SHALL" AND "WILL" ARE SELECTED BUT "MUST" IS NOT AMONG, MUST WILL BE AN EMPTY LIST + """ + + +def get_sop_personalassessment_from_area_rolev2(): + + return f"""Your job is to generate Standard Operating Procedures (SOPs) for the information provided on different roles role of with a focus on the prvided areas + based on the following instructions: + Instructions: + Categorization: Organize the SOPs under the selected categories: a checkboxex of the three categories "must" , "shall" and "will" + So use the selected sop types categories for the specified role : #adhere strictly to these sop types alone and make sure they are not missing + Direct Instructions: The SOPs should directly address responsibilities, objectives, and challenges related to the area of specified to the specific role". + Questions and Anwer context: If extra questions and answers answered based on roles is the provided, use that as more context to generate the sop + Contextual Inference: If SOPs for the area are not explicitly stated, infer them from the role and area context provided. + Format: The SOPs should be direct and concise.(5-7) bullet point per sop type is okay for each role but 3-4 on average is very good + INSTRUCTIONS : STRICTLY ADHERE TO THESE INSTRUCTIONS + NOTE: IF AREAS ARE NOT PROVIDED (AREA IS "NOT PROVIDED"), INTUITIVELY PROVIDE THE SOP BASED ON THE ROLE NAME. + NOTE: MAKE SURE SOPS ARE NOT MISSING FOR THE PROVIDED TYPES. + NOTE: FOR SOP TYPES NOT SELECTED RETURN AN EMPTY LIST and not "null" E.G IF "SHALL" AND "WILL" ARE SELECTED BUT "MUST" IS NOT AMONG, MUST WILL BE AN EMPTY LIST + + NOTE !!!: IF A ROLE POINTS TO A SPECIFIC SOP TYPE (E.G., "SHALL" AND "MUST"), THESE TWO MUST NEVER BE EMPTY FOR THAT ROLE. + : FORMAT: SOPS SHOULD BE CLEAR, DIRECT, AND CONCISE. EACH ROLE SHOULD HAVE 5-7 BULLET POINTS PER SOP TYPE ("WILL," "SHALL," OR "MUST"). FOR COMPLEX ROLES, EACH SOP TYPE MAY HAVE A MAXIMUM OF 7-10 BULLET POINTS, NOT TOTAL ACROSS ALL TYPES, BUT PER SOP TYPE. + + + """ + def get_sop_executive_from_vision_goals(executive): return f"""Your task is to generate Standard Operating Procedures (SOPs) for the executive namely: {executive}, based on the provided vision and goals/mission. @@ -85,6 +119,8 @@ def get_sop_executive_from_vision_goals(executive): def get_vision_mission_extraction_from_doc(): return """Extract vision and mission statements from the document: + + You are provided with an organization document , your goal is to extract vision and mission(or goals) from the document 1. Analyze for explicit or implicit statements. 2. Vision: Long-term aspirations or ideal future state. @@ -93,10 +129,32 @@ def get_vision_mission_extraction_from_doc(): 5. Infer from context if not explicit. 6. Format as two lists: vision and mission. 7. Return empty list if none found for either category. - - Provide extracted or inferred vision and mission statements.""" + 8. If vision and mission is found in the document , extract them as it is ,no changes + NOTE: MAKE SURE YOU EXTRACT EVERY INFORMATION FOUND FOR VISION AND GOALS FROM THE DOCUMENT.DO NOT OMIT ANY + PROVIDE EXTRACTED OR INFERRED VISION AND MISSION STATEMENTS.""" +def get_vision_mission_extraction_from_doc2(): + return """ + + You are provided with a organization document and the departments in the organization and your role is to extract the vision and mission(alo called goals) from the document + If the vision and mission are clearly stated in the document + - Extract the vision of the organization as they are + - Extract the goals(mission) of each the company based on the provided goals of the department and overall questionairre response + + if the vision and mission are not clearly stated in the document + - Infer the vision and mission from the context of the document + - Analyze for explicit or implicit statements. + 2. Vision: Long-term aspirations or ideal future state. + 3. Mission: Organization's purpose, core functions, or primary objectives. + 4. Include multiple statements if found. + 5. Infer from context if not explicit. + 7. Return empty list if none found for either category. + 8. If vision and mission is found in the document , extract them as it is ,no changes + NOTED: if the goal(mission) and vision cant not be found at all, make it empty please + NOTE: MAKE SURE YOU EXTRACT EVERY INFORMATION FOUND FOR VISION AND GOALS FROM THE DOCUMENT.DO NOT OMIT ANY + """ + ''' def get_sop_executive_for_managers(): return Your task is to extract the "Vision", "Mission", and executive-generated Standard Operating Procedures (SOPs) specifically for managers from the provided document. @@ -114,6 +172,26 @@ def get_vision_mission_extraction_from_doc(): Provide the extracted sections exactly as they appear in the document. ''' +def get_vision_mission_extraction_from_questionnaire_executive(): + return """ + + You are provided with an organization's response from a questionnaire, and your role is to extract the vision and mission (also called goals) from the questionnaire response: + + - Generate the vision(at least one paragraph)of the organization based on the questionnaire and + - Generate the goals (mission) of the company based on the provided departmental goals and overall questionairre response + + If the vision and mission are not clearly stated in the questionnaire: + - Infer the vision and mission from the context of the questionnaire. + - Analyze for explicit or implicit statements. + 1. Vision: Long-term aspirations or ideal future state. + 2. Mission: Organization's purpose, core functions, or primary objectives. + 3. Include multiple statements if found. + 4. Infer from context if not explicitly stated. + 5. Return an empty list if none are found for either category. + + NOTE: If the goal and mission of a can not be gotten from the questionaire response, make it empty. + NOTE: Ensure you extract every piece of information found for the vision and goals from the questionnaire. DO NOT OMIT ANYTHING. + """ def get_departments_managers_workers_extraction_prompt(): @@ -215,49 +293,132 @@ def get_sop_for_department_managers(): ''' +def get_sop_executive_from_questionnaire(): + return '''Generate Standard Operating Procedures (SOPs) for specific executives and department managers based on the provided questionnaire responses. + + + + Format the response as a JSON object with the following structure: + { + "executives": { + "must": ["SOP 1", "SOP 2", ...], + "shall": ["SOP 1", "SOP 2", ...], + "will": ["SOP 1", "SOP 2", ...] + }, + "departments": [ + { + "name": "Department Name", + "must": ["SOP 1", "SOP 2", ...], + "shall": ["SOP 1", "SOP 2", ...], + "will": ["SOP 1", "SOP 2", ...] + }, + { + "name": "Department Name", + "must": ["SOP 1", "SOP 2", ...], + "shall": ["SOP 1", "SOP 2", ...], + "will": ["SOP 1", "SOP 2", ...] + } + ] + } + + Ensure that each specified department has its own set of SOPs and if managers are empty arrays- make sop empty for that department + ''' + def get_sop_executive_from_questionnaire(): return '''Generate Standard Operating Procedures (SOPs) for specific executives and department managers based on the provided questionnaire responses. Instructions: - 1. Use the organizational vision and strategic goals to create overarching SOPs for each executive. - 2. Use the departmental strategic goals to create specific SOPs for each department's managers. + 1. Use the organizational vision and strategic goals and department strategic goals to create overarching SOPs for the executives. + 2. Use the departmental strategic goals and team questionnaire to create specific SOPs for each department. 3. Categorize all SOPs into "must," "shall," and "will" categories. 4. Ensure SOPs are actionable, clear, and directly related to the provided information. 5. For executives, focus on high-level, strategic SOPs that align with the overall vision and goals. - 6. For department managers, create department-specific SOPs based on their strategic goals. - 7. Only generate SOPs for the specified departments. + 6. For departments, create SOPs based on their department strategic goals and team questionaiire response Format the response as a JSON object with the following structure: { - "executives": { - "Executive Name 1": { + "executives": [{ + "role":"exceutive role name": + "sops": { "must": ["SOP 1", "SOP 2", ...], "shall": ["SOP 1", "SOP 2", ...], "will": ["SOP 1", "SOP 2", ...] }, - "Executive Name 2": { + {"role":"exceutitve role 2 name" + "sops": { "must": ["SOP 1", "SOP 2", ...], "shall": ["SOP 1", "SOP 2", ...], - "will": ["SOP 1", "SOP 2", ...] - }, + "will": ["SOP 1", "SOP 2", ...]} + ], ... }, "departments": [ { "name": "Department Name", - "managers": { + "managers": [ + "role":"manager role name", + "sops":{ "must": ["SOP 1", "SOP 2", ...], "shall": ["SOP 1", "SOP 2", ...], "will": ["SOP 1", "SOP 2", ...] - } + }, + { + "name": "Department Name 2", + "managers": [ + "role":"manager role name", + "sops":{ + "must": ["SOP 1", "SOP 2", ...], + "shall": ["SOP 1", "SOP 2", ...], + "will": ["SOP 1", "SOP 2", ...] + }] }, ... ] } - Ensure that each specified department has its own set of SOPs. + Ensure that each specified department has its own set of SOPs.if managers are not provided or empty array for a department, make sop for that department empty--> do not form managers and create sop ''' + + + + +def get_sop_executive_from_questionnaire2(): + return '''Generate Standard Operating Procedures (SOPs) for specific department managers based on the provided questionnaire responses. + + Instructions: + 2. Use the departmental strategic goals and team questionnaire and role bases answers if provided to create specific SOPs for each department. + 3. Categorize all SOPs into "must," "shall," and "will" categories. + 4. Ensure SOPs are actionable, clear, and directly related to the provided information. + 5. For executives, focus on high-level, strategic SOPs that align with the overall vision and goals. + 6. For departments, create SOPs based on their department strategic goals and team questionaiire response + + Format the response as a JSON object with the following structure: + {"departments": [ + { + "name": "Department Name", + "managers": [ + "role":"manager role name", + "sops":{ + "must": ["SOP 1", "SOP 2", ...], + "shall": ["SOP 1", "SOP 2", ...], + "will": ["SOP 1", "SOP 2", ...] + }, + { + "name": "Department Name 2", + "managers": [ + "role":"manager role name", + "sops":{ + "must": ["SOP 1", "SOP 2", ...], + "shall": ["SOP 1", "SOP 2", ...], + "will": ["SOP 1", "SOP 2", ...] + }] + }, + ... + ] + } + Ensure that each specified department has its own set of SOPs.if managers are not provided or empty array for a department, make sop for that department empty--> do not form managers and create sop + ''' def get_roles_reference_comparison(): prompt = """ You are tasked with comparing a list of reference roles with the extracted roles from a document. @@ -348,3 +509,49 @@ def get_sop_for_department_managers(): ''' + +def get_dept_vision_mission_extraction_from_doc2(): + return """ + + You are provided with an organizational document and a list of departments within the organization. Your role is to extract the vision of the organization and the goals/mission of each department from the document. Follow these guidelines: + + If the vision and mission are clearly stated in the document: + + Extract the vision of the organization exactly as stated, without modification. + Extract the goals/mission of each department exactly as provided in the document, ensuring no information is omitted. + If the vision and mission are not clearly stated: + + Infer the vision and mission from the context of the document by analyzing explicit or implicit statements. + Vision: Identify the long-term aspirations or ideal future state of the organization. + Mission: Identify the organization's purpose, core functions, or primary objectives, including departmental goals where applicable. + Additional Instructions: + + If multiple statements for vision or mission are found, include all relevant statements. + If vision and mission are entirely absent, return an empty list for the missing category. + Ensure all extracted or inferred information is complete and accurately reflects the document's content. + Do not omit any relevant details for vision and mission found in the document. + Note: If the vision or mission is found in the document, extract it exactly as it appears without making any changes. + """ + +def get_dept_vision_mission_extraction_from_questionaiire(): + return """ + + You are provided with an questionaiire response within the organization. Your role is to extract the vision of the organization and the goals/mission of each department from the document. Follow these guidelines: + + If the vision and mission are clearly stated in the document: + + Extract the vision of the organization exactly as stated, without modification. + Extract the goals/mission of each department exactly as provided in the document, ensuring no information is omitted. + If the vision and mission are not clearly stated: + + Infer the vision and mission from the context of the document by analyzing explicit or implicit statements. + Vision: Identify the long-term aspirations or ideal future state of the organization. + Mission: Identify the organization's purpose, core functions, or primary objectives, including departmental goals where applicable. + Additional Instructions: + + If multiple statements for vision or mission are found, include all relevant statements. + If vision and mission are entirely absent, return an empty list for the missing category. + Ensure all extracted or inferred information is complete and accurately reflects the respone's content. + Do not omit any relevant details for vision and mission found in the document. + + """ \ No newline at end of file diff --git a/src/services/chatbot.py b/src/services/chatbot.py index 27615bf..4a2903a 100644 --- a/src/services/chatbot.py +++ b/src/services/chatbot.py @@ -9,9 +9,70 @@ from src.models.sop_response_schemas import * from src.models.bot_response_schema import * from scripts.assessment_data import generate_summary_stats_v2 from dotenv import load_dotenv +from scripts.statistics_data import (generate_summary_stats,create_json_body,fetch_data) load_dotenv() +import random +import json +from datetime import datetime, timedelta +import pandas as pd +# Define possible areas +areas = [ + "Agile Methodologies", "API Development", "Code Review", "Collaboration with Cross-Functional Teams", + "Continuous Integration/Continuous Deployment (CI/CD)", "Debugging Techniques", "Documentation", + "Performance Optimization", "System Design", "Unit Testing", "Version Control" +] + +# Generate random dates +def random_date(): + start_date = datetime(2024, 1, 1) + return (start_date + timedelta(days=random.randint(1, 300))).strftime('%Y-%m-%dT00:00:00.000Z') + +# Generate dummy assessments +def generate_dummy_data(num_assessments=50, max_users_per_assessment=5): + data = [] + for i in range(1, num_assessments + 1): + assessment_id = str(i) + assessment_name = f"Assessment {i}" + start_date = random_date() + red_flags = random.randint(0, 5) + open_items = random.randint(0, 50) + completed_items = random.randint(0, 50) + total_assigned_items = open_items + completed_items + + # Generate random users for each assessment + user_details = [] + num_users = random.randint(1, max_users_per_assessment) + for _ in range(num_users): + user_name = f"User_{random.randint(1, 100)}" + user_total_items = random.randint(1, 50) + user_completed_items = random.randint(0, user_total_items) + area_list = random.sample(areas, random.randint(1, 5)) + + user_details.append({ + "name": user_name, + "total_assigned_items": user_total_items, + "completed_items": user_completed_items, + "area_list": area_list + }) + + data.append({ + "assessment_id": assessment_id, + "red_flags": red_flags, + "open_items": open_items, + "completed_items": completed_items, + "total_assigned_items": total_assigned_items, + "assessment_name": assessment_name, + "start_date": start_date, + "user_details": user_details + }) + + return {"error": False, "data": data} + +# Generate dummy data +dummy_data = generate_dummy_data(num_assessments=100, max_users_per_assessment=5) +#print(dummy_data) #SopGeneratorDocument class Chatbot: def __init__(self): @@ -123,10 +184,14 @@ class Chatbot: """ try: # Define the path to the company's assessment data (stored as a CSV) - data_path = os.path.join('data', 'raw', 'erp_company_assessment', f'{companyid}_raw_data.csv') - - # Generate summary statistics from the company's assessment data - summary_stats = generate_summary_stats_v2(file_path=data_path) + json_body_area = create_json_body("problematic-areas", companyid) + json_body_assessment = create_json_body("user-stats-by-assessment", companyid) + # Fetching data + problematic_areas_data = fetch_data(json_body_area) + assessment_data = fetch_data(json_body_assessment) + + summary_stats = generate_summary_stats(assessment_data, problematic_areas_data) + print(summary_stats) # Generate the prompt using the company info and the summary statistics @@ -164,7 +229,7 @@ class Chatbot: return None - def predict_next_n_assessment(self, company_info, companyid, N) -> AssessmentPredictionsResponse: + def predict_next_n_assessment(self,companyid, N) -> AssessmentPredictionsResponse: """ This method generates predictions based on past assessment data of a company. It queries the backend for the company's assessment data, generates a prompt, and then uses the GPT-4 model to return predictions based on the query. @@ -176,51 +241,62 @@ class Chatbot: :return: Result containing the prediction result or None if an error occurs. """ try: + + json_body_area = create_json_body("problematic-areas", companyid) + json_body_assessment = create_json_body("user-stats-by-assessment", companyid) + # Fetching data + problematic_areas_data = fetch_data(json_body_area) + assessment_data = fetch_data(json_body_assessment) + + summary_stats = generate_summary_stats(assessment_data, problematic_areas_data) + print(summary_stats) # Define the path to the company's assessment data (stored as a CSV) - data_path = os.path.join('data', 'raw', 'erp_company_assessment', f'{companyid}_raw_data.csv') + #data_path = os.path.join('data', 'raw', 'erp_company_assessment', f'{companyid}_raw_data.csv') # Generate summary statistics from the company's assessment data - summary_stats = generate_summary_stats_v2(file_path=data_path) + #summary_stats = generate_summary_stats_v2(file_path=data_path) # Generate the prompt using the company info and the summary statistics - prompt = predict_next_n_assessments_prompt() + prompt = predict_next_n_assessments_prompt_v2() # Interact with GPT-4 model to get a response + MODEL = "gpt-4o" response = self.client.beta.chat.completions.parse( - model=self.model, + model=MODEL, messages=[ { "role": "system", "content": f"{prompt}" }, + { "role": "user", - "content": f"company info: {company_info}--> N-value is {N} ", + "content": f"Summary stattistics of company past assessment: {summary_stats}", }, - { + { "role": "user", - "content": f"Summary stats: {summary_stats}", + "content": f"Number of next assessments to predict: {N}", } ], - response_format=AssessmentPredictionsResponse, + #response_format=AssessmentPredictionsResponse, max_tokens=1024, temperature=0.1 ) # Extract the response from the GPT-4 model - extracted_text = json.loads(response.choices[0].message.content) + preds = json.loads(response.choices[0].message.content) # Initialize dictionary to store assessments with dynamic names - predictions = {} + #predictions = {} # Loop through the predicted assessments and rename them dynamically - for i in range(N): - assessment_key = f"assessment_{i + 1}" - predictions[assessment_key] = extracted_text["predictions"][i]['AssessmentN'] + #for i in range(N): + #assessment_key = f"assessment_{i + 1}" + #predictions[assessment_key] = extracted_text["predictions"][i]['AssessmentN'] # Return the dynamically named assessments - return predictions + return preds except Exception as e: print(f"An error occurred: {e}") @@ -279,10 +355,18 @@ class Chatbot: """ try: # Define the path to the company's assessment data (stored as a CSV) - data_path = os.path.join('data', 'raw', 'erp_company_assessment', f'{companyid}_raw_data.csv') + #data_path = os.path.join('data', 'raw', 'erp_company_assessment', f'{companyid}_raw_data.csv') # Generate summary statistics from the company's assessment data - summary_stats = generate_summary_stats_v2(file_path=data_path) + #summary_stats = generate_summary_stats_v2(file_path=data_path) + json_body_area = create_json_body("problematic-areas", companyid) + json_body_assessment = create_json_body("user-stats-by-assessment", companyid) + # Fetching data + problematic_areas_data = fetch_data(json_body_area) + assessment_data = fetch_data(json_body_assessment) + + summary_stats = generate_summary_stats(assessment_data, problematic_areas_data) + # Generate the prompt using the company info and the summary statistics prompt = predict_goal_achievement_probability_prompt() @@ -301,7 +385,7 @@ class Chatbot: }, { "role": "user", - "content": f"Summary stats: {summary_stats}", + "content": f"Summary stats of past assement: {summary_stats}", } ], response_format=AchievementPrediction, diff --git a/src/services/document_parser.py b/src/services/document_parser.py index f3c22b8..1e75abb 100644 --- a/src/services/document_parser.py +++ b/src/services/document_parser.py @@ -59,7 +59,7 @@ class DocumentParser: def extract_vision_mission(self, docs) -> VisionMissionResponse: """ - Extracts Vision, Mission, and SOPs categorized into 'must,' 'shall,' and 'will' from the document. + Extracts Vision, Mission' from the document. :param docs: The document(s) from which to extract information. :return: VisionMissionResponse containing the vision, mission, and role-specific SOPs. @@ -92,6 +92,42 @@ class DocumentParser: except: return False + + def extract_vision_mission2(self, docs) -> VisionMissionResponse2: + """ + Extracts Vision, Mission, and SOPs categorized into 'must,' 'shall,' and 'will' from the document. + + :param docs: The document(s) from which to extract information. + :return: VisionMissionResponse containing the vision, mission, and role-specific SOPs. + """ + + try: + docs_text = self._extract_text_from_docs(docs) + prompt = get_vision_mission_extraction_from_doc2() + response = self.client.beta.chat.completions.parse( + model=self.model, + messages=[ + { + "role": "system", + "content": f'''{prompt}''' + }, + { + "role": "user", + "content": [{"type": "text", "text": text} for text in docs_text], + } + ], + response_format=VisionMissionResponse2, + max_tokens=10000, + temperature=0.1 + ) + + # Parse the response from the LLM + extracted_text = json.loads(response.choices[0].message.content) + + return extracted_text + + except: + return False '''def extract_departments_and_managers(self, docs): """ diff --git a/src/services/sop_document_parser.py b/src/services/sop_document_parser.py index 6cdbb20..f13a75c 100644 --- a/src/services/sop_document_parser.py +++ b/src/services/sop_document_parser.py @@ -96,7 +96,83 @@ class DocumentParser: except: return False - + + def extract_vision_mission2(self, docs,departments) -> VisionMissionResponse2: + """ + Extracts Vision, Mission, and SOPs categorized into 'must,' 'shall,' and 'will' from the document. + + :param docs: The document(s) from which to extract information. + :return: VisionMissionResponse containing the vision, mission, and role-specific SOPs. + """ + + try: + docs_text = self._extract_text_from_docs(docs) + prompt = get_vision_mission_extraction_from_doc2() + response = self.client.beta.chat.completions.parse( + model=self.model, + messages=[ + { + "role": "system", + "content": f'''{prompt}''' + }, + { + "role": "user", + "content": f"Department to consider for the company goals generation{departments}" + }, + { + "role": "user", + "content": [{"type": "text", "text": text} for text in docs_text], + } + ], + response_format=VisionMissionResponse2, + max_tokens=10000, + temperature=0.1 + ) + + # Parse the response from the LLM + extracted_text = json.loads(response.choices[0].message.content) + + return extracted_text + + except: + return False + + def extract_dept_goals(self, docs) -> VisionMissionResponse2: + """ + Extracts Vision, Mission, and SOPs categorized into 'must,' 'shall,' and 'will' from the document. + + :param docs: The document(s) from which to extract information. + :return: VisionMissionResponse containing the vision, mission, and role-specific SOPs. + """ + + try: + docs_text = self._extract_text_from_docs(docs) + prompt = get_vision_mission_extraction_from_doc2() + response = self.client.beta.chat.completions.parse( + model=self.model, + messages=[ + { + "role": "system", + "content": f'''{prompt}''' + }, + { + "role": "user", + "content": [{"type": "text", "text": text} for text in docs_text], + } + ], + response_format=DeptGoalsVisssion, + max_tokens=10000, + temperature=0.1 + ) + + # Parse the response from the LLM + extracted_text = json.loads(response.choices[0].message.content) + + return extracted_text + + except: + return False + def get_roles(self, docs): # Extract the text content from the Document objects docs_text = [doc.page_content for doc in docs] diff --git a/src/services/sop_generator.py b/src/services/sop_generator.py index 00c58d3..c8c6ac2 100644 --- a/src/services/sop_generator.py +++ b/src/services/sop_generator.py @@ -7,6 +7,13 @@ from src.prompts.sops import * from src.models.sop_response_schemas import * from src.services.sop_document_parser import DocumentParser from dotenv import load_dotenv +from concurrent.futures import ThreadPoolExecutor, as_completed +from typing import List, Dict +import json +from openai import OpenAI +import os +import time +from collections import deque load_dotenv() @@ -16,6 +23,9 @@ class SopPersonalAssessment: self.api_key = os.getenv("OPENAI_API_KEY") self.client = OpenAI(api_key=self.api_key) self.model = "gpt-4o-mini" + self.rpm_limit = 3 # Requests per minute limit + self.batch_size = 3 # Process 3 roles at a time + self.retry_delays = [4, 8, 16, 32] # Existing methods... @@ -72,42 +82,47 @@ class SopPersonalAssessment: print(f"Error occurred: {str(e)}") return False - - def generate_sops_by_role_and_area(self, roles: List[dict]) -> RoleSops: + + def generate_sops_by_role_and_area(self, roles,qna) -> RoleSops: try: - sops_by_role = [] - for role_info in roles: - role = role_info['role'] - sop_types = role_info['sop_types'] # List of SOP types: ["will", "shall", "must"] - areas = role_info['areas'] # List of areas: ["communication", "development", etc.] - - - prompt = get_sop_personalassessment_from_area_role(role,areas,sop_types) + + + MODEL = "gpt-4o-mini" + prompt = get_sop_personalassessment_from_area_rolev2() response = self.client.beta.chat.completions.parse( - model=self.model, + model=MODEL, messages=[ { "role": "system", "content": f'''{prompt} ''', + }, + { + "role": "user", + "content": f'''povided Roles Data {roles} + ''', + }, + { + "role": "user", + "content": f'''Extra question and answers for more context {qna} + ''', } ], - response_format=RoleSops, - max_tokens=16000, + response_format=RoleSopssLists, + max_tokens=6000, temperature=0.1 ) extracted_text = json.loads(response.choices[0].message.content) # You can customize this to generate SOPs based on the role, SOP types, and areas - sops_by_role.append(extracted_text) - - - - return sops_by_role + + return extracted_text["sops"] - except: + except Exception as e: + print(f"Error occurred: {str(e)}") return False + def generate_roles_from_questionnaire(self, questionnaire_data: List[dict]) -> Roles_response: try: @@ -165,6 +180,7 @@ class SopGeneratorExecutive: Find the mission and vision provided below Vision: {vision} Goals: {goals} + ''' response = self.client.beta.chat.completions.parse( @@ -232,56 +248,35 @@ class SopGeneratorExecutive: return False - def generate_sops_from_questionnaire(self, questionnaire_data: dict, executives: List[str], managers: List[str], departments: List[str]): + def generate_sops_from_questionnaire(self, questionnaire_data: dict, executives: List[str]): try: + print("Generating SOPs from questionnaire...") prompt = get_sop_executive_from_questionnaire() + print(f"Prompt: {prompt}") # Prepare the questionnaire data for the prompt user_content = json.dumps(questionnaire_data, indent=2) + print(f"User content: {user_content}") response = self.client.beta.chat.completions.parse( model=self.model, messages=[ {"role": "system", "content": prompt}, - {"role": "user", "content": f"Generate SOPs based on this questionnaire:\n{user_content}\n\nExecutives to consider: {', '.join(executives)}\nManagers to consider: {', '.join(managers)}\nDepartments to consider: {', '.join(departments)}"} + {"role": "user", "content": f"Generate SOPs based on this questionnaire response:\n{user_content}\n\nExecutives to consider: {', '.join(executives)}"} ], response_format={"type": "json_object"}, max_tokens=16000, temperature=0.1 ) + print("Response received from API.") sops_data = json.loads(response.choices[0].message.content) + print(f"SOPs data: {sops_data}") # Process executive SOPs - executive_sops = {} - for executive in executives: - if executive in sops_data['executives']: - executive_sops[executive] = Categories(**sops_data['executives'][executive]) - else: - executive_sops[executive] = Categories() - - # Process department manager SOPs - departments_with_sops = [] - for dept_name in departments: - dept_data = next((d for d in sops_data['departments'] if d['name'].lower() == dept_name.lower()), None) - if dept_data: - managers_with_sops = [ - ManagerWithSOPs( - title=manager, - sops=ManagerSOPs(**dept_data['managers']) - ) - for manager in managers - - ] - if managers_with_sops: - departments_with_sops.append(DepartmentManagerSOPs( - name=dept_name, - managers=managers_with_sops - )) return { - "executive_sops": executive_sops, - "department_sops": ExecutiveManagerSOPsResponse(departments=departments_with_sops) + "response": sops_data } except Exception as e: @@ -289,6 +284,108 @@ class SopGeneratorExecutive: return False + def generate_vision_mission_from_questionnaire(self, questionnaire_data: dict): + """ + Generate vision and mission based on the questionnaire data provided in the request body. + The request body is expected to contain plain-text information for vision and mission.""" + try: + print("Generating vsion and mission from questionnaire...") + prompt = get_vision_mission_extraction_from_questionnaire_executive() + print(f"Prompt: {prompt}") + + # Prepare the questionnaire data for the prompt + user_content = json.dumps(questionnaire_data, indent=2) + print(f"User content: {user_content}") + + response = self.client.beta.chat.completions.parse( + model=self.model, + messages=[ + {"role": "system", "content": prompt}, + {"role": "user", "content": f"questionnaire response:\n{user_content}"} + ], + response_format=VisionMissionResponse2, + max_tokens=16000, + temperature=0.1 + ) + + print("Response received from API.") + response = json.loads(response.choices[0].message.content) + + + return response + + except Exception as e: + print(f"Error in generate_sops_from_questionnaire: {str(e)}") + return False + + + def generate_dept_goals_from_questionnaire(self, questionnaire_data): + try: + print("Generating SOPs from questionnaire...") + prompt = get_dept_vision_mission_extraction_from_questionaiire() + print(f"Prompt: {prompt}") + + # Prepare the questionnaire data for the prompt + user_content = json.dumps(questionnaire_data, indent=2) + + response = self.client.beta.chat.completions.parse( + model=self.model, + messages=[ + {"role": "system", "content": prompt}, + {"role": "user", "content": f"Generate based on this questionnaire response:\n{user_content}\n"} + ], + response_format=DeptGoalsVisssion, + max_tokens=16000, + temperature=0.1 + ) + + print("Response received from API.") + sops_data = json.loads(response.choices[0].message.content) + + + # Process executive SOPs + + return sops_data + + except Exception as e: + print(f"Error in generate_sops_from_questionnaire: {str(e)}") + return False + + def generate_sops_from_questionnaire2(self, questionnaire_data: dict): + try: + print("Generating SOPs from questionnaire...") + prompt = get_sop_executive_from_questionnaire2() + print(f"Prompt: {prompt}") + + # Prepare the questionnaire data for the prompt + user_content = json.dumps(questionnaire_data, indent=2) + print(f"User content: {user_content}") + + response = self.client.beta.chat.completions.parse( + model=self.model, + messages=[ + {"role": "system", "content": prompt}, + {"role": "user", "content": f"Generate SOPs based on this questionnaire response:\n{user_content}\n"} + ], + response_format={"type": "json_object"}, + max_tokens=16000, + temperature=0.1 + ) + + print("Response received from API.") + sops_data = json.loads(response.choices[0].message.content) + print(f"SOPs data: {sops_data}") + + # Process executive SOPs + + return { + "response": sops_data + } + + except Exception as e: + print(f"Error in generate_sops_from_questionnaire: {str(e)}") + return False + class SopGeneratorManager: def __init__(self): diff --git a/test.py b/test.py index 5a15e2d..0e15ec8 100644 --- a/test.py +++ b/test.py @@ -1,78 +1,140 @@ -import os -import json -import asyncio -from openai import AsyncOpenAI -from pydantic import BaseModel, Field -from typing import List, Dict, Optional -from src.prompts.sops import * -from src.models.questions_response import * -from src.services.sop_document_parser import DocumentParser -from src.prompts.questions import * +import requests +import pandas as pd from dotenv import load_dotenv - load_dotenv() +import os -class QuestionsGenerator: - def __init__(self): - self.api_key = os.getenv("OPENAI_API_KEY") - self.client = AsyncOpenAI(api_key=self.api_key) - self.model = "gpt-4o-mini" +DATA_KEY = os.getenv("AI_DATA_KEY") +# Constants for API requests +URL = "https://erpai.mkdlabs.com//v3/api/custom/erpai/common/get-data-ai" +HEADERS = { + "x-project": DATA_KEY # Replace with your actual key +} - async def generate_single_frequency_questions(self, docs, assessment_type, frequency_number, total_duration): - prompt = get_questions_prompt_v3() - frequency_label = f"{assessment_type} number : {frequency_number}" - - response = await self.client.chat.completions.create( - model=self.model, - messages=[ - {"role": "system", "content": prompt}, - {"role": "user", "content": f"The SOPs are provided below."}, - {"role": "user", "content": json.dumps(docs)}, - {"role": "user", "content": f"Assessment Type: {assessment_type}"}, - {"role": "user", "content": f"Current Frequency Number to generate: {frequency_label}"}, - {"role": "user", "content": f"Duration: {total_duration}"} - ], - temperature=0.1, - response_format={ "type": "json_object" }, - max_tokens=10000 - ) - - questions_json = json.loads(response.choices[0].message.content) - return questions_json - - async def generate_questions(self, input_data: Dict) -> AssessmentQuestions: - try: - sops = input_data['sops'] - assessment_type = input_data['assessment_type'] - total_duration = input_data['duration'] - - chunk_size = 1000 - docs_text = [sops[i:i + chunk_size] for i in range(0, len(sops), chunk_size)] - docs = [{"type": "text", "text": text} for text in docs_text] - - tasks = [] - for frequency_number in range(1, total_duration + 1): - task = self.generate_single_frequency_questions(docs, assessment_type, frequency_number, total_duration) - tasks.append(task) - - all_questions = await asyncio.gather(*tasks) - - return AssessmentQuestions(questions=Questions(questions=all_questions)) - - except Exception as e: - print(f"An error occurred: {e}") - return None - -# Usage -async def main(): - generator = QuestionsGenerator() - input_data = { - "sops": "Your SOP text here", - "assessment_type": "weekly", - "duration": 4 +# JSON bodies for API requests +def create_json_body(area_type, company_id): + return { + "type": area_type, + "options": { + "company_id": company_id + } } - result = await generator.generate_questions(input_data) - print(result) + +# Function to fetch data from the API +def fetch_data(json_body): + json_body["options"]["company_id"] = json_body["options"].get("company_id") # Ensure company_id is included + response = requests.post(URL, headers=HEADERS, json=json_body) + response.raise_for_status() # Raise an error for bad responses + return response.json() + + + +def convert_assessment_data_to_dataframe(assessment_data): + df_assessment = [] + for assessment in assessment_data.get("data", []): + assessment_id = assessment["assessment_id"] + assessment_name = assessment["assessment_name"] + start_date = assessment["start_date"] + open_items = assessment["open_items"] + completed_items = assessment["completed_items"] + total_assigned_items = assessment["total_assigned_items"] + red_flags = assessment["red_flags"] + + for user in assessment.get("user_details", []): + user_name = user["name"] + user_total_items = user["total_assigned_items"] + user_completed_items = user["completed_items"] + + for area in user.get("area_list", []): + df_assessment.append({ + "assessment_id": assessment_id, + "assessment_name": assessment_name, + "start_date": start_date, + "open_items_overall": open_items, + "completed_items_overall": completed_items, + "total_assigned_items_overall": total_assigned_items, + "user_name": user_name, + "user_total_assigned_items": user_total_items, + "user_completed_items": user_completed_items, + "area": area, + "red_flags": red_flags + }) + return pd.DataFrame(df_assessment) + +# Convert to DataFrame + + +# Summary statistics for overall assessment level +def generate_summary_statistics(df): + total_assessments = df['assessment_id'].nunique() + avg_open_items = df.groupby('assessment_id')['open_items_overall'].mean().mean() + avg_completed_items = df.groupby('assessment_id')['completed_items_overall'].mean().mean() + avg_total_assigned_items = df.groupby('assessment_id')['total_assigned_items_overall'].mean().mean() + avg_red_flags = df['red_flags'].mean() + + total_users = df['user_name'].nunique() + avg_user_total_items = df.groupby('user_name')['user_total_assigned_items'].mean().mean() + avg_user_completed_items = df.groupby('user_name')['user_completed_items'].mean().mean() + completion_rate_per_user = (df['user_completed_items'].sum() / df['user_total_assigned_items'].sum()) * 100 if df['user_total_assigned_items'].sum() > 0 else 0 + + area_summary = df['area'].value_counts() + + return { + "total_assessments": total_assessments, + "avg_open_items_per_assessment": avg_open_items, + "avg_completed_items_per_assessment": avg_completed_items, + "avg_total_assigned_items_per_assessment": avg_total_assigned_items, + "avg_red_flags": avg_red_flags, + "total_users": total_users, + "avg_user_total_assigned_items": avg_user_total_items, + "avg_user_completed_items": avg_user_completed_items, + "completion_rate_per_user": completion_rate_per_user, + "area_summary": area_summary.to_dict() + } + +# Additional statistics for efficiency and areas +def generate_extended_statistics(df): + df['user_completion_rate'] = (df['user_completed_items'] / df['user_total_assigned_items']).fillna(0) * 100 + + top_5_efficient_users = df.groupby('user_name')['user_completion_rate'].mean().nlargest(5).to_dict() + bottom_5_least_efficient_users = df.groupby('user_name')['user_completion_rate'].mean().nsmallest(5).to_dict() + + df['uncompleted_items'] = df['user_total_assigned_items'] - df['user_completed_items'] + areas_with_most_uncompleted_items = df.groupby('area')['uncompleted_items'].sum().nlargest(5).to_dict() + + return { + "top_5_efficient_users": top_5_efficient_users, + "bottom_5_least_efficient_users": bottom_5_least_efficient_users, + "areas_with_most_uncompleted_items": areas_with_most_uncompleted_items + } + +# Generate statistics for problematic areas +def generate_problematic_area_statistics(df): + total_open_items = df.groupby('name')['open_items'].sum().sort_values(ascending=False) + total_red_flags = df.groupby('name')['red_flags'].sum().sort_values(ascending=False) + + return pd.DataFrame({ + "total_open_items": total_open_items, + "total_red_flags": total_red_flags + }).fillna(0) + +def generate_summary_stats(assessment_data, area_data): + assessment_df = convert_assessment_data_to_dataframe(assessment_data) + problematic_area_df = pd.DataFrame(area_data.get("data", [])) + + summary_stats = generate_summary_statistics(assessment_df) + extended_stats = generate_extended_statistics(assessment_df) + summary_stats["users(Workers) based stats"] = extended_stats + + problematic_stats = generate_problematic_area_statistics(problematic_area_df) + summary_stats["Area based stats"] = problematic_stats.to_dict(orient='index') + + return summary_stats + if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + from src.services.chatbot import Chatbot + bot = Chatbot() + res = bot.predict_next_n_assessment(companyid=12,N=3) + + print(res) \ No newline at end of file