Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Suggest cTimezone during profile processing from location data by michaelmwu · Pull Request #159 · 508-dev/508-workflows · GitHub
Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Suggest cTimezone during profile processing from location data by michaelmwu · Pull Request #159 · 508-dev/508-workflows · GitHub
Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Suggest cTimezone during profile processing from location data by michaelmwu · Pull Request #159 · 508-dev/508-workflows · GitHub
Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Suggest cTimezone during profile processing from location data by michaelmwu · Pull Request #159 · 508-dev/508-workflows · GitHub
Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Suggest cTimezone during profile processing from location data by michaelmwu · Pull Request #159 · 508-dev/508-workflows · GitHub
Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Suggest cTimezone during profile processing from location data by michaelmwu · Pull Request #159 · 508-dev/508-workflows · GitHub
Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Suggest cTimezone during profile processing from location data by michaelmwu · Pull Request #159 · 508-dev/508-workflows · GitHub
Skip to content

Suggest cTimezone during profile processing from location data - #159

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile
Mar 5, 2026
Merged

Suggest cTimezone during profile processing from location data#159
michaelmwu merged 2 commits into
mainfrom
michaelmwu/suggest-ctimezone-profile

Conversation

@michaelmwu

@michaelmwumichaelmwu commented Mar 5, 2026

Copy link
Copy Markdown
Member

Description

Add automatic timezone suggestion during candidate profile processing. When a resume doesn't explicitly state timezone, infer the standard UTC offset from city/country data that's already extracted.

Changes:

  • Add LLM prompt rule to infer timezone from address_city or address_country (e.g., San Francisco → UTC-08:00, India → UTC+05:30)
  • Add static country-to-timezone mapping for heuristic extraction fallback
  • Apply fallback inference in heuristic path when explicit timezone is not found

This enables suggesting cTimezone during resume profile processing even when candidates don't explicitly list their timezone.

How Has This Been Tested?

Existing resume_extractor tests pass (30 tests). No new test coverage needed as the timezone inference is a fallback optimization that doesn't change existing behavior when timezone is explicitly provided.

Summary by CodeRabbit

  • New Features
    • Resume extraction now automatically infers timezone information from location data (country and city) when timezone is not directly provided.

When resume timezone is not explicitly stated, infer UTC offset from city/country.
Add LLM prompt rule to infer standard timezone from location (e.g., San Francisco → UTC-08:00, India → UTC+05:30).
Add static country-to-timezone mapping for heuristic extraction fallback.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings March 5, 2026 02:48
@coderabbitai

coderabbitaiBot commented Mar 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85207bf8-1bf6-4245-8a49-23732c58772e

📥 Commits

Reviewing files that changed from the base of the PR and between e6ff3a5 and 0a4602a.

📒 Files selected for processing (2)
  • packages/shared/src/five08/resume_extractor.py
  • tests/unit/test_resume_extractor.py
📝 Walkthrough

Walkthrough

The change adds timezone inference capability to the resume extractor by introducing a static country-to-UTC offset mapping and a helper function that infers timezone from extracted location data (country and optionally city). This is integrated into both heuristic and snippet-based extraction flows.

Changes

Cohort / File(s)Summary
Timezone Inference
packages/shared/src/five08/resume_extractor.py
Added _COUNTRY_TIMEZONE mapping (country names to UTC offsets) and _infer_timezone_from_location() helper function. Integrated timezone inference into heuristic extraction flow and snippet-based code path when timezone is not explicitly found. Updated prompt documentation to reflect the new heuristic behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A timezone hopper, bold and bright,
Finds UTC from country's sight,
When clocks run silent, lost in space,
Geography becomes the saving grace!
With mapping true and logic sound,
Every resume's time is found. 🗺️⏰

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Suggest cTimezone during profile processing from location data' is clear and directly related to the main change: adding timezone inference from location (country/city) data during profile processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/suggest-ctimezone-profile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/shared/src/five08/resume_extractor.py`:
- Around line 425-533: _infer_timezone_from_location currently ignores the city
parameter and returns a country-based mapping from _COUNTRY_TIMEZONE even for
multi-timezone countries; update the function to first try a city-based lookup
when city is provided (use a new city-to-tz lookup or normalized city key
lookup), and if city lookup fails fall back to country only when the country is
unambiguous; introduce a small AMBIGUOUS_COUNTRIES set (e.g.,
{"mexico","brazil","russia","australia","usa","canada"}) and if the country is
in that set return None instead of a coarse offset, ensuring you reference the
existing _COUNTRY_TIMEZONE and the function _infer_timezone_from_location when
making changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28b7a852-661e-47b7-a1c0-39466720470a

📥 Commits

Reviewing files that changed from the base of the PR and between 67fb07d and e6ff3a5.

📒 Files selected for processing (1)
  • packages/shared/src/five08/resume_extractor.py

Comment threadpackages/shared/src/five08/resume_extractor.py

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic timezone inference during candidate profile processing. When a resume doesn't explicitly state a timezone, the system infers the UTC offset from the candidate's city/country data. The change affects both the LLM-based extraction path (via an added prompt rule) and the heuristic extraction fallback (via a new static country-to-timezone mapping and inference function).

