コード例 #1
0
ファイル: dump_contents.php プロジェクト: ventaniensis/bopi
function dump_data_iteration($folder, $file)
{
    $util = BopiProcessorFactory::getBopiProcessorTomo1($folder);
    $result = $util->process(substr($file, 0, 4), substr($file, 4, 2), substr($file, 6, 2));
    $dumper = new CSVDumper(';');
    $records = $dumper->dump_contents(substr($file, 0, 4), substr($file, 4, 2), substr($file, 6, 2), $GLOBALS['section'], $GLOBALS['subsection'], $result, $GLOBALS['dump_header']);
    if ($GLOBALS['dump_header'] && $records > 0) {
        $GLOBALS['dump_header'] = false;
    }
}
コード例 #2
0
function stats_process_iteration($folder, $file)
{
    $tomo_1 = $folder . '/' . $file;
    $tomo_2 = str_replace('tomo1', 'tomo2', $tomo_1);
    $tomo_3 = str_replace('tomo1', 'tomo2', $tomo_1);
    $date = substr($file, 0, 8);
    $year = substr($file, 0, 4);
    $month = substr($file, 4, 2);
    $day = substr($file, 6, 2);
    $util = BopiProcessorFactory::getBopiProcessorTomo2($working_folder);
    //$util = BopiProcessorFactory::getBopiProcessorTomo3($working_folder);
    //$util = BopiProcessorFactory::getBopiProcessorTomo1($working_folder);
    $result = $util->process($year, $month, $day);
    foreach ($result as $namespace => $tables) {
        foreach ($tables as $tablename => $records) {
            print $year . ';' . $month . ';' . $date . ';' . $processor->metadata_filename . ';' . $namespace . ';' . $tablename . ';' . count($records) . "\n";
        }
    }
}
コード例 #3
0
ファイル: show-stats.php プロジェクト: ventaniensis/bopi
function stats_process_iteration($folder, $file)
{
    $tomo_1 = $folder . '/' . $file;
    $tomo_2 = str_replace('tomo1', 'tomo2', $tomo_1);
    $tomo_3 = str_replace('tomo1', 'tomo2', $tomo_1);
    $date = substr($file, 0, 8);
    $year = substr($file, 0, 4);
    $month = substr($file, 4, 2);
    $day = substr($file, 6, 2);
    $util = BopiProcessorFactory::getBopiProcessorTomo1($folder);
    if (file_exists($tomo_1)) {
        $result = $util->process($year, $month, $day);
        if ($result['status'] === 'ok') {
            foreach ($result as $namespace => $tables) {
                foreach ($tables as $tablename => $records) {
                    print $year . ';' . $month . ';' . $day . ';TOMO1;' . $namespace . ';' . $tablename . ';' . count($records) . "\n";
                }
            }
        }
        $util = BopiProcessorFactory::getBopiProcessorTomo2($folder);
        $result = $util->process($year, $month, $day);
        if ($result['status'] === 'ok') {
            foreach ($result as $namespace => $tables) {
                foreach ($tables as $tablename => $records) {
                    print $year . ';' . $month . ';' . $day . ';TOMO2;' . $namespace . ';' . $tablename . ';' . count($records) . "\n";
                }
            }
        }
        $util = BopiProcessorFactory::getBopiProcessorTomo3($folder);
        $result = $util->process($year, $month, $day);
        if ($result['status'] === 'ok') {
            foreach ($result as $namespace => $tables) {
                foreach ($tables as $tablename => $records) {
                    print $year . ';' . $month . ';' . $day . ';TOMO3;' . $namespace . ';' . $tablename . ';' . count($records) . "\n";
                }
            }
        }
    }
}
コード例 #4
0
ファイル: process-tomo.php プロジェクト: ventaniensis/bopi
require_once 'bopi/processors/processor.factory.inc';
require_once 'bopi/dumpers/CSVDumper.php';
//$working_folder = 'sandbox';
$working_folder = 'cache.bopi';
error_reporting(E_ERROR | E_PARSE);
$year = $argv[1];
$month = $argv[2];
$day = $argv[3];
$tomo = $argc == 3 ? 1 : $argv[4];
// Get an instance
switch ($tomo) {
    case 2:
        $util = BopiProcessorFactory::getBopiProcessorTomo2($working_folder);
        break;
    case 3:
        $util = BopiProcessorFactory::getBopiProcessorTomo3($working_folder);
        break;
    case 1:
    default:
        $util = BopiProcessorFactory::getBopiProcessorTomo1($working_folder);
        break;
}
$result = $util->process($year, $month, $day);
print_r($result);
//print('Solicitudes marcas:'.count($result['marcas']['solicitudes'])."\n");
//print('Solicitudes nombres:'.count($result['nombres_comerciales']['solicitudes'])."\n");
//$dumper = new CSVDumper(';');
//$dumper->dump_contents($year.$month.$day, 'marcas','solicitudes', $result);
//print_r($result['marcas']['renovacion_denegada_marca']);
//print('Result: '.$result."\n");
コード例 #5
0
                                fwrite($handler, ";");
                                $value = key_exists($field_name, $record) ? $record[$field_name] : '';
                                $value = $dumper->serialize_value($value);
                                //print("\t\tFIELD:".$field_name.':'.$value."\n");
                                // if serializable
                                fwrite($handler, $value);
                            }
                            //print_r($record);
                            fwrite($handler, "\n");
                        }
                    }
                    // Print line
                }
            }
            //exit;
        }
        //if
    }
    //if
}
function dump_data($working_folder, $tomo)
{
    $processor = new FolderProcessor('tomo' . $tomo);
    $processor->traverse_folder($working_folder, dump_data_iteration);
}
$metadata = new MetadataManager('metadata/data.dictionary.tomo' . $GLOBALS['tomo'] . '.txt');
$GLOBALS['metadata'] = $metadata;
open_handlers($out_directory, $metadata->metadata);
$GLOBALS['processor'] = BopiProcessorFactory::getProcessorByNumber($working_folder, $tomo, false);
dump_data($working_folder, $tomo);
close_handlers($out_directory);