Spaces:
Sleeping
Sleeping
added ars route
Browse files- Ars/ai_functions.py +190 -84
- Ars/controllers.py +9 -8
- Ars/objects.py +171 -11
- app.py +2 -0
Ars/ai_functions.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from pdfminer.high_level import extract_text_to_fp
|
2 |
from io import BytesIO
|
3 |
-
from objects import ai,ResumeData,AutomationRiskResult,RealWorldQuestion,SkillDepthResult,BreakDownByDomainUpdate,FlaggedRiskAreasUpdate,BoostSuggestionsUpdate
|
4 |
from embedDoc import search_pinecone_text
|
5 |
from fastapi import UploadFile
|
6 |
|
@@ -56,26 +56,52 @@ def calculate_automation_risk(resume:ResumeData):
|
|
56 |
|
57 |
real_world_data=generate_real_world_data(resume=resume)
|
58 |
prompt = f"""
|
59 |
-
|
60 |
|
61 |
-
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
77 |
|
|
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
|
81 |
|
@@ -83,17 +109,50 @@ def calculate_skill_depth(resume:ResumeData):
|
|
83 |
|
84 |
|
85 |
prompt = f"""
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
-
|
91 |
-
{resume}
|
92 |
-
)
|
93 |
-
|
94 |
-
Return Just Numbers MAX (100) MIN (0)
|
95 |
-
"""
|
96 |
-
result=ai.chat(prompt=prompt,output_schema=SkillDepthResult)
|
97 |
return result
|
98 |
|
99 |
|
@@ -102,20 +161,39 @@ def calculate_Ai_collab_readiness(resume:ResumeData):
|
|
102 |
|
103 |
|
104 |
prompt = f"""
|
105 |
-
|
106 |
-
- Mention of AI tools (ChatGPT, Copilot, etc.)
|
107 |
-
- Stated openness to automation
|
108 |
-
- How do they currently use AI tools in your work or studies?”:
|
109 |
|
110 |
-
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
return result
|
120 |
|
121 |
|
@@ -123,25 +201,42 @@ def calculate_Ai_collab_readiness(resume:ResumeData):
|
|
123 |
|
124 |
|
125 |
|
126 |
-
def generate_domain_breakdown(resume:ResumeData):
|
127 |
|
128 |
|
129 |
prompt = f"""
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
result=ai.chat(prompt=prompt,output_schema=BreakDownByDomainUpdate)
|
146 |
return result
|
147 |
|
@@ -149,26 +244,35 @@ def generate_domain_breakdown(resume:ResumeData):
|
|
149 |
|
150 |
|
151 |
|
152 |
-
def generate_flagged_risk_areas(resume:ResumeData):
|
153 |
|
154 |
|
155 |
prompt = f"""
|
156 |
-
You are a Resume Evaluation AI. Your task is to analyze the provided resume and identify potential risk areas based on the content. Focus on:
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
3. Overreliance on automatable tasks (e.g., data entry, spreadsheets)
|
161 |
|
162 |
-
|
163 |
-
|
|
|
164 |
|
165 |
-
**
|
166 |
-
- "risk_areas: Your spreadsheet skills are highly automatable."
|
167 |
-
- "risk_areas: Your portfolio lacks AI-integrated work."
|
168 |
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
({resume})
|
172 |
"""
|
173 |
result=ai.chat(prompt=prompt,output_schema=FlaggedRiskAreasUpdate)
|
174 |
return result
|
@@ -176,32 +280,34 @@ Here is the resume to evaluate:
|
|
176 |
|
177 |
|
178 |
|
179 |
-
def generate_boost_suggestion(resume:ResumeData):
|
180 |
|
181 |
|
182 |
prompt = f"""
|
183 |
-
You are a Resume Enhancement AI.
|
184 |
|
185 |
-
Focus on
|
186 |
-
-
|
187 |
-
- Enrolling in advanced courses
|
188 |
-
- Expanding
|
189 |
-
-
|
190 |
|
191 |
-
**Examples
|
192 |
-
- "
|
193 |
-
- "
|
194 |
-
- "Add recent certifications to
|
195 |
-
- "
|
196 |
|
197 |
-
**
|
198 |
-
-
|
199 |
-
-
|
200 |
-
-
|
201 |
|
202 |
-
|
203 |
|
204 |
({resume})
|
|
|
|
|
205 |
"""
|
206 |
|
207 |
result=ai.chat(prompt=prompt,output_schema=BoostSuggestionsUpdate)
|
|
|
1 |
from pdfminer.high_level import extract_text_to_fp
|
2 |
from io import BytesIO
|
3 |
+
from objects import ai,ResumeData,AutomationRiskResult,AutomationRiskInput,RealWorldQuestion,SkillDepthResult,SkillDepthInput,BreakDownByDomainUpdate,FlaggedRiskAreasUpdate,BoostSuggestionsUpdate,AICollabReadinessInput
|
4 |
from embedDoc import search_pinecone_text
|
5 |
from fastapi import UploadFile
|
6 |
|
|
|
56 |
|
57 |
real_world_data=generate_real_world_data(resume=resume)
|
58 |
prompt = f"""
|
59 |
+
You are an Automation Risk Calculator AI. Your task is to analyze the user's resume and any provided real-world data to estimate how automatable their skills and job titles are.
|
60 |
|
61 |
+
For each of the following factors, please evaluate on a scale from 0 to 5, where:
|
62 |
|
63 |
+
0 = Not present or irrelevant
|
64 |
+
1 = Very low presence or impact
|
65 |
+
2 = Low presence or impact
|
66 |
+
3 = Moderate presence or impact
|
67 |
+
4 = High presence or impact
|
68 |
+
5 = Very high presence or impact
|
69 |
+
|
70 |
+
Factors to score:
|
71 |
+
|
72 |
+
- repetitiveness of tasks
|
73 |
+
- creativity required
|
74 |
+
- emotional intelligence needed
|
75 |
+
- reliance on data-driven tasks
|
76 |
+
- physical/manual work involved
|
77 |
+
- level of autonomous decision-making
|
78 |
+
- need for strategic thinking
|
79 |
+
- importance of collaboration
|
80 |
+
- current use of AI tools in the role
|
81 |
+
- recent upskilling or adaptability
|
82 |
|
83 |
+
The real-world data may contain labor market trends, automation probabilities, or other relevant insights — use it if helpful.
|
84 |
|
85 |
+
After scoring all factors, calculate an overall automation risk score between 0 and 100, where:
|
86 |
+
- 100 means very low automation risk (skills are highly resilient to automation),
|
87 |
+
- 0 means very high automation risk (skills are highly automatable).
|
88 |
+
|
89 |
+
Return only the final integer risk score (0 to 100) — no explanations or extra text.
|
90 |
+
|
91 |
+
Here is the resume:
|
92 |
+
|
93 |
+
(
|
94 |
+
{resume}
|
95 |
+
)
|
96 |
+
|
97 |
+
Here is the real-world data:
|
98 |
+
|
99 |
+
(
|
100 |
+
{real_world_data}
|
101 |
+
)
|
102 |
+
"""
|
103 |
+
result = ai.chat(prompt=prompt, output_schema=AutomationRiskInput)
|
104 |
+
return result
|
105 |
|
106 |
|
107 |
|
|
|
109 |
|
110 |
|
111 |
prompt = f"""
|
112 |
+
You are a Skill Depth Calculator AI. Your task is to analyze the user's resume data and score various skill-related factors.
|
113 |
+
|
114 |
+
For each of the following factors, please score on a scale from 0 to 5, where:
|
115 |
+
|
116 |
+
0 = Not present or no depth
|
117 |
+
1 = Very shallow experience or presence
|
118 |
+
2 = Basic or limited experience
|
119 |
+
3 = Moderate experience or involvement
|
120 |
+
4 = Strong experience or senior level
|
121 |
+
5 = Expert or highly advanced experience
|
122 |
+
|
123 |
+
Factors to score include (but are not limited to):
|
124 |
+
|
125 |
+
- Years of experience per skill
|
126 |
+
- Seniority level in roles held
|
127 |
+
- Number and relevance of certifications
|
128 |
+
- Breadth of skills (variety and diversity)
|
129 |
+
- Depth in core technical skills
|
130 |
+
- Depth in leadership or management skills
|
131 |
+
- Involvement in complex projects
|
132 |
+
- Contributions to strategic initiatives
|
133 |
+
- Frequency of skill usage in recent roles
|
134 |
+
- Evidence of continuous learning or upskilling
|
135 |
+
- Cross-functional collaboration skills
|
136 |
+
- Recognition or awards related to skills
|
137 |
+
- Public speaking or training experience
|
138 |
+
- Publications or patents (if any)
|
139 |
+
- Industry-specific expertise depth
|
140 |
+
- Mentoring or coaching experience
|
141 |
+
- Ability to innovate using skills
|
142 |
+
- Adaptability to new technologies
|
143 |
+
- Problem-solving skills depth
|
144 |
+
- Communication skills related to technical content
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
Here is the resume:
|
149 |
+
|
150 |
+
(
|
151 |
+
{resume}
|
152 |
+
)
|
153 |
+
"""
|
154 |
|
155 |
+
result=ai.chat(prompt=prompt,output_schema=SkillDepthInput)
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
return result
|
157 |
|
158 |
|
|
|
161 |
|
162 |
|
163 |
prompt = f"""
|
164 |
+
You are an AI Collaboration Readiness Calculator. Your task is to read the following resume and assess how ready the individual is to **collaborate with AI tools**, not just compete against them.
|
|
|
|
|
|
|
165 |
|
166 |
+
Score the user on the following 10 readiness traits, each on a scale from 0 to 5:
|
167 |
|
168 |
+
0 = Not mentioned or no evidence
|
169 |
+
1 = Very minimal evidence or weak relevance
|
170 |
+
2 = Some mention, limited depth
|
171 |
+
3 = Moderate use or awareness
|
172 |
+
4 = Strong use or understanding
|
173 |
+
5 = Expert use or deep integration
|
174 |
+
|
175 |
+
Traits to evaluate:
|
176 |
+
|
177 |
+
- Mention of AI tools (e.g., ChatGPT, GitHub Copilot, Midjourney, etc.)
|
178 |
+
- Adaptability to AI-enhanced workflows
|
179 |
+
- Willingness to learn and adopt AI tools
|
180 |
+
- Understanding of AI ethics and responsible use
|
181 |
+
- Demonstrated collaboration with AI (not just use)
|
182 |
+
- Use of AI for problem-solving
|
183 |
+
- Creativity in applying AI to new tasks or contexts
|
184 |
+
- Speed in learning and applying new AI technologies
|
185 |
+
- Communication skills related to explaining or using AI
|
186 |
+
- Integration of AI into work/study processes
|
187 |
+
|
188 |
+
|
189 |
+
Here is the resume:
|
190 |
+
|
191 |
+
(
|
192 |
+
{resume}
|
193 |
+
)
|
194 |
+
"""
|
195 |
+
|
196 |
+
result=ai.chat(prompt=prompt,output_schema=AICollabReadinessInput)
|
197 |
return result
|
198 |
|
199 |
|
|
|
201 |
|
202 |
|
203 |
|
204 |
+
def generate_domain_breakdown(resume:ResumeData,**helpful_key_data):
|
205 |
|
206 |
|
207 |
prompt = f"""
|
208 |
+
You have one clear objective: analyze the following resume and produce a domain skills breakdown based on the taxonomy below.
|
209 |
+
|
210 |
+
**Task:**
|
211 |
+
Classify and score the candidate’s skills/domains on a scale from 0 to 100, where 0 means no proficiency and 100 means expert-level proficiency.
|
212 |
+
|
213 |
+
**Example output format:**
|
214 |
+
- Technical: 65
|
215 |
+
- Creative: 80
|
216 |
+
- Strategy: 75
|
217 |
+
- Collaboration: 60
|
218 |
+
|
219 |
+
**Domains to consider (but not limited to):**
|
220 |
+
- Technical (e.g., software development, programming)
|
221 |
+
- Creative (e.g., design, content creation)
|
222 |
+
- Strategy (e.g., planning, business analysis)
|
223 |
+
- Collaboration (e.g., teamwork, communication)
|
224 |
+
|
225 |
+
**Requirements:**
|
226 |
+
- Return only the domain names and their scores as shown in the example.
|
227 |
+
- Scores must be integers between 0 and 100.
|
228 |
+
- Provide 4–6 domain categories relevant to the resume content.
|
229 |
+
- Use your best judgment based on the resume to assign scores reflecting demonstrated skills and experience.
|
230 |
+
|
231 |
+
Here is the resume to analyze:
|
232 |
+
|
233 |
+
({resume})
|
234 |
+
|
235 |
+
|
236 |
+
**Analysis data to aid evaluation**:
|
237 |
+
**{helpful_key_data}**
|
238 |
+
"""
|
239 |
+
|
240 |
result=ai.chat(prompt=prompt,output_schema=BreakDownByDomainUpdate)
|
241 |
return result
|
242 |
|
|
|
244 |
|
245 |
|
246 |
|
247 |
+
def generate_flagged_risk_areas(resume:ResumeData,**helpful_key_data):
|
248 |
|
249 |
|
250 |
prompt = f"""
|
|
|
251 |
|
252 |
+
**You are an AI Resume Risk Evaluator.**
|
253 |
+
Your job is to review the following resume and flag potential *career resilience risks*. Focus strictly on:
|
|
|
254 |
|
255 |
+
1. **Missing recent/up-to-date certifications**
|
256 |
+
2. **Lack of AI or automation tool usage**
|
257 |
+
3. **Dependence on easily automatable tasks** (e.g., repetitive data entry, basic spreadsheets)
|
258 |
|
259 |
+
For each issue identified, return **a concise 1–2 sentence explanation** with clear language.
|
|
|
|
|
260 |
|
261 |
+
**Response Format (Examples)**:
|
262 |
+
|
263 |
+
* "Heavy reliance on spreadsheet tasks, which are easily automated."
|
264 |
+
* "No evidence of recent certifications to stay current in the field."
|
265 |
+
* "Resume lacks any mention of AI or automation tools."
|
266 |
+
|
267 |
+
**Resume to evaluate**:
|
268 |
+
|
269 |
+
```
|
270 |
+
({resume})
|
271 |
+
```
|
272 |
+
|
273 |
+
**Analysis data to aid evaluation**:
|
274 |
+
**{helpful_key_data}**
|
275 |
|
|
|
276 |
"""
|
277 |
result=ai.chat(prompt=prompt,output_schema=FlaggedRiskAreasUpdate)
|
278 |
return result
|
|
|
280 |
|
281 |
|
282 |
|
283 |
+
def generate_boost_suggestion(resume:ResumeData,**helpful_key_data):
|
284 |
|
285 |
|
286 |
prompt = f"""
|
287 |
+
You are a Resume Enhancement AI. Analyze the resume below and generate 2 to 4 clear, actionable suggestions to help the user strengthen their profile by addressing skill or experience gaps.
|
288 |
|
289 |
+
Focus on practical, AI-driven improvements such as:
|
290 |
+
- Mastering relevant AI tools
|
291 |
+
- Enrolling in advanced or specialized courses
|
292 |
+
- Expanding the complexity or impact of projects
|
293 |
+
- Obtaining up-to-date certifications
|
294 |
|
295 |
+
**Examples**:
|
296 |
+
- "Learn ChatGPT to boost your coding efficiency."
|
297 |
+
- "Enhance your Python skills through an advanced course."
|
298 |
+
- "Add recent certifications to demonstrate continuous growth."
|
299 |
+
- "Integrate AI tools into your project portfolio."
|
300 |
|
301 |
+
**Guidelines**:
|
302 |
+
- Suggestions must be specific, relevant, and directly tied to the resume content.
|
303 |
+
- Keep each suggestion concise (1–2 sentences).
|
304 |
+
- Avoid generic advice; prioritize actionable, targeted improvements.
|
305 |
|
306 |
+
Resume to analyze:
|
307 |
|
308 |
({resume})
|
309 |
+
**Analysis data to aid evaluation**:
|
310 |
+
**{helpful_key_data}**
|
311 |
"""
|
312 |
|
313 |
result=ai.chat(prompt=prompt,output_schema=BoostSuggestionsUpdate)
|
Ars/controllers.py
CHANGED
@@ -2,17 +2,18 @@ from core import r
|
|
2 |
from repositories import create_boost_suggestions,create_breakdown_by_domain,create_flagged_risk_areas,create_user_resilience
|
3 |
from fastapi import UploadFile
|
4 |
from ai_functions import resume_analysis,calculate_automation_risk,calculate_Ai_collab_readiness,calculate_skill_depth,generate_boost_suggestion,generate_domain_breakdown,generate_flagged_risk_areas
|
5 |
-
|
6 |
async def resilience_analysis(file:UploadFile):
|
7 |
resume= await resume_analysis(file)
|
8 |
risk = calculate_automation_risk(resume)
|
|
|
9 |
skill_depth = calculate_skill_depth(resume)
|
|
|
10 |
ai_readiness = calculate_Ai_collab_readiness(resume)
|
|
|
11 |
ResilienceScore = ((1-(risk.result/100))*0.5+(skill_depth.result/100)*0.3+(ai_readiness.result/100)*0.2)
|
12 |
-
flagged_risk =generate_flagged_risk_areas(resume=resume)
|
13 |
-
boost_suggestion = generate_boost_suggestion(resume=resume)
|
14 |
-
domain_breakdown = generate_domain_breakdown(resume=resume)
|
15 |
-
|
16 |
-
|
17 |
-
print("domain_breakdown",domain_breakdown)
|
18 |
-
return {"overall score": ResilienceScore,"flagged Risk": flagged_risk,"boost suggestion":boost_suggestion,"domain breakdown":domain_breakdown,"resume":resume}
|
|
|
2 |
from repositories import create_boost_suggestions,create_breakdown_by_domain,create_flagged_risk_areas,create_user_resilience
|
3 |
from fastapi import UploadFile
|
4 |
from ai_functions import resume_analysis,calculate_automation_risk,calculate_Ai_collab_readiness,calculate_skill_depth,generate_boost_suggestion,generate_domain_breakdown,generate_flagged_risk_areas
|
5 |
+
from objects import AICollabReadiness,SkillDepthResult,AutomationRiskResult
|
6 |
async def resilience_analysis(file:UploadFile):
|
7 |
resume= await resume_analysis(file)
|
8 |
risk = calculate_automation_risk(resume)
|
9 |
+
risk = AutomationRiskResult(**risk.model_dump())
|
10 |
skill_depth = calculate_skill_depth(resume)
|
11 |
+
skill_depth= SkillDepthResult(**skill_depth.model_dump())
|
12 |
ai_readiness = calculate_Ai_collab_readiness(resume)
|
13 |
+
ai_readiness = AICollabReadiness(**ai_readiness.model_dump())
|
14 |
ResilienceScore = ((1-(risk.result/100))*0.5+(skill_depth.result/100)*0.3+(ai_readiness.result/100)*0.2)
|
15 |
+
flagged_risk =generate_flagged_risk_areas(resume=resume,skil_depth=skill_depth,risk=risk,ai_readiness=ai_readiness)
|
16 |
+
boost_suggestion = generate_boost_suggestion(resume=resume,skil_depth=skill_depth,risk=risk,ai_readiness=ai_readiness)
|
17 |
+
domain_breakdown = generate_domain_breakdown(resume=resume,skil_depth=skill_depth,risk=risk,ai_readiness=ai_readiness)
|
18 |
+
|
19 |
+
return {"overall score": ResilienceScore,"flagged Risk": flagged_risk,"boost suggestion":boost_suggestion,"domain breakdown":domain_breakdown,"resume":resume,"skil_depth":skill_depth,"risk":risk,"ai_readiness":ai_readiness}
|
|
|
|
Ars/objects.py
CHANGED
@@ -104,7 +104,7 @@ class FlaggedRiskAreasCreate(BaseModel):
|
|
104 |
|
105 |
class FlaggedRiskAreasUpdate(BaseModel):
|
106 |
|
107 |
-
risk_areas:List[str]
|
108 |
|
109 |
|
110 |
class BoostSuggestionsCreate(BaseModel):
|
@@ -171,19 +171,179 @@ class RealWorldQuestion(BaseModel):
|
|
171 |
|
172 |
|
173 |
|
174 |
-
class AutomationRiskResult(BaseModel):
|
175 |
-
result: int = Field(...,description="The result of an automation risk estimation done using realword data and resume data of a user")
|
176 |
-
|
177 |
-
|
178 |
|
179 |
-
class
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
|
189 |
|
|
|
104 |
|
105 |
class FlaggedRiskAreasUpdate(BaseModel):
|
106 |
|
107 |
+
risk_areas:Optional[List[str]]=None
|
108 |
|
109 |
|
110 |
class BoostSuggestionsCreate(BaseModel):
|
|
|
171 |
|
172 |
|
173 |
|
|
|
|
|
|
|
|
|
174 |
|
175 |
+
class AutomationRiskInput(BaseModel):
|
176 |
+
# Resume background fields
|
177 |
+
job_title: str = Field(..., description="Most recent job title")
|
178 |
+
industry: str = Field(..., description="Industry sector (e.g., finance, education, manufacturing)")
|
179 |
+
years_experience: int = Field(..., ge=0, description="Years of professional experience")
|
180 |
+
education_level: str = Field(..., description="Highest education level (e.g., Bachelors, Masters, PhD)")
|
181 |
+
|
182 |
+
technical_skills: List[str] = Field(default_factory=list, description="List of technical skills")
|
183 |
+
soft_skills: List[str] = Field(default_factory=list, description="List of soft skills")
|
184 |
+
managerial_experience: bool = Field(..., description="Has managed teams or projects")
|
185 |
+
customer_facing_roles: bool = Field(..., description="Has held customer-facing roles")
|
186 |
+
domain_specialization: Optional[str] = Field(None, description="Specialized domain (e.g., legal, medical)")
|
187 |
+
recent_certifications: List[str] = Field(default_factory=list, description="Certifications obtained recently")
|
188 |
+
|
189 |
+
# Scored traits (all int 0-5)
|
190 |
+
repetitiveness_score: int = Field(..., ge=0, le=5, description="Repetitiveness of the tasks performed")
|
191 |
+
creativity_score: int = Field(..., ge=0, le=5, description="Creativity required in the role")
|
192 |
+
emotional_intelligence_score: int = Field(..., ge=0, le=5, description="Importance of emotional intelligence")
|
193 |
+
data_driven_tasks_score: int = Field(..., ge=0, le=5, description="Dependence on data-driven tasks")
|
194 |
+
physical_task_score: int = Field(..., ge=0, le=5, description="Amount of physical/manual work")
|
195 |
+
decision_making_level: int = Field(..., ge=0, le=5, description="Level of autonomous decision-making")
|
196 |
+
strategic_thinking_score: int = Field(..., ge=0, le=5, description="Need for strategic thinking")
|
197 |
+
collaboration_score: int = Field(..., ge=0, le=5, description="Collaboration required in the role")
|
198 |
+
ai_dependency_score: int = Field(..., ge=0, le=5, description="How much AI tools are already used")
|
199 |
+
upskilling_index: int = Field(..., ge=0, le=5, description="Recent evidence of upskilling/adaptability")
|
200 |
+
|
201 |
+
|
202 |
+
class AutomationRiskResult(AutomationRiskInput):
|
203 |
+
result: Optional[int] =0
|
204 |
+
@model_validator(mode='after')
|
205 |
+
def calculate_result(self,cls) -> int:
|
206 |
+
"""
|
207 |
+
Calculate the overall automation risk score (0-100)
|
208 |
+
based on the scored traits.
|
209 |
+
"""
|
210 |
+
|
211 |
+
# Weights for each scored trait (example weights; you can tune these)
|
212 |
+
weights = {
|
213 |
+
"repetitiveness_score": 15,
|
214 |
+
"creativity_score": -10,
|
215 |
+
"emotional_intelligence_score": -10,
|
216 |
+
"data_driven_tasks_score": 10,
|
217 |
+
"physical_task_score": 10,
|
218 |
+
"decision_making_level": -10,
|
219 |
+
"strategic_thinking_score": -10,
|
220 |
+
"collaboration_score": -5,
|
221 |
+
"ai_dependency_score": 5,
|
222 |
+
"upskilling_index": -5,
|
223 |
+
}
|
224 |
+
|
225 |
+
# Sum weighted scores
|
226 |
+
score = 0
|
227 |
+
for field, weight in weights.items():
|
228 |
+
value = getattr(self, field)
|
229 |
+
score += value * weight
|
230 |
+
|
231 |
+
# Normalize score to 0-100 range
|
232 |
+
# Minimum possible score
|
233 |
+
min_score = sum(0 * w for w in weights.values())
|
234 |
+
# Maximum possible score
|
235 |
+
max_score = sum(5 * w if w > 0 else 0 for w in weights.values()) + \
|
236 |
+
sum(0 * w if w < 0 else 0 for w in weights.values())
|
237 |
+
|
238 |
+
# Because some weights are negative, min/max can be tricky.
|
239 |
+
# Let's compute min and max more precisely:
|
240 |
+
|
241 |
+
min_score = sum(0 * w if w > 0 else 5 * w for w in weights.values())
|
242 |
+
max_score = sum(5 * w if w > 0 else 0 * w for w in weights.values())
|
243 |
+
|
244 |
+
# Clamp the score between min and max
|
245 |
+
score = max(min_score, min(max_score, score))
|
246 |
+
|
247 |
+
# Map score linearly to 0-100
|
248 |
+
normalized_score = int((score - min_score) / (max_score - min_score) * 100)
|
249 |
+
|
250 |
+
self.result = normalized_score
|
251 |
+
return self
|
252 |
+
|
253 |
|
254 |
+
|
255 |
+
|
256 |
+
|
257 |
+
class SkillDepthInput(BaseModel):
|
258 |
+
# Core scoring fields (all 0-5 integers)
|
259 |
+
years_experience_per_skill: int = Field(..., ge=0, le=5, description="Depth of years experience per skill")
|
260 |
+
seniority_level: int = Field(..., ge=0, le=5, description="Seniority level in roles held")
|
261 |
+
certification_presence: int = Field(..., ge=0, le=5, description="Number and relevance of certifications")
|
262 |
+
breadth_of_skills: int = Field(..., ge=0, le=5, description="Variety and diversity of skills")
|
263 |
+
technical_skill_depth: int = Field(..., ge=0, le=5, description="Depth in core technical skills")
|
264 |
+
leadership_skill_depth: int = Field(..., ge=0, le=5, description="Depth in leadership or management skills")
|
265 |
+
complex_projects_involvement: int = Field(..., ge=0, le=5, description="Involvement in complex projects")
|
266 |
+
strategic_initiatives_contribution: int = Field(..., ge=0, le=5, description="Contributions to strategic initiatives")
|
267 |
+
recent_skill_usage_frequency: int = Field(..., ge=0, le=5, description="Frequency of skill usage in recent roles")
|
268 |
+
continuous_learning_evidence: int = Field(..., ge=0, le=5, description="Evidence of continuous learning or upskilling")
|
269 |
+
cross_functional_collaboration: int = Field(..., ge=0, le=5, description="Cross-functional collaboration skills")
|
270 |
+
recognition_awards: int = Field(..., ge=0, le=5, description="Recognition or awards related to skills")
|
271 |
+
public_speaking_training: int = Field(..., ge=0, le=5, description="Public speaking or training experience")
|
272 |
+
publications_patents: int = Field(..., ge=0, le=5, description="Publications or patents (if any)")
|
273 |
+
industry_expertise_depth: int = Field(..., ge=0, le=5, description="Industry-specific expertise depth")
|
274 |
+
mentoring_coaching_experience: int = Field(..., ge=0, le=5, description="Mentoring or coaching experience")
|
275 |
+
innovation_ability: int = Field(..., ge=0, le=5, description="Ability to innovate using skills")
|
276 |
+
adaptability_to_technologies: int = Field(..., ge=0, le=5, description="Adaptability to new technologies")
|
277 |
+
problem_solving_depth: int = Field(..., ge=0, le=5, description="Problem-solving skills depth")
|
278 |
+
technical_communication_skills: int = Field(..., ge=0, le=5, description="Communication skills related to technical content")
|
279 |
+
|
280 |
+
|
281 |
+
class SkillDepthResult(SkillDepthInput):
|
282 |
+
result: Optional[int] =0
|
283 |
+
@model_validator(mode='after')
|
284 |
+
def calculate_result(self) -> None:
|
285 |
+
fields = [
|
286 |
+
self.years_experience_per_skill,
|
287 |
+
self.seniority_level,
|
288 |
+
self.certification_presence,
|
289 |
+
self.breadth_of_skills,
|
290 |
+
self.technical_skill_depth,
|
291 |
+
self.leadership_skill_depth,
|
292 |
+
self.complex_projects_involvement,
|
293 |
+
self.strategic_initiatives_contribution,
|
294 |
+
self.recent_skill_usage_frequency,
|
295 |
+
self.continuous_learning_evidence,
|
296 |
+
self.cross_functional_collaboration,
|
297 |
+
self.recognition_awards,
|
298 |
+
self.public_speaking_training,
|
299 |
+
self.publications_patents,
|
300 |
+
self.industry_expertise_depth,
|
301 |
+
self.mentoring_coaching_experience,
|
302 |
+
self.innovation_ability,
|
303 |
+
self.adaptability_to_technologies,
|
304 |
+
self.problem_solving_depth,
|
305 |
+
self.technical_communication_skills,
|
306 |
+
]
|
307 |
+
|
308 |
+
max_total = 5 * len(fields)
|
309 |
+
total_score = sum(fields)
|
310 |
+
self.result = int((total_score / max_total) * 100)
|
311 |
+
return self
|
312 |
+
|
313 |
|
314 |
+
class AICollabReadinessInput(BaseModel):
|
315 |
+
ai_tool_familiarity: int = Field(..., ge=0, le=5, description="Familiarity with AI tools and platforms")
|
316 |
+
adaptability_to_ai_workflows: int = Field(..., ge=0, le=5, description="Ability to adapt to AI-enhanced workflows")
|
317 |
+
willingness_to_learn_ai_skills: int = Field(..., ge=0, le=5, description="Motivation and willingness to learn AI skills")
|
318 |
+
ai_ethics_understanding: int = Field(..., ge=0, le=5, description="Understanding of AI ethics and responsible use")
|
319 |
+
collaboration_with_ai: int = Field(..., ge=0, le=5, description="Experience or mindset to collaborate effectively with AI systems")
|
320 |
+
problem_solving_with_ai: int = Field(..., ge=0, le=5, description="Skill in using AI to solve complex problems")
|
321 |
+
creativity_in_ai_use: int = Field(..., ge=0, le=5, description="Creativity in leveraging AI capabilities")
|
322 |
+
ai_learning_speed: int = Field(..., ge=0, le=5, description="Speed of learning new AI technologies")
|
323 |
+
communication_about_ai: int = Field(..., ge=0, le=5, description="Ability to communicate AI concepts effectively")
|
324 |
+
ai_tool_integration: int = Field(..., ge=0, le=5, description="Skill in integrating AI tools into existing workflows")
|
325 |
+
|
326 |
+
class AICollabReadiness(AICollabReadinessInput):
|
327 |
+
result: Optional[int] =0
|
328 |
+
@model_validator(mode='after')
|
329 |
+
def calculate_result(self) -> None:
|
330 |
+
fields = [
|
331 |
+
self.ai_tool_familiarity,
|
332 |
+
self.adaptability_to_ai_workflows,
|
333 |
+
self.willingness_to_learn_ai_skills,
|
334 |
+
self.ai_ethics_understanding,
|
335 |
+
self.collaboration_with_ai,
|
336 |
+
self.problem_solving_with_ai,
|
337 |
+
self.creativity_in_ai_use,
|
338 |
+
self.ai_learning_speed,
|
339 |
+
self.communication_about_ai,
|
340 |
+
self.ai_tool_integration,
|
341 |
+
]
|
342 |
+
max_total = 5 * len(fields)
|
343 |
+
total_score = sum(fields)
|
344 |
+
self.result = int((total_score / max_total) * 100)
|
345 |
+
return self
|
346 |
+
|
347 |
|
348 |
|
349 |
|
app.py
CHANGED
@@ -2,11 +2,13 @@ from controller.imports import *
|
|
2 |
|
3 |
import logging
|
4 |
from datetime import datetime
|
|
|
5 |
logging.basicConfig(level=logging.INFO)
|
6 |
logger = logging.getLogger(__name__)
|
7 |
|
8 |
app = FastAPI()
|
9 |
app.mount('/gamification',gamification)
|
|
|
10 |
|
11 |
|
12 |
|
|
|
2 |
|
3 |
import logging
|
4 |
from datetime import datetime
|
5 |
+
from Ars.routes import ARS
|
6 |
logging.basicConfig(level=logging.INFO)
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
9 |
app = FastAPI()
|
10 |
app.mount('/gamification',gamification)
|
11 |
+
app.mount('/Ars',ARS)
|
12 |
|
13 |
|
14 |
|