<commit_before>
<!DOCTYPE html>
<html>
    <head>
        <title>
            About Measure G
        </title>

        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
        <link rel="icon" href="favicon.ico" type="image/x-icon">

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

        <script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['treemap']}]}"></script>
       
   

        <style type="text/css">

            html, body, #map {
                height: 100%;
                padding: 0;
                margin: 0;

                background-color:#fff;
                text-rendering:optimizeLegibility;
                -webkit-text-rendering:optimizeLegibility;
                -webkit-font-smoothing:antialiased;
                color:#333;
                font-weight:300;
                line-height:25px;
                font-family:"Proxima Nova W01","Helvetica Neue",Helvetica,Arial,sans-serif
            }

            /* Wrapper for page content to push down footer */
            #wrap {
              min-height: 100%;
              height: 100%;
            }

            #wrap > .center-container {
              padding: 50px 0 0 0;
              margin:0;
            }

            .center-container, .center-row {
              height:100%;
            }

            .container {
                height: 97%
            }
            #goUp {
                margin: 0 5px;
            }

            </style>

    </head>
    <body>

        <!-- Wrap all page content here -->
        <div id="wrap">

            <!-- Fixed navbar -->
            <div class="navbar navbar-default navbar-fixed-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-target" aria-expanded="false">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="index.html"><strong>Explore Measure G</strong></a>
                    </div>
                    <div class="collapse navbar-collapse" id="navbar-collapse-target">
                        <ul class="nav navbar-nav">
                            <li class=""><a href="index.html">About</a></li>
                            <li class=""><a href="map.html">By Location</a></li>
                            <li class=""><a href="programs.html">By Program</a></li>
                            <li class="active"><a href="treemap.html">Tree Map</a></li>
                        </ul>
                    </div>
                </div>
            </div>

          <!-- Begin page content -->
          <div class="center-container">

            <div class="center-row">
                <div class="container">
                    <div id="chart_div">
                    </div>
                    <input type="button" id="goUp" value="Go up one level" />
                </div>
                
            </div>


          </div>

        </div> <!-- end wrap -->

        <!-- Place your code in the script tags below -->
        <script type="text/javascript">
            google.load("visualization", "1.1", {packages:["treemap"]});

            var dataHeader = [
                ['Spending by Program', null, 0],
                ['CLASS SIZE REDUCTION', 'Spending by Program', null],
                ['ART', 'Spending by Program', null],
                ['MUSIC', 'Spending by Program', null],
                ['COVERED ELEM INTERVENTION PDS', 'Spending by Program', null],
                ['BASIC SCHOOL SUPPORT', 'Spending by Program', null],
                ['SCHOOL LIBRARIES', 'Spending by Program', null],
                ['ORATORICAL FEST/PERFORMANCES', 'Spending by Program', null],
                ['Oakland Fine Arts Summer Schl', 'Spending by Program', null],
                ['MIDDLE SCHOOL ELECTIVES', 'Spending by Program', null],
                ['NCLB HQT COMPLIANCE', 'Spending by Program', null],
                ['OTH PROGRAMS / LOCAL GOALS', 'Spending by Program', null],
                ['HR Recruitment', 'Spending by Program', null]
            ];

            var dataByYear = {};

            years = ["2012", "2013", "2014"];

            $.getJSON('treemap.json', function(data) {

                $.each(data, function(key, row) {

                    $.each(years, function (key, year) {
                        item = [
                            {v: ""+row.uid, f: row.object},
                            row.program,
                            {v: row["g"+year], f: row["money_"+year]}
                        ];

                        if(dataByYear[year]) {
                            dataByYear[year].push(item);
                        } else {
                            dataByYear[year] = [item];
                        }
                    });

                });

                //Add a header to each program data set (only happens once)
                for(var year in dataByYear) {
                    for(var key in dataHeader) {
                        dataByYear[year].unshift(dataHeader[key]);
                    };
                    dataByYear[year].unshift(['Object','Program','Spending by Program']);
                };

            });
