add RTK import
Former-commit-id: a6b6a0a350cf467915ec023c9e41421df3fcb83d
--- a/.gitmodules
+++ b/.gitmodules
@@ -25,7 +25,4 @@
[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,10 +10,8 @@
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 <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/>
+National Archives of Australia, Australian Governments’ Interactive Functions Thesaurus, 2nd edition, September 2005, published at http://www.naa.gov.au/recordkeeping/thesaurus/index.htm.
+
<h2> Open everything </h2>
All documents released CC-BY 3 AU
Open source git @
--- /dev/null
+++ b/admin/importRTKbodies.php
@@ -1,1 +1,56 @@
+<?php
+require_once '../include/common.inc.php';
+
+$db = $server->get_db('disclosr-agencies');
+$rows = $db->get_view("app", "byName")->rows;
+$nametoid = Array();
+$accounts = Array();
+foreach ($rows as $row) {
+ $nametoid[trim($row->key)] = $row->value;
+}
+
+function extractCSVAccounts($url, $nameField, $accountField, $filter) {
+ global $accounts, $nametoid;
+ $request = Requests::get($url);
+ echo $url;
+ $Data = str_getcsv($request->body, "\n"); //parse the rows
+ $headers = Array();
+ foreach ($Data as $num => $line) {
+ $Row = str_getcsv($line, ",");
+ if ($num == 0) {
+ $headers = $Row;
+ print_r($headers);
+ } else {
+ if (isset($Row[array_search($nameField, $headers)])) {
+ $agencyName = $Row[array_search($nameField, $headers)];
+ if (!in_array(trim($agencyName), array_keys($nametoid))) {
+ echo "$agencyName missing" . PHP_EOL;
+ } else {
+ echo $Row[array_search($nameField, $headers)] . PHP_EOL;
+ $accounts[$nametoid[trim($agencyName)]]["rtkURLs"][$agencyName] = 'http://www.righttoknow.org.au/body/'.$Row[array_search($accountField, $headers)];
+ }
+ } else {
+ echo "error finding any agency" . $line . PHP_EOL;
+ }
+ }
+ }
+}
+
+extractCSVAccounts("http://www.righttoknow.org.au/body/all-authorities.csv","Agency","URL name");
+print_r($accounts);
+/* foreach ($accounts as $id => $accountTypes) {
+ echo $id . "<br>" . PHP_EOL;
+ $doc = object_to_array($db->get($id));
+ // print_r($doc);
+
+ foreach ($accountTypes as $accountType => $accounts) {
+ if (!isset($doc["has" . $accountType]) || !is_array($doc["has" . $accountType])) {
+ $doc["has" . $accountType] = Array();
+ }
+ $doc["has" . $accountType] = array_unique(array_merge($doc["has" . $accountType], $accounts));
+ }
+ $db->save($doc);
+}*/
+?>
+
--- a/alaveteli/exportAgencies.csv.php
+++ b/alaveteli/exportAgencies.csv.php
@@ -1,6 +1,20 @@
<?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');
@@ -49,36 +63,45 @@
$row = Array();
$row["#id"] = $agency->id;
$row["name"] = trim($agency->value->name);
- $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->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];
+ }
}
- 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];
+ $row["tag_string"] = $tag[$agency->value->_id] . " " . $agency->value->orgType;
} else {
- $row["tag_string"] = $tag[$agency->value->parentOrg];
+ $row["tag_string"] = $tag[$agency->value->parentOrg] . " " . $agency->value->orgType;
}
- $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));
+ }
+ }
+ if (isset($agency->value->positions)) {
+ foreach ($agency->value->positions as $position) {
+ $row['name'] = iconv("UTF-8", "ASCII//TRANSLIT",$position);
+ $row["short_name"] = shortName($position);
+ fputcsv($fp, array_values($row));
+ }
+ }
}
}
} catch (SetteeRestClientException $e) {
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -14,11 +14,6 @@
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,7 +168,6 @@
$server = new SetteeServer($serverAddr);
function setteErrorHandler($e) {
- Amon::log($e->getMessage() . " " . print_r($_SERVER,true), array('error'));
echo $e->getMessage() . "<br>" . PHP_EOL;
}
--- a/js/bubbletree
+++ /dev/null
--- a/js/flotr2
+++ /dev/null
--- a/js/sigma
+++ /dev/null
--- a/lib/amon-php
+++ /dev/null