$debug_all_remaps = [];
$html = "";
foreach ($allCollections as $index => $params) {
    $processedCollectionsCount++;
    echo " # {$processedCollectionsCount}: PROCESSING {$index}\n ========================================================================================\n";
    if ($flags['--drop-index']) {
        DRIADAgent::deleteRemoteIndex($index);
    }
    echo "\n  Path: {$params['path']}\n";
    // get collection field list
    $fields = json_decode($ingester->getCollectionFieldInfo($index), true);
    $numFields = count($fields);
    //get fields array, with keys remapped as required by DRIAD
    $remap = DRIADAgent::getMappedFields($fields, count($fields), $params);
    // get items
    $payload = $ingester->query($index, 1);
    // equivalent to dmQueryTotalRecs
    $records = [];
    //these are the DMRecords (CISOPTRs, POINTERS, all the same thing)
    $iiif_recs = [];
    if ($flags['--add-item']) {
        $total = 1;
        $records[0] = ['pointer' => $flags['--add-item']];
        echo " Getting specific dmrecord: {$flags['--add-item']}";
    } else {
        $start = 0;
        $pager = 512;
        # can be up to 1024, but this return size seems to be a sweet spot for contentdm/furry wrt processing speed
        $total = json_decode($payload, true)['pager']['total'];
        // get all records in this index
        echo " Getting all 'dmrecords': ";