-
Notifications
You must be signed in to change notification settings - Fork 16
/
cli.py
executable file
·43 lines (34 loc) · 1.14 KB
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import argparse
import logging
import os
import sqlite3
import pandas as pd
from extract import extract
from dataTransformer import DataTransformer
from FileHandler import FileHandler
from load import load
from config import PROCESSED_DATA_PATH, RAW_DATA_PATH, RESUME_PATH
logging.basicConfig(level=logging.INFO)
file_handler = FileHandler(raw_path=RAW_DATA_PATH, processed_path=PROCESSED_DATA_PATH)
def run_search(job_titles):
steps = [
lambda: extract(job_titles),
lambda: DataTransformer(
raw_path=RAW_DATA_PATH,
processed_path=PROCESSED_DATA_PATH,
resume_path=RESUME_PATH,
data=file_handler.import_job_data_from_dir(dirpath=RAW_DATA_PATH),
).transform(),
load,
]
for step in steps:
step()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Run job search")
parser.add_argument(
"job_titles", type=str, help="Job titles to search for (comma-separated)"
)
args = parser.parse_args()
job_titles = [title.strip() for title in args.job_titles.split(",")]
run_search(job_titles)
file_handler.delete_local()