From: maxious Date: Sat, 10 Nov 2012 14:29:53 +0000 Subject: refactor description parsing X-Git-Url: https://maxious.lambdacomplex.org/git/?p=disclosr.git&a=commitdiff&h=1539b350a87b24466d4fc04e42cf919653793a69 --- refactor description parsing Former-commit-id: 12d26f8b33a3ffcf9a8036b00437793bae515db4 --- --- a/.gitmodules +++ b/.gitmodules @@ -10,16 +10,25 @@ [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 +[submodule "documents/lib/parsedatetime"] + path = documents/lib/parsedatetime + url = git://github.com/bear/parsedatetime.git --- a/about.php +++ b/about.php @@ -1,6 +1,6 @@

About/FAQ

@@ -8,9 +8,12 @@

What is this?

Disclo.gs is a project to monitor Australian Federal Government agencies -compliance with their "proactive disclosure requirements". - - +compliance with their "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/. +

Attributions

+National Archives of Australia, Australian Governments’ Interactive Functions Thesaurus, 2nd edition, September 2005, published at http://www.naa.gov.au/recordkeeping/thesaurus/index.htm
+data.gov.au http://data.gov.au/dataset/directory-gov-au-full-data-export/
+directory.gov.au
+australia.gov.au http://australia.gov.au/about/copyright

Open everything

All documents released CC-BY 3 AU Open source git @ --- /dev/null +++ b/admin/agls.php @@ -1,1 +1,35 @@ + + namefunction"; +$db = $server->get_db('disclosr-agencies'); +try { + $agencies = $db->get_view("app", "byCanonicalName", null, true)->rows; + + + if ($agencies) { + foreach ($agencies as $row) { + + echo "" . $row->value->name . ""; + if (isset($row->value->metaTags)) { + if (is_array($row->value->metaTags)) { + $tags =$row->value->metaTags; + } else { + $tags = object_to_array($row->value->metaTags); + } + if (isset($tags['AGLS.Function'])) { + echo "" . $tags['AGLS.Function'] . ""; + } + } + echo ""; + } + } +} catch (SetteeRestClientException $e) { + setteErrorHandler($e); +} +include_footer(); +?> + --- a/admin/conflicts.php +++ b/admin/conflicts.php @@ -1,7 +1,7 @@ get_db('disclosr-agencies'); + +try { + $agencies = $db->get_view("app", "byCanonicalName", null, true)->rows; + //print_r($rows); + foreach ($agencies as $agency) { + //echo $agency->value->name . " ".$agency->value->website."
\n"; + // print_r($agency); + //hasRestricitiveLicence" hasRestrictiveLicense -> has Restrictive Licence + // "hasYoutube" -> Tube + // "comment" -> "comments" + if (!isset($agency->value->metaTags) && isset($agency->value->website)) { + echo $agency->value->name . " ".$agency->value->website."
\n"; + $agency->value->metaTags = Array(); + $request = Requests::get($agency->value->website); + $html = phpQuery::newDocumentHTML($request->body); + phpQuery::selectDocument($html); + foreach (pq('meta')->elements as $meta) { + $tagName = $meta->getAttribute('name');; + $content = $meta->getAttribute('content'); + if ($tagName != "") { +echo "$tagName == $content
\n"; + $agency->value->metaTags[$tagName] = $content; + } + } + //print_r($agency->value->metaTags); + $db->save($agency->value); + echo "
"; + flush(); + } + } +} catch (SetteeRestClientException $e) { + setteErrorHandler($e); +} +?> + --- /dev/null +++ b/admin/importRTKbodies.php @@ -1,1 +1,56 @@ +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 . "
" . 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); +}*/ +?> + --- /dev/null +++ b/admin/naa-agift-tree.php @@ -1,1 +1,2504 @@ + + + + Demo of the tree layout in D3.js + + + + + +
+
+ + + + + + + + + + --- /dev/null +++ b/admin/naa-agift.json @@ -1,1 +1,2232 @@ - +[ + "Home", + "index.htm", + [ + "BUSINESS SUPPORT AND REGULATION", + "000411.htm", + [ + "Association registration", + "000396.htm" + ], + [ + "Business process auditing", + "000413.htm" + ], + [ + "Business registration and licensing", + "000414.htm" + ], + [ + "Business sponsorship", + "001371.htm" + ], + [ + "Consumer protection", + "000439.htm" + ], + [ + "Fair trading compliance", + "000482.htm", + [ + "Prices surveillance", + "000533.htm" + ], + [ + "Product safety", + "000534.htm" + ], + [ + "Trade practices compliance", + "000583.htm" + ] + ], + [ + "Financial institutions regulation", + "000485.htm" + ], + [ + "Government procurement regulation", + "000491.htm" + ], + [ + "Industry assistance schemes", + "000499.htm" + ], + [ + "Industry development", + "000500.htm" + ], + [ + "Insurance regulation", + "000501.htm", + [ + "General insurance", + "000489.htm" + ], + [ + "Life insurance", + "000505.htm" + ] + ], + [ + "Professional accreditation", + "000535.htm" + ], + [ + "Small business services", + "000565.htm", + [ + "Small business advocacy", + "000563.htm" + ], + [ + "Small business development", + "000564.htm" + ] + ], + [ + "Stock market regulation", + "000572.htm" + ] + ], + [ + "CIVIC INFRASTRUCTURE", + "000424.htm", + [ + "Civic management", + "000425.htm", + [ + "Architectural services", + "000387.htm" + ], + [ + "Building approval services", + "000406.htm" + ], + [ + "Building regulations and standards", + "000408.htm" + ], + [ + "Engineering services", + "000477.htm" + ], + [ + "Town planning", + "000582.htm" + ] + ], + [ + "Energy supply", + "000476.htm" + ], + [ + "Integrated services planning", + "000503.htm" + ], + [ + "Public housing", + "000536.htm", + [ + "Public housing construction", + "000537.htm" + ], + [ + "Public housing design", + "000538.htm" + ], + [ + "Public housing maintenance", + "000540.htm" + ] + ], + [ + "Public land management", + "000541.htm", + [ + "Burial ground management", + "000410.htm" + ], + [ + "Cultural centre management", + "000444.htm" + ], + [ + "Garden management", + "000488.htm" + ], + [ + "Memorial maintenance", + "000509.htm" + ], + [ + "Recreational park management", + "000549.htm" + ], + [ + "Sporting facilities management", + "000571.htm" + ] + ], + [ + "Regional developme