diff --git a/.gitignore b/.gitignore index 1c40c95..78ddb01 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ Raw/* # exclude everything except directory application *.[oa] +*.zip *~ * !application @@ -18,5 +19,6 @@ application/* !application/models !application/controllers +!assets/* application/config/database.php application/config/config.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..db545dc --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# OpenDuka + +Open Duka is a project designed by the [Open Institute](http://www.openinstitute.com/) that will provide a freely accessible database of information on Kenyan entities. + +This information will provide citizens, journalists, and civic activists with a practical and easy-to-use tool to understand the ownership structure of the world they live in, demonstrating the practical applications of open information for normal citizens. It will serve as a core dataset for citizens, journalists, and civic activists who want to build 3rd party public transparency and public accountability apps or services, by allowing them to cross reference the Open Duka company shareholder data against other datasets. + +The project aims to scrape data from various sources that range from shareholder information, procurement information, legal cases and company information. + +The current pilot is being launched in Kenya in partnership with the National Council of Law Reporting and funded by A.T.T.I. + +This will be expanded to other sources of corporate data and the site will incorporate visualizations that will be able to show linkages of the data. + + +# Installation + + * Install CodeIgnighter. Download it at https://github.com/EllisLab/CodeIgniter and follow installation documentation. + + * Download OpenDuka files to the CodIgniter instance folder. + + * Edit the config.php in the application/config folder to reflect the web instance you are running. + + * Upload and reconstruct the database from the openduka_alpha.sql file. + + * Edit the database.php in the application/config folder to reflect the database instance you are running. + + +# License + +Open Duka by Open Institute is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License. diff --git a/application/controllers/admin.php b/application/controllers/admin.php index 46eb985..7c8a4a9 100644 --- a/application/controllers/admin.php +++ b/application/controllers/admin.php @@ -292,6 +292,7 @@ function ListTable(){ } + function ListField(){ //$this->output->enable_profiler(TRUE); $stabs = $this->input->post('STab'); @@ -339,7 +340,7 @@ function ListFieldEdit(){ $representation = explode(",",(str_replace(" ","",(str_replace("`","",$doc_info[0]['representation']))))); //echo($stabs); //var_dump($doc_info); exit; - $list = "
'; @@ -369,29 +370,75 @@ function ListFieldEdit(){ } - function EntityExtract(){ - //$this->output->enable_profiler(TRUE); - - //$table_name = $this->input->post('tablename'); - $DocumentType = $this->input->post('DocumentType'); - //$Verb = $this->input->post('Verb'); - $DocName = str_replace(' ', '_', $this->input->post('DocName')); - $viwanja = $this->input->post('Extract'); + function ListFieldEntityEdit(){ + //$this->output->enable_profiler(TRUE); + $stabs = $this->input->post('STab'); + $doc_info = $this->admin_model->get_document_ref($stabs); + //$representation = explode(",",(str_replace(" ","",(str_replace("`","",$doc_info[0]['representation']))))); +//echo($stabs); + //var_dump($doc_info); exit; + $list = "'; + + $list = empty($list) ? "Sorry No Data" : $list; + + echo $list; + } + + + function EntityExtract(){ + //$this->output->enable_profiler(TRUE); + + $table_name = $this->input->post('tablename'); + $DocumentType = $this->input->post('DocumentType'); + //$Verb = $this->input->post('Verb'); + $DocName = (strlen(trim($this->input->post('DocName'))) >= 4) ? str_replace(' ', '_', $this->input->post('DocName')) : ''; + $viwanja = $this->input->post('Extract'); + + if (strlen($DocName) >= 4) { $this->admin_model->table_name_change('NewTable', $DocName); } + else { $DocName = $table_name; } + + $DocID = $this->admin_model->get_document_entry($DocName) ? : $this->admin_model->insert_document($DocName, $DocumentType); + $DocDetails = $this->admin_model->get_document_details($DocID); + $CountryID = $DocDetails[0]['CountryID']; + + //var_dump($viwanja); exit; + //var_dump($Verb); + //echo $DocumentType; exit; $list ="Records Submitted "; $l=0; for($i=0; $i| '. str_replace("_"," ", $key) .' | '; + + } else { + + $extraData .= ''. str_replace("_"," ", $key) .' | '; + } - } $extraData .= ''; - + //echo($extraData); exit; for($j=0; $j'. $val .' | ' ; + // $extraData .= ''. $val .' | ' ; } else { - $extraData .= ''. $val .' | ' ; + //if ($this->home->fieldcheck($fieldname,$dt)){ + //$extraData .= ''. str_replace("\r","", $val) .' | ' ; + //} else { + $extraData .= ''. str_replace("\r","", $val) .' | ' ; + //} } //if($i==12){break;} //++$i; @@ -776,14 +922,15 @@ function node_data(){ } $extraData .= '
|---|
This will be expanded to other sources of corporate data and the site will incorporate visualizations that will be able to show linkages of the data.
+ + +
+ + +- - -
- -+ + +
+ +
- To be able to use OpenDuka's API you need an API key. You can sign up for a key here.
+ To be able to use OpenDuka's API you need an API key. You can sign up for a key here.
Please note that you can only have one API key per app - where an app is defined as the root URL of your application that uses this API.
/api/search?key={YOUR - API - KEY}&term={YOUR SEARCH TERM}
+ /api/search?key={YOUR - API - KEY}&term={YOUR SEARCH TERM}
The above query returns a list of results like so:
[{"ID":"120","Name":"Betty Chepkemoi Koech (ms.)"},{"ID":"183","Name":"Beatrice Moige Gisemba"},{"ID":"329","Name":"Moi Teaching And Referral Hospital Board"},{"ID":"380","Name":"Cllr. Julia Lochingamoi"},{"ID":"1571","Name":"Richardmoitalel Ole Kenta"},{"ID":"1771","Name":"Nicholas Ole Moipei"},{"ID":"2146","Name":"Moi Teaching And Referral Hospital"},{"ID":"2163","Name":"Moi Teaching And Referal Hospital Board"},{"ID":"3405","Name":"MOI UNIVERSITY"},{"ID":"3442","Name":"MOI TEACHING REFFERAL HOSPITAL"},{"ID":"3443","Name":"OPG MOI TEACHING REFFERAL HOSPITAL"}]
@@ -32,10 +32,11 @@
Retrieve by ID
/api/entity?key={YOUR - API - KEY}&id={ID OF ENTITY};
+ /api/entity?key={YOUR - API - KEY}&id={ID OF ENTITY}
The above query returns a list of results like so:
[{"data":[{"dataset_type":[{"Gazette": [{"dataset":[{"Name":"National Council for Law Reporting","Name2":"Christine Agimba","Gazette_Number":"2013_GAZ8654","EffectiveDate":"10\/02\/13 : 10\/02\/16","Action":"0","Appointer":"Githu Muigai - Attorney General","Name_E_":"40","Name2_E_":"41"},{"Name":"Christine Agimba","Name2":"National Council for Law Reporting","Gazette_Number":"2013_GAZ8654","EffectiveDate":"10\/02\/13 : 10\/02\/16","Action":"appointed","Appointer":"","Name_E_":"41","Name2_E_":"40"}]}]}]}]}]
+
diff --git a/application/views/api/footer.php b/application/views/api/footer.php
index 947da66..f840df1 100644
--- a/application/views/api/footer.php
+++ b/application/views/api/footer.php
@@ -1,25 +1,67 @@
-
+
+
++ Our database contains information on people, companies and organisations, as well as their linkages at specified periods of time. + While we make every attempt to make this information as accurate as possible, we take no responsibility for its authenticity. + The current information is derived from the Kenya Gazette, Handsards and procurement websites. + We will be incorporating more information from different sources soon. +
+
+
+
+