Created
July 14, 2016 18:05
-
-
Save R-Rudolf/3c1d605ba977a87df612b7400de86614 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongo_filter = { | |
"status": | |
"open", | |
"current_status": | |
"open", | |
"applications_close_date":{ | |
"$gt":"2016-05-20"}, | |
"latest_end_date": { | |
"$gt":"2016-08-05"}, | |
"earliest_start_date" :{ | |
"$lt":"2016-06-20"}, | |
"duration_max": { | |
"$lte":8}, | |
"duration_min": { | |
"$gte":6}, | |
} | |
def filter_opportunities(item): | |
del item["_id"] | |
workField_not = ["marketing", "sales"] | |
must_contain = ["leadership", | |
"project management", | |
# "teaching" | |
] | |
never_ever = ["egypt"] | |
#if "india" not in json.dumps(item).lower(): | |
# return False | |
#if not item["inIndia"]: | |
# return False | |
if "not provided" in item["meal"].encode("utf8").lower(): | |
return False | |
if "?" in item["accom."]: | |
return False | |
if "?" in item["meal"]: | |
return False | |
if "USD" in item["accom."]: | |
return False | |
if int(item["open"])+int(item["people"]) < 5: | |
return False | |
if int(item["people"]) < 2: | |
return False | |
if item["description"] is not None and " inr " in item["description"].encode("utf8").lower(): | |
return False | |
if any([x in item["workField"].encode("utf8").lower() | |
for x in workField_not]): | |
return False | |
# legalabb az egyik kulcsszot tartalmazza az egesz szoveg | |
if not any([ x in json.dumps(item).lower() | |
for x in must_contain]): | |
return False | |
if any([x in json.dumps(item).lower() | |
for x in never_ever]): | |
return False | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment