Spaces:
Running
Running
pull (#26)
Browse files- providus (f8477832a18af31d2ad212467fe7b8f051c79712)
- Ars/controllers.py +8 -2
- Ars/repositories.py +14 -0
Ars/controllers.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from Ars.core import r
|
2 |
-
from Ars.repositories import get_document_by_hashed_doc,create_new_hashed_doc_entry,create_boost_suggestions,create_breakdown_by_domain,create_flagged_risk_areas,create_user_resilience
|
3 |
from fastapi import UploadFile
|
4 |
from Ars.ai_functions import extract_text_from_bytes,resume_analysis,calculate_automation_risk,calculate_Ai_collab_readiness,calculate_skill_depth,generate_boost_suggestion,generate_domain_breakdown,generate_flagged_risk_areas
|
5 |
from Ars.objects import AICollabReadiness,SkillDepthResult,AutomationRiskResult
|
@@ -34,5 +34,11 @@ async def resilience_analysis(file:UploadFile,userId:str):
|
|
34 |
resultId =await create_new_hashed_doc_entry(data={"hashed_doc":hashed_doc,"resume":final_analysis_response,"userId":userId})
|
35 |
return final_analysis_response
|
36 |
else:
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
return check
|
|
|
1 |
from Ars.core import r
|
2 |
+
from Ars.repositories import get_document_by_hashed_doc_complete,get_document_by_hashed_doc,create_new_hashed_doc_entry,create_boost_suggestions,create_breakdown_by_domain,create_flagged_risk_areas,create_user_resilience
|
3 |
from fastapi import UploadFile
|
4 |
from Ars.ai_functions import extract_text_from_bytes,resume_analysis,calculate_automation_risk,calculate_Ai_collab_readiness,calculate_skill_depth,generate_boost_suggestion,generate_domain_breakdown,generate_flagged_risk_areas
|
5 |
from Ars.objects import AICollabReadiness,SkillDepthResult,AutomationRiskResult
|
|
|
34 |
resultId =await create_new_hashed_doc_entry(data={"hashed_doc":hashed_doc,"resume":final_analysis_response,"userId":userId})
|
35 |
return final_analysis_response
|
36 |
else:
|
37 |
+
result_hash =await get_document_by_hashed_doc_complete(hashed_doc)
|
38 |
+
if result_hash['hashed_doc']==hashed_doc and result_hash['userId']== userId:
|
39 |
+
|
40 |
+
await create_new_hashed_doc_entry(data={"hashed_doc":hashed_doc,"resume":check,"userId":userId})
|
41 |
+
return check
|
42 |
+
|
43 |
+
await create_new_hashed_doc_entry(data={"hashed_doc":hashed_doc,"resume":check,"userId":userId})
|
44 |
return check
|
Ars/repositories.py
CHANGED
@@ -32,6 +32,20 @@ async def get_document_by_hashed_doc(hashed_doc: str):
|
|
32 |
except Exception as e:
|
33 |
# Handle any other errors, like database issues
|
34 |
return {"error": str(e)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
|
37 |
async def get_document_by_userId(userId: str):
|
|
|
32 |
except Exception as e:
|
33 |
# Handle any other errors, like database issues
|
34 |
return {"error": str(e)}
|
35 |
+
|
36 |
+
async def get_document_by_hashed_doc_complete(hashed_doc: str):
|
37 |
+
try:
|
38 |
+
# Find the document using the hashed_doc field
|
39 |
+
document = await db.resume_resilience_analysis.find_one({"hashed_doc": hashed_doc})
|
40 |
+
|
41 |
+
if document:
|
42 |
+
return document
|
43 |
+
else:
|
44 |
+
return None
|
45 |
+
|
46 |
+
except Exception as e:
|
47 |
+
# Handle any other errors, like database issues
|
48 |
+
return {"error": str(e)}
|
49 |
|
50 |
|
51 |
async def get_document_by_userId(userId: str):
|