Beginings of scoring
Beginings of scoring


Former-commit-id: 25071f148abb2abe0e2436ec3b83a60f7394b665

file:a/about.php -> file:b/about.php
--- a/about.php
+++ b/about.php
@@ -1,10 +1,27 @@
+<?php
+include_once('include/common.inc.php');
+include_header();
+?>
+<div class="foundation-header">
+    <h1><a href="about.php">About/FAQ</a></h1>
+    <h4 class="subheader">Lorem ipsum.</h4>
+</div>
+<h2> What is this? </h2>
+Disclosr 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"</a>.
+OGRE (Open Government Realization Evaluation) is a ranking of compliance with these requirements.
+Prometheus is the agent which polls agency websites to assess compliance.
 
-Organisational Data Sources
+<h2> Open everything </h2>
+all documents released CC-BY 3 AU
+Open source git @
+
+<h2>Organisational Data Sources</h2>
 
 http://www.comlaw.gov.au/Browse/Results/ByTitle/AdministrativeArrangementsOrders/Current/Ad/0 defines departments
 Agencies can be found in the Schedule to an Appropriation Bill (budget), Schedule to FMA Regulations and/or Public Service Act.
 
-http://www.finance.gov.au/publications/flipchart/docs/FMACACFlipchart.pdf summarises these
+http://www.finance.gov.au/publications/flipchart/docs/FMACACFlipchart.pdf summarises these. view-source:https://www.tenders.gov.au/?event=public.advancedsearch.home is great for the suspended/active status
 
 When defining the hierachy, this system is designed towards monitoring accountablity. Thus large agencies that have registered their own ABN 
 and have their own accountablity mechanisms/website recieve a seperate record as a child of their department.
@@ -14,10 +31,20 @@
 As agencies themselves shift between departments, there may be scope for providing time ranges but typically the newest hierarchy will be the one recorded.
 A department/agency name will be the newest active name assigned to that ABN.
 
+ABN information is derived from the ABR. This is the definitive umpire about which former name should be linked to which current name. 
+For example "Department of Transport and Regional Services" became "Department of Infrastructure, Transport, Regional Development and Local Government" (same ABN)
+however it later split into "Department of Infrastructure and Transport" (same ABN) 
+and "Department of Regional Australia, Regional Development and Local Government" (new ABN).
+
 Statistical information from http://www.apsc.gov.au/stateoftheservice/1011/statsbulletin/section1.html#t2total https://www.apsedii.gov.au/apsedii/CustomQueryx33.shtml
+and individual annual reports.
 
-Open Government Scoring
+<h2>Open Government Scoring</h2>
 +1 point for every true Has... attribute
 -1 point for every false Has... (ie. Has Not) attribute
 
+Don't like this? Make your own score, suggest a better scoring mechanism.
 
+<?php
+include_footer();
+?>

--- a/getAgency.php
+++ b/getAgency.php
@@ -33,7 +33,13 @@
             } if (strpos($key, "has") === 0) {
                 echo "<label for='$key'><input type='checkbox' id='$key' name='$key' value='$value'> $key</label>";
             } else {
-                echo "<label>$key</label><input  class='input-text' type='text' id='$key' name='$key' value='$value'/></tr>";
+                echo "<label>$key</label><input  class='input-text' type='text' id='$key' name='$key' value='$value'/>";
+                if ((strpos($key,"URL") > 0 || $key == 'website')&& $value != "") {
+                   echo "<a href='$value'>view</a>"; 
+                }
+                if ($key == 'abn') {
+                   echo "<a href='http://www.abr.business.gov.au/SearchByAbn.aspx?SearchText=33380054835'>view abn</a>";
+                }
             }
         }
     }

--- a/include/couchdb.inc.php
+++ b/include/couchdb.inc.php
@@ -8,12 +8,34 @@
     $obj->_id = "_design/" . urlencode("app");
     $obj->language = "javascript";
     $obj->views->byABN->map = "function(doc) {   emit(doc.abn, doc); };";
-    $obj->views->byName->map = "function(doc) {   emit(doc.name, doc); };";
+    $obj->views->byName->map = "function(doc) {   emit(doc.name, doc);
+ for (name in doc.otherNames) {
+if (doc.otherNames[name] != '' && doc.otherNames[name] != doc.name) {
+       	 emit(doc.otherNames[name], doc); 
+}
+        }
+};";
     $obj->views->byLastModified->map = "function(doc) {   emit(doc.metadata.lastModified, doc); }";
     $obj->views->getActive->map = 'function(doc) { if (doc.status == "active") {  emit(doc._id, doc); } };';
     $obj->views->getSuspended->map = 'function(doc) { if (doc.status == "suspended") {  emit(doc._id, doc); } };';
     $obj->views->getScrapeRequired->map = "function(doc) {   emit(doc.abn, doc); };";
     $obj->views->showNamesABNs->map = "function(doc) {   emit(doc._id, {name: doc.name, abn: doc.abn}); };";