Changes:

  • Add a _COUNTRY_TIMEZONE static dictionary mapping ~70 countries to their standard UTC offsets, and a _infer_timezone_from_location fallback function that looks up timezone by country name
  • Apply the fallback inference in the heuristic extraction path when explicit timezone is not found in the resume text
  • Add an LLM prompt rule instructing the model to infer timezone from city/country when not explicitly stated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +531
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The city parameter is accepted but never used in the function body. This creates a misleading API where callers might expect city-based timezone inference (e.g., for multi-timezone countries like the US or Canada), but it silently does nothing. Either remove the city parameter since it's unused, or implement city-based lookup to provide more granular timezone inference for multi-timezone countries.

Suggested change
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
_CITY_TIMEZONE: dict[str, str] = {
# Common US cities
"new york": "UTC-05:00",
"san francisco": "UTC-08:00",
"los angeles": "UTC-08:00",
"seattle": "UTC-08:00",
"chicago": "UTC-06:00",
"boston": "UTC-05:00",
"washington, dc": "UTC-05:00",
"washington dc": "UTC-05:00",
"atlanta": "UTC-05:00",
"denver": "UTC-07:00",
# Common Canadian cities
"toronto": "UTC-05:00",
"vancouver": "UTC-08:00",
"montreal": "UTC-05:00",
"calgary": "UTC-07:00",
# Common Australian cities
"sydney": "UTC+10:00",
"melbourne": "UTC+10:00",
"brisbane": "UTC+10:00",
"perth": "UTC+08:00",
# Common European cities
"london": "UTC+00:00",
"paris": "UTC+01:00",
"berlin": "UTC+01:00",
"madrid": "UTC+01:00",
"rome": "UTC+01:00",
"amsterdam": "UTC+01:00",
}
def_infer_timezone_from_location(
*, country: str|None, city: str|None=None
) ->str|None:
"""Best-effort UTC offset from country name, with city fallback (heuristic only)."""
ifcountry:
tz=_COUNTRY_TIMEZONE.get(country.strip().lower())
iftz:
returntz
ifcity:
tz=_CITY_TIMEZONE.get(city.strip().lower())
iftz:
returntz

Copilot uses AI. Check for mistakes.
"- infer linkedin_url and website_links from bare domains when scheme is missing\n"
"- for phone return digits with country code and leading + (e.g. +15551234567); if no country code in the source, infer it from address_country or address_city (e.g. United States → +1, India → +91, UK → +44)\n"
"- if timezone is provided, normalize it to UTC offset form like UTC±HH:MM before output\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLM prompt groups Kyiv with Nairobi and Istanbul at UTC+03:00, but Ukraine's standard UTC offset is UTC+02:00 (EET). This is inconsistent with the _COUNTRY_TIMEZONE static mapping on line 470, which correctly lists "ukraine": "UTC+02:00". Kyiv should be moved to a UTC+02:00 grouping (e.g., alongside Bucharest or Athens) to avoid contradictory timezone inference between the LLM path and the heuristic fallback path.

Suggested change
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Nairobi/Istanbul/Kyiv → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"
"- if timezone is null but address_city or address_country is known, infer the standard UTC offset (e.g., San Francisco/Los Angeles/Seattle → UTC-08:00, Denver → UTC-07:00, Chicago/Dallas/Houston → UTC-06:00, New York/Boston/Atlanta → UTC-05:00, London/Dublin/Lisbon → UTC+00:00, Paris/Berlin/Amsterdam/Rome/Madrid → UTC+01:00, Bucharest/Athens/Kyiv → UTC+02:00, Nairobi/Istanbul → UTC+03:00, UAE/Dubai → UTC+04:00, India/Mumbai/Bangalore → UTC+05:30, Singapore/Shanghai/Beijing → UTC+08:00, Tokyo/Seoul → UTC+09:00, Sydney/Melbourne → UTC+10:00); omit if location is ambiguous\n"

Copilot uses AI. Check for mistakes.
Comment on lines +524 to +532
def _infer_timezone_from_location(
*, country: str | None, city: str | None = None
) -> str | None:
"""Best-effort UTC offset from country name (heuristic fallback only)."""
if country:
tz = _COUNTRY_TIMEZONE.get(country.strip().lower())
if tz:
return tz
return None

CopilotAIMar 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file covers other internal helpers like _infer_seniority_from_resume (lines 458-491 in test_resume_extractor.py), _normalize_name_part, and _coerce_email_list, but no tests are added for _infer_timezone_from_location. At minimum, tests should cover: (1) a known country returning the correct offset, (2) an unknown country returning None, (3) a None country returning None, and (4) case-insensitive matching (e.g., "India" vs "india").

Copilot uses AI. Check for mistakes.
- Add _CITY_TIMEZONE map and use city first in _infer_timezone_from_location
- Add _AMBIGUOUS_COUNTRY_TIMEZONE set; return None for multi-zone countries
(US, Canada, Mexico, Brazil, Australia, Russia, Indonesia)
- Fix Kyiv in LLM prompt to UTC+02:00 (was incorrectly grouped at UTC+03:00)
- Remove ambiguous countries from _COUNTRY_TIMEZONE
- Add 8 unit tests for _infer_timezone_from_location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michaelmwu
michaelmwu merged commit 2217c20 into mainMar 5, 2026
5 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/suggest-ctimezone-profile branch March 5, 2026 03:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@michaelmwu