Skip to content

Commit

Permalink
remove postal code (#17)
Browse files Browse the repository at this point in the history
* fix: remove postal code
  • Loading branch information
cullenwatson authored Aug 27, 2023
1 parent d72d14d commit 33f6768
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ site_type (enum)
│ │ ├── country (str)
│ │ ├── city (str)
│ │ ├── state (str)
│ │ ├── postal_code (str)
│ │ └── address (str)
│ ├── description (str)
│ ├── job_type (enum)
│ ├── compensation (object)
Expand All @@ -79,11 +77,9 @@ site_type (enum)
"company_name": "INTEL",
"job_url": "https://www.indeed.com/jobs/viewjob?jk=a2cfbb98d2002228",
"location": {
"country": "US",
"country": "USA",
"city": "Austin",
"state": "TX",
"postal_code": null,
"address": null
},
"description": "Job Description Designs, develops, tests, and debugs..."
"job_type": "fulltime",
Expand All @@ -95,7 +91,10 @@ site_type (enum)
},
"date_posted": "2023-08-18T00:00:00"
}, ...
]
],
"total_results": 845,
"returned_results": 15
},
"linkedin": {
"success": true,
"error": null,
Expand All @@ -105,11 +104,9 @@ site_type (enum)
"company_name": "Public Partnerships | PPL",
"job_url": "https://www.linkedin.com/jobs/view/3690013792",
"location": {
"country": "US",
"country": "USA",
"city": "Austin",
"state": "TX",
"postal_code": null,
"address": null
},
"description": "Public Partnerships LLC supports individuals with disabilities..."
"job_type": null,
Expand Down
6 changes: 2 additions & 4 deletions api/core/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ class JobType(Enum):


class Location(BaseModel):
country: str
country: str = "USA"
city: str = None
state: str = None
postal_code: str = None
address: str = None


class CompensationInterval(Enum):
Expand All @@ -38,7 +36,7 @@ class Compensation(BaseModel):
interval: CompensationInterval
min_amount: float
max_amount: float
currency: str = "US"
currency: str = "USA"


class JobPost(BaseModel):
Expand Down
1 change: 0 additions & 1 deletion api/core/scrapers/indeed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def process_job(job) -> Optional[JobPost]:
city=job.get("jobLocationCity"),
state=job.get("jobLocationState"),
postal_code=job.get("jobLocationPostal"),
country="US",
),
job_type=job_type,
compensation=compensation,
Expand Down
4 changes: 0 additions & 4 deletions api/core/scrapers/linkedin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ def get_location(metadata_card: Optional[Tag]) -> Location:
:param metadata_card
:return: location
"""
location = Location(
country="US",
)
if metadata_card is not None:
location_tag = metadata_card.find(
"span", class_="job-search-card__location"
Expand All @@ -179,7 +176,6 @@ def get_location(metadata_card: Optional[Tag]) -> Location:
if len(parts) == 2:
city, state = parts
location = Location(
country="US",
city=city,
state=state,
)
Expand Down
1 change: 0 additions & 1 deletion api/core/scrapers/ziprecruiter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ def get_location(job: BeautifulSoup) -> Location:
else:
city, state = None, None
return Location(
country="US",
city=city,
state=state,
)
Expand Down
7 changes: 5 additions & 2 deletions api/v1/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ async def scrape_jobs(scraper_input: ScraperInput) -> Dict[str, JobResponse]:
:param scraper_input:
:return: Dict[str, JobResponse]: where each key is a site
"""

def scrape_site(site: Site) -> Tuple[str, JobResponse]:
scraper_class = SCRAPER_MAPPING[site]
scraper = scraper_class()
scraped_data = scraper.scrape(scraper_input)
return (site.value, scraped_data)

with ThreadPoolExecutor() as executor:
resp_dict = {site: resp for site, resp in executor.map(scrape_site, scraper_input.site_type)}
resp_dict = {
site: resp
for site, resp in executor.map(scrape_site, scraper_input.site_type)
}

return resp_dict

0 comments on commit 33f6768

Please sign in to comment.