jobs

package
v2.8.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jobs implements EdgeFetch's pure-CPU job & ATS intelligence engine: compensation & workplace normalization, Schema.org JobPosting JSON-LD extraction, EEO/AI boilerplate classification, JSON record chunking, 18+ ATS board/posting adapters & auto-discovery, company/domain anti-spoofing filters, redirect loss diagnostics, HTTP 402 / x402 payment-term sanitization, and ethical blocked hints.

Zero net/http or crypto/tls imports are permitted in WASM-compiled files so edgefetch-core.wasm stays well within Cloudflare Workers' bundle budget.

Index

Constants

View Source
const (
	HoursPerYear  = 2080 // 40h x 52w
	DaysPerYear   = 260  // 5d x 52w
	WeeksPerYear  = 52
	MonthsPerYear = 12
)

Annualization multipliers (standard full-time conventions).

View Source
const LeverBoardPageSize = 100

LeverBoardPageSize is the Lever postings page requested per board fetch (~19 KB per posting with descriptions).

View Source
const LocationUnknown = "unknown"

LocationUnknown is the bucket assigned when a location cannot be normalized confidently.

View Source
const SalaryMethod = "Employer-posted ranges from official ATS boards, annualized (hour x2080, day x260, week x52, month x12). " +
	"Deduplicated by posting URL, then postings with the same company, title family, seniority, currency, basis and " +
	"annualized range are collapsed into one observation (one employer posting one band in many cities counts once). " +
	"Percentiles use linear interpolation between closest ranks (Hyndman-Fan type 7). Currencies are never mixed."

SalaryMethod documents the statistics and weighting rules (also embedded in every report).

View Source
const SeniorityUnspecified = "unspecified"

SeniorityUnspecified is the seniority assigned when a title carries no level signal.

Variables

View Source
var PublicJobFeeds = []PublicJobFeedSpec{
	{ID: "weworkremotely", URL: "https://weworkremotely.com/remote-jobs.rss"},
	{ID: "himalayas", URL: "https://himalayas.app/jobs/api?limit=50"},
	{ID: "workingnomads", URL: "https://www.workingnomads.com/api/exposed_jobs/"},
}

PublicJobFeeds lists the keyless robots.txt-allowed remote job feeds integrated into jobs.

Functions

func AnnualizationFactor added in v2.8.19

func AnnualizationFactor(p PayPeriod) float64

AnnualizationFactor returns the multiplier that converts an amount in period p to a yearly amount (0 = unknown).

func CanonicalJobKey

func CanonicalJobKey(company, title string) string

CanonicalJobKey returns a deduplication key `company::title` stripping parenthetical suffixes and punctuation.

func DecodeEntitiesBasic

func DecodeEntitiesBasic(s string) string

DecodeEntitiesBasic decodes common named HTML entities and valid scalar numeric character references.

func DecodeURIComponent

func DecodeURIComponent(s string) (string, bool)

DecodeURIComponent matches JavaScript decodeURIComponent (percent-only unescaping + strict UTF-8 check).

func DefaultHTMLToMD

func DefaultHTMLToMD(frag, base string) (string, []string)

DefaultHTMLToMD converts an HTML fragment to Markdown using extract.ExtractHTMLDocumentFull.

func DetectWorkdayRedirectStub

func DetectWorkdayRedirectStub(rawBody, baseURL string) (string, bool)

DetectWorkdayRedirectStub detects Workday's `{"widget":"redirect","url":"/Workday","externalSpa":true}` stub response.

func EncodeURIComponent

func EncodeURIComponent(s string) string

