def format_and_score_diff_data(self, diff_results):
        """Reformat the api results to work with the front-end."""
        base = dict()
        meta = base.setdefault('meta', dict())
        tests = base.setdefault('tests', dict())
        score = base.setdefault('score', dict())
        for model_filename, result in iteritems(diff_results):
            if meta == dict():
                meta = result["meta"]
            for test_id, test_results in iteritems(result["tests"]):
                tests.setdefault(test_id, dict())
                if tests[test_id] == dict():
                    tests[test_id]["summary"] = test_results["summary"]
                    tests[test_id]["title"] = test_results["title"]
                    tests[test_id]["format_type"] = test_results["format_type"]
                if isinstance(test_results["metric"], dict):
                    tests[test_id].setdefault("diff", dict())
                    for param in test_results["metric"]:
                        tests[test_id]["diff"].setdefault(param, list()). \
                            append({
                                "model": model_filename,
                                "data": test_results["data"].setdefault(param),
                                "duration":
                                    test_results["duration"].setdefault(param),
                                "message":
                                    test_results["message"].setdefault(param),
                                "metric":
                                    test_results["metric"].setdefault(param),
                                "result":
                                    test_results["result"].setdefault(param)})
                else:
                    tests[test_id].setdefault("diff", list())
                    tests[test_id]["diff"].append({
                        "model": model_filename,
                        "data": test_results.setdefault("data"),
                        "duration": test_results.setdefault("duration"),
                        "message": test_results.setdefault("message"),
                        "metric": test_results.setdefault("metric"),
                        "result": test_results.setdefault("result")})
            self.result = result
            self.compute_score()
            score.setdefault('total_score', dict()).setdefault('diff', list())
            score.setdefault('sections', dict()).setdefault('diff', list())
            score['total_score']['diff'].append({
                "model": model_filename,
                "total_score": self.result['score']['total_score']})
            for section in self.result['score']['sections']:
                section.update({"model": model_filename})
                score['sections']['diff'].append(section)
        return base
Reformat the api results to work with the front-end.