def METHOD_NAME(query: BaseQuery) -> Tuple[Dict[str, Dict[int, int]], bool]:
    def defaultdict_int_factory() -> Callable:
        return lambda: defaultdict(int)
    dict_grouped = defaultdict(defaultdict_int_factory())
    has_data = False
    for row in query:
        has_data = True
        age_range = row.age_group
        injury_id = row.injury_severity
        count = row.count
        # The age groups in the DB are not the same age groups in the Widget - so we need to merge some groups
        age_parse = parse_age_from_range(age_range)
        if not age_parse:
            dict_grouped[UNKNOWN][injury_id] += count
        else:
            min_age, max_age = age_parse
            found_age_range = False
            # Find to what "bucket" to aggregate the data
            for item_min_range, item_max_range in AGE_RANGE_DICT.items():
                if item_min_range <= min_age <= max_age <= item_max_range:
                    string_age_range = f"{item_min_range:02}-{item_max_range:02}"
                    dict_grouped[string_age_range][injury_id] += count
                    found_age_range = True
                    break
            if not found_age_range:
                dict_grouped[UNKNOWN][injury_id] += count
    # Rename the last key
    dict_grouped[SIXTY_FIVE_PLUS] = dict_grouped[SIXTY_TWOHUNDRED]
    del dict_grouped[SIXTY_TWOHUNDRED]
    return dict_grouped, has_data