function generate_EnvEOL_data()
 {
     require_library('connectors/IUCNRedlistDataConnector');
     $func = new IUCNRedlistDataConnector();
     $basenames = array("eol_env_annotations_noParentTerms");
     // list of needed basenames
     $options = $this->download_options;
     $options['expire_seconds'] = 2592000 * 3;
     // 3 months before cache expires
     $text_path = $func->load_zip_contents($this->species_list_export, $options, $basenames, ".tsv");
     print_r($text_path);
     self::csv_to_array($text_path[$basenames[0]]);
     $this->archive_builder->finalize(TRUE);
     // remove temp dir
     $parts = pathinfo($text_path[$basenames[0]]);
     recursive_rmdir($parts["dirname"]);
     debug("\n temporary directory removed: " . $parts["dirname"]);
     recursive_rmdir($this->TEMP_DIR);
     // comment this if u want to check "need_to_check_tc_id.txt"
     /* run problematic tc_ids with cache=0 --- a utility
        $tc_ids = self::get_dump();
        foreach($tc_ids as $tc_id)
        {
            $rec['taxon_id'] = $tc_id;
            self::prepare_taxon($rec);
        }
        exit("\n-exit-\n");
        */
 }
 private function access_raw_data()
 {
     require_library('connectors/IUCNRedlistDataConnector');
     $func = new IUCNRedlistDataConnector();
     $basenames = array("tnames_OBIS", "ranges_OBIS");
     // csv files: taxa file, data file respectively
     $this->text_path["obis"] = $func->load_zip_contents($this->obis_csv_zip_file, $this->download_options, $basenames, ".csv");
     $this->text_path["worms"] = $func->load_zip_contents($this->worms_taxon_tab_zip_file, $this->download_options, array("worms_taxon"), ".tab");
     print_r($this->text_path);
     $this->worms_taxa = self::get_worms_taxa();
 }
Example #3
0
namespace php_active_record;

/*
execution time: 3 hours when HTTP request is already cached
Connector processes a CSV file exported from the IUCN portal (www.iucnredlist.org). 
The exported CSV file is requested and is generated by the portal a couple of days afterwards.
The completion is confirmed via email to the person who requested it.

To be harvestd quarterly: https://jira.eol.org/browse/WEB-5427
#==== 8 PM, 25th of the month, quarterly (Feb, May, Aug, Nov) => IUCN Structured Data
00 20 25 2,5,8,11 * /usr/bin/php /opt/eol_php_code/update_resources/connectors/737.php > /dev/null

            taxon   measurementorfact
2014 05 27  73,465  533,549
2014 08 14  76,022  554,047
increase    2,557   20,498
*/
include_once dirname(__FILE__) . "/../../config/environment.php";
require_library('connectors/IUCNRedlistDataConnector');
$timestart = time_elapsed();
$resource_id = 737;
$func = new IUCNRedlistDataConnector($resource_id);
$func->generate_IUCN_data();
Functions::finalize_dwca_resource($resource_id);
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n";
echo "\n elapsed time = " . $elapsed_time_sec . " seconds";
echo "\n elapsed time = " . $elapsed_time_sec / 60 . " minutes";
echo "\n elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours";
echo "\n Done processing.\n";