--- a/.gitmodules +++ b/.gitmodules @@ -10,19 +10,22 @@ [submodule "lib/Requests"] path = lib/Requests url = https://github.com/rmccue/Requests.git -[submodule "javascripts/flotr2"] - path = javascripts/flotr2 +[submodule "js/flotr2"] + path = js/flotr2 url = https://github.com/HumbleSoftware/Flotr2.git [submodule "lib/phpquery"] path = lib/phpquery url = https://github.com/TobiaszCudnik/phpquery.git -[submodule "javascripts/sigma"] - path = javascripts/sigma +[submodule "js/sigma"] + path = js/sigma url = https://github.com/jacomyal/sigma.js.git -[submodule "javascripts/bubbletree"] - path = javascripts/bubbletree +[submodule "js/bubbletree"] + path = js/bubbletree url = https://github.com/okfn/bubbletree.git [submodule "lib/querypath"] path = lib/querypath url = https://github.com/technosophos/querypath.git +[submodule "lib/amon-php"] + path = lib/amon-php + url = https://github.com/martinrusev/amon-php.git
--- a/about.php +++ b/about.php @@ -10,8 +10,10 @@ Disclo.gs is a project to monitor Australian Federal Government agencies compliance with their <a href="http://www.oaic.gov.au/publications/other_operational/foi_policy_frequently_asked_questions.html#_Toc291837571">"proactive disclosure requirements" to make a transparency league table as suggested by gov2 taskforce http://gov2.net.au/blog/2009/09/19/a-league-ladder-of-psi-openness/</a>. <h2> Attributions </h2> -National Archives of Australia, Australian Governments’ Interactive Functions Thesaurus, 2nd edition, September 2005, published at http://www.naa.gov.au/recordkeeping/thesaurus/index.htm. - +National Archives of Australia, Australian Governments’ Interactive Functions Thesaurus, 2nd edition, September 2005, published at http://www.naa.gov.au/recordkeeping/thesaurus/index.htm <br/> +data.gov.au http://data.gov.au/dataset/directory-gov-au-full-data-export/ <br/> +directory.gov.au <br/> +australia.gov.au http://australia.gov.au/about/copyright <br/> <h2> Open everything </h2> All documents released CC-BY 3 AU Open source git @
--- a/admin/naa-agift-tree.php +++ b/admin/naa-agift-tree.php @@ -31,9 +31,9 @@ <div id="tree-container"></div> <div id="viz"></div> -<script type="text/javascript" src="../javascripts/jquery-1.6.2.min.js"></script> -<script type="text/javascript" src="../javascripts/d3.min.js"></script> -<script type="text/javascript" src="../javascripts/d3.layout.min.js"></script> +<script type="text/javascript" src="../js/jquery-1.6.2.min.js"></script> +<script type="text/javascript" src="../js/d3.min.js"></script> +<script type="text/javascript" src="../js/d3.layout.min.js"></script> <script> /**
--- a/alaveteli/exportAgencies.csv.php +++ b/alaveteli/exportAgencies.csv.php @@ -1,20 +1,6 @@ <?php include_once("../include/common.inc.php"); - -function shortName($name) { - $name = trim($name); - if (strstr($name,"Minister ") || strstr($name,"Treasurer") || strstr($name,"Parliamentary Secretary")) { - $badWords = Array ("Assisting the Prime Minister on","Assisting on"," the "," of "," for "," on "," and "," to ",","," ","'","`"); - return str_replace($badWords,"",$name); - } - - else { - $out = Array(); - preg_match_all('/[A-Z]/', $name, $out); - return implode("", $out[0]); - } -} setlocale(LC_CTYPE, 'C'); @@ -63,38 +49,36 @@ $row = Array(); $row["#id"] = $agency->id; $row["name"] = trim($agency->value->name); - if (isset($agency->value->foiEmail)) { - $row["request_email"] = $agency->value->foiEmail; - } else { - if ($agency->value->orgType == "FMA-DepartmentOfState") { - $row["request_email"] = "foi@" . GetDomain($agency->value->website); - } else { - $row["request_email"] = $foiEmail[$agency->value->parentOrg]; + $row["request_email"] = (isset($agency->value->foiEmail) ? $agency->value->foiEmail : ""); + $row["short_name"] = (isset($agency->value->shortName) ? $agency->value->shortName : ""); + $row["notes"] = (isset($agency->value->description) ? $agency->value->description : ""); + + $otherBodies = Array(); + if (isset($agency->value->foiBodies)) { + $otherBodies = array_merge($otherBodies, $agency->value->foiBodies); + } + if (isset($agency->value->positions)) { + $positions = Array(); + foreach ($agency->value->positions as $position) { + $positions[] = "Office of the ".$position; } + $otherBodies = array_merge($otherBodies, $positions); } - if (isset($agency->value->shortName)) { - $row["short_name"] = $agency->value->shortName; - } else { - $row["short_name"] = shortName($agency->value->name); + sort($otherBodies); + if (count($otherBodies) > 0) { + $row["notes"] .= "<br/> This department also responds to requests for information held by " . implode(", ", $otherBodies); } - $row["notes"] = ""; + $row["publication_scheme"] = (isset($agency->value->infoPublicationSchemeURL) ? $agency->value->infoPublicationSchemeURL : ""); $row["home_page"] = (isset($agency->value->website) ? $agency->value->website : ""); if ($agency->value->orgType == "FMA-DepartmentOfState") { - $row["tag_string"] = $tag[$agency->value->_id] . " " . $agency->value->orgType; + $row["tag_string"] = $tag[$agency->value->_id]; } else { - $row["tag_string"] = $tag[$agency->value->parentOrg] . " " . $agency->value->orgType; + $row["tag_string"] = $tag[$agency->value->parentOrg]; } - + $row["tag_string"] .= " " . $agency->value->orgType; + $row["tag_string"] .= " federal"; fputcsv($fp, array_values($row)); - - if (isset($agency->value->foiBodies)) { - foreach ($agency->value->foiBodies as $foiBody) { - $row['name'] = iconv("UTF-8", "ASCII//TRANSLIT",$foiBody); - $row["short_name"] = shortName($foiBody); - fputcsv($fp, array_values($row)); - } - } } } } catch (SetteeRestClientException $e) {
--- a/bubbletree.php +++ b/bubbletree.php @@ -5,13 +5,13 @@ <meta charset="UTF-8"/> <title>Minimal BubbleTree Demo</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script> - <script type="text/javascript" src="javascripts/bubbletree/lib/jquery.history.js"></script> - <script type="text/javascript" src="javascripts/bubbletree/lib/raphael.js"></script> - <script type="text/javascript" src="javascripts/bubbletree/lib/vis4.js"></script> - <script type="text/javascript" src="javascripts/bubbletree/lib/Tween.js"></script> - <script type="text/javascript" src="javascripts/bubbletree/build/bubbletree.js"></script> - <link rel="stylesheet" type="text/css" href="javascripts/bubbletree/build/bubbletree.css" /> - <script type="text/javascript" src="javascripts/bubbletree/styles/cofog.js"></script> + <script type="text/javascript" src="js/bubbletree/lib/jquery.history.js"></script> + <script type="text/javascript" src="js/bubbletree/lib/raphael.js"></script> + <script type="text/javascript" src="js/bubbletree/lib/vis4.js"></script> + <script type="text/javascript" src="js/bubbletree/lib/Tween.js"></script> + <script type="text/javascript" src="js/bubbletree/build/bubbletree.js"></script> + <link rel="stylesheet" type="text/css" href="js/bubbletree/build/bubbletree.css" /> + <script type="text/javascript" src="js/bubbletree/styles/cofog.js"></script> <script type="text/javascript">
--- /dev/null +++ b/documents/google676a414ad086cefb.html @@ -1,1 +1,2 @@ +google-site-verification: google676a414ad086cefb.html
--- /dev/null +++ b/documents/index.php @@ -1,1 +1,15 @@ +australian disclosure logs +are you looking for more information about: +contracts +gov orgs +lobbyists + +1/1/11 title (Dept dfggdfgdf) +description: +source link: +documents: + #1 title link + + +rss feed here
--- /dev/null +++ b/documents/rss.xml.php @@ -1,1 +1,30 @@ +<?php +// Agency X updated Y, new files, diff of plain text/link text, +// feed for just one agency or all +// This is a minimum example of using the Universal Feed Generator Class +include("lib/FeedWriter.php"); +//Creating an instance of FeedWriter class. +$TestFeed = new FeedWriter(RSS2); +//Setting the channel elements +//Use wrapper functions for common channelelements +$TestFeed->setTitle('Last Modified - All'); +$TestFeed->setLink('http://disclosr.lambdacomplex.org/rss.xml.php'); +$TestFeed->setDescription('This is test of creating a RSS 2.0 feed Universal Feed Writer'); +//Retriving informations from database +$rows = $db->get_view("app", "byLastModified")->rows; +//print_r($rows); +foreach ($rows as $row) { + //Create an empty FeedItem + $newItem = $TestFeed->createNewItem(); + //Add elements to the feed item + $newItem->setTitle($row['name']); + $newItem->setLink($row['id']); + $newItem->setDate(date("c", $row['metadata']['lastModified'])); + $newItem->setDescription($row['name']); + //Now add the feed item + $TestFeed->addItem($newItem); +} +//OK. Everything is done. Now genarate the feed. +$TestFeed->genarateFeed(); +?>
--- /dev/null +++ b/documents/runScrapers.php
--- /dev/null +++ b/documents/scrapers/3cd40b1240e987cbcd3f0e67054ce259.py @@ -1,1 +1,1 @@ - +http://www.apvma.gov.au/rss/disclosure.rss
--- /dev/null +++ b/documents/scrapers/8c9421f852c441910bf1d93a57b31d64.py @@ -1,1 +1,1 @@ - +http://www.daff.gov.au/about/foi/ips/disclosure_log
--- /dev/null +++ b/documents/scrapers/be9996f0ac58f71f23d074e82d44ead3.py @@ -1,1 +1,2 @@ +http://foi.deewr.gov.au/disclosure-log/rss
--- /dev/null +++ b/documents/scrapers/e2a845e55bc9986e6c75c5ad2c508b8d.py @@ -1,1 +1,1 @@ - +www.finance.gov.au/foi/disclosure-log/foi-rss.xml
--- /dev/null +++ b/documents/scrapers/rtk.py @@ -1,1 +1,1 @@ - +http://www.righttoknow.org.au/feed/search/%20(latest_status:successful%20OR%20latest_status:partially_successful)
--- /dev/null +++ b/documents/search.php @@ -1,1 +1,25 @@ +<?php +include_once('include/common.inc.php'); +include_header('Search'); +?> +<div class="foundation-header"> + <h1><a href="search.php">Search</a></h1> +</div> +<form> + <input type="text" name="q" value="<?php if (isset($_REQUEST['q']))echo $_REQUEST['q'];?>"/> + <input type="submit"/> +</form> +<?php +if (isset($_REQUEST['q'])) { + $request = Requests::get($serverAddr."disclosr-documents/_fti/_design/lucene/by_all?include_docs=true&q=".$_REQUEST['q']); + $results = json_decode($request->body); + $db = $server->get_db('disclosr-documents'); + foreach ($results->rows as $result) { + //print_r($result); + //$row = $db->get($result->id); + echo $result->doc->_id." ".$result->doc->url."<br>".PHP_EOL; + } +} +include_footer(); +?>
--- a/getAgency.php +++ b/getAgency.php @@ -9,7 +9,11 @@ if (strpos($key, "_") === 0 || $key== "metadata") return; echo "<tr>"; - echo "<td>" . $schemas['agency']["properties"][$key]['x-title'] . "<br><small>" . $schemas['agency']["properties"][$key]['description'] . "</small></td><td>"; + echo "<td>"; + if (isset($schemas['agency']["properties"][$key])) { + echo $schemas['agency']["properties"][$key]['x-title'] . "<br><small>" . $schemas['agency']["properties"][$key]['description']."</small>"; + } + echo "</td><td>"; if (is_array($value)) { echo "<ol>"; foreach ($value as $subkey => $subvalue) {
--- a/graph.php +++ b/graph.php @@ -86,9 +86,9 @@ if ($format == "html") { ?> <div id="sigma-example" width="960" style="min-height:800px;background-color: #333;"></div> - <script src="javascripts/sigma.min.js"></script> - <script src="javascripts/sigma/plugins/sigma.parseGexf.js"></script> - <script src="javascripts/sigma/plugins/sigma.forceatlas2.js"></script> + <script src="js/sigma.min.js"></script> + <script src="js/sigma/plugins/sigma.parseGexf.js"></script> + <script src="js/sigma/plugins/sigma.forceatlas2.js"></script> <script type="text/javascript">function init() { // Instanciate sigma.js and customize rendering : var sigInst = sigma.init(document.getElementById('sigma-example')).drawingProperties({
--- a/include/common.inc.php +++ b/include/common.inc.php @@ -14,6 +14,11 @@ require_once $basePath.'lib/Requests/library/Requests.php'; Requests::register_autoloader(); +require $basePath."lib/amon-php/amon.php"; +Amon::config(array('address'=> 'http://127.0.0.1:2464', + 'protocol' => 'http', + 'secret_key' => "I2LJ6dOMmlnXgVAkTPFXd5M3ejkga8Gd2FbBt6iqZdw")); +Amon::setup_exception_handler(); # Convert a stdClass to an Array. http://www.php.net/manual/en/language.types.object.php#102735 function object_to_array(stdClass $Class) {
--- a/include/couchdb.inc.php +++ b/include/couchdb.inc.php @@ -168,6 +168,7 @@ $server = new SetteeServer($serverAddr); function setteErrorHandler($e) { + Amon::log($e->getMessage() . " " . print_r($_SERVER,true), array('error')); echo $e->getMessage() . "<br>" . PHP_EOL; }
--- a/include/template.inc.php +++ b/include/template.inc.php @@ -66,11 +66,11 @@ <!-- Included JS Files --> - <script src="<?php echo $basePath; ?>javascripts/foundation.js"></script> - <script src="<?php echo $basePath; ?>javascripts/app.js"></script> + <script src="<?php echo $basePath; ?>js/foundation.js"></script> + <script src="<?php echo $basePath; ?>js/app.js"></script> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> - <script type="text/javascript" src="javascripts/flotr2/flotr2.js"></script> + <script type="text/javascript" src="<?php echo $basePath ?>js/flotr2/flotr2.js"></script> <?php if (strpos($_SERVER['SERVER_NAME'], ".gs")) { ?>
--- a/javascripts/app.js +++ /dev/null @@ -1,95 +1,1 @@ -/* Foundation v2.1.4 http://foundation.zurb.com */ -$(document).ready(function () { - /* Use this js doc for all application specific JS */ - - /* TABS --------------------------------- */ - /* Remove if you don't need :) */ - - function activateTab($tab) { - var $activeTab = $tab.closest('dl').find('a.active'), - contentLocation = $tab.attr("href") + 'Tab'; - - //Make Tab Active - $activeTab.removeClass('active'); - $tab.addClass('active'); - - //Show Tab Content - $(contentLocation).closest('.tabs-content').children('li').hide(); - $(contentLocation).show(); - } - - $('dl.tabs').each(function () { - //Get all tabs - var tabs = $(this).children('dd').children('a'); - tabs.click(function (e) { - activateTab($(this)); - }); - }); - - if (window.location.hash) { - activateTab($('a[href="' + window.location.hash + '"]')); - } - - /* ALERT BOXES ------------ */ - $(".alert-box").delegate("a.close", "click", function(event) { - event.preventDefault(); - $(this).closest(".alert-box").fadeOut(function(event){ - $(this).remove(); - }); - }); - - - /* PLACEHOLDER FOR FORMS ------------- */ - /* Remove this and jquery.placeholder.min.js if you don't need :) */ - - //$('input, textarea').placeholder(); - - - - /* UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE6/7/8 SUPPORT AND ARE USING .block-grids */ -// $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'left'}); -// $('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'left'}); -// $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'left'}); -// $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'left'}); - - - - /* DROPDOWN NAV ------------- */ - - var currentFoundationDropdown = null; - $('.nav-bar li a, .nav-bar li a:after').each(function() { - $(this).data('clicks', 0); - }); - $('.nav-bar li a, .nav-bar li a:after').live('click', function(e) { - e.preventDefault(); - if (currentFoundationDropdown !== $(this).index() || currentFoundationDropdown === null) { - $(this).data('clicks', 0); - currentFoundationDropdown = $(this).index(); - } - $(this).data('clicks', ($(this).data('clicks') + 1)); - var f = $(this).siblings('.flyout'); - if (!f.is(':visible') && $(this).parent('.has-flyout').length > 1) { - $('.nav-bar li .flyout').hide(); - f.show(); - } else if (($(this).data('clicks') > 1) || ($(this).parent('.has-flyout').length < 1)) { - window.location = $(this).attr('href'); - } - }); - $('.nav-bar').live('click', function(e) { - e.stopPropagation(); - if ($(e.target).parents().is('.flyout') || $(e.target).is('.flyout')) { - e.preventDefault(); - } - }); - // $('body').bind('touchend', function(e) { - // if (!$(e.target).parents().is('.nav-bar') || !$(e.target).is('.nav-bar')) { - // $('.nav-bar li .flyout').is(':visible').hide(); - // } - // }); - - /* DISABLED BUTTONS ------------- */ - /* Gives elements with a class of 'disabled' a return: false; */ - -}); -
--- a/javascripts/bubbletree +++ /dev/null
--- a/javascripts/d3.layout.min.js +++ /dev/null @@ -1,1 +1,1 @@ -(function(){function bh(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function bg(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function bf(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function be(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function bd(a,b){return a.depth-b.depth}function bc(a,b){return b.x-a.x}function bb(a,b){return a.x-b.x}function ba(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=ba(c[f],b),a)>0&&(a=d)}return a}function _(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function $(a){return a.children?a.children[0]:a._tree.thread}function Z(a,b){return a.parent==b.parent?1:2}function Y(a){var b=a.children;return b?Y(b[b.length-1]):a}function X(a){var b=a.children;return b?X(b[0]):a}function W(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function V(a){return 1+d3.max(a,function(a){return a.y})}function U(a,b,c){var d=b.r+c.r,e=a.r+c.r,f=b.x-a.x,g=b.y-a.y,h=Math.sqrt(f*f+g*g),i=(e*e+h*h-d*d)/(2*e*h),j=Math.acos(i),k=i*e,l=Math.sin(j)*e;f/=h,g/=h,c.x=a.x+k*f+l*g,c.y=a.y+k*g-l*f}function T(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)T(e[f],b,c,d)}}function S(a){var b=a.children;b?(b.forEach(S),a.r=P(b)):a.r=Math.sqrt(a.value)}function R(a){delete a._pack_next,delete a._pack_prev}function Q(a){a._pack_next=a._pack_prev=a}function P(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(Q),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],U(g,h,i),l(i),M(g,i),g._pack_prev=i,M(i,h),h=g._pack_next;for(var m=3;m<f;m++){U(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(O(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(O(k,i)){p<o&&(n=-1,j=k);break}n==0?(M(g,i),h=i,l(i)):n>0?(N(g,j),h=j,m--):(N(j,h),g=j,m--)}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}a.forEach(R);return s}function O(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function N(a,b){a._pack_next=b,b._pack_prev=a}function M(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function L(a,b){return a.value-b.value}function J(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function I(a,b){return b.value-a.value}function H(a){return a.value}function G(a){return a.children}function F(a,b){a.sort=d3.rebind(a,b.sort),a.children=d3.rebind(a,b.children),a.links=J,a.value=d3.rebind(a,b.value),a.nodes=function(b){K=!0;return(a.nodes=a)(b)};return a}function E(a){return[d3.min(a),d3.max(a)]}function D(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function C(a,b){return D(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function B(a,b){return a+b[1]}function A(a){return a.reduce(B,0)}function z(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function w(a,b,c){a.y0=b,a.y=c}function v(a){return a.y}function u(a){return a.x}function t(a){return 1}function s(a){return 20}function r(a){var b=0,c=0;a.count=0;if(!a.leaf){var d=a.nodes,e=d.length,f=-1,g;while(++f<e){g=d[f];if(g==null)continue;r(g),a.count+=g.count,b+=g.count*g.cx,c+=g.count*g.cy}}a.point&&(a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5),a.count++,b+=a.point.x,c+=a.point.y),a.cx=b/a.count,a.cy=c/a.count}function q(){d3.event.stopPropagation(),d3.event.preventDefault()}function p(){i&&(q(),i=!1)}function o(){!f||(g&&(i=!0,q()),d3.event.type==="mouseup"&&n(),f.fixed=!1,e=h=f=j=null)}function n(){if(!!f){var a=j.parentNode;if(!a){f.fixed=!1,h=f=j=null;return}var b=m(a);g=!0,f.px=b[0]-h[0],f.py=b[1]-h[1],q(),e.resume()}}function m(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function l(a){a!==f&&(a.fixed=!1)}function k(a){a.fixed=!0}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;b.push(a);return b}function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}d3.layout={},d3.layout.bundle=function(){return function(b){var c=[],d=-1,e=b.length;while(++d<e)c.push(a(b[d]));return c}},d3.layout.chord=function(){function k(){b.sort(function(a,b){return i(a.target.value,b.target.value)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push(v.value<w.value?{source:w,target:v}:{source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function G(b,c){var d=m(this.parentNode);(f=b).fixed=!0,g=!1,j=this,e=a,h=[d[0]-b.x,d[1]-b.y],q()}function F(){var a=A.length,e=B.length,f=d3.geom.quadtree(A),g,h,j,k,l,m,n;for(g=0;g<e;++g){h=B[g],j=h.source,k=h.target,m=k.x-j.x,n=k.y-j.y;if(l=m*m+n*n)l=d*D[g]*((l=Math.sqrt(l))-C[g])/l,m*=l,n*=l,k.x-=m,k.y-=n,j.x+=m,j.y+=n}var o=d*x;m=c[0]/2,n=c[1]/2,g=-1;while(++g<a)h=A[g],h.x+=(m-h.x)*o,h.y+=(n-h.y)*o;r(f);var p=d*w;g=-1;while(++g<a)f.visit(E(A[g],p));g=-1;while(++g<a)h=A[g],h.fixed?(h.x=h.px,h.y=h.py):(h.x-=(h.px-(h.px=h.x))*i,h.y-=(h.py-(h.py=h.y))*i);b.tick.dispatch({type:"tick",alpha:d});return(d*=.99)<.005}function E(a,b){return function(c,d,e,f,g){if(c.point!==a){var h=c.cx-a.x,i=c.cy-a.y,j=1/Math.sqrt(h*h+i*i);if((f-d)*j<y){var k=b*c.count*j*j;a.x+=h*k,a.y+=i*k;return!0}if(c.point&&isFinite(j)){var k=b*j*j;a.x+=h*k,a.y+=i*k}}}}var a={},b=d3.dispatch("tick"),c=[1,1],d,i=.9,u=s,v=t,w=-30,x=.1,y=.8,z,A=[],B=[],C,D;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return A;A=b;return a},a.links=function(b){if(!arguments.length)return B;B=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.linkDistance=function(b){if(!arguments.length)return u;u=d3.functor(b);return a},a.distance=a.linkDistance,a.linkStrength=function(b){if(!arguments.length)return v;v=d3.functor(b);return a},a.friction=function(b){if(!arguments.length)return i;i=b;return a},a.charge=function(b){if(!arguments.length)return w;w=b;return a},a.gravity=function(b){if(!arguments.length)return x;x=b;return a},a.theta=function(b){if(!arguments.length)return y;y=b;return a},a.start=function(){function l(){if(!i){i=[];for(d=0;d<e;++d)i[d]=[];for(d=0;d<f;++d){var a=B[d];i[a.source.index].push(a.target),i[a.target.index].push(a.source)}}return i[b]}function k(a,c){var d=l(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}var b,d,e=A.length,f=B.length,g=c[0],h=c[1],i,j;for(b=0;b<e;++b)(j=A[b]).index=b;C=[],D=[];for(b=0;b<f;++b)j=B[b],typeof j.source=="number"&&(j.source=A[j.source]),typeof j.target=="number"&&(j.target=A[j.target]),C[b]=u.call(this,j,b),D[b]=v.call(this,j,b);for(b=0;b<e;++b)j=A[b],isNaN(j.x)&&(j.x=k("x",g)),isNaN(j.y)&&(j.y=k("y",h)),isNaN(j.px)&&(j.px=j.x),isNaN(j.py)&&(j.py=j.y);return a.resume()},a.resume=function(){d=.1,d3.timer(F);return a},a.stop=function(){d=0;return a},a.drag=function(){this.on("mouseover.force",k).on("mouseout.force",l).on("mousedown.force",G).on("touchstart.force",G),d3.select(window).on("mousemove.force",n).on("touchmove.force",n).on("mouseup.force",o,!0).on("touchend.force",o,!0).on("click.force",p,!0);return a};return a};var e,f,g,h,i,j;d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.size=function(a){if(!arguments.length)return b;b=a;return e};return F(e,a)},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{data:f[a],value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function g(h,i){var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1],k[p][q][1])}return h}var a=Object,b=x["default"],c=y.zero,d=w,e=u,f=v;g.values=function(b){if(!arguments.length)return a;a=b;return g},g.order=function(a){if(!arguments.length)return b;b=typeof a=="function"?a:x[a];return g},g.offset=function(a){if(!arguments.length)return c;c=typeof a=="function"?a:y[a];return g},g.x=function(a){if(!arguments.length)return e;e=a;return g},g.y=function(a){if(!arguments.length)return f;f=a;return g},g.out=function(a){if(!arguments.length)return d;d=a;return g};return g};var x={"inside-out":function(a){var b=a.length,c,d,e=a.map(z),f=a.map(A),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},y={silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){var b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:function(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}};d3.layout.histogram=function(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1/l:1,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;f=-1;while(++f<l)o