Example #1
0
def get_real_allergens(allergen_list):
    """Takes an iterable of allergens, all of which may be abstract or real
    and converts them to a list of real allergens that may appear in 
    a list of ingrdients"""
    real_allergens = set()
    for allergen in allergen_list:
        allergen = allergen.lower().strip()
        reals =  get(allergen)
        if reals:
            real_allergens.update(reals)
        else:
            real_allergens.add(allergen)

    logger.debug("Expanded allergens from %s to %s" % 
        (str(allergen_list), str(real_allergens)) )
    return real_allergens
def generate():
    logger.debug("Beginning dish users per day mapreduce job")
    requests.map_reduce(m, r, out=SON([("replace", settings.USERS_PER_DAY_COLLECTION), ("db", settings.METRICS_DB)]))
    logger.debug("Mapreduce query completed")
def generate():
    logger.debug("Beginning dish autocompletion list mapreduce job")
    results = recipes.map_reduce(m, r, out={'replace': dish.name})
    logger.debug("Mapreduce query completed, removing items below threshold...")
    dish.remove({'value.source_count': {'$lt': settings.DISH_AUTOCOMPLETION_MIN_SOURCES}}, safe=True)
    logger.debug("Completed dish autocompletion mapreduce job. Results: %d" % dish.count())