def METHOD_NAME(self):
    '''Builds any invalid atomic result caches and creates final output'''
    timing = {
        'start': monotonic()
    }
    logger.debug('T%d: Result data build started', timing['start'])
    error_flag = False
    results = None
    self.check_buildToken(timing) # Don't restart calculation if another calculation thread exists
    if self.get_valid(): # Output existing calculated results
        logger.info('T%d: Returning valid cache', timing['start'])
    else:
        timing['build_start'] = monotonic()
        self.set_buildToken(monotonic())
        heats = {}
        for heat in self._racecontext.rhdata.get_heats():
            if self._racecontext.rhdata.savedRaceMetas_has_heat(heat.id):
                rounds = []
                for race in self._racecontext.rhdata.get_savedRaceMetas_by_heat(heat.id):    
                    pilotraces = []
                    for pilotrace in self._racecontext.rhdata.get_savedPilotRaces_by_savedRaceMeta(race.id):
                        gevent.sleep()
                        laps = []
                        for lap in self._racecontext.rhdata.get_savedRaceLaps_by_savedPilotRace(pilotrace.id):
                            laps.append({
                                'id': lap.id,
                                'lap_time_stamp': lap.lap_time_stamp,
                                'lap_time': lap.lap_time,
                                'lap_time_formatted': lap.lap_time_formatted,
                                'source': lap.source,
                                'deleted': lap.deleted
                            })
                        pilot_data = self._racecontext.rhdata.get_pilot(pilotrace.pilot_id)
                        if pilot_data:
                            nodepilot = pilot_data.callsign
                        else:
                            nodepilot = None
                        pilotraces.append({
                            'callsign': nodepilot,
                            'pilot_id': pilotrace.pilot_id,
                            'node_index': pilotrace.node_index,
                            'laps': laps
                        })
                    results = self._racecontext.rhdata.get_results_savedRaceMeta(race)
                    rounds.append({
                        'id': race.round_id,
                        'start_time_formatted': race.start_time_formatted,
                        'nodes': pilotraces,
                        'leaderboard': results
                    })
                results = self._racecontext.rhdata.get_results_heat(heat)
                heats[heat.id] = {
                    'heat_id': heat.id,
                    'displayname': heat.display_name,
                    'rounds': rounds,
                    'leaderboard': results
                }
        timing['round_results'] = monotonic()
        logger.debug('T%d: heat_round results assembled in %.3fs', timing['start'], timing['round_results'] - timing['build_start'])
        gevent.sleep()
        heats_by_class = {}
        heats_by_class[RHUtils.CLASS_ID_NONE] = [heat.id for heat in self._racecontext.rhdata.get_heats_by_class(RHUtils.CLASS_ID_NONE)]
        for race_class in self._racecontext.rhdata.get_raceClasses():
            heats_by_class[race_class.id] = [heat.id for heat in self._racecontext.rhdata.get_heats_by_class(race_class.id)]
        timing['by_class'] = monotonic()
        gevent.sleep()
        current_classes = {}
        for race_class in self._racecontext.rhdata.get_raceClasses():
            results = self._racecontext.rhdata.get_results_raceClass(race_class)
            ranking = self._racecontext.rhdata.get_ranking_raceClass(race_class)
            current_class = {}
            current_class['id'] = race_class.id
            current_class['name'] = race_class.name
            current_class['description'] = race_class.description
            current_class['leaderboard'] = results
            current_class['ranking'] = ranking
            current_classes[race_class.id] = current_class
        timing['event'] = monotonic()
        logger.debug('T%d: results by class assembled in %.3fs', timing['start'], timing['event'] - timing['by_class'])
        gevent.sleep()
        results = self._racecontext.rhdata.get_results_event()
        timing['event_end'] = monotonic()
        logger.debug('T%d: event results assembled in %.3fs', timing['start'], timing['event_end'] - timing['event'])
        payload = {
            'heats': heats,
            'heats_by_class': heats_by_class,
            'classes': current_classes,
            'event_leaderboard': results,
            'consecutives_count': self._racecontext.rhdata.get_optionInt('consecutivesCount', 3)
        }
        self.set_cache(payload)
        self.set_buildToken(False)
        if error_flag:
            logger.warning('T%d: Cache results build failed; leaving page cache invalid', timing['start'])
            # *** emit_priority_message(__("Results did not load completely. Please try again."), False)
            self._Events.trigger(Evt.CACHE_FAIL)
        else:
            self.set_valid(True)
            self._Events.trigger(Evt.CACHE_READY)
        logger.debug('T%d: Page cache built in: %fs', timing['start'], monotonic() - timing['build_start'])
    timing['end'] = monotonic()
    logger.info('T%d: Built results data in: %fs', timing['start'], timing['end'] - timing['start'])