EncodeURIComponent matches JavaScript encodeURIComponent (preserving A-Z a-z 0-9 - _ . ! ~ * ' ( )).

func ExpandCompanyFilterTokens

func ExpandCompanyFilterTokens(rawCompany string) []string

ExpandCompanyFilterTokens expands a raw company name, domain, or career URL into canonical brand filter tokens.

func ExtractWorkdayReqID

func ExtractWorkdayReqID(uStr string) string

ExtractWorkdayReqID extracts the trailing `_<reqId>` token from a Workday job posting URL.

func FormatJobPostingHeaderMarkdown

func FormatJobPostingHeaderMarkdown(jp StructuredJobPosting) string

FormatJobPostingHeaderMarkdown formats a crisp top-of-document Markdown summary block for a StructuredJobPosting.

func FormatNormalizedPay

func FormatNormalizedPay(pay *NormalizedPay) string

FormatNormalizedPay formats a NormalizedPay into a crisp summary (e.g. `$230,000–$350,000 USD/year (base)`).

func FormatSalaryReportMarkdown added in v2.8.19

func FormatSalaryReportMarkdown(rep SalaryReport) string

FormatSalaryReportMarkdown renders a compact Markdown summary of rep.

func HasExecutableScriptTag

func HasExecutableScriptTag(rawHTML string) bool

HasExecutableScriptTag returns true only when rawHTML contains at least one executable `<script>` tag.

func InferCompanyFromATSURL

func InferCompanyFromATSURL(urlStr string) string

InferCompanyFromATSURL extracts the tenant/company slug from a known ATS URL.

func IsJobLabelKnownStale

func IsJobLabelKnownStale(label string, maxDays float64) bool

IsJobLabelKnownStale checks whether an unparsed relative postedLabel (e.g. `30+ days ago`) is older than maxDays.

func IsJobLegalBoilerplateChunk

func IsJobLegalBoilerplateChunk(text, heading string) bool

IsJobLegalBoilerplateChunk detects EEO, disability accommodations, AI-in-hiring, and privacy boilerplate chunks.

func IsKnownATSPostingHostWithUnresolvedSlug

func IsKnownATSPostingHostWithUnresolvedSlug(urlStr string) (platform, rawSlug string, ok bool)

IsKnownATSPostingHostWithUnresolvedSlug checks if urlStr targets a known ATS host whose slug failed normal parsing.

func IsKnownMultiTenantATSHost

func IsKnownMultiTenantATSHost(host string) bool

IsKnownMultiTenantATSHost reports whether host belongs to a multi-tenant ATS vendor.

func IsSmartRecruitersBoardURL

func IsSmartRecruitersBoardURL(urlStr string) (org, boardURL string, ok bool)

IsSmartRecruitersBoardURL checks if urlStr is a root SmartRecruiters company board URL (`https://jobs.smartrecruiters.com/{Org}`).

func IsThinScriptedPage

func IsThinScriptedPage(rawHTML, extractedMarkdown string) bool

IsThinScriptedPage determines whether a `<script>`-bearing HTML page yielded a thin/filter-only shell (`< 80` words or `> 60%` nav/link lines).

func IsValidATSSlug

func IsValidATSSlug(slug string) bool

IsValidATSSlug checks whether an ATS board slug (1 or 2 `/`-separated segments) is non-junk and structurally valid.

func IsValidAshbySlug

func IsValidAshbySlug(slug string) bool

IsValidAshbySlug checks Ashby organization slugs, permitting single internal spaces (e.g. `Hippocratic AI`).

func MarshalNoEscape

func MarshalNoEscape(v any) string

MarshalNoEscape serializes v to compact JSON without HTML-escaping `<`, `>`, or `&`.

func MatchTitleQuery added in v2.8.19

func MatchTitleQuery(query string) (family string, seniority string)

MatchTitleQuery normalizes a free-text user query ("senior swe salary in london") into the same (family, seniority) space as NormalizeTitleFamily: it drops salary/question filler words and anything after " in " / " at " / " near " (location and company are separate query fields), then normalizes. Seniority is "" (no filter) when the query names no level.

func MatchesATSTenantSlugAgainstToken

func MatchesATSTenantSlugAgainstToken(rawSlug, tok string, opts TenantSlugMatchOptions) bool

MatchesATSTenantSlugAgainstToken checks whether rawSlug legitimately matches brand token tok.

func MatchesAllowedCompanyOrDomain

func MatchesAllowedCompanyOrDomain(job StructuredJobRecord, allowedTokens []string, allowedBoardPrefixes []string) bool

MatchesAllowedCompanyOrDomain strictly verifies whether job belongs to the requested company/domain scope, blocking impostor ATS slugs, cross-TLD spoofs, shared-hosting subdomains, and open job aggregators.

func MatchesGeoLocationsFilter

func MatchesGeoLocationsFilter(jobLocations, geoFilters []string) bool

MatchesGeoLocationsFilter checks jobLocations against geographic filter tokens (including US state/city vs Canadian province disambiguation).

func MatchesJobQueryRelevance

func MatchesJobQueryRelevance(title, snippet, query string) string

MatchesJobQueryRelevance returns `"phrase"`, `"all_tokens"`, or `""` (no match).

func MatchesScopedATSCandidateURL

func MatchesScopedATSCandidateURL(u string, hasScope bool, allowedTokens []string, segmentedTokens []string, confirmedBoardURLs []string, companyFilter string) bool

MatchesScopedATSCandidateURL checks whether a search-discovered ATS URL belongs to the requested company/domain scope.

func NormalizeCompanyKey added in v2.8.19

func NormalizeCompanyKey(name string) string

NormalizeCompanyKey lowercases, folds accents, keeps ASCII letters/digits as space-separated words, and drops trailing legal suffixes ("Acme, Inc." -> "acme").

func NormalizeDottedCorporateAbbreviations

func NormalizeDottedCorporateAbbreviations(raw string) string

NormalizeDottedCorporateAbbreviations collapses dotted corporate/geo abbreviations (`L.L.C.` -> `llc`, `U.S.A.` -> `usa`) without collapsing spaced/dotted brand spoofs like `S.T.R.I.P.E`.

func NormalizeLocationBucket added in v2.8.19

func NormalizeLocationBucket(loc string) (bucket, country string)

NormalizeLocationBucket maps a free-text posting location to a deterministic bucket and ISO2 country:

  • "remote" when the text says remote/anywhere/WFH/distributed (country = any region named, e.g. "Remote - US" -> US)
  • "metro:<slug>" for a known metro alias (suburbs fold in, e.g. "Palo Alto, CA" -> metro:san-francisco) unless an explicit region contradicts the metro's country ("London, ON" -> country:CA, "Vancouver, WA" -> country:US)
  • "country:<ISO2>" when only a country, US state, Canadian province or ISO code is recognized
  • "unknown" otherwise

Only the first of several ';' / ' or ' / ' and ' / ' & ' separated locations is considered.

func NormalizeLocationQuery added in v2.8.19

func NormalizeLocationQuery(q string) string

NormalizeLocationQuery normalizes a user location query: already-bucketed values ("remote", "country:us", "metro:london") pass through canonicalized; free text goes through NormalizeLocationBucket. Empty input returns "" (no location filter).

func NormalizeSeniorityQuery added in v2.8.19

func NormalizeSeniorityQuery(s string) string

NormalizeSeniorityQuery canonicalizes a seniority filter ("Sr" -> senior, "VP" -> vp); unknown -> "".

func NormalizeTitleFamily added in v2.8.19

func NormalizeTitleFamily(title string) (family string, seniority string)

NormalizeTitleFamily reduces a posting title to a canonical (family, seniority) pair. Deterministic rules:

  1. Decode entities, strip invisible runes, lowercase, fold accents, cap at 300 bytes.
  2. Remove (...) [...] {...} groups; a group consisting only of level words still contributes its level.
  3. Drop tokens with 3+ digits (requisition ids, years).
  4. Split into clauses on , ; : | @ " - " " / ". The first clause with non-level words is the head; trailing clauses (specializations, teams, locations) never enter the family and contribute a level only when they consist solely of level words ("Software Engineer, Senior").
  5. Level words: intern/co-op, junior/jr/associate/new grad/entry level, mid/intermediate, senior/sr, lead, staff, principal/distinguished, manager, senior manager, director, head (of), vp/vice president, chief (executive). Highest word level wins. Roman I..V (and a trailing 1..5) map to junior, mid, senior, staff, principal and apply only when no word level is present.
  6. Manager: "Manager, X" / "Manager of X" / "Senior Manager, X" give family "X manager" and seniority manager (senior manager); "<engineering|science|design|analytics|research|infrastructure|qa> manager" is also a people-management level; other "X manager" titles (product, account, ...) are functional families.
  7. Noise words (remote, hybrid, contract, US/EMEA, ...) are dropped and the remainder maps through a small synonym table (swe/software developer/engineer -> software engineer, sre -> site reliability engineer, pm -> product manager when standalone, "<backend|frontend|...> developer" -> "<...> engineer").

Seniority is SeniorityUnspecified when no level is found; family is "" when nothing remains.

func NormalizeWorkdayPostedAt

func NormalizeWorkdayPostedAt(rawPostedOn string, now time.Time) string

NormalizeWorkdayPostedAt returns only the authoritative ISO date string (or `""`) for a Workday `startDate`/`postedOn`.

func ParseWorkdayPostedField

func ParseWorkdayPostedField(rawPostedOn string, now time.Time) (postedAt *string, postedLabel string)

ParseWorkdayPostedField parses Workday `postedOn` / `startDate` values into genuine ISO dates vs open-ended bucket labels (`30+ days ago`).

func SafeJSONParse

func SafeJSONParse(raw string) any

SafeJSONParse unmarshals JSON after stripping any leading UTF-8 BOM, returning nil on error.

func SalaryPercentile added in v2.8.19

func SalaryPercentile(sorted []float64, p float64) float64

SalaryPercentile returns the p-quantile (0..1) of sorted values using linear interpolation between closest ranks (Hyndman-Fan type 7; numpy default, Excel PERCENTILE.INC): h = (n-1)p, q = x[floor(h)] + (h-floor(h)) * (x[floor(h)+1] - x[floor(h)]). Returns 0 for an empty slice.

func SanitizeISOCurrencyCode

func SanitizeISOCurrencyCode(raw string, fallback string) string

SanitizeISOCurrencyCode validates a 3-letter ASCII ISO currency code or returns fallback.

func SanitizeJobFieldPlain

func SanitizeJobFieldPlain(raw string, maxLen int) string

SanitizeJobFieldPlain sanitizes plain metadata fields, neutralizing unsafe Markdown links and escaping residual angle brackets.

func ScaleShorthandAnnualAmount

func ScaleShorthandAnnualAmount(val *float64, period PayPeriod) *float64

ScaleShorthandAnnualAmount expands Ashby/shorthand annual thousands (`230` -> `230000`) when period == `year`.

func StripHTMLTagsQuoteAware

func StripHTMLTagsQuoteAware(src, replacement string) string

StripHTMLTagsQuoteAware strips HTML comments, CDATA wrappers, and quote-aware HTML tags in linear O(N) time.

func StripInvisibleJobChars

func StripInvisibleJobChars(s string) string

StripInvisibleJobChars strips ANSI CSI sequences, Unicode Tags (U+E0000..U+E007F), Variation Selectors Supplement (U+E0100..U+E01EF), BiDi overrides/isolates, zero-width chars, and C0/C1 controls.

func StripTagsPlain

func StripTagsPlain(s string) string

StripTagsPlain removes invisible chars, strips HTML tags, decodes entities, re-strips smuggled invisible chars, and collapses whitespace.

Types

type ATSBoardStatus

type ATSBoardStatus string

ATSBoardStatus classifies an ATS board probe into 6 deterministic outcomes.

const (
	BoardStatusOK              ATSBoardStatus = "ok"
	BoardStatusEmptyBoard      ATSBoardStatus = "empty_board"
	BoardStatusWrongSlug       ATSBoardStatus = "wrong_slug"
	BoardStatusBlockedOrDown   ATSBoardStatus = "blocked_or_down"
	BoardStatusNotFound        ATSBoardStatus = "not_found"
	BoardStatusBudgetExhausted ATSBoardStatus = "budget_exhausted"
)

func ClassifyATSBoardStatus

func ClassifyATSBoardStatus(params ClassifyBoardStatusParams) ATSBoardStatus

ClassifyATSBoardStatus classifies an ATS board HTTP response into `ok`, `empty_board`, `wrong_slug`, or `blocked_or_down`.

type ATSFormattedResult

type ATSFormattedResult struct {
	Title         string                `json:"title"`
	Description   string                `json:"description,omitempty"`
	PublishedTime string                `json:"publishedTime,omitempty"`
	Markdown      string                `json:"markdown"`
	Links         []string              `json:"links,omitempty"`
	JobPosting    *StructuredJobPosting `json:"jobPosting,omitempty"`
	Jobs          []StructuredJobRecord `json:"jobs,omitempty"`
	Total         *int                  `json:"total,omitempty"`
	Returned      *int                  `json:"returned,omitempty"`
	Truncated     *bool                 `json:"truncated,omitempty"`
	NextCursor    string                `json:"nextCursor,omitempty"`
}

ATSFormattedResult holds the formatted Markdown and structured records produced by an ATS adapter.

func FormatATSResponse

func FormatATSResponse(urlStr, rawBody, origURL string, htmlToMD HTMLToMDFunc, now time.Time) *ATSFormattedResult

FormatATSResponse resolves urlStr via ResolveATSPreFetchSpec and formats rawBody into an ATSFormattedResult.

type ATSPostingIdentity

type ATSPostingIdentity struct {
	Platform   string   `json:"platform"`
	Slug       string   `json:"slug"`
	BoardURL   string   `json:"boardUrl"`
	PostingID  string   `json:"postingId"`
	RoleTokens []string `json:"roleTokens"`
}

func ParseATSPostingIdentity

func ParseATSPostingIdentity(urlStr string) *ATSPostingIdentity

ParseATSPostingIdentity parses a saved ATS posting URL into `(platform, slug, boardUrl, postingId, roleTokens)`.

type ATSPreFetchSpec

type ATSPreFetchSpec struct {
	ID          string `json:"id"`
	FetchURL    string `json:"fetchUrl"`
	Method      string `json:"method"`
	RequestBody string `json:"requestBody,omitempty"`
	ContentType string `json:"contentType,omitempty"`
	Kind        string `json:"kind"`
	Accept      string `json:"accept"`
	// contains filtered or unexported fields
}

ATSPreFetchSpec describes how to fetch and format an ATS API twin before scraping HTML.

func ResolveATSPreFetchSpec

func ResolveATSPreFetchSpec(urlStr string) *ATSPreFetchSpec

ResolveATSPreFetchSpec resolves pre-fetch ATS API twin specs (Ashby, Workday CXS, Greenhouse US/EU, Lever US/EU, Workable, Gem, Rippling, We Work Remotely, Himalayas, Working Nomads).

func (*ATSPreFetchSpec) Format

func (s *ATSPreFetchSpec) Format(rawBody, origURL string, htmlToMD HTMLToMDFunc) *ATSFormattedResult

Format parses rawBody into an ATSFormattedResult using htmlToMD (defaulting to DefaultHTMLToMD when nil).

type BlockedSuggestion

type BlockedSuggestion struct {
	Reason     string            `json:"reason"`
	Host       string            `json:"host,omitempty"`
	Signal     string            `json:"signal,omitempty"`
	Price      string            `json:"price,omitempty"`
	Terms      *X402PaymentTerms `json:"terms,omitempty"`
	Suggestion string            `json:"suggestion"`
}

BlockedSuggestion provides an ethical alternative when a URL is blocked by robots.txt, Content-Signal, WAF, or HTTP 402.

func BuildBlockedInfo

func BuildBlockedInfo(urlStr, outcome, problem string, status int, headers map[string]string, rawBody string) *BlockedSuggestion

BuildBlockedInfo builds an ethical blocked diagnostic & alternative suggestion without ever bypassing blocks or paying automatically.

type ChunkJSONRecordsParams

type ChunkJSONRecordsParams struct {
	RawBody     string       `json:"rawBody"`
	ContentType string       `json:"contentType"`
	URL         string       `json:"url"`
	JSONFilter  string       `json:"jsonFilter"`
	HTMLToMD    HTMLToMDFunc `json:"-"`
}

ChunkJSONRecordsParams configures ChunkJSONRecords.

type ChunkedJSONRecordsResult

type ChunkedJSONRecordsResult struct {
	Title          string            `json:"title"`
	TotalRecords   int               `json:"totalRecords"`
	MatchedRecords int               `json:"matchedRecords"`
	Chunks         []JSONRecordChunk `json:"chunks"`
	Markdown       string            `json:"markdown"`
}

ChunkedJSONRecordsResult holds the per-record chunks and combined Markdown for a JSON array response.

func ChunkJSONRecords

func ChunkJSONRecords(params ChunkJSONRecordsParams) *ChunkedJSONRecordsResult

ChunkJSONRecords detects JSON record arrays, applies optional jsonFilter, converts HTML fields to Markdown, and emits one self-contained chunk per record.

type ClassifyBoardStatusParams

type ClassifyBoardStatusParams struct {
	HTTPStatus   int    `json:"httpStatus"`
	RequestedURL string `json:"requestedUrl"`
	FinalURL     string `json:"finalUrl,omitempty"`
	ContentState string `json:"contentState,omitempty"`
	JobCount     int    `json:"jobCount,omitempty"`
}

ClassifyBoardStatusParams configures ClassifyATSBoardStatus.

type DiscoverBoardsParams

type DiscoverBoardsParams struct {
	SourceURL string   `json:"sourceUrl"`
	FinalURL  string   `json:"finalUrl,omitempty"`
	RawHTML   string   `json:"rawHtml,omitempty"`
	Links     []string `json:"links,omitempty"`
}

DiscoverBoardsParams configures DiscoverATSBoardsFromHTML.

type DiscoveredATSBoard

type DiscoveredATSBoard struct {
	Domain         string         `json:"domain,omitempty"`
	Platform       string         `json:"platform"`
	Slug           string         `json:"slug"`
	BoardURL       string         `json:"boardUrl"`
	DiscoveredFrom string         `json:"discoveredFrom"`
	BoardStatus    ATSBoardStatus `json:"boardStatus,omitempty"`
	Tried          []string       `json:"tried,omitempty"`
	Total          *int           `json:"total,omitempty"`
	Returned       *int           `json:"returned,omitempty"`
	Truncated      *bool          `json:"truncated,omitempty"`
	NextCursor     string         `json:"nextCursor,omitempty"`
}

DiscoveredATSBoard describes an ATS job board discovered from a company domain or HTML page.

func DiscoverATSBoardsFromHTML

func DiscoverATSBoardsFromHTML(params DiscoverBoardsParams) []DiscoveredATSBoard

DiscoverATSBoardsFromHTML scans a company `/careers` or `/jobs` page for 16+ ATS platforms.

type FallbackBoard

type FallbackBoard struct {
	Slug     string `json:"slug"`
	BoardURL string `json:"boardUrl"`
}

FallbackBoard describes a compact or hyphenated slug fallback board URL.

func BuildCompactSlugFallbackBoards

func BuildCompactSlugFallbackBoards(platform, slug string) []FallbackBoard

BuildCompactSlugFallbackBoards builds compact and hyphenated board URL fallbacks for space-bearing display slugs.

type FilterAndRankParams

type FilterAndRankParams struct {
	Collected               []StructuredJobRecord `json:"collected"`
	Query                   string                `json:"query"`
	HasCompanyOrDomainScope bool                  `json:"hasCompanyOrDomainScope"`
	AllowedCompanyTokens    []string              `json:"allowedCompanyTokens"`
	AllowedBoardPrefixes    []string              `json:"allowedBoardPrefixes"`
	ExcludeList             []JobExcludeEntry     `json:"excludeList"`
	WantRemote              *bool                 `json:"wantRemote"`
	GeoLocationsFilter      []string              `json:"geoLocationsFilter"`
	MinBase                 *float64              `json:"minBase"`
	MinBaseMode             string                `json:"minBaseMode"`
	StrictPay               bool                  `json:"strictPay"`
	PostedWithinDays        *float64              `json:"postedWithinDays"`
	Limit                   int                   `json:"limit"`
	NowMs                   int64                 `json:"nowMs"`
}

FilterAndRankParams configures FilterAndRankJobs.

type FilterAndRankResult

type FilterAndRankResult struct {
	FinalJobs       []StructuredJobRecord `json:"finalJobs"`
	FinalIndices    []RankedJobIndex      `json:"finalIndices"`
	MatchedTotal    int                   `json:"matchedTotal"`
	PayUnknownCount *int                  `json:"payUnknownCount,omitempty"`
}

FilterAndRankResult holds both the full ranked StructuredJobRecord slice and index mapping.

func FilterAndRankJobs

func FilterAndRankJobs(params FilterAndRankParams) FilterAndRankResult

FilterAndRankJobs deduplicates, scopes, filters, and ranks collected job postings.

type FullBoardKeyInfo

type FullBoardKeyInfo struct {
	Key      string `json:"key"`
	Platform string `json:"platform"`
	Slug     string `json:"slug"`
	IsBoard  bool   `json:"isBoard"`
	BoardURL string `json:"boardUrl"`
}

FullBoardKeyInfo classifies an ATS URL into its canonical board key and whether the URL itself is the parent board.

func ClassifyFullBoardKey

func ClassifyFullBoardKey(urlStr string) *FullBoardKeyInfo

ClassifyFullBoardKey classifies an ATS board or posting URL into its parent board key and canonical board URL.

type HTMLToMDFunc

type HTMLToMDFunc func(htmlFrag, baseURL string) (markdown string, links []string)

HTMLToMDFunc converts an HTML fragment into GitHub-Flavored Markdown and extracted links.

type JSONRecordChunk

type JSONRecordChunk struct {
	Ordinal  int    `json:"ordinal"`
	Heading  string `json:"heading"`
	Text     string `json:"text"`
	RecordID string `json:"recordId,omitempty"`
}

type JobExcludeEntry

type JobExcludeEntry struct {
	Company string `json:"company"`
	Title   string `json:"title"`
	URL     string `json:"url"`
}

JobExcludeEntry specifies a URL or company/title pattern to exclude from search results.

type NormalizedPay

type NormalizedPay struct {
	Min      *float64  `json:"min"`
	Max      *float64  `json:"max"`
	Currency string    `json:"currency"`
	Period   PayPeriod `json:"period"`
	Interval string    `json:"interval,omitempty"`
	Basis    PayBasis  `json:"basis"`
	Raw      string    `json:"raw,omitempty"`
}

NormalizedPay holds standardized compensation bounds, currency, period, and basis.

func ParsePayFromText

func ParsePayFromText(text string) *NormalizedPay

ParsePayFromText extracts standardized NormalizedPay from prose compensation text.

type PayBasis

type PayBasis string

PayBasis classifies compensation as base salary, OTE, or total target cash/comp.

const (
	PayBasisBase  PayBasis = "base"
	PayBasisOTE   PayBasis = "ote"
	PayBasisTotal PayBasis = "total"
)

func InferPayBasis

func InferPayBasis(labelOrContext string) PayBasis

InferPayBasis classifies compensation basis (`base` vs `ote` vs `total`) from surrounding prose context.

type PayPeriod

type PayPeriod string

PayPeriod enumerates normalized compensation intervals.

const (
	PayPeriodYear  PayPeriod = "year"
	PayPeriodMonth PayPeriod = "month"
	PayPeriodWeek  PayPeriod = "week"
	PayPeriodDay   PayPeriod = "day"
	PayPeriodHour  PayPeriod = "hour"
)

func NormalizePeriod

func NormalizePeriod(rawPeriod string) PayPeriod

NormalizePeriod maps raw compensation period strings to `hour`, `day`, `week`, `month`, or `year`.

type PublicJobFeedSpec

type PublicJobFeedSpec struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

PublicJobFeedSpec identifies a robots.txt-allowed public remote job feed.

type RankedJobIndex

type RankedJobIndex struct {
	Index      int    `json:"index"`
	MatchedOn  string `json:"matchedOn"`
	PayUnknown bool   `json:"payUnknown,omitempty"`
}

RankedJobIndex records the surviving source index and computed relevance/pay flags.

type RawJobPostingInspection

type RawJobPostingInspection struct {
	DescriptionHTML             string `json:"descriptionHtml"`
	RawDecodedStringsForPICheck string `json:"rawDecodedStringsForPiCheck"`
}

RawJobPostingInspection holds the primary description HTML and flattened decoded strings for prompt-injection scanning.

func InspectRawJobPostingJSONLDLinear

func InspectRawJobPostingJSONLDLinear(rawHTML string) RawJobPostingInspection

InspectRawJobPostingJSONLDLinear extracts entity-decoded string values from all JobPosting JSON-LD blocks using the same quote-aware `<script>` parser as ExtractJobPostingJSONLD, preserving Unicode Tag smuggling detection.

type RedirectAnalysis

type RedirectAnalysis struct {
	Redirected       bool   `json:"redirected"`
	RedirectNote     string `json:"redirectNote,omitempty"`
	FiltersMayBeLost bool   `json:"filtersMayBeLost,omitempty"`
}

RedirectAnalysis describes material URL redirects and potential dropped filter parameters.

func AnalyzeURLRedirect

func AnalyzeURLRedirect(requestedURL, finalURL string) RedirectAnalysis

AnalyzeURLRedirect flags material URL redirects and warns when role/search/query filters may have been dropped.

type RegistrableBrandInfo

type RegistrableBrandInfo struct {
	SLD               string `json:"sld"`
	TLD               string `json:"tld"`
	RegistrableDomain string `json:"registrableDomain"`
	JoinedRegistrable string `json:"joinedRegistrable"`
	IsVettedTLD       bool   `json:"isVettedTld"`
}

RegistrableBrandInfo describes the registrable brand SLD and TLD of a hostname.

func ExtractRegistrableBrandInfo

func ExtractRegistrableBrandInfo(hostname string) *RegistrableBrandInfo

ExtractRegistrableBrandInfo extracts the brand SLD, TLD, and registrable domain, rejecting CentralNic private suffixes and numeric TLDs.

type SalaryBreakdown added in v2.8.19

type SalaryBreakdown struct {
	Key    string  `json:"key"`
	Label  string  `json:"label,omitempty"`
	Count  int     `json:"count"`
	Median float64 `json:"median"`
}

SalaryBreakdown is one group row (seniority, location bucket, or company) with its median midpoint.

type SalaryObservation added in v2.8.19

type SalaryObservation struct {
	URL            string        `json:"url"`
	TitleRaw       string        `json:"titleRaw"`
	TitleFamily    string        `json:"titleFamily"`
	Seniority      string        `json:"seniority"`
	CompanyKey     string        `json:"companyKey"`
	Company        string        `json:"company"`
	LocationRaw    string        `json:"locationRaw,omitempty"`
	LocationBucket string        `json:"locationBucket"`
	Country        string        `json:"country,omitempty"`
	WorkplaceType  WorkplaceType `json:"workplaceType"`
	Currency       string        `json:"currency"`
	Period         PayPeriod     `json:"period"`
	Basis          PayBasis      `json:"basis"`
	Min            float64       `json:"min"`
	Max            float64       `json:"max"`
	MinAnnual      float64       `json:"minAnnual"`
	MaxAnnual      float64       `json:"maxAnnual"`
	PostedAt       string        `json:"postedAt,omitempty"`
	Source         string        `json:"source"`
	SeenAt         int64         `json:"seenAt"`
}

SalaryObservation is one employer-posted pay range, normalized and annualized. URL is the dedupe key.

func SalaryObservationFromJob added in v2.8.19

func SalaryObservationFromJob(rec StructuredJobRecord, seenAtMs int64) (SalaryObservation, bool)

SalaryObservationFromJob converts a normalized job record into a salary observation. It returns false when pay is missing or implausible: no positive finite bound, non-ISO currency, unknown period, empty URL or title family, hourly < 1, annualized min < 1,000 or annualized max > 5,000,000 (bounds are multiplied by salaryCurrencyScale for low-denomination currencies). A single bound is used for both ends; min > max is swapped.

func SalaryObservationsFromJobs added in v2.8.19

func SalaryObservationsFromJobs(recs []StructuredJobRecord, seenAtMs int64) ([]SalaryObservation, int)

SalaryObservationsFromJobs maps SalaryObservationFromJob over recs, returning accepted observations (never nil) and the number rejected.

type SalaryQuery added in v2.8.19

type SalaryQuery struct {
	TitleFamily    string `json:"titleFamily,omitempty"`
	Seniority      string `json:"seniority,omitempty"`
	LocationBucket string `json:"locationBucket,omitempty"`
	Company        string `json:"company,omitempty"`
	Currency       string `json:"currency,omitempty"`
	Basis          string `json:"basis,omitempty"`
	MaxAgeDays     int    `json:"maxAgeDays,omitempty"`
	NowMs          int64  `json:"nowMs,omitempty"`
}

SalaryQuery selects observations for AggregateSalaries. Empty fields do not filter.

type SalaryReport added in v2.8.19

type SalaryReport struct {
	Query        SalaryQuery       `json:"query"`
	Matched      int               `json:"matched"`
	Postings     int               `json:"postings"`
	Currency     string            `json:"currency"`
	Basis        string            `json:"basis"`
	Currencies   map[string]int    `json:"currencies"`
	Midpoint     SalaryStats       `json:"midpoint"`
	Min          SalaryStats       `json:"min"`
	Max          SalaryStats       `json:"max"`
	BySeniority  []SalaryBreakdown `json:"bySeniority"`
	ByLocation   []SalaryBreakdown `json:"byLocation"`
	TopCompanies []SalaryBreakdown `json:"topCompanies"`
	Sample       []SalarySample    `json:"sample"`
	Sources      map[string]int    `json:"sources"`
	Notes        []string          `json:"notes"`
	Method       string            `json:"method"`
	Markdown     string            `json:"markdown"`
}

SalaryReport is the AggregateSalaries result. All statistics are in Currency, annualized.

func AggregateSalaries added in v2.8.19

func AggregateSalaries(obs []SalaryObservation, q SalaryQuery) SalaryReport

AggregateSalaries computes a single-currency salary report. Order of operations:

  1. Re-validate observations; dedupe by canonical URL keeping the most recently seen.
  2. Age filter: keep observations whose max(postedAt, seenAt) is within maxAgeDays (default 180; < 0 disables) of nowMs (default: the newest observation's recency, so results are deterministic).
  3. Filter by titleFamily (normalized via NormalizeTitleFamily), seniority, locationBucket ("remote" matches remote; "country:XX" matches country:XX, metros in XX and remote postings tagged XX; "metro:x" exact), and company (NormalizeCompanyKey).
  4. Currency: query value, else the most common currency among matches (ties alphabetical); other currencies are only counted in Currencies and Notes.
  5. Basis: query value (base/total/ote/all), else base when >= 3 base postings, else all.
  6. Collapse clusters keyed (company, family, seniority, currency, basis, rounded minAnnual, rounded maxAnnual) into one observation each (weight 1); statistics, breakdowns and samples are over clusters. A cluster counts once in every location bucket it was posted in. Sources count postings.

type SalarySample added in v2.8.19

type SalarySample struct {
	Title          string    `json:"title"`
	Company        string    `json:"company"`
	Location       string    `json:"location,omitempty"`
	LocationBucket string    `json:"locationBucket"`
	Seniority      string    `json:"seniority"`
	Currency       string    `json:"currency"`
	Period         PayPeriod `json:"period"`
	Basis          PayBasis  `json:"basis"`
	Min            float64   `json:"min"`
	Max            float64   `json:"max"`
	MinAnnual      float64   `json:"minAnnual"`
	MaxAnnual      float64   `json:"maxAnnual"`
	URL            string    `json:"url"`
	PostedAt       string    `json:"postedAt,omitempty"`
	Source         string    `json:"source,omitempty"`
	Postings       int       `json:"postings"`
}

SalarySample is one representative observation (cluster) for display.

type SalaryStats added in v2.8.19

type SalaryStats struct {
	Count  int     `json:"count"`
	P10    float64 `json:"p10"`
	P25    float64 `json:"p25"`
	Median float64 `json:"median"`
	P75    float64 `json:"p75"`
	P90    float64 `json:"p90"`
	Mean   float64 `json:"mean"`
}

SalaryStats summarizes one annualized series. Values are rounded to whole currency units.

func ComputeSalaryStats added in v2.8.19

func ComputeSalaryStats(vals []float64) SalaryStats

ComputeSalaryStats computes type-7 percentiles and the arithmetic mean of vals (input is not mutated).

type SalvagedAshbyBoard

type SalvagedAshbyBoard struct {
	Salvaged         bool             `json:"salvaged"`
	OrganizationName string           `json:"organizationName,omitempty"`
	Jobs             []map[string]any `json:"jobs"`
}

SalvagedAshbyBoard holds complete job objects salvaged linearly from a truncated Ashby job-board JSON payload.

func SalvageAshbyBoardFromTruncatedJSON

func SalvageAshbyBoardFromTruncatedJSON(raw string) *SalvagedAshbyBoard

SalvageAshbyBoardFromTruncatedJSON scans a truncated `posting-api/job-board/{org}` JSON response in O(N) time and recovers all complete job objects before truncation.

type SimilarRole

type SimilarRole struct {
	Title string `json:"title"`
	URL   string `json:"url"`
}

SimilarRole holds an open role suggested when a saved posting is closed.

func FindSimilarRoles

func FindSimilarRoles(openRoles []SimilarRole, roleTokens []string) []SimilarRole

FindSimilarRoles scores open roles against roleTokens extracted from a closed posting URL.

type StructuredJobPosting

type StructuredJobPosting struct {
	Title              string         `json:"title"`
	HiringOrganization string         `json:"hiringOrganization,omitempty"`
	JobLocation        []string       `json:"jobLocation,omitempty"`
	JobLocationType    string         `json:"jobLocationType,omitempty"`
	WorkplaceType      WorkplaceType  `json:"workplaceType"`
	BaseSalary         *NormalizedPay `json:"baseSalary"`
	Pay                *NormalizedPay `json:"pay"`
	DatePosted         string         `json:"datePosted,omitempty"`
	ValidThrough       string         `json:"validThrough,omitempty"`
	EmploymentType     string         `json:"employmentType,omitempty"`
	URL                string         `json:"url,omitempty"`
	ApplyURL           string         `json:"applyUrl,omitempty"`
	Source             string         `json:"source,omitempty"`
}

StructuredJobPosting holds single-posting metadata extracted from JSON-LD or ATS APIs.

func ExtractJobPostingJSONLD

func ExtractJobPostingJSONLD(rawHTML, baseURL, fallbackProse string) *StructuredJobPosting

ExtractJobPostingJSONLD parses `<script type="application/ld+json">` blocks for `@type: JobPosting`.

type StructuredJobRecord

type StructuredJobRecord struct {
	Title          string         `json:"title"`
	Company        string         `json:"company"`
	URL            string         `json:"url"`
	ApplyURL       string         `json:"applyUrl"`
	WorkplaceType  WorkplaceType  `json:"workplaceType"`
	Locations      []string       `json:"locations"`
	Pay            *NormalizedPay `json:"pay"`
	PayUnknown     bool           `json:"payUnknown,omitempty"`
	MatchedOn      string         `json:"matchedOn,omitempty"`
	PostedAt       *string        `json:"postedAt"`
	PostedLabel    string         `json:"postedLabel,omitempty"`
	Source         string         `json:"source"`
	EmploymentType string         `json:"employmentType,omitempty"`
	Snippet        string         `json:"snippet,omitempty"`
}

StructuredJobRecord represents a normalized job listing row across ATS boards and feeds.

func ParseBuiltInMarkdownCards

func ParseBuiltInMarkdownCards(biMD string, maxCards int, wantRemoteFalse bool) []StructuredJobRecord

ParseBuiltInMarkdownCards extracts BuiltIn job cards and inline compensation from scraped BuiltIn Markdown.

func ParsePublicJobFeedRecords

func ParsePublicJobFeedRecords(feedID, rawBody string) []StructuredJobRecord

ParsePublicJobFeedRecords parses We Work Remotely RSS, Himalayas JSON, and Working Nomads JSON job feeds.

func ParseSmartRecruitersBoardScrape

func ParseSmartRecruitersBoardScrape(origURL, markdown, rawHTML string, links []string) []StructuredJobRecord

ParseSmartRecruitersBoardScrape extracts StructuredJobRecord rows from public `https://jobs.smartrecruiters.com/{Company}` HTML/Markdown boards.

type TenantSlugMatchOptions

type TenantSlugMatchOptions struct {
	Host             string
	JobCompany       string
	SegmentedTokens  map[string]bool
	AllowAshbySpaces bool
}

TenantSlugMatchOptions configures MatchesATSTenantSlugAgainstToken.

type VerifiedPostingStatus

type VerifiedPostingStatus string

VerifiedPostingStatus enumerates saved-posting batch verification states.

const (
	PostingStatusLive      VerifiedPostingStatus = "live"
	PostingStatusClosed    VerifiedPostingStatus = "closed"
	PostingStatusBoardGone VerifiedPostingStatus = "board_gone"
	PostingStatusUnknown   VerifiedPostingStatus = "unknown"
)

type WorkplaceType

type WorkplaceType string

WorkplaceType classifies remote, hybrid, onsite, or unknown work arrangements.

const (
	WorkplaceRemote  WorkplaceType = "remote"
	WorkplaceHybrid  WorkplaceType = "hybrid"
	WorkplaceOnsite  WorkplaceType = "onsite"
	WorkplaceUnknown WorkplaceType = "unknown"
)

func InferWorkdayWorkplaceType

func InferWorkdayWorkplaceType(remoteType, locText, title string) WorkplaceType

InferWorkdayWorkplaceType resolves Workday `remoteType` + location + title, defaulting concrete non-vague locations to `onsite`.

func InferWorkplaceType

func InferWorkplaceType(text string) WorkplaceType

InferWorkplaceType classifies workplace arrangement (`remote` | `hybrid` | `onsite` | `unknown`) from free text.

func ResolveExplicitWorkplaceType

func ResolveExplicitWorkplaceType(explicitField, htmlContext, proseContext string) WorkplaceType

ResolveExplicitWorkplaceType inspects explicit fields, embedded Ashby workplaceType JSON, and prose `Location Type:` labels. Returns `""` when no explicit workplace type is found.

type X402ExtraMetadata

type X402ExtraMetadata struct {
	Name     string `json:"name,omitempty"`
	Version  string `json:"version,omitempty"`
	Decimals *int   `json:"decimals,omitempty"`
}

X402ExtraMetadata holds allowlisted depth-1 x402 token metadata.

type X402ParseResult

type X402ParseResult struct {
	Price string           `json:"price,omitempty"`
	Terms X402PaymentTerms `json:"terms"`
}

X402ParseResult pairs the formatted human price summary (if valid) with sanitized X402PaymentTerms.

func ParseX402PaymentTerms

func ParseX402PaymentTerms(status int, headers map[string]string, rawBody, expectedHost string) *X402ParseResult

ParseX402PaymentTerms parses HTTP 402 Payment Required headers and JSON bodies into strictly sanitized X402ParseResult.

type X402PaymentTerms

type X402PaymentTerms struct {
	X402Version       *int               `json:"x402Version,omitempty"`
	AcceptsCount      *int               `json:"acceptsCount,omitempty"`
	Scheme            string             `json:"scheme,omitempty"`
	Price             string             `json:"price,omitempty"`
	Amount            string             `json:"amount,omitempty"`
	MaxAmountRequired string             `json:"maxAmountRequired,omitempty"`
	Asset             string             `json:"asset,omitempty"`
	Currency          string             `json:"currency,omitempty"`
	Network           string             `json:"network,omitempty"`
	PayTo             string             `json:"payTo,omitempty"`
	Resource          string             `json:"resource,omitempty"`
	Description       string             `json:"description,omitempty"`
	Invoice           string             `json:"invoice,omitempty"`
	Macaroon          string             `json:"macaroon,omitempty"`
	Extra             *X402ExtraMetadata `json:"extra,omitempty"`
}

X402PaymentTerms holds sanitized HTTP 402 / x402 / L402 payment requirements.

func (X402PaymentTerms) IsEmpty

func (t X402PaymentTerms) IsEmpty() bool

IsEmpty reports whether X402PaymentTerms carries zero populated fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL