This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
|
||||
from django.db.models import Q
|
||||
|
||||
from apps.profiles.models import SearchProfile
|
||||
|
||||
from .normalization import normalize_token
|
||||
|
||||
# Deliberately title-led: employer pages regularly mention digital systems in otherwise
|
||||
# non-IT vacancies. A description hit alone must therefore never make a vacancy relevant.
|
||||
IT_TITLE_TERMS = (
|
||||
"it",
|
||||
"ict",
|
||||
"informatica",
|
||||
"software",
|
||||
"development engineer",
|
||||
"devops",
|
||||
"secops",
|
||||
"cloud",
|
||||
"data engineer",
|
||||
"data scientist",
|
||||
"data steward",
|
||||
"database",
|
||||
"dba",
|
||||
"business intelligence",
|
||||
"bi analyst",
|
||||
"system engineer",
|
||||
"systems engineer",
|
||||
"systeembeheer",
|
||||
"infrastructure engineer",
|
||||
"infrastructuur engineer",
|
||||
"network engineer",
|
||||
"network architect",
|
||||
"netwerkbeheer",
|
||||
"netwerk engineer",
|
||||
"cybersecurity",
|
||||
"cyber security",
|
||||
"security engineer",
|
||||
"security architect",
|
||||
"security analyst",
|
||||
"information security",
|
||||
"informatiebeveiliging",
|
||||
"workplace engineer",
|
||||
"modern workplace",
|
||||
"digital workplace",
|
||||
"service desk",
|
||||
"servicedesk",
|
||||
"helpdesk",
|
||||
"support engineer",
|
||||
"support specialist",
|
||||
"application lead",
|
||||
"application engineer",
|
||||
"application manager",
|
||||
"application specialist",
|
||||
"applicatiebeheer",
|
||||
"platform engineer",
|
||||
"platform expert",
|
||||
"solution architect",
|
||||
"solutions architect",
|
||||
"technical architect",
|
||||
"technisch architect",
|
||||
"functional analyst",
|
||||
"functioneel analist",
|
||||
"business analyst",
|
||||
"product owner",
|
||||
"web developer",
|
||||
"mobile developer",
|
||||
"low-code developer",
|
||||
"low code developer",
|
||||
"api developer",
|
||||
"idm developer",
|
||||
"power platform",
|
||||
"forgerock",
|
||||
"embedded",
|
||||
"c#",
|
||||
"front end",
|
||||
"frontend",
|
||||
"back end",
|
||||
"backend",
|
||||
"full stack",
|
||||
"fullstack",
|
||||
"php",
|
||||
".net",
|
||||
"java",
|
||||
"python",
|
||||
"powershell",
|
||||
"azure",
|
||||
"aws",
|
||||
"microsoft 365",
|
||||
"linux",
|
||||
"windows server",
|
||||
"kubernetes",
|
||||
"docker",
|
||||
"terraform",
|
||||
"erp",
|
||||
"sap",
|
||||
"machine learning",
|
||||
"ai engineer",
|
||||
"artificial intelligence",
|
||||
"image processing",
|
||||
"computer vision",
|
||||
"qa engineer",
|
||||
"test automation",
|
||||
)
|
||||
|
||||
# These phrases can contain IT vocabulary while describing commercial, recruitment,
|
||||
# or educational-design work. They therefore override positive title signals.
|
||||
NON_IT_TITLE_TERMS = (
|
||||
"business developer",
|
||||
"business development",
|
||||
"it recruitment",
|
||||
"it recruiter",
|
||||
"learning designer",
|
||||
)
|
||||
|
||||
IT_PROFILE_TERMS = (*IT_TITLE_TERMS, "networking", "security", "active directory", "intune")
|
||||
|
||||
|
||||
def _term_pattern(term: str) -> str:
|
||||
escaped = re.escape(term).replace(r"\ ", r"[\s/_-]+")
|
||||
return rf"(?<!\w){escaped}(?!\w)"
|
||||
|
||||
|
||||
IT_TITLE_PATTERN = "(?:" + "|".join(_term_pattern(term) for term in IT_TITLE_TERMS) + ")"
|
||||
NON_IT_TITLE_PATTERN = "(?:" + "|".join(_term_pattern(term) for term in NON_IT_TITLE_TERMS) + ")"
|
||||
_IT_TITLE_RE = re.compile(IT_TITLE_PATTERN, re.IGNORECASE)
|
||||
_NON_IT_TITLE_RE = re.compile(NON_IT_TITLE_PATTERN, re.IGNORECASE)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ItRelevanceAssessment:
|
||||
relevant: bool
|
||||
signals: tuple[str, ...]
|
||||
reason: str
|
||||
|
||||
|
||||
def assess_it_relevance(title: str) -> ItRelevanceAssessment:
|
||||
normalized_title = normalize_token(title)
|
||||
blocked_signal = _NON_IT_TITLE_RE.search(normalized_title)
|
||||
if blocked_signal:
|
||||
return ItRelevanceAssessment(
|
||||
relevant=False,
|
||||
signals=(),
|
||||
reason=f"Niet-technische titelcontext: {blocked_signal.group(0)}.",
|
||||
)
|
||||
signals = tuple(
|
||||
term
|
||||
for term in IT_TITLE_TERMS
|
||||
if re.search(_term_pattern(normalize_token(term)), normalized_title, re.IGNORECASE)
|
||||
)
|
||||
if signals:
|
||||
return ItRelevanceAssessment(
|
||||
relevant=True,
|
||||
signals=signals[:4],
|
||||
reason="IT-signaal in functietitel: " + ", ".join(signals[:4]),
|
||||
)
|
||||
return ItRelevanceAssessment(
|
||||
relevant=False,
|
||||
signals=(),
|
||||
reason="Geen aantoonbaar IT-signaal in de functietitel.",
|
||||
)
|
||||
|
||||
|
||||
def profile_requires_it_focus(profile: SearchProfile) -> bool:
|
||||
configured = " ".join([profile.name, *profile.desired_titles, *profile.desired_skills])
|
||||
normalized = normalize_token(configured)
|
||||
return any(
|
||||
re.search(_term_pattern(normalize_token(term)), normalized, re.IGNORECASE)
|
||||
for term in IT_PROFILE_TERMS
|
||||
)
|
||||
|
||||
|
||||
def it_relevance_query(prefix: str = "") -> Q:
|
||||
"""Return the database equivalent of the conservative title-led classifier."""
|
||||
return Q(**{f"{prefix}original_title__iregex": IT_TITLE_PATTERN}) & ~Q(
|
||||
**{f"{prefix}original_title__iregex": NON_IT_TITLE_PATTERN}
|
||||
)
|
||||
@@ -14,6 +14,7 @@ from apps.jobs.services.geocoding import resolve_cached_location
|
||||
from apps.profiles.models import SearchProfile
|
||||
|
||||
from .normalization import normalize_token
|
||||
from .relevance import assess_it_relevance, profile_requires_it_focus
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -227,6 +228,9 @@ def _hard_exclusions(
|
||||
conflicts = sorted(excluded_skills.intersection(explicit_job_skills))
|
||||
if conflicts:
|
||||
reasons.append("Uitgesloten verplichte skill: " + ", ".join(conflicts))
|
||||
it_relevance = assess_it_relevance(job.original_title)
|
||||
if profile_requires_it_focus(profile) and not it_relevance.relevant:
|
||||
reasons.append(it_relevance.reason)
|
||||
return reasons, distance.distance_confidence
|
||||
|
||||
|
||||
@@ -292,6 +296,7 @@ def _analyze_with_ai(job: JobPosting, profile: SearchProfile) -> tuple[AiAnalysi
|
||||
def calculate_score(job: JobPosting, profile: SearchProfile) -> ScoreResult:
|
||||
distance = _distance(job, profile)
|
||||
exclusions, distance_confidence = _hard_exclusions(job, profile, distance)
|
||||
it_relevance = assess_it_relevance(job.original_title)
|
||||
title_fit = _title_fit(job, profile)
|
||||
skill_fit, present_skills, missing_skills = _skill_fit(job, profile)
|
||||
features = job.analysis_features or {}
|
||||
@@ -381,6 +386,8 @@ def calculate_score(job: JobPosting, profile: SearchProfile) -> ScoreResult:
|
||||
concerns: list[str] = []
|
||||
if title_fit >= 0.75:
|
||||
positives.append("Functietitel sluit goed aan op het zoekprofiel.")
|
||||
if it_relevance.relevant:
|
||||
positives.append("IT-focus bevestigd via de functietitel.")
|
||||
if present_skills:
|
||||
positives.append("Herkenbare skills: " + ", ".join(present_skills[:6]))
|
||||
if job.direct_employer and not job.recruiter:
|
||||
@@ -435,6 +442,11 @@ def calculate_score(job: JobPosting, profile: SearchProfile) -> ScoreResult:
|
||||
concerns=concerns,
|
||||
hard_exclusions=exclusions,
|
||||
evidence={
|
||||
"it_relevance": {
|
||||
"relevant": it_relevance.relevant,
|
||||
"signals": list(it_relevance.signals),
|
||||
"reason": it_relevance.reason,
|
||||
},
|
||||
"distance_km": distance.exact_distance_km,
|
||||
"distance_has_data": distance.has_distance_data,
|
||||
"distance_exact": distance.exact_distance_km is not None,
|
||||
|
||||
Reference in New Issue
Block a user