Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old processed files #86

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion run_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,39 @@
from scripts.ResumeProcessor import ResumeProcessor
from scripts.JobDescriptionProcessor import JobDescriptionProcessor
import logging

import os
logging.basicConfig(filename='app.log', filemode='w',
level=logging.DEBUG,
format='%(name)s - %(levelname)s - %(message)s')

PROCESSED_RESUMES_PATH = "Data/Processed/Resumes"
PROCESSED_JOB_DESCRIPTIONS_PATH = "Data/Processed/JobDescription"

def read_json(filename):
with open(filename) as f:
data = json.load(f)
return data

def remove_old_files(files_path):

for filename in os.listdir(files_path):
try:
file_path = os.path.join(files_path, filename)

if os.path.isfile(file_path):
os.remove(file_path)
except Exception as e:
logging.error(f"Error deleting {file_path}:\n{e}")

logging.info("Deleted old files from "+files_path)


logging.info('Started to read from Data/Resumes')
try:
# Check if there are resumes present or not.
# If present then parse it.
remove_old_files(PROCESSED_RESUMES_PATH)

file_names = get_filenames_from_dir("Data/Resumes")
logging.info('Reading from Data/Resumes is now complete.')
except:
Expand All @@ -40,6 +57,8 @@ def read_json(filename):
try:
# Check if there are resumes present or not.
# If present then parse it.
remove_old_files(PROCESSED_JOB_DESCRIPTIONS_PATH)

file_names = get_filenames_from_dir("Data/JobDescription")
logging.info('Reading from Data/JobDescription is now complete.')
except:
Expand Down
19 changes: 14 additions & 5 deletions streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,14 @@ def tokenize_string(input_string):

resume_names = get_filenames_from_dir("Data/Processed/Resumes")

st.write("There are", len(resume_names),
output = 0

if len(resume_names) > 1:
st.write("There are", len(resume_names),
" resumes present. Please select one from the menu below:")
output = st.slider('Select Resume Number', 0, len(resume_names)-1, 2)
output = st.slider('Select Resume Number', 0, len(resume_names)-1, 0)
else:
st.write("There is 1 resume present")

avs.add_vertical_space(5)

Expand Down Expand Up @@ -195,10 +200,14 @@ def tokenize_string(input_string):

job_descriptions = get_filenames_from_dir("Data/Processed/JobDescription")

st.write("There are", len(job_descriptions),
output = 0
if len(job_descriptions) > 1:
st.write("There are", len(job_descriptions),
" resumes present. Please select one from the menu below:")
output = st.slider('Select Job Description Number',
0, len(job_descriptions)-1, 2)
output = st.slider('Select Job Description Number',
0, len(job_descriptions)-1, 0)
else:
st.write("There is 1 job description present")

avs.add_vertical_space(5)

Expand Down