Esempio n. 1
0
    def score(self, project: scoring_base.ScoringProject) -> float:
        job_search_length = project.get_search_length_now()

        # User has not started their job search.
        if job_search_length <= 0:
            raise scoring_base.NotEnoughDataException(
                'Search not started yet. We cannot say whether this is blocking.')

        missing_fields: Set[str] = set()
        if not project.details.total_interview_count:
            missing_fields.add('projects.0.totalInterviewCount')
        if not project.details.weekly_applications_estimate:
            missing_fields.add('projects.0.weeklyApplicationsEstimate')

        # Either negative or between 0 and 1.
        interview_score = 1 - max(0, project.details.total_interview_count) / job_search_length
        if interview_score <= 0:
            # User has at least one interview per month, they don't need more tips on getting
            # interviews.
            return 0

        if missing_fields:
            raise scoring_base.NotEnoughDataException(
                'Missing some information about applications', fields=missing_fields)

        # Varies between 0 and 3.
        application_score = _APPLICATION_PER_WEEK[project.details.weekly_applications_estimate] / 5

        # Varies between 0 and 3.
        return interview_score * application_score
Esempio n. 2
0
    def score_and_explain(self, project: scoring_base.ScoringProject) \
            -> scoring_base.ExplainedScore:
        """Compute a score for the given ScoringProject."""

        close_jobs = self.get_close_jobs(project)
        search_since_nb_months = round(project.get_search_length_now())
        score_modifier = 0
        reasons: List[str] = []
        if len(close_jobs.close_jobs) + len(close_jobs.evolution_jobs) < 2:
            return scoring_base.NULL_EXPLAINED_SCORE
        # TODO(cyrille): Make this more robust.
        force_in_stuck_market = None
        # TODO(cyrille): Rather use market_stress to avoid depending on diagnostic to be computed.
        if project.details.diagnostic.category_id == 'stuck-market':
            force_in_stuck_market = scoring_base.ExplainedScore(1, reasons)
        if project.get_user_age() >= 45:
            return force_in_stuck_market or scoring_base.NULL_EXPLAINED_SCORE
        if project.details.passionate_level >= project_pb2.PASSIONATING_JOB:
            score_modifier = -1
        else:
            reasons.append(project.translate_string(
                "vous n'êtes pas trop attaché à votre métier"))
        if project.details.job_search_has_not_started or search_since_nb_months <= 1:
            return scoring_base.ExplainedScore(2 + score_modifier, reasons)
        reasons = [
            project.translate_string('vous cherchez depuis {} mois')
            .format(search_since_nb_months)]
        if search_since_nb_months >= 12:
            return scoring_base.ExplainedScore(3, reasons)
        if search_since_nb_months >= 9:
            return scoring_base.ExplainedScore(2, reasons)
        if search_since_nb_months >= 6:
            return scoring_base.ExplainedScore(1, reasons)
        return force_in_stuck_market or scoring_base.NULL_EXPLAINED_SCORE
Esempio n. 3
0
    def score(self, project: scoring_base.ScoringProject) -> float:
        # TODO(cyrille): Find a way to make sure they're really desillusioned.
        if project.get_search_length_now() < 3:
            # User is probably not disillusioned yet.
            return 0
        if project.details.seniority < project_pb2.CARREER:
            return 0

        return max(0, min(3, project.get_user_age() - 50))
Esempio n. 4
0
    def score_and_explain(self, project: scoring_base.ScoringProject) \
            -> scoring_base.ExplainedScore:
        """Compute a score for the given ScoringProject."""

        frustration_reasons = list(self._get_frustrations_reasons(project))
        its_easy = project.translate_static_string(
            "c'est plus facile à faire qu'on peut le croire")

        if frustration_reasons or project.get_search_length_now() > 3:
            return scoring_base.ExplainedScore(
                2, frustration_reasons or [its_easy])
        return scoring_base.ExplainedScore(1, [its_easy])
Esempio n. 5
0
    def score_and_explain(self, project: scoring_base.ScoringProject) \
            -> scoring_base.ExplainedScore:
        """Compute the score for a given project and explains it.

        Requirements are:
        - not having a driving license (duh)
        - being older than 25 (we have other resources for younger people)
        And for this specific help from PE:
        - being registered as unemployed for more than 6 months
        - be sure that a license would really help to get a job (market tension)
        - not have too much allowances from PE
        """

        # TODO(cyrille): Add tension market.
        age = project.get_user_age()
        # TODO(cyrille): Figure out in a notebook if junior salary from IMT would be more relevant.
        expected_salary = project.salary_estimation()
        if age < 25 or project.get_search_length_now(
        ) < 6 or expected_salary > 20000:
            return scoring_base.NULL_EXPLAINED_SCORE
        return _score_and_explain_after_filters(project)