(self)
return rows.values()
Return raw case rows grouped by recipe
Return raw case rows grouped by recipe
Return raw case rows grouped by recipe
def _get_grouped_rows(self):
        """Return raw case rows grouped by recipe"""
        rows = defaultdict(lambda: {
            'recipe': None,
            'references': [],
            'ingredients': [],
        })
        for row in self._ucr.get_data():
            if row['food_type'] in (STANDARD_RECIPE, NON_STANDARD_RECIPE):
                if row['already_reported_recipe_case_id']:
                    rows[row['already_reported_recipe_case_id']]['references'].append(row)
                else:
                    rows[row['doc_id']]['recipe'] = row
            elif row['recipe_case_id']:
                rows[row['recipe_case_id']]['ingredients'].append(row)
            else:
                # this isn't part of a recipe
                rows[row['doc_id']]['ingredients'].append(row)
        return rows.values()
def _get_grouped_rows ( self ) : rows = defaultdict ( lambda : { 'recipe' : None , 'references' : [ ] , 'ingredients' : [ ] , } ) for row in self . _ucr . get_data ( ) : if row [ 'food_type' ] in ( STANDARD_RECIPE , NON_STANDARD_RECIPE ) : if row [ 'already_reported_recipe_case_id' ] : rows [ row [ 'already_reported_recipe_case_id' ] ] [ 'references' ] . append ( row ) else : rows [ row [ 'doc_id' ] ] [ 'recipe' ] = row elif row [ 'recipe_case_id' ] : rows [ row [ 'recipe_case_id' ] ] [ 'ingredients' ] . append ( row ) else : # this isn't part of a recipe rows [ row [ 'doc_id' ] ] [ 'ingredients' ] . append ( row ) return rows . values ( )