+    // http://stackoverflow.com/questions/646628/javascript-startswith
+    $obj->views->score->map = 'if(!String.prototype.startsWith){
+    String.prototype.startsWith = function (str) {
+        return !this.indexOf(str);
+    }
+}
+
+function(doc) {
+count = 0;
+for(var propName in doc) {
+      if(typeof(doc[propName]) != "undefined" && propName.startsWith("l")) {
+  	count++
+	}
+}
+  emit(doc._id,{name: doc.name, score:count});
+}';
 
     // allow safe updates (even if slightly slower due to extra: rev-detection check).
     return $db->save($obj, true);

--- a/include/template.inc.php
+++ b/include/template.inc.php
@@ -43,7 +43,7 @@
                     <div class="eight columns hide-on-phones">
                         <strong class="right">
                             <a href="getAgency.php">Agencies</a>
-                             <a href="getAgency.php">About</a>
+                             <a href="about.php">About/FAQ</a>
                         </strong>
                     </div>
                 </div>

--- a/schemas/agency.json.php
+++ b/schemas/agency.json.php
@@ -4,8 +4,8 @@
     "description" => "Representation of government agency and online transparency measures",
     "type" => "object",
     "properties" => Array(
-        "name" => Array("type" => "string", "required" => true, "description" => "Agency Name, most recent and broadest"),
-        "othernames" => Array("type" => "array", "required" => true, "description" => "Agency Names",
+        "name" => Array("type" => "string", "required" => true, "x-title"=> "Agency Name", "description" => "Agency Name, most recent and broadest"),
+        "othernames" => Array("type" => "array", "required" => true, "x-title" => "Agency Past/Other Names", "description" => "Agency Names",
             "items" => Array("type" => "string")),
     ),
     /*"org":{"type":"object",

file:b/score.php (new)
--- /dev/null
+++ b/score.php
@@ -1,1 +1,19 @@
+<?php
 
+include_once('include/common.inc.php');
+include_header();
+
+$db = $server->get_db('disclosr-agencies');
+
+try {
+    $rows = $db->get_view("score", "score")->rows;
+    //print_r($rows);
+    foreach ($rows as $row) {
+        echo $row->value->name." ".$row->value->score."<br>";
+    }
+} catch (SetteeRestClientException $e) {
+    setteErrorHandler($e);
+}
+
+include_footer();
+?>

--- a/stylesheets/app.css
+++ b/stylesheets/app.css
@@ -21,14 +21,7 @@
   font-size: 16px;
   font-size: 1.6rem;
   font-weight: 800; }
-#navbar h1 a { color: #fff; font-weight: bold; }
-#navbar h2 a {
-  text-indent: -99999px;
-  display: block;
-  width: 82px;
-  height: 14px;
-  background: url('../images/by-zurb.png'); }
-  
+#navbar a { color: #fff; font-weight: bold; }
 
 #navbar strong { display: block; margin: 0; padding: 0; height: 14px; line-height: 14px; position: relative; bottom: 4px; }
 #navbar strong a {
@@ -39,5 +32,41 @@
 }
 #navbar strong a.button { padding: 4px 10px; font-weight: bold; }
 
+/* other zurb copied css */
+.row { max-width: 1200px; }
+
+div.foundation-header { margin: 0 0 40px 0; padding: 30px 0 0 0; border-bottom: solid 1px #ccc; }
+div.foundation-header h1 { margin-bottom: 0; padding: 0; }
+div.foundation-header h1 a { color: #181818; }
+div.foundation-header h1 a:hover { color: #181818; }
+div.foundation-header .subheader { margin-bottom: 9px; }
+
+div.highlight { margin-bottom: 12px; }
+
+img.beta { position: absolute; top: 0px; right: 0px; }
+
+/* Footer */
+footer.row {
+  margin-top: 80px;
+  border-top: solid 1px #e6e6e6;
+  padding-top: 20px; }
+footer.row h6 {
+  color: #6f6f6f;
+  font-size: 14px;
+  font-size: 1.4rem;
+  margin-bottom: 4px; }
+footer.row p {
+  color: #626262;
+  font-size: 12px;
+  font-size: 1.2rem;
+  line-height: 18px; }
+footer.row a {
+  color: #222222; }
+footer.row a:hover {
+  text-decoration: underline; }
+  
 
 
+.row.display { background: #f4f4f4; margin-bottom: 10px; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; }
+.row.display .column, .row.display .columns { background: #e7e7e7; font-size: 11px; text-indent: 3px; padding-top: 6px; padding-bottom: 6px; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; }
+