Vaibhav84 commited on
Commit
78baac2
·
1 Parent(s): 97590c5
AddSkillDetails.py DELETED
@@ -1,71 +0,0 @@
1
-
2
- from psycopg2 import sql
3
- import pymysql
4
- import pandas as pd
5
- from DbConnection import DbConnection
6
- class AddSkill:
7
- def AddSkillDetails(skills):
8
- returnMsg=''
9
- details = skills.split(',')
10
- skill_details = details[0]
11
- skill_type = details [1]
12
- skill_score1 = details[2]
13
- weightage = -2
14
- is_active = True
15
- conn = DbConnection.GetMySQLDbConnection()
16
- cursor = conn.cursor()
17
- print("Adding Skill " + skill_details)
18
- query = "SELECT skillid FROM skillmaster WHERE upper(skillDetails) IN (%s)"
19
- params = (skill_details.upper(),) # Replace 'Test' with your actual variable or user input
20
- cursor.execute(query, params)
21
- if cursor.rowcount == 0:
22
-
23
- insert_query = ("""INSERT INTO skillmaster (SkillDetails, SkillType, Weightage, IsActive, skill_score)
24
- VALUES (%s, %s, %s, %s, %s)""")
25
- cursor.execute(insert_query, (skill_details, skill_type, weightage, is_active, skill_score1))
26
- conn.commit()
27
- returnMsg = 'Skill Added successfully'
28
- else:
29
- returnMsg = 'Skill Already in DB'
30
-
31
- # Close the cursor and connection
32
- cursor.close()
33
- # Close the connection
34
- conn.close()
35
- print(returnMsg)
36
- return returnMsg
37
- def UpdateSkillDetails(skills):
38
- returnMsg=''
39
- details = skills.split(',')
40
- skill_details = details[0]
41
- weightage = details [1]
42
- is_active = True
43
- conn = DbConnection.GetMySQLDbConnection()
44
- cursor = conn.cursor()
45
- print("Updating Skill " + skill_details)
46
- query = "SELECT skillid FROM skillmaster WHERE upper(skillDetails) IN (%s)"
47
- params = (skill_details.upper(),) # Replace 'Test' with your actual variable or user input
48
- cursor.execute(query, params)
49
- if cursor.rowcount == 0:
50
- returnMsg = 'Skill Not in DB'
51
- else:
52
- update_query = ("""UPDATE skillmaster set weightage = %s where upper(skilldetails) = %s""")
53
- cursor.execute(update_query, (weightage, skill_details.upper()))
54
- conn.commit()
55
- returnMsg = 'Skill Updated successfully'
56
-
57
- # Close the cursor and connection
58
- cursor.close()
59
- # Close the connection
60
- conn.close()
61
- print(returnMsg)
62
- return returnMsg
63
- def GetSkillDetails():
64
- conn = DbConnection.GetMySQLDbConnection()
65
- cursor = conn.cursor()
66
- cursor.execute("SELECT * FROM skillmaster")
67
- cursor.close()
68
- # Close the connection
69
- conn.close()
70
- return cursor.fetchall()
71
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ClassModals.py DELETED
@@ -1,22 +0,0 @@
1
- from pydantic import BaseModel
2
- class Modals:
3
- class AddSkillDetails(BaseModel):
4
- SkillName: str = 'SkillName'
5
- SkillType: str = 'Soft Skill'
6
- SkillScore: int = 10
7
-
8
- class FileDetails(BaseModel):
9
- filecontents: str
10
- IsJobDescription: bool
11
- filename: str
12
- fileid: str
13
- message: str
14
- class SkillDetails(BaseModel):
15
- skillid: int
16
- requiredSkills: str
17
- softSkills: str
18
- goodToHaveSkills: str
19
-
20
- class UpdateSkillDetails(BaseModel):
21
- SkillName: str = 'SkillName'
22
- SkillWeightage: int = -2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Database/SkillMaster.csv DELETED
@@ -1,62 +0,0 @@
1
- "skillid";"skilldetails";"skilltype";"weightage";"isactive";"skill_score"
2
- 17;"Office Automation";"Hard Skill";0.0;1;"100"
3
- 18;"Biography";"Hard Skill";0.0;1;"100"
4
- 19;"X Window System";"Hard Skill";0.0;1;"57"
5
- 21;"Hospitality Management";"Hard Skill";0.0;1;"200"
6
- 25;"Computer Booking Systems";"Hard Skill";0.0;1;"57"
7
- 27;"Online Communication";"Hard Skill";0.0;1;"200"
8
- 28;"Credit Control";"Hard Skill";0.0;1;"200"
9
- 112;"Hindi Language";"Hard Skill";0.0;1;"100"
10
- 130;"French Language";"Soft Skill";0.0;1;"100"
11
- 194;"SkillName";"Soft Skill";0.0;1;"10"
12
- 5269;"Project Proposals";"Hard Skill";0.0;1;"100"
13
- 5332;"E";"Hard Skill";0.0;1;"100"
14
- 5334;"Activism";"Hard Skill";0.0;1;"59"
15
- 5348;"Disabilities";"Hard Skill";0.0;1;"92"
16
- 5417;"Job Descriptions";"Hard Skill";0.0;1;"100"
17
- 5418;"English Language";"Soft Skill";0.0;1;"100"
18
- 5459;"Industrialization";"Hard Skill";0.0;1;"71"
19
- 5464;"Levelling";"Hard Skill";0.0;1;"67"
20
- 5488;"Consumables";"Hard Skill";0.0;1;"69"
21
- 5535;"Management Process";"Hard Skill";0.0;1;"200"
22
- 5583;"Containerization";"Hard Skill";0.0;1;"100"
23
- 5628;"Interactivity";"Hard Skill";0.0;1;"91"
24
- 5692;"Naturalization";"Hard Skill";0.0;1;"73"
25
- 6021;"Custom Backend";"Hard Skill";0.0;1;"100"
26
- 6027;"B";"Hard Skill";0.0;1;"100"
27
- 6310;"Commenting";"Hard Skill";0.0;1;"81"
28
- 6436;"Drawing";"Hard Skill";0.0;1;"100"
29
- 6508;"Building Management";"Hard Skill";0.0;1;"200"
30
- 6702;"Building Automation";"Hard Skill";0.0;1;"200"
31
- 6855;"Gardening";"Hard Skill";0.0;1;"70"
32
- 7040;"Good Agricultural Practices";"Hard Skill";0.0;1;"60"
33
- 7117;"Nice";"Hard Skill";0.0;1;"100"
34
- 7239;"Probation";"Hard Skill";0.0;1;"100"
35
- 7282;"Oracle";"Hard Skill";-2.0;1;"100"
36
- 7295;"System.net.mail";"Hard Skill";0.0;1;"60"
37
- 7297;"WPF";"Hard Skill";-2.0;1;"100"
38
- 7299;"Spring";"Hard Skill";-2.0;1;"100"
39
- 7300;"EJB";"Hard Skill";-2.0;1;"100"
40
- 7301;"Struts";"Hard Skill";-2.0;1;"100"
41
- 7302;"J2EE";"Hard Skill";-2.0;1;"100"
42
- 7311;"SharePoint";"Hard Skill";-2.0;1;"100"
43
- 7312;"SSIS";"Hard Skill";-2.0;1;"100"
44
- 7314;"Nodejs";"Hard Skill";-2.0;1;"100"
45
- 7329;"Ddd Service";"Hard Skill";0.0;1;"100"
46
- 7330;"OOPS";"Hard Skill";-2.0;1;"90"
47
- 7331;"Lambda";"Hard Skill";-2.0;1;"90"
48
- 7335;"Cloud";"Hard Skill";-2.0;1;"90"
49
- 7342;"Toolchain";"Hard Skill";0.0;1;"100"
50
- 7350;"User Feedback";"Hard Skill";0.0;1;"100"
51
- 7373;"Excel";"Hard Skill";-2.0;1;"90"
52
- 7374;"Word";"Hard Skill";-2.0;1;"90"
53
- 7375;"Tally";"Hard Skill";-2.0;1;"100"
54
- 7376;"GST";"Hard Skill";-2.0;1;"90"
55
- 7377;"Income Tax";"Hard Skill";0.0;1;"100"
56
- 7387;"International Taxation";"Hard Skill";0.0;1;"200"
57
- 7388;"Internal Auditing";"Hard Skill";0.0;1;"200"
58
- 7389;"DOT";"Hard Skill";0.0;1;"100"
59
- 7390;"Apache Wicket";"Hard Skill";0.0;1;"100"
60
- 7391;"Accounts Payable";"Hard Skill";0.0;1;"100"
61
- 7392;"Computer Literacy";"Soft Skill";0.0;1;"100"
62
- 7393;"test";"Har Skill";0.0;1;"50"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Database/SkillMasterTableScript.txt DELETED
@@ -1,9 +0,0 @@
1
- CREATE TABLE "skillmaster" (
2
- "skillid" int NOT NULL AUTO_INCREMENT,
3
- "skilldetails" varchar(255) NOT NULL,
4
- "skilltype" varchar(50) DEFAULT NULL,
5
- "weightage" decimal(10,2) DEFAULT NULL,
6
- "isactive" tinyint(1) DEFAULT '1',
7
- "skill_score" varchar(20) DEFAULT NULL,
8
- PRIMARY KEY ("skillid")
9
- );
 
 
 
 
 
 
 
 
 
 
DbConnection.py DELETED
@@ -1,21 +0,0 @@
1
-
2
- import pymysql
3
-
4
- timeout = 10
5
- class DbConnection:
6
- def GetMySQLDbConnection():
7
- connection = pymysql.connect(
8
- charset="utf8mb4",
9
- connect_timeout=timeout,
10
- cursorclass=pymysql.cursors.DictCursor,
11
- db="defaultdb",
12
- host="mysql-anu-xboxgames1900-aebf.a.aivencloud.com",
13
- password="AVNS_TGfs_uHRKteMjB9pFnq",
14
- read_timeout=timeout,
15
- port=25227,
16
- user="avnadmin",
17
- write_timeout=timeout,
18
- )
19
- return connection
20
-
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ExtractContentsFromFile.py DELETED
@@ -1,32 +0,0 @@
1
- import io
2
- import PyPDF2
3
- import docx2txt
4
- import numpy as np
5
- from psycopg2.extensions import register_adapter, AsIs
6
- register_adapter(np.int64, AsIs)
7
- import warnings
8
- warnings.filterwarnings('ignore')
9
- class ExtractContentFromFile:
10
- def ExtractDataFromFile(FileName,file):
11
- text =''
12
- try:
13
- #print(text)
14
- if FileName.endswith("pdf"):
15
- reserve_pdf_on_memory = io.BytesIO(file)
16
- load_pdf = PyPDF2.PdfReader(reserve_pdf_on_memory)
17
- for page in load_pdf.pages:
18
- text += page.extract_text()
19
-
20
- elif FileName.endswith("doc") or FileName.endswith("docx"):
21
- text = docx2txt.process(file)
22
- text = text.read()
23
-
24
- else:
25
- text = file.decode('utf-8')
26
- except:
27
- print("Error reading file")
28
- finally:
29
- # Close the resources to free up memory
30
- del reserve_pdf_on_memory
31
- del load_pdf
32
- return text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
RemoveSkills.py DELETED
@@ -1,40 +0,0 @@
1
- import psycopg2
2
- import pymysql
3
- from DbConnection import DbConnection
4
- class RemoveSkill:
5
- def RemoveSkillDetails(SkillName):
6
- returnMsg=''
7
- conn = DbConnection.GetMySQLDbConnection()
8
- cursor = conn.cursor()
9
-
10
- query = "SELECT skillid FROM skillmaster WHERE upper(skillDetails) IN (%s)"
11
- params = (SkillName.upper(),) # Replace 'Test' with your actual variable or user input
12
- cursor.execute(query, params)
13
- if cursor.rowcount == 0:
14
- print("New Archived Entry")
15
- skill_type = "Hard Skill"
16
- skill_score1 = 0
17
- weightage = 0
18
- is_active = True
19
- returnMsg = 'Skill Not in DB'
20
- insert_query = ("""INSERT INTO skillmaster (SkillDetails, SkillType, Weightage, IsActive, skill_score)
21
- VALUES (%s, %s, %s, %s, %s)""")
22
- cursor.execute(insert_query, (SkillName, skill_type, weightage, is_active, skill_score1))
23
- conn.commit()
24
- returnMsg = 'Skill Added successfully'
25
- else:
26
- print("Update Archived Entry")
27
- query = "update skillmaster set weightage = 0 where upper(skilldetails) = (%s)"
28
- params = (SkillName.upper(),)
29
- cursor.execute(query, params)
30
- conn.commit()
31
- returnMsg = 'Skill Updated successfully'
32
-
33
- # Close the cursor and connection
34
- cursor.close()
35
- # Close the connection
36
- conn.close()
37
- print(returnMsg)
38
-
39
-
40
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/Data/Angular1.pdf DELETED
Binary file (209 kB)
 
