husseinelsaadi commited on
Commit
76030db
·
0 Parent(s):

Initial commit: Project structure for Codingo AI recruitment System

Browse files
Files changed (3) hide show
  1. .gitignore +38 -0
  2. readme.md +273 -0
  3. requirements.txt +6 -0
.gitignore ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ env/
8
+ build/
9
+ develop-eggs/
10
+ dist/
11
+ downloads/
12
+ eggs/
13
+ .eggs/
14
+ lib/
15
+ lib64/
16
+ parts/
17
+ sdist/
18
+ var/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual Environment
24
+ venv/
25
+ ENV/
26
+
27
+ # PyCharm
28
+ .idea/
29
+
30
+ # Training data & models
31
+ data/raw_cvs/
32
+ backend/model/*.pkl
33
+
34
+ # Jupyter Notebook
35
+ .ipynb_checkpoints
36
+
37
+ # OS specific
38
+ .DS_Store
readme.md ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Codingo - AI Powered Smart Recruitment System
2
+
3
+ This repository contains the implementation of Codingo, an AI-powered online recruitment platform designed to automate and enhance the hiring process through a virtual HR assistant named LUNA.
4
+
5
+ ## Project Overview
6
+
7
+ Codingo addresses the challenges of traditional recruitment processes by offering:
8
+ - Automated CV screening and skill-based shortlisting
9
+ - AI-led interviews through the virtual assistant LUNA
10
+ - Real-time cheating detection during assessments
11
+ - Gamified practice tools for candidates
12
+ - Secure administration interface for hiring managers
13
+
14
+ ## Getting Started
15
+
16
+ This guide outlines the development process, starting with local model training before moving to AWS deployment.
17
+
18
+ ### Prerequisites
19
+
20
+ - Python 3.8+
21
+ - pip (Python package manager)
22
+ - Git
23
+
24
+ ### Development Process
25
+
26
+ We'll implement the project in phases:
27
+
28
+ #### Phase 1: Local Training and Feature Extraction (Current Phase)
29
+
30
+ This initial phase focuses on building and training the model locally before AWS deployment.
31
+
32
+ ### Project Structure
33
+
34
+ ```
35
+ Codingo/
36
+ ├── backend/ # Flask API backend
37
+ │ ├── app.py # Flask server
38
+ │ ├── predict.py # Predict using trained model
39
+ │ ├── train_model.py # Model training script
40
+ │ ├── model/ # Trained model artifacts
41
+ │ │ └── cv_classifier.pkl
42
+ │ ├── utils/
43
+ │ │ ├── text_extractor.py # PDF/DOCX to text
44
+ │ │ └── preprocessor.py # Cleaning, tokenizing
45
+
46
+ ├── data/
47
+ │ ├── training.csv # Your training dataset
48
+ │ └── raw_cvs/ # CV files (PDF/DOCX/txt)
49
+
50
+ ├── notebooks/
51
+ │ └── eda.ipynb # Data exploration & feature work
52
+
53
+ ├── requirements.txt # Python dependencies
54
+ └── README.md # Project overview
55
+ ```
56
+
57
+ ## Step-by-Step Implementation Guide
58
+
59
+ ### Step 1: Create Training Dataset
60
+
61
+ Start by manually collecting ~50-100 CV-like text samples with position labels.
62
+
63
+ **File:** `data/training.csv`
64
+
65
+ Example format:
66
+ ```
67
+ text,position
68
+ "Experienced in Python, Flask, AWS",Backend Developer
69
+ "Built dashboards with React and TypeScript",Frontend Developer
70
+ "ML projects using pandas, scikit-learn",Data Scientist
71
+ ```
72
+
73
+ ### Step 2: Train Model
74
+
75
+ Implement a classifier using scikit-learn to predict job roles from CV text.
76
+
77
+ **File:** `backend/train_model.py`
78
+
79
+ ```python
80
+ import pandas as pd
81
+ from sklearn.feature_extraction.text import TfidfVectorizer
82
+ from sklearn.pipeline import Pipeline
83
+ from sklearn.linear_model import LogisticRegression
84
+ import joblib
85
+
86
+ # Load training data
87
+ df = pd.read_csv('data/training.csv')
88
+
89
+ # Define model pipeline
90
+ model = Pipeline([
91
+ ('tfidf', TfidfVectorizer(max_features=5000, ngram_range=(1, 2))),
92
+ ('classifier', LogisticRegression(max_iter=1000))
93
+ ])
94
+
95
+ # Train model
96
+ model.fit(df['text'], df['position'])
97
+
98
+ # Save model
99
+ joblib.dump(model, 'backend/model/cv_classifier.pkl')
100
+
101
+ print("Model trained and saved successfully!")
102
+ ```
103
+
104
+ ### Step 3: Test Prediction Locally
105
+
106
+ Create a script to verify your model works correctly.
107
+
108
+ **File:** `backend/predict.py`
109
+
110
+ ```python
111
+ import joblib
112
+ import sys
113
+
114
+ def predict_role(cv_text):
115
+ # Load the trained model
116
+ model = joblib.load('backend/model/cv_classifier.pkl')
117
+
118
+ # Make prediction
119
+ prediction = model.predict([cv_text])[0]
120
+ confidence = max(model.predict_proba([cv_text])[0]) * 100
121
+
122
+ return {
123
+ 'predicted_position': prediction,
124
+ 'confidence': f"{confidence:.2f}%"
125
+ }
126
+
127
+ if __name__ == "__main__":
128
+ if len(sys.argv) > 1:
129
+ # Get CV text from command line argument
130
+ cv_text = sys.argv[1]
131
+ else:
132
+ # Example CV text
133
+ cv_text = "Experienced Python developer with 5 years of experience in Flask and AWS."
134
+
135
+ result = predict_role(cv_text)
136
+ print(f"Predicted Position: {result['predicted_position']}")
137
+ print(f"Confidence: {result['confidence']}")
138
+ ```
139
+
140
+ ### Step 4: Add Text Extraction Utility
141
+
142
+ Create utilities to extract text from PDF and DOCX files.
143
+
144
+ **File:** `backend/utils/text_extractor.py`
145
+
146
+ ```python
147
+ import fitz # PyMuPDF
148
+ import docx
149
+ import os
150
+
151
+ def extract_text_from_pdf(path):
152
+ """Extract text from PDF file."""
153
+ doc = fitz.open(path)
154
+ text = ""
155
+ for page in doc:
156
+ text += page.get_text()
157
+ return text.strip()
158
+
159
+ def extract_text_from_docx(path):
160
+ """Extract text from DOCX file."""
161
+ doc = docx.Document(path)
162
+ text = "\n".join([paragraph.text for paragraph in doc.paragraphs])
163
+ return text.strip()
164
+
165
+ def extract_text(file_path):
166
+ """Extract text from either PDF or DOCX."""
167
+ extension = os.path.splitext(file_path)[1].lower()
168
+
169
+ if extension == '.pdf':
170
+ return extract_text_from_pdf(file_path)
171
+ elif extension in ['.docx', '.doc']:
172
+ return extract_text_from_docx(file_path)
173
+ elif extension == '.txt':
174
+ with open(file_path, 'r', encoding='utf-8') as f:
175
+ return f.read().strip()
176
+ else:
177
+ raise ValueError(f"Unsupported file extension: {extension}")
178
+ ```
179
+
180
+ ### Step 5: Add Flask API (Simple)
181
+
182
+ Create a basic Flask API to accept CV uploads and return predictions.
183
+
184
+ **File:** `backend/app.py`
185
+
186
+ ```python
187
+ from flask import Flask, request, jsonify
188
+ from utils.text_extractor import extract_text
189
+ import joblib
190
+ import os
191
+
192
+ app = Flask(__name__)
193
+ model = joblib.load("model/cv_classifier.pkl")
194
+
195
+ # Ensure directories exist
196
+ os.makedirs("data/raw_cvs", exist_ok=True)
197
+ os.makedirs("model", exist_ok=True)
198
+
199
+ @app.route("/predict", methods=["POST"])
200
+ def predict():
201
+ if 'file' not in request.files:
202
+ return jsonify({"error": "No file provided"}), 400
203
+
204
+ file = request.files["file"]
205
+ file_path = f"data/raw_cvs/{file.filename}"
206
+ file.save(file_path)
207
+
208
+ try:
209
+ text = extract_text(file_path)
210
+ prediction = model.predict([text])[0]
211
+ confidence = max(model.predict_proba([text])[0]) * 100
212
+
213
+ return jsonify({
214
+ "predicted_position": prediction,
215
+ "confidence": f"{confidence:.2f}%"
216
+ })
217
+ except Exception as e:
218
+ return jsonify({"error": str(e)}), 500
219
+
220
+ if __name__ == "__main__":
221
+ app.run(debug=True)
222
+ ```
223
+
224
+ ### Step 6: Install Dependencies
225
+
226
+ **File:** `requirements.txt`
227
+
228
+ ```
229
+ flask
230
+ scikit-learn
231
+ pandas
232
+ joblib
233
+ PyMuPDF
234
+ python-docx
235
+ ```
236
+
237
+ Run: `pip install -r requirements.txt`
238
+
239
+ ## Next Steps
240
+
241
+ After completing Phase 1, we'll move to:
242
+
243
+ 1. **Phase 2: Enhanced Model & NLP Features**
244
+ - Implement BERT or DistilBERT for improved semantic understanding
245
+ - Add skill extraction from CVs
246
+ - Develop job-CV matching scoring
247
+
248
+ 2. **Phase 3: Web Interface & Chatbot**
249
+ - Develop user interface for admin and candidates
250
+ - Implement LUNA virtual assistant using LangChain
251
+ - Add interview scheduling functionality
252
+
253
+ 3. **Phase 4: Video Interview & Proctoring**
254
+ - Add video interview capabilities
255
+ - Implement cheating detection using computer vision
256
+ - Develop automated scoring system
257
+
258
+ 4. **Phase 5: AWS Deployment**
259
+ - Set up AWS infrastructure using Terraform
260
+ - Deploy application to EC2/Lambda
261
+ - Configure S3 for file storage
262
+
263
+ ## Authors
264
+
265
+ - Hussein El Saadi
266
+ - Nour Ali Shaito
267
+
268
+ ## Supervisor
269
+ - Dr. Ali Ezzedine
270
+
271
+ ## License
272
+
273
+ This project is licensed under the MIT License - see the LICENSE file for details.
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ flask
2
+ scikit-learn
3
+ pandas
4
+ joblib
5
+ PyMuPDF
6
+ python-docx