<commit_msg>remove racing condition, make getJSON synchromous<commit_after>
<!DOCTYPE html>
<html>
    <head>
        <title>
            About Measure G
        </title>

        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
        <link rel="icon" href="favicon.ico" type="image/x-icon">

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

        <script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['treemap']}]}"></script>
       
   

        <style type="text/css">

            html, body, #map {
                height: 100%;
                padding: 0;
                margin: 0;

                background-color:#fff;
                text-rendering:optimizeLegibility;
                -webkit-text-rendering:optimizeLegibility;
                -webkit-font-smoothing:antialiased;
                color:#333;
                font-weight:300;
                line-height:25px;
                font-family:"Proxima Nova W01","Helvetica Neue",Helvetica,Arial,sans-serif
            }

            /* Wrapper for page content to push down footer */
            #wrap {
              min-height: 100%;
              height: 100%;
            }

            #wrap > .center-container {
              padding: 50px 0 0 0;
              margin:0;
            }

            .center-container, .center-row {
              height:100%;
            }

            .container {
                height: 97%
            }
            #goUp {
                margin: 0 5px;
            }

            </style>

    </head>
    <body>

        <!-- Wrap all page content here -->
        <div id="wrap">

            <!-- Fixed navbar -->
            <div class="navbar navbar-default navbar-fixed-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-target" aria-expanded="false">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="index.html"><strong>Explore Measure G</strong></a>
                    </div>
                    <div class="collapse navbar-collapse" id="navbar-collapse-target">
                        <ul class="nav navbar-nav">
                            <li class=""><a href="index.html">About</a></li>
                            <li class=""><a href="map.html">By Location</a></li>
                            <li class=""><a href="programs.html">By Program</a></li>
                            <li class="active"><a href="treemap.html">Tree Map</a></li>
                        </ul>
                    </div>
                </div>
            </div>

          <!-- Begin page content -->
          <div class="center-container">

            <div class="center-row">
                <div class="container">
                    <div id="chart_div">
                    </div>
                    <input type="button" id="goUp" value="Go up one level" />
                </div>
                
            </div>


          </div>

        </div> <!-- end wrap -->

        <!-- Place your code in the script tags below -->
        <script type="text/javascript">
            google.load("visualization", "1.1", {packages:["treemap"]});

            var dataHeader = [
                ['Spending by Program', null, 0],
                ['CLASS SIZE REDUCTION', 'Spending by Program', null],
                ['ART', 'Spending by Program', null],
                ['MUSIC', 'Spending by Program', null],
                ['COVERED ELEM INTERVENTION PDS', 'Spending by Program', null],
                ['BASIC SCHOOL SUPPORT', 'Spending by Program', null],
                ['SCHOOL LIBRARIES', 'Spending by Program', null],
                ['ORATORICAL FEST/PERFORMANCES', 'Spending by Program', null],
                ['Oakland Fine Arts Summer Schl', 'Spending by Program', null],
                ['MIDDLE SCHOOL ELECTIVES', 'Spending by Program', null],
                ['NCLB HQT COMPLIANCE', 'Spending by Program', null],
                ['OTH PROGRAMS / LOCAL GOALS', 'Spending by Program', null],
                ['HR Recruitment', 'Spending by Program', null]
            ];

            var dataByYear = {};

            years = ["2012", "2013", "2014"];

            $.ajax('treemap.json',{
                async: false
            })


                .done(function (data) {

                  $.each(data, function(key, row) {

                      $.each(years, function (key, year) {
                          item = [
                              {v: ""+row.uid, f: row.object},
                              row.program,
                              {v: row["g"+year], f: row["money_"+year]}
                          ];

                          if(dataByYear[year]) {
                              dataByYear[year].push(item);
                          } else {
                              dataByYear[year] = [item];
                          }
                      });

                  });

                  //Add a header to each program data set (only happens once)
                  for(var year in dataByYear) {
                      for(var key in dataHeader) {
                          dataByYear[year].unshift(dataHeader[key]);
                      };
                      dataByYear[year].unshift(['Object','Program','Spending by Program']);
                  };

                });

{'fraction_non_alphanumeric': 0.14190344378409184, 'fraction_numerical': 0.010258080273548808, 'mean_word_length': 1.2999438307433064, 'pattern_counts': {'":': 0, '<': 157, '<?xml version=': 0, '>': 159, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6045320', 'n_tokens_mistral': 3487, 'n_tokens_neox': 3138, 'n_words': 686}