SampleCode/Data/DotNet1.pdf DELETED
Binary file (211 kB)
 
SampleCode/Data/Java1.pdf DELETED
Binary file (225 kB)
 
SampleCode/Data/Python_Developer.pdf DELETED
Binary file (222 kB)
 
SampleCode/Data/React1.pdf DELETED
Binary file (213 kB)
 
SampleCode/PHP/UpdateSkill.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
- // API endpoint URL
3
- $url = 'https://vaibhav84-resumeapi.hf.space/UpdateSkillDetails/';
4
-
5
- // Define the input data
6
- $data = array(
7
- "SkillName" => "Test4",
8
- "SkillWeightage" => -3 // Example weightage
9
- );
10
-
11
- // Initialize cURL
12
- $curl = curl_init();
13
-
14
- // Set cURL options
15
- curl_setopt_array($curl, array(
16
- CURLOPT_URL => $url,
17
- CURLOPT_RETURNTRANSFER => true,
18
- CURLOPT_CUSTOMREQUEST => "PUT",
19
- CURLOPT_POSTFIELDS => json_encode($data),
20
- CURLOPT_HTTPHEADER => array(
21
- "Content-Type: application/json"
22
- ),
23
- ));
24
-
25
- // Execute the cURL request
26
- $response = curl_exec($curl);
27
-
28
- // Check for errors
29
- if (curl_errno($curl)) {
30
- echo 'Error: ' . curl_error($curl);
31
- } else {
32
- // Print response
33
- echo "Skill details updated successfully.\n";
34
- echo "Response: " . $response . "\n";
35
- }
36
-
37
- // Close cURL
38
- curl_close($curl);
39
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/PHP/UploadJD.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- // API endpoint URL
3
- $url = "https://vaibhav84-resumeapi.hf.space/UploadJobDescription/";
4
- // Path to the file you want to upload
5
- $file_path = "data/Java1.pdf";
6
-
7
- // Extract the filename from the file path
8
- $file_name = basename($file_path);
9
-
10
- // Initialize cURL
11
- $curl = curl_init();
12
-
13
- // Set cURL options
14
- curl_setopt_array($curl, array(
15
- CURLOPT_URL => $url,
16
- CURLOPT_RETURNTRANSFER => true,
17
- CURLOPT_POST => true,
18
- CURLOPT_POSTFIELDS => array(
19
- 'file' => new CURLFile($file_path), // Attach the file
20
- 'FileName' => $file_name // Pass the filename parameter
21
- ),
22
- ));
23
- $start_time = microtime(true);
24
- // Execute the cURL request
25
- $response = curl_exec($curl);
26
- // Measure the end time
27
- $end_time = microtime(true);
28
-
29
- // Calculate the total time taken
30
- $total_time = $end_time - $start_time;
31
-
32
- // Check for errors
33
- if (curl_errno($curl)) {
34
- echo 'Error: ' . curl_error($curl);
35
- } else {
36
- // Print response
37
- echo $response . " \n";
38
- echo "Total time: " . $total_time . " seconds\n";
39
- }
40
-
41
- // Close cURL
42
- //php samplephpcall.php
43
- curl_close($curl);
44
- ?>
45
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/SampleAddSkill.py DELETED
@@ -1,32 +0,0 @@
1
- import requests
2
- from pydantic import BaseModel
3
- class UserAddNewSkill:
4
- # Define the class for the input data
5
- class AddSkillDetails(BaseModel):
6
- SkillName: str = 'SkillName'
7
- SkillType: str = 'Soft Skill'
8
- SkillScore: int = 10
9
-
10
- # Define the data to be sent to the API
11
-
12
- def AddNewSkill(API, skillName1,SkillType1,SkillScore1):
13
- data = UserAddNewSkill.AddSkillDetails(
14
- SkillName=skillName1,
15
- SkillType=SkillType1,
16
- SkillScore=SkillScore1 # Example score
17
- )
18
-
19
- # URL of the API endpoint
20
- #url = "https://vaibhav84-resumeapi.hf.space/AddSkillDetails/"
21
-
22
- # Make the POST request
23
- response = requests.post(API, json=data.dict())
24
-
25
- # Check the response
26
- if response.status_code == 200:
27
- print("Skill details added successfully.")
28
- print("Response:", response.json())
29
- else:
30
- print("Failed to add skill details.")
31
- print("Status code:", response.status_code)
32
- print("Response:", response.text)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/SampleCall.py DELETED
@@ -1,46 +0,0 @@
1
- import requests
2
- import os
3
- import time
4
- # URL of the API endpoint
5
- url = "https://vaibhav84-resumeapi.hf.space/UploadJobDescription/"
6
-
7
- def CallAPI(file_path):
8
- # Open the file in binary mode
9
- with open(file_path, "rb") as file:
10
- # Prepare the file to be sent in the request
11
- files = {"file": (file_path, file)}
12
-
13
- # Additional parameters for the request
14
- params = {"FileName": file_name} # Adjust FileName if necessary
15
- start_time = time.time()
16
- # Make the POST request
17
- response = requests.post(url, files=files, params=params)
18
- end_time = time.time()
19
- total_time = end_time - start_time
20
- # Check if the request was successful (status code 200)
21
- if response.status_code == 200:
22
- print("_____________________________________________________")
23
- print("Job description uploaded successfully.", file_name)
24
- print("")
25
- # Print the response from the API
26
- print(response.text)
27
- print("")
28
- print("Total time:", total_time, "seconds")
29
- print("_____________________________________________________")
30
- else:
31
- print("Failed to upload job description.")
32
- print("Status code:", response.status_code)
33
- print("Response:", response.text)
34
-
35
- folderPath = "Data"
36
- files = os.listdir(folderPath)
37
- for file in files:
38
-
39
- filePath = os.path.join(folderPath, file)
40
- file_name = os.path.basename(filePath)
41
- CallAPI(filePath)
42
- # Path to the file you want to upload
43
- #file_path = "data/python_developer.pdf"
44
-
45
-
46
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/SampleCallAdmin.py DELETED
@@ -1,116 +0,0 @@
1
- import requests
2
- import os
3
- import time
4
- from pydantic import BaseModel
5
-
6
- from SampleAddSkill import UserAddNewSkill
7
- # URL of the API endpoint
8
- url = "https://vaibhav84-resumeapi.hf.space/"
9
- class AddSkillDetails(BaseModel):
10
- SkillName: str = 'SkillName'
11
- SkillType: str = 'Soft Skill'
12
- SkillScore: int = 10
13
-
14
- class UpdateSkillDetails(BaseModel):
15
- SkillName: str = 'SkillName'
16
- SkillWeightage: int = -2
17
-
18
- def CallAPI(API):
19
-
20
-
21
- # Make the POST request
22
- response = requests.get(url + API)
23
-
24
- # Check if the request was successful (status code 200)
25
- if response.status_code == 200:
26
- print("_____________________________________________________")
27
- print("Skill Details")
28
- print("")
29
- # Print the response from the API
30
- print(response.text)
31
- print("")
32
- print("_____________________________________________________")
33
- else:
34
- print("Failed to get skill details.")
35
- print("Status code:", response.status_code)
36
- print("Response:", response.text)
37
-
38
- #RemoveSkillsByName
39
- def CallRemoveAPI(API, SkillName):
40
-
41
- params = {"SkillName": SkillName}
42
- # Make the POST request
43
- response = requests.delete(url + API,params=params)
44
-
45
- # Check if the request was successful (status code 200)
46
- if response.status_code == 200:
47
- print("_____________________________________________________")
48
- print("Skill Deleted ")
49
- print("")
50
- # Print the response from the API
51
- print(response.text)
52
- print("")
53
- print("_____________________________________________________")
54
- else:
55
- print("Failed to delete skill details.")
56
- print("Status code:", response.status_code)
57
- print("Response:", response.text)
58
-
59
- def CallUpdateSkillAPI(API, SkillName1, weight):
60
- data = UpdateSkillDetails(
61
- SkillName=SkillName1,
62
- SkillWeightage=weight
63
- )
64
- print(data)
65
- # Make the POST request
66
- response = requests.put(url + API,json=data.dict())
67
-
68
- # Check if the request was successful (status code 200)
69
- if response.status_code == 200:
70
- print("_____________________________________________________")
71
- print("Skill Updated ")
72
- print("")
73
- # Print the response from the API
74
- print(response.text)
75
- print("")
76
- print("_____________________________________________________")
77
- else:
78
- print("Failed to update skill details.")
79
- print("Status code:", response.status_code)
80
- print("Response:", response.text)
81
-
82
- def CallAddSkillAPI(API, SkillName1,skilltype, score):
83
- UserAddNewSkill.AddNewSkill(url + API,SkillName1,skilltype,score)
84
-
85
-
86
- print("Enter API number to call:")
87
- print("1. GetAll Skill")
88
- print("2. Remove Skill")
89
- print("3. Update Skill")
90
- print("4. Add Skill")
91
- userinput = input()
92
- if(userinput == "1"):
93
- CallAPI('GetAllSkillDetails/')
94
- elif(userinput == "2"):
95
- print("Enter skill which you want to delete")
96
- userinputskill = input()
97
- CallRemoveAPI('RemoveSkillsByName',userinputskill)
98
- elif(userinput == "3"):
99
- print("Enter skill which you want to update")
100
- userupdateskill = input()
101
- print("Enter skill weightage you want to update")
102
- userwskill = input()
103
- CallUpdateSkillAPI('UpdateSkillDetails/',userupdateskill,userwskill)
104
- elif(userinput == "4"):
105
- print("Enter skill which you want to add")
106
- uskill = input()
107
- print("Enter skill type")
108
- userskilltype = input()
109
- print("Enter skill score")
110
- userskillscore = input()
111
- CallAddSkillAPI('AddSkillDetails/',uskill,userskilltype,userskillscore)
112
-
113
-
114
- #UpdateSkillDetails
115
-
116
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/SampleDbConnection.py DELETED
@@ -1,23 +0,0 @@
1
- import pymysql
2
-
3
- timeout = 10
4
- db_params = {}
5
- connection = pymysql.connect(
6
- charset="utf8mb4",
7
- connect_timeout=timeout,
8
- cursorclass=pymysql.cursors.DictCursor,
9
- db="defaultdb",
10
- host="mysql-anu-xboxgames1900-aebf.a.aivencloud.com",
11
- password="AVNS_TGfs_uHRKteMjB9pFnq",
12
- read_timeout=timeout,
13
- port=25227,
14
- user="avnadmin",
15
- write_timeout=timeout,
16
- )
17
-
18
- try:
19
- cursor = connection.cursor()
20
- cursor.execute("SELECT * FROM skillmaster")
21
- print(cursor.fetchall())
22
- finally:
23
- connection.close()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/UpdateSkill.py DELETED
File without changes
SampleCode/__pycache__/SampleAddSkill.cpython-39.pyc DELETED
Binary file (1.15 kB)
 
