Пример #1
0
def predict_rub_salary_hh(language):
    vacancies = get_vacancies_hh(language)
    salaries = []
    for vacancy in vacancies:
        if vacancy['salary']['currency'] == 'RUR':
            salary = predict_salary(vacancy['salary']['from'], vacancy['salary']['to'])
            salaries.append(salary)

    return {
        'vacancies_found': len(vacancies),
        'vacancies_processed': len(salaries),
        'average_salary': int(statistics.mean(salaries))
    }
Пример #2
0
def predict_rub_salary_sj(vacancy_description):
    """Predict salary in rubles given a vacancy description.

    :param vacancy_description: vacancy description
    :return: predicted salary
    """

    if vacancy_description.get("currency") != "rub":
        return None

    salary_from = vacancy_description.get("payment_from")
    salary_to = vacancy_description.get("payment_to")

    return predict_salary(salary_from, salary_to)
Пример #3
0
def predict_rub_salary_sj(secret_key, language):
    vacancies = get_vacancies_sj(secret_key, language)
    salaries = []
    for vacancy in vacancies:
        if vacancy['currency'] == 'rub' and (vacancy['payment_from']
                                             or vacancy['payment_to']):
            salary = predict_salary(vacancy['payment_from'],
                                    vacancy['payment_to'])
            salaries.append(salary)
    return {
        'vacancies_found': len(vacancies),
        'vacancies_processed': len(salaries),
        'average_salary': int(statistics.mean(salaries))
    }
Пример #4
0
def predict_rub_salary_hh(salary_fork):
    """Predict salary in rubles given a salary fork.

    :param salary_fork: salary fork
    :return: predicted salary
    """

    if not salary_fork:
        return None
    if salary_fork.get("currency") != "RUR":
        return None

    salary_from = salary_fork.get("from")
    salary_to = salary_fork.get("to")

    return predict_salary(salary_from, salary_to)
Пример #5
0
def predict_rub_salary_for_headhunter(vacancy):
    vacancy_salary = vacancy["salary"]
    if vacancy_salary and vacancy_salary["currency"] == "RUR":
        return predict_salary(vacancy_salary["from"], vacancy_salary["to"])
Пример #6
0
def predict_rub_salary_for_superjob(vacancy):
    if vacancy["currency"] == "rub":
        return predict_salary(vacancy["payment_from"], vacancy["payment_to"])