add medical_center flag: clinical/HCOMP faculty and medical-center clinical staff

Orthogonal boolean column alongside category, computed in classifier.py's
new is_medical_center(). Always flags MED CTR-tagged titles and the
existing HS CLIN PROF/-HCOMP patterns regardless of campus; additionally
flags generic clinical-workforce titles (physicians, nurses, dentists,
pharmacists, therapists, techs, etc.) only at the five campuses that
operate a UC-owned academic medical center (UCSF, UCLA, UCD, UCI, UCSD),
since those titles are indistinguishable from Student Health Services
staff elsewhere. SHS-tagged titles are always excluded.

Threaded through as a --group-by dimension for --aggregate-output and
as a column on --top-earners-output rows, alongside the per-employee CSV.
This commit is contained in:
Miloš Jovanović 2026-08-04 22:52:58 +00:00
parent efce6f3dec
commit 99d5108d76
2 changed files with 95 additions and 21 deletions

View file

@ -376,3 +376,69 @@ def classify_title(raw_title: str, gross_pay: float = 0.0,
return "PROF_STAFF"
else:
return "SUPPORT_STAFF"
# ---------------------------------------------------------------------------
# MEDICAL CENTER FLAG
# ---------------------------------------------------------------------------
# Orthogonal to classify_title()'s category: marks employees working at a UC
# academic medical center (clinical/HCOMP faculty, physicians, nurses, and
# the broader allied-health/hospital-operations workforce), regardless of
# which of the 8 categories they land in above.
#
# Built from actual UC-wages title text, not guessed. Two signals:
#
# 1. ALWAYS (any campus): titles that are unambiguous wherever they appear.
# - "MED CTR" literal substring -- only ever seen on hospital-building
# facilities/exec titles (MED CTR COOK, CEO MED CTR, etc.), never on
# clinical professional titles, never at non-medical-center campuses.
# - HS CLIN PROF / HS CLIN INSTR series (Health Sciences clinical
# faculty -- same titles already routed to NON_SENATE_ACADEMIC above).
# - Bare "-HCOMP" ladder titles (Health Sciences Compensation Plan --
# same titles already routed to SENATE_FACULTY above).
#
# 2. ONLY at the 5 campuses that operate a UC-owned academic medical center
# (UCSF, UCLA, UCD, UCI, UCSD -- UC Riverside has a medical school but no
# UC-owned teaching hospital of its own): generic clinical-workforce
# titles (physicians, nurses, dentists, pharmacists, therapists, techs,
# etc.). These same titles show up identically at every campus (student
# health services exists everywhere), so outside these 5 campuses they
# can't be told apart from student health staff by title text alone.
#
# EXCLUDED everywhere: any title containing "SHS" (Student Health Services)
# -- present even at UCSF (e.g. "HC ADM SHS MGR 1"), a distinct campus-wide
# operation from the hospital system.
MEDICAL_CENTER_CAMPUSES = frozenset({"UCSF", "UCLA", "UCD", "UCI", "UCSD"})
_MEDICAL_ALWAYS_RX = _rx(
r"MED CTR",
r"^HS\s+(?:ASST\s+|ASSOC\s+)?CLIN (?:PROF|INSTR)\b",
r"-HCOMP\b",
)
_MEDICAL_CLINICAL_STAFF_RX = _rx(
r"\bPHYSICIAN\b", r"\bPHYSCN\b", r"\bNURSE\b", r"\bANESTHET",
r"\bDENTIST\b", r"\bPHARM", r"\bTHERAPIST\b", r"\bRESP THER",
r"\bPERFUSION", r"\bMIDWIFE\b", r"\bAUDIOLOG", r"\bOPTOMETR",
r"\bDIETIT", r"\bCLIN SOCIAL", r"\bRADIOLOG", r"\bCLIN LAB",
r"\bPHLEBOTOM", r"\bMED TCHN\b", r"\bNUC MED TCHNO\b", r"\bDIALYSIS\b",
r"\bULTRASOUND\b", r"\bECHOCARD", r"\bEEG\b", r"\bCATH LAB\b",
r"\bPSYCHIAT",
)
_MEDICAL_EXCLUDE_RX = _rx(r"\bSHS\b")
def is_medical_center(raw_title: str, campus: str) -> bool:
t = normalise(raw_title)
if any(rx.search(t) for rx in _MEDICAL_EXCLUDE_RX):
return False
if any(rx.search(t) for rx in _MEDICAL_ALWAYS_RX):
return True
if campus in MEDICAL_CENTER_CAMPUSES:
return any(rx.search(t) for rx in _MEDICAL_CLINICAL_STAFF_RX)
return False