SampleCode/ca.pem DELETED
@@ -1,25 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIEQTCCAqmgAwIBAgIUeOk/j5D8tDsrzwYSvjqXMEdi79UwDQYJKoZIhvcNAQEM
3
- BQAwOjE4MDYGA1UEAwwvNjllMTExOTQtNjRmNy00YjYxLTgzMDctYTQyMjU2NGU5
4
- NTNhIFByb2plY3QgQ0EwHhcNMjQwMzI0MDYyMzMzWhcNMzQwMzIyMDYyMzMzWjA6
5
- MTgwNgYDVQQDDC82OWUxMTE5NC02NGY3LTRiNjEtODMwNy1hNDIyNTY0ZTk1M2Eg
6
- UHJvamVjdCBDQTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAMqtfbv+
7
- 233UB6p29LijiBLmVMAT91c6MXQJ13HCeghcjgBACLabARu2SMohGMEdJOVhdbZK
8
- aNU5YEPZayWQri2Xqrf7AFF/0/M+W7nAvFebs7RJ0k0AY80sih5F4LxgKy6CYhVE
9
- Ir+TNfO5hrB/qFc2BR8rAq2zm+qHK4NgJQ9s36+8JOphv4BRCt8xc/kkX2jnGFw5
10
- pWZV7/CXbymaMjk8WnSyRvYoMxk4FBewZshbVJXww/A3V2XC3J+k1HsU7ZZD3p+5
11
- HcAh0MgPLn0+LNnKfkqwRGst1ANI2WF5SpvkqS+2iF52Yq0O4LAoxKtithvMdwsR
12
- b5LmtGoPag44vgaxJmJSMwMLqK5Uz+fkGytPrznu9ALYjP/i6LlApKEsxltwcPaq
13
- tm2nWpEXxaUkIzrWqJOPCFL1XN2pZ2V6KodSSd9RxE7qKl+no+YQSLwPIT8C5rkO
14
- kIizu7Bmb8hrtCHk9XoEu0wRrRRNnOOTNb8mQpflzKwO3VNpwZn7MtM32QIDAQAB
15
- oz8wPTAdBgNVHQ4EFgQU2UjrAgDlISlFeGeZSNc7y0v3gegwDwYDVR0TBAgwBgEB
16
- /wIBADALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEMBQADggGBADFIiIw8v6AP3C2N
17
- 0oJX+9yMJ7+qd9BEqHISk0mji/VKO9p8bsz3WnncQfPhOvkCIDR+IEXKKhji5jg5
18
- N0VqoXExy7VG9D7I+1FMva4OLQVyQDSt/MirFrXOpuE9Gb4m1pwZFPLclyLYFHV0
19
- pH4WR57KUK0M+wfUzBitV7pingAkXKzSqL/CEKo9scR3vH6n2ZYu/53PAVx+neNB
20
- 3ZSkF/LB+cBOdOj3kt2DhaLSpnC1hltcviToqDZX1tmVBwD/XwmXMOJtxz5yzvRA
21
- yQBkMxTVfwPC+3mque00jl/tcrk3grhI9cPqB5PF01GqUNCPXn9XnMh0FPowou6v
22
- Z6g2FGTLbUDMM40oI4K3CLEtqsZ+UvJPIDbKj+NSJ7fRyksmBzc2S3YsDF1JHQ/e
23
- aMW92T1NZDx+wwI5D8V+qZ0PG5CQe0U4KD2Ecvs1Gg1z2JBsOkJ+BpOKBXT6VuI/
24
- Qmeyx2P+NoExuWF6bHbaI0/0h/XWvuz5LeCPJES+jA7JZVgpxg==
25
- -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SampleCode/index.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- $uri = "mysql://avnadmin:AVNS_TGfs_uHRKteMjB9pFnq@mysql-anu-xboxgames1900-aebf.a.aivencloud.com:25227/defaultdb?ssl-mode=REQUIRED";
4
-
5
- $fields = parse_url($uri);
6
-
7
- // build the DSN including SSL settings
8
- $conn = "mysql:";
9
- $conn .= "host=" . $fields["host"];
10
- $conn .= ";port=" . $fields["port"];;
11
- $conn .= ";dbname=defaultdb";
12
- $conn .= ";sslmode=verify-ca;sslrootcert=ca.pem";
13
-
14
- try {
15
- $db = new PDO($conn, $fields["user"], $fields["pass"]);
16
-
17
- $stmt = $db->query("SELECT VERSION()");
18
- print($stmt->fetch()[0]);
19
- } catch (Exception $e) {
20
- echo "Error: " . $e->getMessage();
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SkillExtract.py DELETED
@@ -1,220 +0,0 @@
1
- import psycopg2
2
- from psycopg2 import sql
3
- import pandas as pd
4
- import re
5
- class SkillExtractorDetails:
6
-
7
- def GetSkillId(skillname,jdmasterid,db_params):
8
- #Fetching skill id from skillmaster
9
- conn = psycopg2.connect(**db_params)
10
- cursor = conn.cursor()
11
- query = "select skillid from skillmaster where upper(skilldetails) = (%s)"
12
- params = (skillname.upper(),)
13
- cursor.execute(query, params)
14
- generated_skill_id = cursor.fetchone()[0]
15
- #jdmasterid = 912
16
- #print(generated_skill_id)
17
- #checking if skill id already in skilldetails
18
- query = "SELECT skillid FROM jdSkilldetails WHERE skillid IN (%s) and jdMasterid in (%s)"
19
- params = (generated_skill_id,jdmasterid,)
20
- cursor.execute(query, params)
21
- if cursor.rowcount > 0:
22
- #print("Already")
23
- query =''
24
- else:
25
- #print("Updating in DB")
26
- insert_query = sql.SQL("""INSERT INTO jdSkilldetails (Skillid, jdMasterid) VALUES (%s, %s)""")
27
- cursor.execute(insert_query, (generated_skill_id, jdmasterid))
28
- conn.commit()
29
-
30
- cursor.close()
31
- # Close the connection
32
- conn.close()
33
- return generated_skill_id
34
- def skill_Validate(df, skill):
35
- skill = skill.upper()
36
- if (len(skill.split()) < 2 and len(skill) < 3) or len(skill.split())==1:
37
- df['skill_present'] = df['skilldetails'].apply(lambda x: re.match(rf'^{skill}$', x))
38
- if any(df['skill_present']):
39
- #print("Valid Skill")
40
- return 1
41
- else:
42
- #print("Not a Skill")
43
- return 0
44
- elif df['skilldetails'].str.contains(skill.upper()).any():
45
- #print("Valid Skill")
46
- return 1
47
- else:
48
- # print("Not a Skill")
49
- return 0
50
- def getNewSkills(db_params):
51
- query = "select skillid,skilldetails,skilltype,skill_score from skillmaster where weightage = -2"
52
- conn = psycopg2.connect(**db_params)
53
- cursor = conn.cursor()
54
- df_skill_master = pd.read_sql_query(query, conn)
55
- df_skill_master['skilldetails'] = df_skill_master['skilldetails'].str.upper()
56
- cursor.close()
57
- # Close the connection
58
- conn.close()
59
-
60
- #print(df_skill_master)
61
- return df_skill_master
62
- def extractWords(job_description,JdMasterid,db_params):
63
- job_roles = []
64
- job_description = job_description.replace(')',' ')
65
- delimiters = ",", " ", " , ", ";","\n","/","\\"
66
- regex_pattern = '|'.join(map(re.escape, delimiters))
67
- df = SkillExtractorDetails.getNewSkills(db_params)
68
- data = re.split(regex_pattern, job_description)
69
- #data = job_description.split(',')
70
- for ds in data:
71
- #print(ds)
72
- try:
73
- if(SkillExtractorDetails.skill_Validate(df,ds.strip())):
74
- job_roles.append(ds)
75
- SkillExtractorDetails.GetSkillId(ds.strip(),JdMasterid,db_params)
76
- print("Skills Identified* : " + ds)
77
- except Exception as error:
78
- test = 1
79
- return job_roles
80
- def SkillExtract(db_params,skill_extractor,JdID, IsJD):
81
- print("Extracting Skills for the JD...")
82
- # Connect to the PostgreSQL database
83
- conn = psycopg2.connect(**db_params)
84
- cursor = conn.cursor()
85
-
86
- jd_id = str(JdID)
87
- # Retrieve "id" and "description" columns from the table
88
- #query = sql.SQL("select jdmasterid,jobdescription from JDMaster where isskillsextracted in (0)")
89
- query = "select jdmasterid,jobdescription,filename from JDMaster where isskillsextracted = 0 and jdmasterid ="+ jd_id
90
- CVquery = "select masterid,description,filename from CourseMaster where isskillsextracted = 0 and masterid ="+ jd_id
91
- # Use Pandas to read the data into a DataFrame
92
- if(IsJD):
93
- df = pd.read_sql_query(query, conn)
94
- else:
95
- df = pd.read_sql_query(CVquery, conn)
96
-
97
- # Print the DataFrame (for demonstration purposes)
98
- #print(df)
99
-
100
- skill_details = ''
101
- skill_type = ''
102
- weightage = -1.0
103
- is_active = True
104
- Skillid = 0
105
- jdMasterid = 0
106
- OldSkillCount = 0
107
- NewSkillCount = 0
108
- if(len(df.index) > 0):
109
- print("Total IDs for Extractraction : " + str(len(df.index)))
110
- for index, row in df.iterrows():
111
- # Access individual columns using column names
112
- if(IsJD):
113
- id_value = row['jdmasterid']
114
- description_value = row['jobdescription']
115
- else:
116
- id_value = row['masterid']
117
- description_value = row['description']
118
-
119
- filename_jd = row['filename']
120
- OldSkillCount = 0
121
- NewSkillCount = 0
122
- skill_score = 0.0
123
- print("Extracting Skills For ", filename_jd + " , Id : " + str(id_value) + " , Index " + str(index + 1))
124
-
125
-
126
- annotations = skill_extractor.annotate(description_value)
127
- matches = annotations['results']['full_matches']+annotations['results']['ngram_scored']
128
- skills_list = []
129
- for result in matches:
130
- if(1==1):
131
-
132
- isOld = "Yes"
133
- skill_id = result['skill_id']
134
- skill_name1 = skill_extractor.skills_db[skill_id]['skill_name']
135
- skill_name = skill_name1.split("(")[0].strip()
136
- skill_type = skill_extractor.skills_db[skill_id]['skill_type']
137
- skill_score = round(result['score'],2)
138
-
139
-
140
- if( skill_name in skills_list):
141
- continue
142
- skills_list.append(skill_name)
143
- #print("Skill Identified : ", j['doc_node_value'])
144
- query = "SELECT skillid FROM skillmaster WHERE skillDetails IN (%s)"
145
- params = (skill_name,) # Replace 'Test' with your actual variable or user input
146
- cursor.execute(query, params)
147
- if cursor.rowcount > 0:
148
- print('Skill in DB')
149
- else:
150
- NewSkillCount = NewSkillCount + 1
151
- isOld = "No"
152
- skill_details = skill_name
153
- weightage = -1.0
154
- skill_score = skill_score * 100
155
- skill_score1 = str(skill_score)
156
- #skill_score = skill_score.astype(float)
157
- #print(skill_score)
158
- insert_query = sql.SQL("""INSERT INTO SkillMaster (SkillDetails, SkillType, Weightage, IsActive, skill_score)
159
- VALUES (%s, %s, %s, %s, %s) RETURNING SkillID""")
160
- cursor.execute(insert_query, (skill_details, skill_type, weightage, is_active, skill_score1))
161
- conn.commit()
162
-
163
- print("Skill Identified : ", skill_name)
164
- #print("Skill inserted in SkillMaster and Inserted in JDSkillDetails")
165
-
166
-
167
-
168
- print("Skills Updated for Skills Extraction for file ", filename_jd)
169
- print("Total Skills : ", len(skills_list))
170
- return SkillExtractorDetails.latestSkillDetails(id_value,db_params,IsJD)
171
- def latestSkillDetails(jid,db_params,IsJD):
172
- data = ""
173
- data = SkillExtractorDetails.display_skills(jid,db_params,IsJD)
174
- # jid = df.iat[0,0]
175
- return data
176
- def tuple_to_int(tup):
177
- if len(tup) == 1:
178
- return tup[0]
179
- else:
180
- return tup[0] * (10 ** (len(tup) - 1)) + SkillExtractorDetails.tuple_to_int(tup[1:])
181
-
182
-
183
- def skill_check(dbQuery,db_params,IsJD):
184
- conn = psycopg2.connect(**db_params)
185
- cursor = conn.cursor()
186
- df = pd.read_sql_query(dbQuery, conn)
187
- Required_Skills=''
188
- for index, row in df.iterrows():
189
-
190
- skillname = row['skillname']
191
- Required_Skills = Required_Skills + ', '+ skillname
192
-
193
- Required_Skills = Required_Skills[2:]
194
- return Required_Skills
195
- def display_skills(id, db_params,IsJD):
196
- jd=str(id)
197
- tableName = 'CVSkillDetails'
198
- if(IsJD):
199
- tableName = 'SkillDetails'
200
-
201
-
202
- query = "select skillname from " + tableName +" where id = "+ jd +" and skillscore > 99 and skilltype = 'Hard Skill'"
203
- RequiredSkills_Hard = SkillExtractorDetails.skill_check(query,db_params,IsJD)
204
-
205
- query = "select skillname from " + tableName +" where id = "+ jd +" and skillscore > 50 and skilltype = 'Soft Skill'"
206
- RequiredSkills_Soft = SkillExtractorDetails.skill_check(query,db_params,IsJD)
207
-
208
- query = "select skillname from " + tableName +" where id = "+ jd +" and skillscore < 50 and skilltype = 'Soft Skill'"
209
- RequiredSkills_G1 = SkillExtractorDetails.skill_check(query,db_params,IsJD)
210
-
211
- query = "select skillname from " + tableName +" where id = "+ jd +" and skillscore < 99 and skilltype = 'Hard Skill'"
212
- RequiredSkills_G2 = SkillExtractorDetails.skill_check(query,db_params,IsJD)
213
-
214
- print('')
215
- print("Required Skills : " + RequiredSkills_Hard)
216
- print('')
217
- print("Required Soft Skills : " + RequiredSkills_Soft)
218
- print('')
219
- print("Good to have Skills : " + RequiredSkills_G1 + " " + RequiredSkills_G2)
220
- return RequiredSkills_Hard + "@" + RequiredSkills_Soft + "@" + RequiredSkills_G1 + " " + RequiredSkills_G2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SkillExtractV1.py DELETED
@@ -1,164 +0,0 @@
1
- import re
2
- from datetime import datetime
3
- import psycopg2
4
- import pandas as pd
5
- from DbConnection import DbConnection
6
- class SkillExtractorDetailsV1:
7
-
8
-
9
- def GetSkillData(skill_extractor, inputData):
10
- getdbskills = SkillExtractorDetailsV1.getSkills1()
11
- print(getdbskills)
12
- skills_list = []
13
- annotations = skill_extractor.annotate(inputData)
14
- matches = annotations['results']['full_matches']+annotations['results']['ngram_scored']
15
- skill_Typelst = []
16
- skill_Scorelst = []
17
- reuiredSkilllst = []
18
- softskillslst = []
19
- goodtohavelst = []
20
- ArchivedSkill=0
21
- for result in matches:
22
- ArchivedSkill=0
23
- skill_id = result['skill_id']
24
- skill_name1 = skill_extractor.skills_db[skill_id]['skill_name']
25
- skill_name = skill_name1.split("(")[0].strip()
26
- skill_type = skill_extractor.skills_db[skill_id]['skill_type']
27
- skill_score = round(result['score'],2) * 100
28
- #result = getdbskills[getdbskills['skilldetails'] == skill_name.upper()]
29
- #print('Result1 -'+ result)
30
- print('Skill - ' + skill_name.upper())
31
- for row in getdbskills:
32
- if(row['skills'].upper() == skill_name.upper()):
33
- ArchivedSkill=1
34
- break
35
-
36
- if(ArchivedSkill == 0 and skill_name not in skills_list):
37
- print('Weightage non skill-'+ skill_name)
38
- print(skill_name)
39
- print(skill_score)
40
- print(skill_type)
41
- skills_list.append(skill_name)
42
- if(skill_score > 99 and skill_type != 'Soft Skill'):
43
- reuiredSkilllst.append(skill_name)
44
- elif(skill_score > 50 and skill_type == 'Soft Skill'):
45
- softskillslst.append(skill_name)
46
- elif(skill_score <= 50 and skill_type == 'Soft Skill'):
47
- goodtohavelst.append(skill_name)
48
- elif(skill_score <= 99 and skill_type != 'Soft Skill'):
49
- goodtohavelst.append(skill_name)
50
-
51
- # skills_list.append(skill_name)
52
- # skill_Typelst.append(skill_type)
53
- # skill_Scorelst.append(skill_score)
54
- else:
55
- print('Weightage zero skill-'+ skill_name)
56
- # list_of_tuples = list(zip(skills_list, skill_Typelst,skill_Scorelst))
57
- # df = pd.DataFrame(list_of_tuples,
58
- # columns=['Skill_Name', 'Skill_Type','Skill_Score'])
59
- newSkilllst = SkillExtractorDetailsV1.extractWordsNew(inputData)
60
- reqSkill = ''
61
- if(len(newSkilllst)>0):
62
- reqSkill = ','.join(reuiredSkilllst) + ',' + ','.join(newSkilllst)
63
- else:
64
- reqSkill = ','.join(reuiredSkilllst)
65
-
66
- data = {'Data':['Required Skills', 'Soft Skills', 'Good to have Skills'], 'Values':[reqSkill, ','.join(softskillslst), ','.join(goodtohavelst)]}
67
- df = pd.DataFrame(data)
68
-
69
- return df
70
-
71
- def GetSkillDatafromDB():
72
- conn = DbConnection.GetMySQLDbConnection()
73
-
74
- query = "select skilldetails from skillmaster where weightage = 0"
75
- df = pd.read_sql_query(query, conn)
76
- return df
77
-
78
- def extractWords(job_description):
79
- job_roles = []
80
- job_description = job_description.replace(')',' ')
81
- delimiters = ",", " ", " , ", ";","\n","/","\\"
82
- regex_pattern = '|'.join(map(re.escape, delimiters))
83
- df = SkillExtractorDetailsV1.getNewSkills()
84
- data = re.split(regex_pattern, job_description)
85
- #data = job_description.split(',')
86
- for ds in data:
87
- #print(ds)
88
- try:
89
-
90
- if(SkillExtractorDetailsV1.skill_Validate(df,ds.strip())):
91
- job_roles.append(ds)
92
- #SkillExtractorDetails.GetSkillId(ds.strip(),JdMasterid,db_params)
93
- print("Additional Skills : " + ds)
94
- except Exception as error:
95
- test = 1
96
- return job_roles
97
- def extractWordsNew(job_description):
98
- job_roles = []
99
- job_description = job_description.replace(')',' ')
100
- delimiters = ",", " ", " , ", ";","\n","/","\\"
101
- regex_pattern = '|'.join(map(re.escape, delimiters))
102
- df = SkillExtractorDetailsV1.getNewSkills1()
103
- data = re.split(regex_pattern, job_description)
104
- #data = job_description.split(',')
105
- for ds in data:
106
- #print(ds)
107
- try:
108
- for row in df:
109
- if(row['skills'].upper() == ds.strip().upper()):
110
- if(ds.strip() not in job_roles):
111
- job_roles.append(ds.strip())
112
- print("Additional Skills : " + ds)
113
-
114
- except Exception as error:
115
- test = 1
116
- return job_roles
117
-
118
- def getNewSkills():
119
- query = "select skillid,skilldetails,skilltype,skill_score from skillmaster where weightage = -2"
120
- conn = DbConnection.GetMySQLDbConnection()
121
- cursor = conn.cursor()
122
- df_skill_master = pd.read_sql_query(query, conn)
123
- df_skill_master['skilldetails'] = df_skill_master['skilldetails'].str.upper()
124
- cursor.close()
125
- # Close the connection
126
- conn.close()
127
-
128
- #print(df_skill_master)
129
- return df_skill_master
130
- def getSkills1():
131
- conn = DbConnection.GetMySQLDbConnection()
132
- cursor = conn.cursor()
133
- cursor.execute("SELECT upper(skilldetails) skills FROM skillmaster where weightage = 0")
134
- cursor.close()
135
- # Close the connection
136
- conn.close()
137
- return cursor.fetchall()
138
- #print(df_skill_master)
139
- def getNewSkills1():
140
- conn = DbConnection.GetMySQLDbConnection()
141
- cursor = conn.cursor()
142
- cursor.execute("SELECT upper(skilldetails) skills FROM skillmaster where weightage = -2")
143
- cursor.close()
144
- # Close the connection
145
- conn.close()
146
- return cursor.fetchall()
147
- #print(df_skill_master)
148
-
149
- def skill_Validate(df, skill):
150
- skill = skill.upper()
151
- if (len(skill.split()) < 2 and len(skill) < 3) or len(skill.split())==1:
152
- df['skill_present'] = df['skilldetails'].apply(lambda x: re.match(rf'^{skill}$', x))
153
- if any(df['skill_present']):
154
- #print("Valid Skill")
155
- return 1
156
- else:
157
- #print("Not a Skill")
158
- return 0
159
- elif df['skilldetails'].str.contains(skill.upper()).any():
160
- #print("Valid Skill")
161
- return 1
162
- else:
163
- # print("Not a Skill")
164
- return 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SkillExtract_Backup.py DELETED
@@ -1,236 +0,0 @@
1
- import psycopg2
2
- from psycopg2 import sql
3
- import pandas as pd
4
- import re
5
- class SkillExtractorDetails:
6
-
7
- def GetSkillId(skillname,jdmasterid,db_params):
8
- #Fetching skill id from skillmaster
9
- conn = psycopg2.connect(**db_params)
10
- cursor = conn.cursor()
11
- query = "select skillid from skillmaster where upper(skilldetails) = (%s)"
12
- params = (skillname.upper(),)
13
- cursor.execute(query, params)
14
- generated_skill_id = cursor.fetchone()[0]
15
- #jdmasterid = 912
16
- #print(generated_skill_id)
17
- #checking if skill id already in skilldetails
18
- query = "SELECT skillid FROM jdSkilldetails WHERE skillid IN (%s) and jdMasterid in (%s)"
19
- params = (generated_skill_id,jdmasterid,)
20
- cursor.execute(query, params)
21
- if cursor.rowcount > 0:
22
- #print("Already")
23
- query =''
24
- else:
25
- #print("Updating in DB")
26
- insert_query = sql.SQL("""INSERT INTO jdSkilldetails (Skillid, jdMasterid) VALUES (%s, %s)""")
27
- cursor.execute(insert_query, (generated_skill_id, jdmasterid))
28
- conn.commit()
29
-
30
- cursor.close()
31
- # Close the connection
32
- conn.close()
33
- return generated_skill_id
34
- def skill_Validate(df, skill):
35
- skill = skill.upper()
36
- if (len(skill.split()) < 2 and len(skill) < 3) or len(skill.split())==1:
37
- df['skill_present'] = df['skilldetails'].apply(lambda x: re.match(rf'^{skill}$', x))
38
- if any(df['skill_present']):
39
- #print("Valid Skill")
40
- return 1
41
- else:
42
- #print("Not a Skill")
43
- return 0
44
- elif df['skilldetails'].str.contains(skill.upper()).any():
45
- #print("Valid Skill")
46
- return 1
47
- else:
48
- # print("Not a Skill")
49
- return 0
50
- def getNewSkills(db_params):
51
- query = "select skillid,skilldetails,skilltype,skill_score from skillmaster where weightage = -2"
52
- conn = psycopg2.connect(**db_params)
53
- cursor = conn.cursor()
54
- df_skill_master = pd.read_sql_query(query, conn)
55
- df_skill_master['skilldetails'] = df_skill_master['skilldetails'].str.upper()
56
- cursor.close()
57
- # Close the connection
58
- conn.close()
59
-
60
- #print(df_skill_master)
61
- return df_skill_master
62
- def extractWords(job_description,JdMasterid,db_params):
63
- job_roles = []
64
- job_description = job_description.replace(')',' ')
65
- delimiters = ",", " ", " , ", ";","\n","/","\\"
66
- regex_pattern = '|'.join(map(re.escape, delimiters))
67
- df = SkillExtractorDetails.getNewSkills(db_params)
68
- data = re.split(regex_pattern, job_description)
69
- #data = job_description.split(',')
70
- for ds in data:
71
- #print(ds)
72
- try:
73
- if(SkillExtractorDetails.skill_Validate(df,ds.strip())):
74
- job_roles.append(ds)
75
- SkillExtractorDetails.GetSkillId(ds.strip(),JdMasterid,db_params)
76
- print("Skills Identified* : " + ds)
77
- except Exception as error:
78
- test = 1
79
- return job_roles
80
- def SkillExtract(db_params,skill_extractor,JdID):
81
- print("Extracting Skills for the JD...")
82
- # Connect to the PostgreSQL database
83
- conn = psycopg2.connect(**db_params)
84
- cursor = conn.cursor()
85
-
86
- jd_id = str(JdID)
87
- # Retrieve "id" and "description" columns from the table
88
- #query = sql.SQL("select jdmasterid,jobdescription from JDMaster where isskillsextracted in (0)")
89
- query = "select jdmasterid,jobdescription,filename from JDMaster where isskillsextracted = 0 and jdmasterid ="+ jd_id
90
-
91
- # Use Pandas to read the data into a DataFrame
92
- df = pd.read_sql_query(query, conn)
93
-
94
- # Print the DataFrame (for demonstration purposes)
95
- #print(df)
96
-
97
- skill_details = ''
98
- skill_type = ''
99
- weightage = -1.0
100
- is_active = True
101
- Skillid = 0
102
- jdMasterid = 0
103
- OldSkillCount = 0
104
- NewSkillCount = 0
105
- if(len(df.index) > 0):
106
- print("Total JDs for Extractraction : " + str(len(df.index)))
107
- for index, row in df.iterrows():
108
- # Access individual columns using column names
109
- id_value = row['jdmasterid']
110
- filename_jd = row['filename']
111
- OldSkillCount = 0
112
- NewSkillCount = 0
113
- skill_score = 0.0
114
- print("Extracting Skills For ", filename_jd + " , Id : " + str(id_value) + " , Index " + str(index + 1))
115
-
116
- description_value = row['jobdescription']
117
- #print(description_value)
118
-
119
- annotations = skill_extractor.annotate(description_value)
120
- matches = annotations['results']['full_matches']+annotations['results']['ngram_scored']
121
- skills_list = []
122
- for result in matches:
123
- if(1==1):
124
-
125
- isOld = "Yes"
126
- skill_id = result['skill_id']
127
- skill_name1 = skill_extractor.skills_db[skill_id]['skill_name']
128
- skill_name = skill_name1.split("(")[0].strip()
129
- skill_type = skill_extractor.skills_db[skill_id]['skill_type']
130
- skill_score = round(result['score'],2)
131
-
132
-
133
- if( skill_name in skills_list):
134
- continue
135
- skills_list.append(skill_name)
136
- #print("Skill Identified : ", j['doc_node_value'])
137
- query = "SELECT skillid FROM skillmaster WHERE skillDetails IN (%s)"
138
- params = (skill_name,) # Replace 'Test' with your actual variable or user input
139
- cursor.execute(query, params)
140
- if cursor.rowcount > 0:
141
- print("Skill Identified : ", skill_name)
142
- result = cursor.fetchall()
143
- for row in result:
144
- row_as_int = [int(element) for element in row]
145
- #print("Skill Already in SkillMaster")
146
- OldSkillCount = OldSkillCount + 1
147
- isOld = "Yes"
148
- query = "SELECT skillid FROM jdSkilldetails WHERE skillid IN (%s) and jdMasterid in (%s)"
149
- params = (row_as_int[0],id_value,)
150
- cursor.execute(query, params)
151
- if cursor.rowcount > 0:
152
- weightage = -1.0
153
- #print("Skill Already in SkillMaster and JDSkillDetails")
154
- else:
155
- Skillid = row_as_int[0]
156
- jdMasterid = id_value
157
- insert_query = sql.SQL("""INSERT INTO jdSkilldetails (Skillid, jdMasterid) VALUES (%s, %s)""")
158
- cursor.execute(insert_query, (Skillid, jdMasterid))
159
- conn.commit()
160
- #print("Skill Already in SkillMaster and Inserted in JDSkillDetails")
161
- #print(row_as_int)
162
- else:
163
- NewSkillCount = NewSkillCount + 1
164
- isOld = "No"
165
- skill_details = skill_name
166
- weightage = -1.0
167
- skill_score = skill_score * 100
168
- skill_score1 = str(skill_score)
169
- #skill_score = skill_score.astype(float)
170
- #print(skill_score)
171
- insert_query = sql.SQL("""INSERT INTO SkillMaster (SkillDetails, SkillType, Weightage, IsActive, skill_score)
172
- VALUES (%s, %s, %s, %s, %s) RETURNING SkillID""")
173
- cursor.execute(insert_query, (skill_details, skill_type, weightage, is_active, skill_score1))
174
- conn.commit()
175
- generated_skill_id = cursor.fetchone()[0]
176
- Skillid = generated_skill_id
177
- jdMasterid = id_value
178
- insert_query = sql.SQL("""INSERT INTO jdSkilldetails (Skillid, jdMasterid) VALUES (%s, %s)""")
179
- cursor.execute(insert_query, (Skillid, jdMasterid))
180
- conn.commit()
181
- print("Skill Identified : ", skill_name)
182
- #print("Skill inserted in SkillMaster and Inserted in JDSkillDetails")
183
- SkillExtractorDetails.extractWords(description_value,id_value,db_params)
184
- query = "update public.jdmaster set isskillsextracted = 1 where jdmasterid = (%s)"
185
-
186
- params = (id_value,)
187
- cursor.execute(query, params)
188
- conn.commit()
189
- print("Skills Updated for Skills Extraction for file ", filename_jd)
190
- print("Total Skills : ", len(skills_list))
191
- return SkillExtractorDetails.latestSkillDetails(id_value,db_params)
192
- def latestSkillDetails(jid,db_params):
193
- data = ""
194
- data = SkillExtractorDetails.display_skills(jid,db_params)
195
- # jid = df.iat[0,0]
196
- return data
197
- def tuple_to_int(tup):
198
- if len(tup) == 1:
199
- return tup[0]
200
- else:
201
- return tup[0] * (10 ** (len(tup) - 1)) + SkillExtractorDetails.tuple_to_int(tup[1:])
202
-
203
-
204
- def skill_check(dbQuery,db_params):
205
- conn = psycopg2.connect(**db_params)
206
- cursor = conn.cursor()
207
- df = pd.read_sql_query(dbQuery, conn)
208
- Required_Skills=''
209
- for index, row in df.iterrows():
210
-
211
- skillname = row['skillname']
212
- Required_Skills = Required_Skills + ', '+ skillname
213
-
214
- Required_Skills = Required_Skills[2:]
215
- return Required_Skills
216
- def display_skills(id, db_params):
217
- jd=str(id)
218
- query = "select skillname from SkillDetails where id = "+ jd +" and skillscore > 99 and skilltype = 'Hard Skill'"
219
- RequiredSkills_Hard = SkillExtractorDetails.skill_check(query,db_params)
220
-
221
- query = "select skillname from SkillDetails where id = "+ jd +" and skillscore > 50 and skilltype = 'Soft Skill'"
222
- RequiredSkills_Soft = SkillExtractorDetails.skill_check(query,db_params)
223
-
224
- query = "select skillname from SkillDetails where id = "+ jd +" and skillscore < 50 and skilltype = 'Soft Skill'"
225
- RequiredSkills_G1 = SkillExtractorDetails.skill_check(query,db_params)
226
-
227
- query = "select skillname from SkillDetails where id = "+ jd +" and skillscore < 99 and skilltype = 'Hard Skill'"
228
- RequiredSkills_G2 = SkillExtractorDetails.skill_check(query,db_params)
229
-
230
- print('')
231
- print("Required Skills : " + RequiredSkills_Hard)
232
- print('')
233
- print("Required Soft Skills : " + RequiredSkills_Soft)
234
- print('')
235
- print("Good to have Skills : " + RequiredSkills_G1 + " " + RequiredSkills_G2)
236
- return RequiredSkills_Hard + "@" + RequiredSkills_Soft + "@" + RequiredSkills_G1 + " " + RequiredSkills_G2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SkillMatcher.py DELETED
@@ -1,110 +0,0 @@
1
- import psycopg2
2
- import pandas as pd
3
- from sentence_transformers import SentenceTransformer, util
4
- class SkillMatch:
5
- def SkillMatcher(model,db_params,jdID):
6
- print("Checking Best Course for the JD...")
7
- conn = psycopg2.connect(**db_params)
8
- cursor_obj = conn.cursor()
9
-
10
- query = "select * from JDDetailsAllSkill where jdmasterid = (%s)"
11
- params = (jdID,)
12
- cursor_obj.execute(query,params)
13
- jd_data = cursor_obj.fetchall()
14
- #connection_obj.commit()
15
- print(jd_data)
16
- query = "select * from CourseDetailsForMatching"
17
- cursor_obj.execute(query)
18
- cv_data = cursor_obj.fetchall()
19
- print(cv_data)
20
- #connection_obj.commit()
21
- query = "select jdmasterid || '-' || courseid from courseskillmatch"
22
- cursor_obj.execute(query)
23
- match_data = cursor_obj.fetchall()
24
-
25
- jd_skills = {}
26
- for obj in jd_data:
27
- if obj[0] not in jd_skills:
28
- jd_skills[obj[0]] = []
29
-
30
- jd_skills[obj[0]].append(obj[1])
31
-
32
- cv_skills = {}
33
- for obj in cv_data:
34
- if obj[0] not in cv_skills:
35
- cv_skills[obj[0]] = []
36
-
37
- cv_skills[obj[0]].append(obj[1])
38
-
39
-
40
- count = 0
41
- MatchSkillsId = 0
42
- isAlreadyInDb = False
43
- TopScore = 0
44
- CourseId = 0
45
- MatchId =''
46
- for jd in jd_skills:
47
- for cv in cv_skills:
48
- #if(cv in match_data[1] and jd in match_data[0]):
49
- #print("Already record : " + str(cv) + " , " + str(jd))
50
- isAlreadyInDb = False
51
- match_details = str(jd) + "-" + str(cv)
52
- print("Checking for existing Profile")
53
- for i in match_data:
54
- if(i[0] == match_details):
55
- print( "Already in Database -----------" + i[0])
56
- isAlreadyInDb = True
57
- break
58
-
59
- if(isAlreadyInDb == True):
60
- continue
61
- #print(match_details)
62
- print("Running Matching Algo")
63
- count += 1
64
- sentence1 = " ".join(cv_skills[cv])
65
- sentence2 = " ".join(jd_skills[jd])
66
- embedding1 = model.encode(sentence1, convert_to_tensor=True)
67
- embedding2 = model.encode(sentence2, convert_to_tensor=True)
68
-
69
- # Compute cosine similarity between the two sentence embeddings
70
- cosine_similarit = util.cos_sim(embedding1, embedding2)
71
- if(TopScore < cosine_similarit * 100):
72
- TopScore = cosine_similarit * 100
73
- CourseId = cv
74
-
75
- print("DB Entry for Matching Results")
76
- #common = set(cv_skills[cv]) & set(jd_skills[jd])
77
- if(1==1):
78
- if(MatchSkillsId == 0):
79
- query = "select coalesce(max(skillmatchid),0) + 1 from courseskillmatch"
80
- cursor_obj.execute(query)
81
- MatchId = cursor_obj.fetchall()
82
- MatchSkillsId = SkillMatch.tuple_to_int( MatchId[0])
83
-
84
-
85
-
86
- if(1==1):
87
- record = (MatchSkillsId, cv, jd, cosine_similarit[0][0].item(),1)
88
- query = """INSERT INTO public.courseskillmatch(SkillMatchID, courseid, JDMasterID, MatchScore,isactive) VALUES (%s,%s,%s,%s,%s)"""
89
- cursor_obj.execute(query, record)
90
- conn.commit()
91
- MatchSkillsId = MatchSkillsId + 1
92
- print( str( MatchSkillsId) + " "+"Updating in DB - JD {} CV {} ".format(jd, cv), cosine_similarit[0][0].item())
93
- #print(TopScore)
94
- print(CourseId)
95
- query = "select filename from coursemaster where masterid = " + str(CourseId)
96
- df = pd.read_sql_query(query, conn)
97
- try:
98
- MatchId = df.iat[0,0]
99
- except:
100
- print(CourseId)
101
- print("------------------------Beta Results - " + MatchId)
102
- cursor_obj.close()
103
- conn.close()
104
- return str(MatchId) + ";" + str(TopScore[0][0].item()) + ";" + str(CourseId)
105
-
106
- def tuple_to_int(tup):
107
- if len(tup) == 1:
108
- return tup[0]
109
- else:
110
- return tup[0] * (10 ** (len(tup) - 1)) + SkillMatch.tuple_to_int(tup[1:])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
UploadFile.py DELETED
@@ -1,32 +0,0 @@
1
- from datetime import date
2
- import psycopg2
3
- from psycopg2 import sql
4
- import pandas as pd
5
-
6
- class UploadOpenFile:
7
-
8
- def uploadFile(text,filePath,db_params,isJD):
9
-
10
- conn = psycopg2.connect(**db_params)
11
- cursor = conn.cursor()
12
- if(isJD):
13
- df = pd.read_sql_query("Select max(jdmasterid) from JdMaster", conn)
14
- else:
15
- df = pd.read_sql_query("Select max(masterid) from CourseMaster", conn)
16
- try:
17
- MasterId = df.iat[0,0] + 1
18
- except:
19
- MasterId =1
20
-
21
- print(MasterId)
22
- if(isJD):
23
- query =sql.SQL("""INSERT INTO JDMaster (jdmasterid,jobdescription, filename, UploadedDate, IsDetailsExtracted,IsSkillsExtracted,source) VALUES (%s,%s,%s,%s,%s,%s,%s)""")
24
- else:
25
- query =sql.SQL("""INSERT INTO CourseMaster (masterid,description, filename, UploadedDate, IsDetailsExtracted,IsSkillsExtracted,source) VALUES (%s,%s,%s,%s,%s,%s,%s)""")
26
- cursor.execute(query, (MasterId,text,filePath, date.today(),0,0,"JD"))
27
- conn.commit()
28
- cursor.close()
29
- conn.close()
30
- print("File Uploaded...")
31
- return MasterId
32
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
movies.csv DELETED
The diff for this file is too large to render. See raw diff