Uma achiloc1#47
Conversation
✅ Deploy Preview for mewannajob ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR refactors text extraction logic from script.js into separate modular files under web/model/parsing/, improving code organization and maintainability. The changes extract three major functions (extractLocation, extractEducation, and extractAchievements) into dedicated handler files that follow the IIFE pattern to expose functions globally.
Key Changes
- Moved
extractLocation,extractEducation, andextractAchievementsfunctions fromscript.jsto separate files inweb/model/parsing/ - Enhanced
extractAchievementsfunction with more comprehensive achievement detection including Latin honors, scholarships, fellowships, and competition awards - Completely rewrote
extractLocationfunction with improved multi-country support (US and India) and more robust location parsing - Standardized code formatting with consistent 4-space indentation in date/time parsing functions
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
web/script.js |
Removed 403 lines of extraction functions and reformatted indentation for date parsing utilities |
web/model/parsing/location_text_handler.js |
New file implementing enhanced location extraction with support for US/Indian states, cities, and postal codes |
web/model/parsing/education_text_handler.js |
New file containing education level classification logic extracted from script.js |
web/model/parsing/achievement_text_handler.js |
New file with significantly expanded achievement detection beyond the original Dean's/Chancellor's List |
web/index.html |
Added script tags to load the three new text handler modules before script.js |
Comments suppressed due to low confidence (1)
web/model/parsing/location_text_handler.js:4
- Unused variable STATE_ABBR.
const STATE_ABBR = [
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,200 @@ | |||
| // educationClassifier.js | |||
There was a problem hiding this comment.
The file comment says // educationClassifier.js but the actual filename is education_text_handler.js. Update the comment to match the filename for consistency.
| // educationClassifier.js | |
| // education_text_handler.js |
| @@ -0,0 +1,55 @@ | |||
| // achievementClassifier.js | |||
There was a problem hiding this comment.
The file comment says // achievementClassifier.js but the actual filename is achievement_text_handler.js. Update the comment to match the filename for consistency.
| // achievementClassifier.js | |
| // achievement_text_handler.js |
| const STATE_ABBR = [ | ||
| 'AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY', 'DC' | ||
| ]; |
There was a problem hiding this comment.
The STATE_ABBR constant is declared but never used in this file. The state abbreviations are already hardcoded in the regex pattern on line 26. Consider removing this unused constant or refactoring the findCityState function to use it for better maintainability.
| /\baa\b\b|\ba\.?\s*a\.?\b/, | ||
| /\bas\b\b|\ba\.?\s*s\.?\b/, |
There was a problem hiding this comment.
The regex patterns have a duplicate word boundary \b\b at the beginning. This should be \b only. The first part should be /\baa\b|\ba\.?\s*a\.?\b/ and the second should be /\bas\b|\ba\.?\s*s\.?\b/.
| /\baa\b\b|\ba\.?\s*a\.?\b/, | |
| /\bas\b\b|\ba\.?\s*s\.?\b/, | |
| /\baa\b|\ba\.?\s*a\.?\b/, | |
| /\bas\b|\ba\.?\s*s\.?\b/, |
|
|
||
| if ( | ||
| bachelorPositive.some(r => r.test(text)) && | ||
| !bachelorNegative.some(r => r.test(text)) |
There was a problem hiding this comment.
Missing arrow function syntax. This should be !bachelorNegative.some(r => r.test(text)) instead of !bachelorNegative.some(r.test(text)). The current code will throw a runtime error because r.test is attempting to access a property on the callback parameter r directly instead of calling test as a method.
| <!-- First load the classifier --> | ||
| <!-- PDF.js --> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"></script> | ||
| <!-- Mammoth.js --> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script> | ||
| <script src="model/data/skill_dict.js"></script> |
There was a problem hiding this comment.
The comment "First load the classifier" is misleading because the scripts being loaded are text handlers/extractors, not classifiers. Additionally, it's placed before the PDF.js comment. Consider moving it to line 84 before the actual text handler scripts, or updating it to say "Load text extraction handlers" for clarity.
| <!-- First load the classifier --> | |
| <!-- PDF.js --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"></script> | |
| <!-- Mammoth.js --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script> | |
| <script src="model/data/skill_dict.js"></script> | |
| <!-- PDF.js --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"></script> | |
| <!-- Mammoth.js --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script> | |
| <script src="model/data/skill_dict.js"></script> | |
| <!-- Load text extraction handlers --> |
| @@ -0,0 +1,110 @@ | |||
| // locationClassifier.js | |||
There was a problem hiding this comment.
The file comment says // locationClassifier.js but the actual filename is location_text_handler.js. Update the comment to match the filename for consistency.
| // locationClassifier.js | |
| // location_text_handler.js |
| @@ -0,0 +1,200 @@ | |||
| // educationClassifier.js | |||
| (function (global) { | |||
There was a problem hiding this comment.
please remove this file from your git commits if you plan on merging this
There was a problem hiding this comment.
I took your branch earlier and added mine, how should I do this?
No description provided.