Merge the seniority ladder's levels: title rules, host tables, extract, migration 25 (wp-sen-a-levels)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # app/prep/hosts/jobylon.py # app/prep/hosts/recruitee.py
This commit is contained in:
commit
dd9e359609
16 files changed
+328
-138
No files matched your search
+22
-10
@@ -72,16 +72,28 @@ Fields:
|
||||
("Berlin", "Greater London"). '' if none is named.
|
||||
- country: ISO 3166-1 alpha-2 code of that place ("DE", "GB"), or ''.
|
||||
- remote: "remote", "hybrid" or "onsite" only when the posting says so, else ''.
|
||||
- seniority: exactly one of {", ".join(s for s in SENIORITIES if s)}, for every
|
||||
posting; never ''. This is the one field where you decide rather than
|
||||
extract. Judge the level of the person hired from the title and the text (or
|
||||
the short teaser when there is no text), weighing years of experience,
|
||||
scope and who the role reports to. `stated` is the level the job board
|
||||
itself gave and `title_level` the one a word in the title suggests. Both
|
||||
are hints: boards use different vocabularies and many state nothing, so
|
||||
overrule them when the posting says otherwise. When nothing says, choose the
|
||||
likeliest level for that kind of title; most postings are for individual
|
||||
contributors, not managers.
|
||||
- seniority: exactly one of {", ".join(LEVELS)}, for every posting; never ''.
|
||||
This is the one field where you decide rather than extract. The levels are
|
||||
one ladder; from staff up each rung has an individual-contributor level and
|
||||
a people-lead level of equal weight:
|
||||
intern, junior, mid, senior: no track.
|
||||
staff (Staff, Tech Lead, "Lead Engineer", "Marketing Lead") |
|
||||
lead (Team Lead, Supervisor) or manager (manages a team).
|
||||
principal (Principal, Senior Staff) |
|
||||
senior_manager (Senior Manager, manages managers, Associate Director).
|
||||
distinguished (Senior Principal, Distinguished, Technical Fellow) |
|
||||
director (Director, Head of a function).
|
||||
exec (VP, C-level, Managing Director).
|
||||
Choose a people level only when the hire manages people; a Product,
|
||||
Account or Project Manager is an individual contributor. Judge the level of
|
||||
the person hired from the title and the text (or the short teaser when
|
||||
there is no text), weighing years of experience, scope and who the role
|
||||
reports to. `stated` is the level the job board itself gave and
|
||||
`title_level` the one a word in the title suggests. Both are hints: boards
|
||||
use different vocabularies and many state nothing, so overrule them when
|
||||
the posting says otherwise. When nothing says, choose the likeliest level
|
||||
for that kind of title; most postings are for individual contributors, not
|
||||
managers.
|
||||
- salary_min, salary_max: yearly gross amounts as integers, or null. A stated
|
||||
monthly figure is multiplied by 12; an hourly or daily rate is null. A single
|
||||
figure is both min and max.
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
#: The embed's `experience`. Only the coarse levels are mapped; "Experienced"
|
||||
#: sits between "Mid level" and the managerial levels and says too little to
|
||||
#: place, so it maps to none.
|
||||
#: place, so it maps to none. "Lead" is a senior individual ("Lead
|
||||
#: Engineer"), `staff`, beside the managerial "Manager".
|
||||
SENIORITY: dict[str, str] = {
|
||||
"student": "intern", "internship": "intern", "trainee": "intern",
|
||||
"entry level": "junior", "entry-level": "junior", "junior": "junior",
|
||||
"graduate": "junior", "mid level": "mid", "mid-level": "mid", "mid": "mid",
|
||||
"senior": "senior", "lead": "lead", "manager": "manager", "director": "director",
|
||||
"senior": "senior", "lead": "staff", "manager": "manager", "director": "director",
|
||||
"executive": "exec", "not applicable": "", "experienced": ""}
|
||||
|
||||
#: The embed's `employment_type`.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"""Recruitee's words, for prep."""
|
||||
|
||||
#: `experience_code`. `experienced` names no level and is known, so it maps
|
||||
#: to none.
|
||||
SENIORITY = {"student_school": "intern", "student_college": "intern", "entry_level": "junior",
|
||||
"mid_level": "mid", "experienced": "", "manager": "manager",
|
||||
"senior_manager": "senior_manager", "executive": "exec"}
|
||||
#: to none. A college student is an intern as a school one is.
|
||||
SENIORITY = {"student_school": "intern", "student_college": "intern",
|
||||
"entry_level": "junior", "mid_level": "mid", "experienced": "",
|
||||
"manager": "manager", "senior_manager": "senior_manager", "executive": "exec"}
|
||||
|
||||
#: The words of `employment_type_code` (`fulltime_permanent`), which is
|
||||
#: lowercased and split at "_" and "-"; the first entry found among its words
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ from app.storage import Store
|
||||
|
||||
#: Raised when the rules in this package change the way a stored word maps,
|
||||
#: so every open role is mapped again as it is after a table changes.
|
||||
VERSION = 1
|
||||
VERSION = 2
|
||||
|
||||
#: The state key the last run's `fingerprint` is kept under.
|
||||
STATE = "prep:tables"
|
||||
|
||||
+157
-80
@@ -13,38 +13,58 @@ pattern is a word-bounded regex against that. Patterns are therefore written
|
||||
folded: `direktör` is `direktor`, `chef d'équipe` is `chef d equipe`; `ø` and
|
||||
`æ` stay as they are, since NFKD does not decompose them.
|
||||
|
||||
The highest level named wins, checked from `exec` down: "Senior Director" is
|
||||
a director, "Managing Director" an exec, "Lead Project Manager" a lead. The
|
||||
one exception is `intern`, tried first: a title that says internship or
|
||||
thesis is one whatever it names after ("Praktikum ... Assistenz des Senior
|
||||
Vice Presidents"). A C-level or head named as the boss of the person hired
|
||||
("Executive Assistant to the CEO", "Office of the Head of ...") is cut out
|
||||
before matching (`_NOISE`). Rules that decide the doubtful cases:
|
||||
The levels are the ladder of `app.models.LADDER`: from `staff` up, a rung has
|
||||
an individual-contributor level and a people-lead level. A title is matched
|
||||
twice, for the highest people level it names (`_PEOPLE`: a head, a manager,
|
||||
a team lead) and for the highest individual grade (`_GRADES`: Principal,
|
||||
Staff, Senior). A people level wins over a grade on its own rung or below:
|
||||
"Staff Engineering Manager" is a manager, "Senior Director" a director. A
|
||||
grade above the people level's rung lifts it one rung, and one only:
|
||||
"Principal Engineering Manager" is a senior manager. Without a people level
|
||||
the grade decides: "Principal Product Manager" is principal, since a product
|
||||
manager is an individual contributor. A slash names two levels (`_OR`):
|
||||
"Senior/Staff Engineer" is staff, not a Senior Staff. The one exception is `intern`, tried
|
||||
first: a title that says internship or thesis is one whatever it names after
|
||||
("Praktikum ... Assistenz des Senior Vice Presidents"). A C-level or head
|
||||
named as the boss of the person hired ("Executive Assistant to the CEO",
|
||||
"Office of the Head of ...") is cut out before matching (`_NOISE`). Rules
|
||||
that decide the doubtful cases:
|
||||
|
||||
- **exec** is C-level ("Chief ... Officer", CTO), "VP" and above (a bank's VP
|
||||
is mid-level, but a tech company's is not, and the filter is the reader's:
|
||||
exec), "Managing Director", Geschäftsführer, Vorstand and VD.
|
||||
- **director** is the word in English, Danish, Swedish, German, French,
|
||||
Spanish and Italian, "Head of" and a title's own first word "Head", and the
|
||||
German "Leiter" alone or of a whole department (Bereichsleiter,
|
||||
Abteilungsleiter). "Senior Director" and "Executive Director" are directors.
|
||||
- **senior_manager** is "Senior Manager", a senior people manager ("Sr.
|
||||
Engineering Manager"), "Associate Director", "Assistant Director" and a
|
||||
bank's "Assistant Vice President" (AVP, Associate VP).
|
||||
- **manager** is a level only where the word means someone who runs a team:
|
||||
a bare "Manager", "Senior Manager", "Manager, Data Science" (the word
|
||||
first, as a level), an "Assistant Store Manager" as a lead, and the compounds whose department or place is what is
|
||||
managed (`_PEOPLE_MANAGER`: engineering, team, store, general ...). Every
|
||||
other "X Manager" is an individual contributor by function (Account,
|
||||
Product, Project, Customer Success, Office, Marketing, Sales ...) and says
|
||||
nothing, so "Senior Product Manager" is senior. An unlisted compound stays
|
||||
unknown, which costs a recall the filter's "and no level" makes up.
|
||||
- **director** is the word in English, Danish, Swedish, German, French, Spanish
|
||||
and Italian, "Head of" and a title's own first word "Head", and the German
|
||||
"Leiter" alone or of a whole department (Bereichsleiter, Abteilungsleiter).
|
||||
"Associate Director" and "Executive Director" are directors. **manager** is
|
||||
also the Danish, Swedish, German and Dutch head of a shop, site or office
|
||||
(-chef, -leder, Filialleiter, Kontorchef), French "responsable" and "gérant",
|
||||
Spanish "jefe" and "gerente". **exec** is C-level ("Chief ... Officer", CTO), "VP" and above
|
||||
(a bank's VP is mid-level, but a tech company's is not, and the filter is
|
||||
the reader's: exec), "Managing Director", Geschäftsführer, Vorstand and VD.
|
||||
A bank's "Assistant Vice President" is a director.
|
||||
- **lead** is "Lead" as a noun at either end ("Tech Lead", "Lead Engineer";
|
||||
not "Lead Generation"), "Leader", "Supervisor", and the team-sized German,
|
||||
Danish, Dutch and French forms (Teamleiter, Teamleider, chef d'équipe).
|
||||
- **staff** is "Staff" and "Principal". "Staff Nurse", "Staff Accountant"
|
||||
and their kind are left out; "Principal Investigator" and a
|
||||
"Staff Scientist" at a lab are taken as staff and are not.
|
||||
a bare "Manager", "Manager, Data Science" (the word first, as a level), and
|
||||
the compounds whose department or place is what is managed
|
||||
(`_PEOPLE_MANAGER`: engineering, team, store, general ...), and a "Tech
|
||||
Lead Manager". Every other "X
|
||||
Manager" is an individual contributor by function (Account, Product,
|
||||
Project, Customer Success, Office, Marketing, Sales ...) and says nothing,
|
||||
so "Senior Product Manager" is senior. An unlisted compound stays unknown,
|
||||
which costs a recall the filter's "and no level" makes up. **manager** is
|
||||
also the head of a shop, site or office: "Store Leader", the Danish,
|
||||
Swedish, German and Dutch -chef, -leder, Filialleiter, Kontorchef, French
|
||||
"responsable" and "gérant", Spanish "jefe" and "gerente".
|
||||
- **lead** is a team lead: "Team Lead", "Team Leader", the floor-sized leads
|
||||
(`_TEAM_SIZED_LEAD`: shift, crew, kitchen ...), a "People Leader",
|
||||
"Supervisor", an "Assistant Store Manager" or "Associate Store Leader", and
|
||||
the team-sized German, Danish, Dutch, Swedish and French forms (Teamleiter,
|
||||
Teamleider, teamledare, chef d'équipe).
|
||||
- **distinguished** is "Senior Principal", "Distinguished", "Technical
|
||||
Fellow", "Engineering Fellow" and SAP's "Chief Expert". "Fellow" alone is
|
||||
academic ("Research Fellow", "Postdoctoral Fellow") and says nothing.
|
||||
- **principal** is "Principal" and "Senior Staff".
|
||||
- **staff** is "Staff", and "Lead" or "Leader" as a noun at either end that
|
||||
is not a team lead ("Tech Lead", "Lead Engineer", "Marketing Lead", "Sales
|
||||
Leader"; not "Lead Generation"). "Staff Nurse", "Staff Accountant" and their
|
||||
kind are left out.
|
||||
- **project managers stay unknown** in every language (Projektleiter,
|
||||
Bauleiter, chef de projet, projektleder, prosjektleder): they are Project
|
||||
Managers. Halbleiter and the other -leiter words for things are cut out too.
|
||||
@@ -55,9 +75,12 @@ before matching (`_NOISE`). Rules that decide the doubtful cases:
|
||||
"Mid-level", "Intermediate", "II", "Medior".
|
||||
|
||||
Known wrong, and left so: "Senior Care Assistant" and other "senior" that
|
||||
means elderly; "Level II" outside a role level; "Principal Investigator";
|
||||
"Staff" on a title with an unlisted staff noun; "Field CTO" taken as unknown;
|
||||
"Chief of Staff" as unknown; "Assistant Manager" as unknown; French "responsable" is
|
||||
means elderly; "Level II" outside a role level; "Principal Investigator" and
|
||||
a "Staff Scientist" at a lab as principal and staff; "Staff" on a title with
|
||||
an unlisted staff noun; a retail "Lead Store Advisor" and a "Sales Leader"
|
||||
who runs a team as staff; "Distinguished Engineer, Team Lead" as a senior
|
||||
manager, one rung above the lead; "Field CTO" taken as unknown; "Chief of
|
||||
Staff" as unknown; "Assistant Manager" as unknown; French "responsable" is
|
||||
taken as a manager wherever it stands, and "Directeur" of a small firm as a
|
||||
director; "VP" as exec at a bank.
|
||||
"""
|
||||
@@ -66,7 +89,7 @@ from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from app.models import title_key
|
||||
from app.models import LADDER, title_key
|
||||
|
||||
#: A C-level title or abbreviation, for `_NOISE`.
|
||||
_C_LEVEL = (r"(?:ceo|cto|cfo|coo|cio|ciso|cpo|cdo|chro|caio"
|
||||
@@ -96,6 +119,7 @@ _NOISE = re.compile(
|
||||
rf"|office|support|referent\w*|advisor|adviser) (?:\w+ ){{0,3}}?{_C_LEVEL}"
|
||||
rf"|{_C_LEVEL} (?:assistant|assistenz|office|team|support|founder associate)"
|
||||
r"|field (?:cto|cio|ciso)"
|
||||
r"|(?:technical|engineering|technology) fellows? office"
|
||||
r"|\w*(?:halb|nicht|supra|strom|blitzab)leiter"
|
||||
r"|\w*(?:projekt|prosjekt|project|bau|bygge|produkt)(?:leiter|leitung|leder|ledare|leider)(?:in)?"
|
||||
r"|zugchef\w*)\b"
|
||||
@@ -118,33 +142,40 @@ _HEAD_JOBS = (r"(?:chef|cook|barista|nurse|coach|waiter|bartender|mechanic|garde
|
||||
r"|teacher|cashier|housekeeper|receptionist|technician|butcher|baker"
|
||||
r"|stylist|of)")
|
||||
|
||||
#: `(level, patterns)`, in the order they are tried: `intern` first, since a
|
||||
#: title that says internship is one whatever it names after ("Internship, Office
|
||||
#: of the Head of Product"); then the rest from `exec` down. A title takes the
|
||||
#: first level with a match, so a rule need not exclude what a later rule claims.
|
||||
_RULES: tuple[tuple[str, tuple[str, ...]], ...] = (
|
||||
("intern", (
|
||||
r"\binterns?\b", r"\binternship\w*", r"\bwerkstudent\w*", r"\bworking students?\b",
|
||||
r"\bstudent (?:assistant|worker|helper|aide|job|position|trainee|employee)s?\b",
|
||||
r"\bstudentische\w*", r"\bstudent(?:er)?med(?:hj|arb)\w*",
|
||||
r"\bstudent\w*job\w*", r"\bjobstudent\b",
|
||||
r"\w*praktik(?:um|ant\w*|a|ophold|plads)?\b", r"\bpraxissemester\b", r"\bduales? studium\b",
|
||||
r"\bstagiaires?\b", r"\bstagiair\w*", r"\bstagista\b", r"\btirocin\w*",
|
||||
r"\bestagiari[oa]s?\b", r"\bbecari[oa]s?\b", r"\bpracticas\b", r"\bpracticante\b",
|
||||
r"\baprendiz\b", r"\balternan\w*", r"\bapprenti(?:e|es|s)?\b", r"\bapprentice\w*",
|
||||
r"\bazubi\b", r"\bauszubildende\w*", r"\bausbildung\b", r"\blehr(?:ling|ausbildung|stelle)\b",
|
||||
r"\w*lærling\w*", r"\b\w*elev\b",
|
||||
r"\b\w+student\b", r"(?<!phd )(?<!doctoral )(?<!graduate )(?<!masters )\bstudent$",
|
||||
r"\bvolontar\w*",
|
||||
r"\b(?:master|bachelor|abschluss)arbeit\b", r"\bthesis\b",
|
||||
r"\bmasterproef\b", r"\beindwerk\b", r"\bafstudeer\w*",
|
||||
# French and Dutch "stage": a title that starts or ends with it, or
|
||||
# says how many months, and not the English stage (Stage Manager, early stage).
|
||||
r"^stage\b(?! (?:manager|management|hand|crew|technician|director|lighting|door))",
|
||||
r"(?<!early )(?<!late )(?<!growth )(?<!seed )(?<!mid )(?<!next )(?<!final )"
|
||||
r"(?<!pre )(?<!first )(?<!phase )\bstage$",
|
||||
r"\bstage (?:\d+ )?(?:mois|mesi|maanden|months)\b",
|
||||
)),
|
||||
#: Floor-sized leads, which run a shift or a crew: "Shift Lead" and "Crew
|
||||
#: Leader" are team leads where "Marketing Lead" is an individual.
|
||||
_TEAM_SIZED_LEAD = r"(?:team|shift|crew|group|kitchen|warehouse|floor)"
|
||||
|
||||
#: What says the person is still studying or training, tried before
|
||||
#: anything else: a title that says internship is one whatever it names
|
||||
#: after ("Internship, Office of the Head of Product").
|
||||
_INTERN: tuple[str, ...] = (
|
||||
r"\binterns?\b", r"\binternship\w*", r"\bwerkstudent\w*", r"\bworking students?\b",
|
||||
r"\bstudent (?:assistant|worker|helper|aide|job|position|trainee|employee)s?\b",
|
||||
r"\bstudentische\w*", r"\bstudent(?:er)?med(?:hj|arb)\w*",
|
||||
r"\bstudent\w*job\w*", r"\bjobstudent\b",
|
||||
r"\w*praktik(?:um|ant\w*|a|ophold|plads)?\b", r"\bpraxissemester\b", r"\bduales? studium\b",
|
||||
r"\bstagiaires?\b", r"\bstagiair\w*", r"\bstagista\b", r"\btirocin\w*",
|
||||
r"\bestagiari[oa]s?\b", r"\bbecari[oa]s?\b", r"\bpracticas\b", r"\bpracticante\b",
|
||||
r"\baprendiz\b", r"\balternan\w*", r"\bapprenti(?:e|es|s)?\b", r"\bapprentice\w*",
|
||||
r"\bazubi\b", r"\bauszubildende\w*", r"\bausbildung\b", r"\blehr(?:ling|ausbildung|stelle)\b",
|
||||
r"\w*lærling\w*", r"\b\w*elev\b",
|
||||
r"\b\w+student\b", r"(?<!phd )(?<!doctoral )(?<!graduate )(?<!masters )\bstudent$",
|
||||
r"\bvolontar\w*",
|
||||
r"\b(?:master|bachelor|abschluss)arbeit\b", r"\bthesis\b",
|
||||
r"\bmasterproef\b", r"\beindwerk\b", r"\bafstudeer\w*",
|
||||
# French and Dutch "stage": a title that starts or ends with it, or
|
||||
# says how many months, and not the English stage (Stage Manager, early stage).
|
||||
r"^stage\b(?! (?:manager|management|hand|crew|technician|director|lighting|door))",
|
||||
r"(?<!early )(?<!late )(?<!growth )(?<!seed )(?<!mid )(?<!next )(?<!final )"
|
||||
r"(?<!pre )(?<!first )(?<!phase )\bstage$",
|
||||
r"\bstage (?:\d+ )?(?:mois|mesi|maanden|months)\b",
|
||||
)
|
||||
|
||||
#: `(level, patterns)` of the people track, from `exec` down. A title takes
|
||||
#: the first level with a match, so a rule need not exclude what a later rule
|
||||
#: claims.
|
||||
_PEOPLE: tuple[tuple[str, tuple[str, ...]], ...] = (
|
||||
("exec", (
|
||||
r"\b(?:ceo|cto|cfo|coo|cio|ciso|cpo|cdo|chro|caio)\b",
|
||||
r"\bchief(?: \w+){0,4}? officer\b", r"\bchief executive\b",
|
||||
@@ -156,9 +187,9 @@ _RULES: tuple[tuple[str, tuple[str, ...]], ...] = (
|
||||
r"\bgeschaftsfuhr\w*", r"\bgeschaftsleit\w*", r"\bvorstand\b",
|
||||
)),
|
||||
("director", (
|
||||
r"(?<!associate )(?<!assoc )(?<!assistant )(?<!asst )"
|
||||
r"\b(?:director(?:a|s|es|in)?|directeur|directrice|direktor(?:in|er)?"
|
||||
r"|direktør(?:er)?|direttore|direttrice)\b",
|
||||
r"\bavp\b", r"\b(?:assistant|associate|assoc) (?:vice president|vp)\b",
|
||||
r"\bhead of\b", r"\b(?:department|division|unit|practice|group|team|country|regional) head\b",
|
||||
rf"^head (?!{_HEAD_JOBS}\b)", r"\bhead$",
|
||||
# Leiter(in) alone or of a whole unit (Bereichsleiter), and a title that
|
||||
@@ -168,10 +199,15 @@ _RULES: tuple[tuple[str, tuple[str, ...]], ...] = (
|
||||
r"|entwicklungs|werks)leit(?:er|erin|ung)\b",
|
||||
r"\bhoofd\b",
|
||||
)),
|
||||
("senior_manager", (
|
||||
r"\b(?:associate|assoc|assistant|asst) director\b",
|
||||
r"\bavp\b", r"\b(?:assistant|associate|assoc) (?:vice president|vp)\b",
|
||||
rf"\b(?:senior|sr|snr) (?:{_PEOPLE_MANAGER} )?manager\b",
|
||||
)),
|
||||
("manager", (
|
||||
r"^(?:(?:senior|sr|global|regional|group|executive) )*manager\b",
|
||||
r"\b(?:senior|sr) manager\b",
|
||||
r"^(?:(?:global|regional|group|executive) )*manager\b",
|
||||
rf"(?<!assistant )(?<!deputy )(?<!asst )\b{_PEOPLE_MANAGER} manager\b",
|
||||
r"\btech lead manager\b", r"(?<!associate )\bstore lead(?:er)?\b",
|
||||
# -leiter / -leder / -leider of a shop, site or department: Filialleiter,
|
||||
# Afdelingsleder. The team-sized ones are lead (below), and project ones
|
||||
# are cut out by _NOISE. A -leitung is only these, since "Rohrleitung"
|
||||
@@ -192,18 +228,33 @@ _RULES: tuple[tuple[str, tuple[str, ...]], ...] = (
|
||||
r"\bresponsabile\b",
|
||||
)),
|
||||
("lead", (
|
||||
r"\b(?:team|tech|squad)?lead\b", r"\b(?:team|shift)?leader\b",
|
||||
rf"\b{_TEAM_SIZED_LEAD} ?lead(?:er)?s?\b",
|
||||
r"\bsupervisor\b", r"\bsuperviseur\b",
|
||||
rf"\b(?:assistant|deputy|asst) {_PEOPLE_MANAGER} manager\b",
|
||||
r"\bassociate store leader\b", r"\bpeople leader\b",
|
||||
r"\b(?:team|gruppen?|schicht|hold|vagt)(?:leit(?:er|erin|ung)|leder|leider)\b",
|
||||
r"\b(?:team|grupp)?ledare\b", r"\bchef(?: fe)? d equipe\b", r"\blider\b",
|
||||
r"\bjef[ea] de equipo\b",
|
||||
r"\b(?:team|grupp)?ledare\b", r"\bchef(?: fe)? d equipe\b",
|
||||
r"\blider de equip[oe]\b", r"\bjef[ea] de equipo\b",
|
||||
)),
|
||||
("staff", (
|
||||
r"\bstaff\b", r"\bprincipal\b", r"\bdistinguished\b",
|
||||
)
|
||||
|
||||
#: `(level, patterns)` of the individual grades, from the highest down, as
|
||||
#: `_PEOPLE`: "Senior Principal" is tried before "Principal".
|
||||
_GRADES: tuple[tuple[str, tuple[str, ...]], ...] = (
|
||||
("distinguished", (
|
||||
r"\b(?:senior|sr|snr) principal\b", r"\bdistinguished\b",
|
||||
r"\b(?:technical|engineering|technology) fellow\b",
|
||||
# SAP's top individual-contributor grade.
|
||||
r"\bchief expert\b",
|
||||
)),
|
||||
("principal", (
|
||||
r"\b(?:senior|sr|snr) staff\b", r"\bprincipal\b",
|
||||
)),
|
||||
("staff", (
|
||||
r"\bstaff\b",
|
||||
# "Lead" the noun at either end; the team leads are `_PEOPLE`'s.
|
||||
r"\b(?:tech)?lead\b", r"\bleader\b", r"\blider\b",
|
||||
)),
|
||||
("senior", (
|
||||
r"\b(?:senior|sr|snr|iii)\b",
|
||||
)),
|
||||
@@ -218,19 +269,45 @@ _RULES: tuple[tuple[str, tuple[str, ...]], ...] = (
|
||||
)),
|
||||
)
|
||||
|
||||
#: `_RULES`, compiled once, in the same order.
|
||||
_COMPILED: tuple[tuple[str, tuple[re.Pattern[str], ...]], ...] = tuple(
|
||||
(level, tuple(re.compile(pattern) for pattern in patterns))
|
||||
for level, patterns in _RULES)
|
||||
|
||||
def _compile(rules: tuple[tuple[str, tuple[str, ...]], ...]
|
||||
) -> tuple[tuple[str, re.Pattern[str]], ...]:
|
||||
"""Each level's patterns as one alternation, in the same order."""
|
||||
return tuple((level, re.compile("|".join(f"(?:{p})" for p in patterns)))
|
||||
for level, patterns in rules)
|
||||
|
||||
|
||||
_INTERN_RE = re.compile("|".join(f"(?:{p})" for p in _INTERN))
|
||||
_PEOPLE_RE = _compile(_PEOPLE)
|
||||
_GRADES_RE = _compile(_GRADES)
|
||||
|
||||
#: The people level one rung above each people level, for a grade that lifts it.
|
||||
_LIFT: dict[str, str] = {
|
||||
level: next((up for up, (r, t) in LADDER.items() if t == "people" and r == rung + 1), level)
|
||||
for level, (rung, track) in LADDER.items() if track == "people"}
|
||||
|
||||
|
||||
#: A slash between two words, which `title_key` would fold to a space:
|
||||
#: "Senior/Principal" names two grades, not a Senior Principal. The gender
|
||||
#: marker's single letters (m/w/d) are left to `title_key`.
|
||||
_OR = re.compile(r"(?<=\w\w|\w\.)\s*/\s*(?=\w\w)")
|
||||
|
||||
|
||||
def _first(rules: tuple[tuple[str, re.Pattern[str]], ...], folded: str) -> str:
|
||||
return next((level for level, pattern in rules if pattern.search(folded)), "")
|
||||
|
||||
|
||||
def from_title(title: str) -> str:
|
||||
"""The highest level `title` names, one of `SENIORITIES`, or `''` when it
|
||||
names none. See the module docstring for what counts."""
|
||||
folded = " ".join(_NOISE.sub(" ", title_key(title)).split())
|
||||
"""The level `title` names, one of `SENIORITIES`, or `''` when it names
|
||||
none. See the module docstring for what counts."""
|
||||
folded = " ".join(_NOISE.sub(" ", title_key(_OR.sub(" or ", title or ""))).split())
|
||||
if not folded:
|
||||
return ""
|
||||
for level, patterns in _COMPILED:
|
||||
if any(pattern.search(folded) for pattern in patterns):
|
||||
return level
|
||||
return ""
|
||||
if _INTERN_RE.search(folded):
|
||||
return "intern"
|
||||
people, grade = _first(_PEOPLE_RE, folded), _first(_GRADES_RE, folded)
|
||||
if not people:
|
||||
return grade
|
||||
if grade and LADDER[grade][0] > LADDER[people][0]:
|
||||
return _LIFT[people]
|
||||
return people
|
||||
@@ -611,6 +611,18 @@ ALTER TABLE companies ADD COLUMN hand_reason TEXT NOT NULL DEFAULT '';
|
||||
(24, "companies.all_countries takes over the All roles tag, and companies.all_roles "
|
||||
"means no role narrowing; a board's {\"terms\": false} becomes its company's "
|
||||
"all_roles", lambda conn: _split_all_roles(conn)),
|
||||
# Seniority became a ladder of two tracks (models.LADDER): staff, lead,
|
||||
# manager and director each split, so a model level in one of them is
|
||||
# emptied for extract to read the role again. The level shown is then
|
||||
# the first filled of the three, as Store.write_prep writes it; the
|
||||
# title's is mapped again by the next prep (app.prep.stage.VERSION 2).
|
||||
(25, "roles.seniority_model cleared where it is staff, lead, manager or director, "
|
||||
"which the ladder splits; roles.seniority from the model, stated and title levels", """
|
||||
UPDATE roles SET seniority_model = ''
|
||||
WHERE seniority_model IN ('staff', 'lead', 'manager', 'director');
|
||||
UPDATE roles SET seniority = COALESCE(NULLIF(seniority_model, ''),
|
||||
NULLIF(seniority_stated, ''), seniority_title);
|
||||
"""),
|
||||
)
|
||||
|
||||
#: What a file created from `SCHEMA` today is already at.
|
||||
|
||||
Reference in new issue
Block a user