IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 5, 2007, 3:16:08 PM (19 years ago)
Author:
jhoblitt
Message:

rename exp_id -> exp_name
rename exp_tag -> exp_id
add add rawExp.exp_tag for use as an external name only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/dettool.c

    r13977 r14023  
    173173        " FROM rawExp"
    174174        " LEFT JOIN detInputExp"
    175         "   ON rawExp.exp_tag = detInputExp.exp_tag"
     175        "   ON rawExp.exp_id = detInputExp.exp_id"
    176176        " WHERE"
    177         "    detInputExp.exp_tag IS NULL"
     177        "    detInputExp.exp_id IS NULL"
    178178        "    AND rawExp.obstype != 'object'"
    179179    );
     
    461461    }
    462462
    463     // we have to support multipe exp_tags
    464     psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
     463    // we have to support multipe exp_ids
     464    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
    465465    if (!item) {
    466466        // this shouldn't actually happen when using psArgs
    467         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     467        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    468468        return false;
    469469    }
    470470    psMetadata *where = psMetadataAlloc();
    471471
    472     // make sure that -exp_tag was parsed correctly
     472    // make sure that -exp_id was parsed correctly
    473473    // XXX this can be removed someday
    474474    if (item->type == PS_DATA_METADATA_MULTI) {
     
    476476        psMetadataItem *mItem = NULL;
    477477        while ((mItem = psListGetAndIncrement(iter))) {
    478             psString exp_tag = mItem->data.V;
    479             // if exp_tag is NULL then it means that -exp_tag has not been
     478            psString exp_id = mItem->data.V;
     479            // if exp_id is NULL then it means that -exp_id has not been
    480480            // specified
    481             if (!exp_tag) {
     481            if (!exp_id) {
    482482                psError(PS_ERR_UNKNOWN, true,
    483                         "at least one -exp_tag is required");
     483                        "at least one -exp_id is required");
    484484                psFree(where);
    485485                return false;
    486486            }
    487487
    488             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
    489                  PS_META_DUPLICATE_OK, "==", exp_tag)) {
    490                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     488            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
     489                 PS_META_DUPLICATE_OK, "==", exp_id)) {
     490                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    491491                psFree(iter);
    492492                psFree(where);
     
    496496        psFree(iter);
    497497    } else {
    498         psAbort(                "-exp_tag was not parsed correctly (this should not happen");
     498        psAbort(                "-exp_id was not parsed correctly (this should not happen");
    499499    }
    500500
     
    504504    }
    505505
    506     // check that the specified exp_tags actually exist
     506    // check that the specified exp_ids actually exist
    507507    psArray *detrendExps = rawExpSelectRowObjects(config->dbh, where, 0);
    508508    psFree(where);
     
    512512    }
    513513
    514     // we should have one rawExp row per exp_tag specified
     514    // we should have one rawExp row per exp_id specified
    515515    if (psListLength(item->data.list) != psArrayLength(detrendExps)) {
    516         psAbort(    "an -exp_tag matched more then one rawExp (this should not happen");
     516        psAbort(    "an -exp_id matched more then one rawExp (this should not happen");
    517517
    518518    }
     
    17681768        "       %d,"
    17691769        "       0,"
    1770         "       detResidExp.exp_tag,"
     1770        "       detResidExp.exp_id,"
    17711771        "       detResidExp.accept"
    17721772        "   FROM detResidExp"
    17731773        "   JOIN rawExp"
    1774         "       USING(exp_tag)"
     1774        "       USING(exp_id)"
    17751775        "   WHERE det_id = %d"
    17761776    );
     
    19791979        det_id,
    19801980        iteration,
    1981         rawExp->exp_tag,
     1981        rawExp->exp_id,
    19821982        true            // use
    19831983    );
     
    19911991    // select rawExp.*
    19921992    // by:
    1993     // exp_tag
     1993    // exp_id
    19941994
    19951995    psString query = psStringCopy(
     
    19971997        " FROM detInputExp"
    19981998        " JOIN rawExp"
    1999         " USING(exp_tag)"
     1999        " USING(exp_id)"
    20002000        );
    20012001
     
    20582058            " FROM rawImfile"
    20592059            " JOIN detInputExp"
    2060             "   USING(exp_tag) "
     2060            "   USING(exp_id) "
    20612061            " JOIN rawExp"
    2062             "   USING(exp_tag) "
     2062            "   USING(exp_id) "
    20632063            " JOIN detRun"
    20642064            "   ON detInputExp.det_id = detRun.det_id"
     
    21302130    //
    21312131    // det_id is in detInputExp
    2132     // exp_tag is in detInputExp
     2132    // exp_id is in detInputExp
    21332133    // det_id is not in detProccessedImfile
    2134     // exp_tag is not in detProccessedImfile
     2134    // exp_id is not in detProccessedImfile
    21352135    // class_is is not in detProccessedImfile
    21362136    psString query = psStringCopy(
     
    21462146            "    USING(det_id, iteration)"
    21472147            " JOIN rawExp"
    2148             "    ON detInputExp.exp_tag = rawExp.exp_tag"
     2148            "    ON detInputExp.exp_id = rawExp.exp_id"
    21492149            " JOIN rawImfile"
    2150             "    ON detInputExp.exp_tag = rawImfile.exp_tag"
     2150            "    ON detInputExp.exp_id = rawImfile.exp_id"
    21512151            " LEFT JOIN detProcessedImfile"
    21522152            "   ON detInputExp.det_id = detProcessedImfile.det_id"
    2153             "   AND rawImfile.exp_tag = detProcessedImfile.exp_tag"
     2153            "   AND rawImfile.exp_id = detProcessedImfile.exp_id"
    21542154            "   AND rawImfile.class_id = detProcessedImfile.class_id"
    21552155            " WHERE"
     
    21572157            "   AND detRun.mode = 'master'"
    21582158            "   AND detProcessedImfile.det_id IS NULL"
    2159             "   AND detProcessedImfile.exp_tag IS NULL"
     2159            "   AND detProcessedImfile.exp_id IS NULL"
    21602160            "   AND detProcessedImfile.class_id IS NULL"
    21612161        );
     
    22232223    }
    22242224
    2225     // select exp_tags from detInputExp matching det_idp
     2225    // select exp_ids from detInputExp matching det_idp
    22262226    // where query should be pre-generated
    22272227    psArray *detInputExp =
     
    22322232    }
    22332233
    2234     // generate where query with just the exp_tags
    2235     psMetadata *where_exp_tags = psMetadataAlloc();
     2234    // generate where query with just the exp_ids
     2235    psMetadata *where_exp_ids = psMetadataAlloc();
    22362236    for (long i = 0; i < psArrayLength(detInputExp); i++) {
    22372237        detInputExpRow *row = detInputExp->data[i];
    2238         if (!psMetadataAddStr(where_exp_tags, PS_LIST_TAIL, "exp_tag",
    2239                 PS_META_DUPLICATE_OK, "==", row->exp_tag)
     2238        if (!psMetadataAddS64(where_exp_ids, PS_LIST_TAIL, "exp_id",
     2239                PS_META_DUPLICATE_OK, "==", row->exp_id)
    22402240        ) {
    2241             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     2241            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    22422242            psFree(detInputExp);
    2243             psFree(where_exp_tags);
     2243            psFree(where_exp_ids);
    22442244            return NULL;
    22452245        }
     
    22472247    psFree(detInputExp);
    22482248
    2249     // select rawImfiles with matching exp_tags
     2249    // select rawImfiles with matching exp_ids
    22502250    psArray *rawImfiles =
    2251         rawImfileSelectRowObjects(config->dbh, where_exp_tags, 0);
    2252     psFree(where_exp_tags);
     2251        rawImfileSelectRowObjects(config->dbh, where_exp_ids, 0);
     2252    psFree(where_exp_ids);
    22532253    if (!rawImfiles) {
    22542254        psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found");
     
    22632263    PS_ASSERT_PTR_NON_NULL(config, false);
    22642264
    2265     // det_id, exp_tag, class_id, uri, recipe, -bg, -bg_stdev
     2265    // det_id, exp_id, class_id, uri, recipe, -bg, -bg_stdev
    22662266    // are required
    22672267    bool status = false;
     
    22752275        return false;
    22762276    }
    2277     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    2278     if (!status) {
    2279         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    2280         return false;
    2281     }
    2282     if (!exp_tag) {
    2283         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     2277    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     2278    if (!status) {
     2279        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     2280        return false;
     2281    }
     2282    if (!exp_id) {
     2283        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    22842284        return false;
    22852285    }
     
    23842384    }
    23852385
    2386     // find the matching rawImfile by exp_tag/class_id
     2386    // find the matching rawImfile by exp_id/class_id
    23872387    psMetadata *where = psMetadataAlloc();
    2388     if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
    2389         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     2388    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
     2389        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    23902390        psFree(where);
    23912391        return false;
     
    24152415    detProcessedImfileRow *detRow = detProcessedImfileRowAlloc(
    24162416        (psS32)atol(det_id),
    2417         exp_tag,
     2417        (psS64)atoll(exp_id),
    24182418        class_id,
    24192419        uri,
     
    24612461    // select detRun.iteration
    24622462    // select detRun.det_type
    2463     // select detProcessedImfile.exp_tag
     2463    // select detProcessedImfile.exp_id
    24642464    // by:
    24652465    // find the current iteration bassed on det_id
    2466     // find all exp_tags in the current det_id/iteration from detInputExp
    2467     // find all rawImfiles in the current exp_tags
    2468     // compare to detProcessedImfiles by det_id/exp_tag
     2466    // find all exp_ids in the current det_id/iteration from detInputExp
     2467    // find all rawImfiles in the current exp_ids
     2468    // compare to detProcessedImfiles by det_id/exp_id
    24692469    // found how many imfile there are in each class_id
    24702470    // and:
     
    24772477        "    iteration,"
    24782478        "    det_type,"
    2479         "    exp_tag,"
     2479        "    exp_id,"
    24802480        "    camera,"
    24812481        "    workdir"
     
    24862486        "    detRun.det_type,"
    24872487        "    detRun.workdir,"
    2488         "    detProcessedImfile.exp_tag,"
     2488        "    detProcessedImfile.exp_id,"
    24892489        "    rawExp.camera,"
    24902490        "    detProcessedImfile.class_id,"
     
    24942494        "   USING(det_id, iteration)"
    24952495        " JOIN rawExp"
    2496         "   ON detInputExp.exp_tag = rawExp.exp_tag"
     2496        "   ON detInputExp.exp_id = rawExp.exp_id"
    24972497        " JOIN rawImfile"
    2498         "   ON rawExp.exp_tag = rawImfile.exp_tag"
     2498        "   ON rawExp.exp_id = rawImfile.exp_id"
    24992499        " LEFT JOIN detProcessedImfile"
    25002500        "   ON detRun.det_id = detProcessedImfile.det_id"
    2501         "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
     2501        "   AND detInputExp.exp_id = detProcessedImfile.exp_id"
    25022502        "   AND rawImfile.class_id = detProcessedImfile.class_id"
    25032503        " LEFT JOIN detProcessedExp"
    25042504        "   ON detProcessedImfile.det_id = detProcessedExp.det_id"
    2505         "   AND detProcessedImfile.exp_tag = detProcessedExp.exp_tag"
     2505        "   AND detProcessedImfile.exp_id = detProcessedExp.exp_id"
    25062506        " WHERE"
    25072507        "   detRun.state = 'run'"
     
    25092509        "   AND detProcessedImfile.fault = 0"
    25102510        "   AND detProcessedExp.det_id IS NULL"
    2511         "   AND detProcessedExp.exp_tag IS NULL"
     2511        "   AND detProcessedExp.exp_id IS NULL"
    25122512        "   AND detInputExp.include = 1"
    25132513        " GROUP BY"
    2514         "    rawExp.exp_tag,"
     2514        "    rawExp.exp_id,"
    25152515        "    detRun.det_id"
    25162516        " HAVING"
     
    25792579    PS_ASSERT_PTR_NON_NULL(config, false);
    25802580
    2581     // det_id, exp_tag, recip, -bg, -bg_stdev
     2581    // det_id, exp_id, recip, -bg, -bg_stdev
    25822582    // are required
    25832583    bool status = false;
     
    25912591        return false;
    25922592    }
    2593     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    2594     if (!status) {
    2595         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    2596         return false;
    2597     }
    2598     if (!exp_tag) {
    2599         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     2593    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     2594    if (!status) {
     2595        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     2596        return false;
     2597    }
     2598    if (!exp_id) {
     2599        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    26002600        return false;
    26012601    }
     
    26932693        "    detRun.iteration,"
    26942694        "    detRun.det_type,"
    2695         "    detProcessedImfile.exp_tag"
     2695        "    detProcessedImfile.exp_id"
    26962696        " FROM detRun"
    26972697        " JOIN detInputExp"
     
    26992699        "    AND detRun.iteration = detInputExp.iteration"
    27002700        " JOIN rawExp"
    2701         "    ON detInputExp.exp_tag = rawExp.exp_tag"
     2701        "    ON detInputExp.exp_id = rawExp.exp_id"
    27022702        " JOIN detProcessedImfile"
    27032703        "    ON detInputExp.det_id = detProcessedImfile.det_id"
    2704         "    AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
     2704        "    AND detInputExp.exp_id = detProcessedImfile.exp_id"
    27052705        " LEFT JOIN detProcessedExp"
    27062706        "    ON detInputExp.det_id = detProcessedExp.det_id"
    2707         "    AND detProcessedImfile.exp_tag= detProcessedExp.exp_tag"
     2707        "    AND detProcessedImfile.exp_id= detProcessedExp.exp_id"
    27082708        " LEFT JOIN rawImfile"
    2709         "    ON detInputExp.exp_tag = rawImfile.exp_tag"
     2709        "    ON detInputExp.exp_id = rawImfile.exp_id"
    27102710        "    AND detProcessedImfile.class_id = rawImfile.class_id"
    27112711        " WHERE"
     
    27132713        "   AND detRun.mode = 'master'"
    27142714        "   AND detProcessedExp.det_id IS NULL"
    2715         "   AND detProcessedExp.exp_tag IS NULL"
     2715        "   AND detProcessedExp.exp_id IS NULL"
    27162716        "   AND detInputExp.include = 1"
    27172717        "   AND detRun.det_id = %s"
    2718         "   AND detProcessedImfile.exp_tag = '%s'"
     2718        "   AND detProcessedImfile.exp_id = '%s'"
    27192719        " GROUP BY"
    27202720        "    detProcessedImfile.class_id,"
     
    27252725        );
    27262726
    2727     if (!p_psDBRunQuery(config->dbh, query, det_id, exp_tag)) {
     2727    if (!p_psDBRunQuery(config->dbh, query, det_id, exp_id)) {
    27282728        psError(PS_ERR_UNKNOWN, false, "database error");
    27292729        psFree(query);
     
    27472747    detProcessedExpRow *detRow = detProcessedExpRowAlloc(
    27482748        (psS32)atol(det_id),
    2749         exp_tag,
     2749        (psS64)atoll(exp_id),
    27502750        recipe,
    27512751        bg,
     
    28722872    // by:
    28732873    // find the current iteration bassed on det_id
    2874     // find all exp_tags in the current det_id/iteration from detInputExp
    2875     // find all rawImfiles in the current exp_tags
    2876     // compare to detProcessedImfiles by det_id/exp_tag
     2874    // find all exp_ids in the current det_id/iteration from detInputExp
     2875    // find all rawImfiles in the current exp_ids
     2876    // compare to detProcessedImfiles by det_id/exp_id
    28772877    // found how many imfile there are in each class_id
    28782878    // and:
     
    28952895        "    AND detRun.iteration = detInputExp.iteration\n"
    28962896        " JOIN rawExp\n"
    2897         "    ON detInputExp.exp_tag = rawExp.exp_tag\n"
     2897        "    ON detInputExp.exp_id = rawExp.exp_id\n"
    28982898        " JOIN rawImfile\n"
    2899         "    ON detInputExp.exp_tag = rawImfile.exp_tag\n"
     2899        "    ON detInputExp.exp_id = rawImfile.exp_id\n"
    29002900        " LEFT JOIN detProcessedImfile\n"
    29012901        "    ON detInputExp.det_id = detProcessedImfile.det_id\n"
    2902         "    AND detInputExp.exp_tag = detProcessedImfile.exp_tag\n"
     2902        "    AND detInputExp.exp_id = detProcessedImfile.exp_id\n"
    29032903        "    AND rawImfile.class_id = detProcessedImfile.class_id\n"
    29042904        " LEFT JOIN detStackedImfile\n"
     
    30073007        "   ON detRun.det_id = detInputExp.det_id"
    30083008        "   AND detRun.iteration = detInputExp.iteration"
    3009         "   AND detProcessedImfile.exp_tag = detInputExp.exp_tag"
     3009        "   AND detProcessedImfile.exp_id = detInputExp.exp_id"
    30103010        " JOIN rawExp"
    3011         "   ON rawExp.exp_tag = detProcessedImfile.exp_tag"
     3011        "   ON rawExp.exp_id = detProcessedImfile.exp_id"
    30123012        " WHERE"
    30133013    );
     
    32133213    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
    32143214            (psS64)atoll(det_id))) {
    3215         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     3215        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    32163216        psFree(where);
    32173217        return false;
     
    33773377    // by:
    33783378    // find the current iteration bassed on det_id
    3379     // find all exp_tags in the current det_id/iteration from detInputExp
     3379    // find all exp_ids in the current det_id/iteration from detInputExp
    33803380    // sort to detInputExp.imfiles to find the largest value per det_id/iter
    33813381    // compare imfiles to the number of detStackedImfiles by class_id
     
    34073407        "   AND detRun.iteration = detInputExp.iteration"
    34083408        " JOIN rawExp"
    3409         "   ON detInputExp.exp_tag = rawExp.exp_tag"
     3409        "   ON detInputExp.exp_id = rawExp.exp_id"
    34103410        " JOIN detStackedImfile"
    34113411        "   ON detInputExp.det_id = detStackedImfile.det_id"
     
    34233423        "   AND detNormalizedStatImfile.class_id IS NULL"
    34243424        " GROUP BY"
    3425         "   rawExp.exp_tag,"
     3425        "   rawExp.exp_id,"
    34263426        "   detRun.iteration,"
    34273427        "   detRun.det_id"
     
    36333633        "   USING(det_id, iteration)"
    36343634        " JOIN rawExp"
    3635         "   ON detInputExp.exp_tag = rawExp.exp_tag"
     3635        "   ON detInputExp.exp_id = rawExp.exp_id"
    36363636        " JOIN detNormalizedStatImfile"
    36373637        "   ON detStackedImfile.det_id = detNormalizedStatImfile.det_id"
     
    37743774        psMetadata *where = psMetadataAlloc();
    37753775        for (long i = 0; i < psArrayLength(inputExps); i++) {
    3776             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
     3776            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
    37773777                    PS_META_DUPLICATE_OK, "==",
    3778                     ((detInputExpRow *)inputExps->data[i])->exp_tag)) {
    3779                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     3778                    ((detInputExpRow *)inputExps->data[i])->exp_id)) {
     3779                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    37803780                psFree(inputExps);
    37813781                psFree(where);
     
    39633963        "    AND detRun.iteration = detInputExp.iteration"
    39643964        " JOIN rawExp"
    3965         "    ON detInputExp.exp_tag = rawExp.exp_tag"
     3965        "    ON detInputExp.exp_id = rawExp.exp_id"
    39663966        " JOIN detNormalizedImfile"
    39673967        "    ON detInputExp.det_id = detNormalizedImfile.det_id"
    39683968        "    AND detInputExp.iteration = detNormalizedImfile.iteration"
    39693969        " LEFT JOIN rawImfile"
    3970         "    ON detInputExp.exp_tag = rawImfile.exp_tag"
     3970        "    ON detInputExp.exp_id = rawImfile.exp_id"
    39713971        "    AND detNormalizedImfile.class_id = rawImfile.class_id"
    39723972        " LEFT JOIN detNormalizedExp"
     
    41524152        "    AND detRun.iteration = detInputExp.iteration"
    41534153        " JOIN rawExp"
    4154         "    ON detInputExp.exp_tag = rawExp.exp_tag"
     4154        "    ON detInputExp.exp_id = rawExp.exp_id"
    41554155        " JOIN detNormalizedImfile"
    41564156        "    ON detInputExp.det_id = detNormalizedImfile.det_id"
    41574157        "    AND detInputExp.iteration = detNormalizedImfile.iteration"
    41584158        " LEFT JOIN rawImfile"
    4159         "    ON detInputExp.exp_tag = rawImfile.exp_tag"
     4159        "    ON detInputExp.exp_id = rawImfile.exp_id"
    41604160        "    AND detNormalizedImfile.class_id = rawImfile.class_id"
    41614161        " LEFT JOIN detNormalizedExp"
     
    44374437        "   detRun.workdir,\n"
    44384438        "   detRun.reduction,\n"
    4439         "   detProcessedImfile.exp_tag,\n"
     4439        "   detProcessedImfile.exp_id,\n"
    44404440        "   detProcessedImfile.class_id,\n"
    44414441        "   detProcessedImfile.uri,\n"
     
    44464446        "   USING(det_id, iteration)\n"
    44474447        " JOIN rawExp\n"
    4448         "   ON detInputExp.exp_tag = rawExp.exp_tag\n"
     4448        "   ON detInputExp.exp_id = rawExp.exp_id\n"
    44494449        " JOIN detProcessedImfile\n"
    44504450        "   ON detRun.det_id = detProcessedImfile.det_id\n"
    4451         "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag\n"
     4451        "   AND detInputExp.exp_id = detProcessedImfile.exp_id\n"
    44524452        " JOIN detNormalizedImfile\n"
    44534453        "   ON detRun.det_id = detNormalizedImfile.det_id\n"
     
    44574457        "   ON detRun.det_id = detResidImfile.det_id\n"
    44584458        "   AND detRun.iteration = detResidImfile.iteration\n"
    4459         "   AND detProcessedImfile.exp_tag = detResidImfile.exp_tag\n"
     4459        "   AND detProcessedImfile.exp_id = detResidImfile.exp_id\n"
    44604460        "   AND detProcessedImfile.class_id = detResidImfile.class_id\n"
    44614461        " WHERE\n"
     
    44654465        "   AND detResidImfile.det_id IS NULL\n"
    44664466        "   AND detResidImfile.iteration IS NULL\n"
    4467         "   AND detResidImfile.exp_tag IS NULL\n"
     4467        "   AND detResidImfile.exp_id IS NULL\n"
    44684468        "   AND detResidImfile.class_id IS NULL\n"
    44694469        " UNION"
     
    44754475        "   detRun.workdir,\n"
    44764476        "   detRun.reduction,\n"
    4477         "   rawImfile.exp_tag,\n"
     4477        "   rawImfile.exp_id,\n"
    44784478        "   rawImfile.class_id,\n"
    44794479        "   rawImfile.uri,\n"
     
    44844484        "    USING(det_id, iteration)\n"
    44854485        " JOIN rawExp\n"
    4486         "    ON detInputExp.exp_tag = rawExp.exp_tag\n"
     4486        "    ON detInputExp.exp_id = rawExp.exp_id\n"
    44874487        " JOIN rawImfile\n"
    4488         "    ON detInputExp.exp_tag = rawImfile.exp_tag\n"
     4488        "    ON detInputExp.exp_id = rawImfile.exp_id\n"
    44894489        " LEFT JOIN detResidImfile\n"
    44904490        "   ON detRun.det_id = detResidImfile.det_id\n"
    44914491        "   AND detRun.iteration = detResidImfile.iteration\n"
    4492         "   AND rawImfile.exp_tag = detResidImfile.exp_tag\n"
     4492        "   AND rawImfile.exp_id = detResidImfile.exp_id\n"
    44934493        "   AND rawImfile.class_id = detResidImfile.class_id\n"
    44944494        " WHERE\n"
     
    44974497        "   AND detResidImfile.det_id IS NULL\n"
    44984498        "   AND detResidImfile.iteration IS NULL\n"
    4499         "   AND detResidImfile.exp_tag IS NULL\n"
     4499        "   AND detResidImfile.exp_id IS NULL\n"
    45004500        "   AND detResidImfile.class_id IS NULL\n"
    45014501        );
     
    46584658
    46594659    // make sure that there is a coresponding entry in detNormalizedImfile
    4660     // and the exp_tag specified is valid
     4660    // and the exp_id specified is valid
    46614661    // select * from detNormalizedImfile
    46624662    // by det_id, iteration, class_id
     
    46744674        "   ON detRun.det_id = detResidImfile.det_id\n"
    46754675        "   AND detRun.iteration = detResidImfile.iteration\n"
    4676         "   AND detInputExp.exp_tag = detResidImfile.exp_tag\n"
     4676        "   AND detInputExp.exp_id = detResidImfile.exp_id\n"
    46774677        "   AND detNormalizedImfile.class_id = detResidImfile.class_id\n"
    46784678        " WHERE\n"
     
    46814681        "  AND detResidImfile.det_id IS NULL\n"
    46824682        "  AND detResidImfile.iteration IS NULL\n"
    4683         "  AND detResidImfile.exp_tag IS NULL\n"
     4683        "  AND detResidImfile.exp_id IS NULL\n"
    46844684        "  AND detResidImfile.class_id IS NULL\n"
    46854685        " UNION\n"
     
    47034703        "    USING(det_id, iteration)\n"
    47044704        " JOIN rawExp\n"
    4705         "    ON detInputExp.exp_tag = rawExp.exp_tag\n"
     4705        "    ON detInputExp.exp_id = rawExp.exp_id\n"
    47064706        " JOIN rawImfile\n"
    4707         "    ON detInputExp.exp_tag = rawImfile.exp_tag\n"
     4707        "    ON detInputExp.exp_id = rawImfile.exp_id\n"
    47084708        " LEFT JOIN detResidImfile\n"
    47094709        "   ON detRun.det_id = detResidImfile.det_id\n"
    47104710        "   AND detRun.iteration = detResidImfile.iteration\n"
    4711         "   AND rawImfile.exp_tag = detResidImfile.exp_tag\n"
     4711        "   AND rawImfile.exp_id = detResidImfile.exp_id\n"
    47124712        "   AND rawImfile.class_id = detResidImfile.class_id\n"
    47134713        " WHERE\n"
     
    47164716        "   AND detResidImfile.det_id IS NULL\n"
    47174717        "   AND detResidImfile.iteration IS NULL\n"
    4718         "   AND detResidImfile.exp_tag IS NULL\n"
     4718        "   AND detResidImfile.exp_id IS NULL\n"
    47194719        "   AND detResidImfile.class_id IS NULL\n"
    4720         "   AND detInputExp.exp_tag = '%1$s'\n"
     4720        "   AND detInputExp.exp_id = '%1$s'\n"
    47214721        ") AS foo\n"
    47224722        "  %2$s"
     
    47764776    psFree(where);
    47774777
    4778     // exp_tag is manadatory to cross check that this is a exp_tag for this
     4778    // exp_id is manadatory to cross check that this is a exp_id for this
    47794779    // detRun
    4780     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    4781     if (!status) {
    4782         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     4780    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     4781    if (!status) {
     4782        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
    47834783        psFree(whereClause);
    47844784        psFree(query);
    47854785        return false;
    47864786    }
    4787     if (!exp_tag) {
    4788         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     4787    if (!exp_id) {
     4788        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    47894789        psFree(whereClause);
    47904790        psFree(query);
     
    47924792    }
    47934793
    4794     if (!p_psDBRunQuery(config->dbh, query, exp_tag, whereClause)) {
     4794    if (!p_psDBRunQuery(config->dbh, query, exp_id, whereClause)) {
    47954795        psError(PS_ERR_UNKNOWN, false, "database error");
    47964796        psFree(whereClause);
     
    48624862
    48634863    bool status = false;
    4864     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    4865     if (!status) {
    4866         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    4867         return false;
    4868     }
    4869     if (!exp_tag) {
    4870         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     4864    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     4865    if (!status) {
     4866        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     4867        return false;
     4868    }
     4869    if (!exp_id) {
     4870        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    48714871        return false;
    48724872    }
     
    49794979            normalizedImfile->det_id,
    49804980            normalizedImfile->iteration,
    4981             exp_tag,
     4981            (psS64)atoll(exp_id),
    49824982            normalizedImfile->class_id,
    49834983            uri,
     
    50205020    // select detResidImfile.*
    50215021    // by:
    5022     // where det_id, iteration, exp_tag is not in detResidExp;
     5022    // where det_id, iteration, exp_id is not in detResidExp;
    50235023
    50245024    psString query = psStringCopy(
     
    50325032        "   USING(det_id, iteration)"
    50335033        " JOIN rawExp"
    5034         "   USING(exp_tag)"
     5034        "   USING(exp_id)"
    50355035        " WHERE"
    50365036    );
     
    51285128    // select detRun.iteration
    51295129    // select detRun.det_type
    5130     // select detInputExp.exp_tag
     5130    // select detInputExp.exp_id
    51315131    // select detInputExp.include
    51325132    // by:
    51335133    // find the current iteration bassed on det_id
    5134     // find all exp_tags in the current det_id/iteration from detInputExp
     5134    // find all exp_ids in the current det_id/iteration from detInputExp
    51355135    // compare to detInputExp.imfiles to derResidImfile by class_id
    51365136    // and:
    5137     // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
     5137    // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
    51385138
    51395139    psString query = psStringCopy(
     
    51435143        "   det_type,\n"
    51445144        "   mode,\n"
    5145         "   exp_tag,\n"
     5145        "   exp_id,\n"
    51465146        "   include,\n"
    51475147        "   camera,\n"
     
    51545154        "       detRun.mode,\n"
    51555155        "       detRun.workdir,\n"
    5156         "       detInputExp.exp_tag,\n"
     5156        "       detInputExp.exp_id,\n"
    51575157        "       detInputExp.include,\n"
    51585158        "       rawExp.imfiles,\n"
     
    51635163        "       USING(det_id, iteration)\n"
    51645164        "   JOIN rawExp\n"
    5165         "       ON detInputExp.exp_tag = rawExp.exp_tag\n"
     5165        "       ON detInputExp.exp_id = rawExp.exp_id\n"
    51665166        "   JOIN detResidImfile\n"
    51675167        "       ON detRun.det_id = detResidImfile.det_id\n"
    51685168        "       AND detRun.iteration = detResidImfile.iteration\n"
    5169         "       AND detInputExp.exp_tag = detResidImfile.exp_tag\n"
     5169        "       AND detInputExp.exp_id = detResidImfile.exp_id\n"
    51705170        "   LEFT JOIN detResidExp\n"
    51715171        "       ON detResidImfile.det_id = detResidExp.det_id\n"
    51725172        "       AND detResidImfile.iteration = detResidExp.iteration\n"
    5173         "       AND detResidImfile.exp_tag = detResidExp.exp_tag\n"
     5173        "       AND detResidImfile.exp_id = detResidExp.exp_id\n"
    51745174        "   WHERE\n"
    51755175        "       detRun.state = 'run'\n"
     
    51775177        "       AND detResidExp.det_id IS NULL\n"
    51785178        "       AND detResidExp.iteration IS NULL\n"
    5179         "       AND detResidExp.exp_tag IS NULL\n"
     5179        "       AND detResidExp.exp_id IS NULL\n"
    51805180        "   GROUP BY\n"
    5181         "       detInputExp.exp_tag,\n"
     5181        "       detInputExp.exp_id,\n"
    51825182        "       detRun.iteration,\n"
    51835183        "       detRun.det_id\n"
     
    52585258    // select detRun.iteration
    52595259    // select detRun.det_type
    5260     // select detInputExp.exp_tag
     5260    // select detInputExp.exp_id
    52615261    // select detInputExp.include
    52625262    // by:
    52635263    // find the current iteration bassed on det_id
    5264     // find all exp_tags in the current det_id/iteration from detInputExp
     5264    // find all exp_ids in the current det_id/iteration from detInputExp
    52655265    // compare to detInputExp.imfiles to derResidImfile by class_id
    52665266    // and:
    5267     // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
     5267    // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
    52685268
    52695269    psString query = psStringCopy(
     
    52715271        "   det_id,"
    52725272        "   iteration,"
    5273         "   exp_tag,"
     5273        "   exp_id,"
    52745274        "   include"
    52755275        " FROM"
     
    52785278        "       detRun.iteration,"
    52795279        "       detRun.det_type,"
    5280         "       detInputExp.exp_tag,"
     5280        "       detInputExp.exp_id,"
    52815281        "       detInputExp.include,"
    52825282        "       rawExp.imfiles"
     
    52855285        "       USING(det_id, iteration)"
    52865286        "   JOIN rawExp"
    5287         "       ON detInputExp.exp_tag = rawExp.exp_tag"
     5287        "       ON detInputExp.exp_id = rawExp.exp_id"
    52885288        "   JOIN detResidImfile"
    52895289        "       ON detRun.det_id = detResidImfile.det_id"
    52905290        "       AND detRun.iteration = detResidImfile.iteration"
    5291         "       AND detInputExp.exp_tag = detResidImfile.exp_tag"
     5291        "       AND detInputExp.exp_id = detResidImfile.exp_id"
    52925292        "   LEFT JOIN detResidExp"
    52935293        "       ON detResidImfile.det_id = detResidExp.det_id"
    52945294        "       AND detResidImfile.iteration = detResidExp.iteration"
    5295         "       AND detResidImfile.exp_tag = detResidExp.exp_tag"
     5295        "       AND detResidImfile.exp_id = detResidExp.exp_id"
    52965296        "   WHERE"
    52975297        "       detRun.state = 'run'"
    52985298        "       AND detResidExp.det_id IS NULL"
    52995299        "       AND detResidExp.iteration IS NULL"
    5300         "       AND detResidExp.exp_tag IS NULL"
     5300        "       AND detResidExp.exp_id IS NULL"
    53015301        "   GROUP BY"
    5302         "       detInputExp.exp_tag,"
     5302        "       detInputExp.exp_id,"
    53035303        "       detRun.iteration,"
    53045304        "       detRun.det_id"
     
    53095309
    53105310    {
    5311         // build a query to search by det_id, iteration, exp_tag
     5311        // build a query to search by det_id, iteration, exp_id
    53125312        psMetadata *where = psMetadataAlloc();
    53135313        bool status = false;
     
    53425342            return false;
    53435343        }
    5344         psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    5345         if (!status) {
    5346             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     5344        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     5345        if (!status) {
     5346            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
    53475347            psFree(where);
    53485348            psFree(query);
    53495349            return false;
    53505350        }
    5351         if (exp_tag) {
    5352             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
    5353                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     5351        if (exp_id) {
     5352            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
     5353                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    53545354                psFree(where);
    53555355                psFree(query);
     
    54485448        return false;
    54495449    }
    5450     psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag");
    5451     if (!status) {
    5452         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
    5453         return false;
    5454     }
    5455     if (!exp_tag) {
    5456         psError(PS_ERR_UNKNOWN, true, "exp_tag is required");
     5450    psString exp_id = psMetadataLookupStr(&status, row, "exp_id");
     5451    if (!status) {
     5452        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
     5453        return false;
     5454    }
     5455    if (!exp_id) {
     5456        psError(PS_ERR_UNKNOWN, true, "exp_id is required");
    54575457        return false;
    54585458    }
     
    55655565            det_id,
    55665566            iteration,
    5567             exp_tag,
     5567            (psS64)atoll(exp_id),
    55685568            recipe,
    55695569            bg,
     
    56115611        "   USING(det_id, iteration)"
    56125612        " JOIN detResidExp"
    5613         "   USING(det_id, iteration, exp_tag)"
     5613        "   USING(det_id, iteration, exp_id)"
    56145614        " WHERE"
    56155615        "   detRun.state = 'run'"
     
    56975697    // by:
    56985698    // find the current iteration bassed on det_id
    5699     // find all exp_tags in the current det_id/iteration from detInputExp
    5700     // find all exp_tags in the current det_id/iteration from detResidExp
    5701     // compare the counts of exp_tags
     5699    // find all exp_ids in the current det_id/iteration from detInputExp
     5700    // find all exp_ids in the current det_id/iteration from detResidExp
     5701    // compare the counts of exp_ids
    57025702
    57035703    psString query = psStringCopy(
     
    57165716        "       detRun.mode,\n"
    57175717        "       detRun.workdir,\n"
    5718         "       detInputExp.exp_tag,\n"
     5718        "       detInputExp.exp_id,\n"
    57195719        "       rawExp.camera\n"
    57205720        "   FROM detRun\n"
     
    57225722        "       USING(det_id, iteration)\n"
    57235723        "   JOIN rawExp\n"
    5724         "       ON detInputExp.exp_tag = rawExp.exp_tag\n"
     5724        "       ON detInputExp.exp_id = rawExp.exp_id\n"
    57255725        "   LEFT JOIN detResidExp\n"
    57265726        "       ON detRun.det_id = detResidExp.det_id\n"
    57275727        "       AND detRun.iteration = detResidExp.iteration\n"
    5728         "       AND detInputExp.exp_tag = detResidExp.exp_tag\n"
     5728        "       AND detInputExp.exp_id = detResidExp.exp_id\n"
    57295729        "   WHERE\n"
    57305730        "       detRun.state = 'run'\n"
     
    57335733        "       detRun.iteration\n"
    57345734        "   HAVING\n"
    5735         "       COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)\n"
     5735        "       COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)\n"
    57365736        " ) AS residdetrun\n"
    57375737        );
     
    57975797    PS_ASSERT_PTR_NON_NULL(config, false);
    57985798
    5799     // build a query to search by det_id, iteration, exp_tag
     5799    // build a query to search by det_id, iteration, exp_id
    58005800    psMetadata *where = psMetadataAlloc();
    58015801    bool status = false;
     
    58255825        return false;
    58265826    }
    5827     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    5828     if (!status) {
    5829         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     5827    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     5828    if (!status) {
     5829        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
    58305830        psFree(where);
    58315831        return false;
    58325832    }
    5833     if (exp_tag) {
    5834         if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
    5835             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     5833    if (exp_id) {
     5834        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
     5835            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    58365836            psFree(where);
    58375837            return false;
     
    58405840
    58415841    // find the values we're going to set
    5842     // copy everything but det_id, iteration, & exp_tag from the args and
     5842    // copy everything but det_id, iteration, & exp_id from the args and
    58435843    // remove the '-' prefix
    58445844    psMetadata *set = psMetadataAlloc();
     
    59575957    // by:
    59585958    // find the current iteration bassed on det_id
    5959     // find all exp_tags in the current det_id/iteration from detInputExp
    5960     // find all exp_tags in the current det_id/iteration from detResidExp
    5961     // compare the counts of exp_tags
     5959    // find all exp_ids in the current det_id/iteration from detInputExp
     5960    // find all exp_ids in the current det_id/iteration from detResidExp
     5961    // compare the counts of exp_ids
    59625962
    59635963    psString query = pxDataGet("dettool_find_completed_runs.sql");
     
    59685968
    59695969    {
    5970         // build a query to search by det_id, iteration, exp_tag
     5970        // build a query to search by det_id, iteration, exp_id
    59715971        psMetadata *where = psMetadataAlloc();
    59725972        bool status = false;
     
    62716271    // select detRun.det_id
    62726272    // select detRun.iteration
    6273     // select detInputExp.exp_tag
     6273    // select detInputExp.exp_id
    62746274    // select detResidExp.accept
    62756275    // by:
    62766276    // find the current iteration bassed on det_id
    6277     // find all exp_tags in the current det_id/iteration from detInputExp
    6278     // find all exp_tags in the current det_id/iteration from detResidExp
    6279     // compare the counts of exp_tags
     6277    // find all exp_ids in the current det_id/iteration from detInputExp
     6278    // find all exp_ids in the current det_id/iteration from detResidExp
     6279    // compare the counts of exp_ids
    62806280
    62816281    psString query = psStringCopy(
     
    62836283        "   detRun.det_id AS det_id,"
    62846284        "   detRun.iteration,"
    6285         "   detInputExp.exp_tag,"
     6285        "   detInputExp.exp_id,"
    62866286        "   detResidExp.accept"
    62876287        " FROM detRun"
     
    62926292        "   ON detRun.det_id = detResidExp.det_id"
    62936293        "   AND detRun.iteration = detResidExp.iteration"
    6294         "   AND detInputExp.exp_tag = detResidExp.exp_tag"
     6294        "   AND detInputExp.exp_id = detResidExp.exp_id"
    62956295        " WHERE"
    62966296        "   detRun.state = 'run'"
     
    63106310        "   detRun.det_id,"
    63116311        "   detRun.iteration,"
    6312         "   detInputExp.exp_tag"
     6312        "   detInputExp.exp_id"
    63136313        " HAVING"
    6314         "   COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
     6314        "   COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
    63156315        );
    63166316
     
    63576357    for (long i = 0; i < psArrayLength(output); i++) {
    63586358        psMetadata *row = output->data[i];
    6359         psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag");
     6359        psString exp_id = psMetadataLookupStr(&status, row, "exp_id");
    63606360        if (!status) {
    63616361            // rollback
     
    63636363                psError(PS_ERR_UNKNOWN, false, "database error");
    63646364            }
    6365             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
     6365            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
    63666366            psFree(output);
    63676367            return false;
     
    63836383                    (psS32)atol(det_id),
    63846384                    newIteration,
    6385                     exp_tag,
     6385                    (psS64)atoll(exp_id),
    63866386                    accept
    63876387                )
     
    64246424    }
    64256425
    6426     // we have to support multipe exp_tags
    6427     psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
     6426    // we have to support multipe exp_ids
     6427    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
    64286428    if (!item) {
    64296429        // this shouldn't actually happen when using psArgs
    6430         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    6431         return false;
    6432     }
    6433 
    6434     psList *exp_tag_list = item->data.list;
     6430        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     6431        return false;
     6432    }
     6433
     6434    psList *exp_id_list = item->data.list;
    64356435    psMetadata *where = psMetadataAlloc();
    6436     // make sure that -exp_tag was parsed correctly
     6436    // make sure that -exp_id was parsed correctly
    64376437    // XXX this can be removed someday
    64386438    if (item->type == PS_DATA_METADATA_MULTI) {
     
    64406440        psMetadataItem *mItem = NULL;
    64416441        while ((mItem = psListGetAndIncrement(iter))) {
    6442             psString exp_tag = mItem->data.V;
    6443             // if exp_tag is NULL then it means that -exp_tag has not been
     6442            psString exp_id = mItem->data.V;
     6443            // if exp_id is NULL then it means that -exp_id has not been
    64446444            // specified
    6445             if (!exp_tag) {
     6445            if (!exp_id) {
    64466446                psError(PS_ERR_UNKNOWN, true,
    6447                         "at least one -exp_tag is required");
     6447                        "at least one -exp_id is required");
    64486448                psFree(where);
    64496449                return false;
    64506450            }
    64516451
    6452             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
    6453                         PS_META_DUPLICATE_OK, "==", exp_tag)) {
    6454                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     6452            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
     6453                        PS_META_DUPLICATE_OK, "==", exp_id)) {
     6454                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    64556455                psFree(iter);
    64566456                psFree(where);
     
    64606460        psFree(iter);
    64616461    } else {
    6462         psAbort(                "-exp_tag was not parsed correctly (this should not happen");
    6463     }
    6464 
    6465     // check that the specified exp_tags actually exist in the iteration zero
     6462        psAbort(                "-exp_id was not parsed correctly (this should not happen");
     6463    }
     6464
     6465    // check that the specified exp_ids actually exist in the iteration zero
    64666466    // detInputExp set
    64676467
     
    64876487    }
    64886488
    6489     // build a hash for the valid exp_tags
    6490     psHash *valid_exp_tags = psHashAlloc(psArrayLength(detrendExps));
     6489    // build a hash for the valid exp_ids
     6490    psHash *valid_exp_ids = psHashAlloc(psArrayLength(detrendExps));
     6491// XXX: FIXME!
     6492#if 0
    64916493    for (long i = 0; i < psArrayLength(detrendExps); i++) {
    6492         psHashAdd(valid_exp_tags,
    6493             ((detInputExpRow *)detrendExps->data[i])->exp_tag,
     6494        psHashAdd(valid_exp_ids,
     6495            ((detInputExpRow *)detrendExps->data[i])->exp_id,
    64946496            detrendExps->data[i]
    64956497        );
    64966498    }
     6499#endif
    64976500    psFree(detrendExps);
    64986501
     
    65016504    if (!psDBTransaction(config->dbh)) {
    65026505        psError(PS_ERR_UNKNOWN, false, "database error");
    6503         psFree(valid_exp_tags);
     6506        psFree(valid_exp_ids);
    65046507        return false;
    65056508    }
     
    65126515            psError(PS_ERR_UNKNOWN, false, "database error");
    65136516        }
    6514         psFree(valid_exp_tags);
    6515         return false;
    6516     }
    6517 
    6518     // check exp_tags and build up an array of new detInputExp rows at the same
     6517        psFree(valid_exp_ids);
     6518        return false;
     6519    }
     6520
     6521    // check exp_ids and build up an array of new detInputExp rows at the same
    65196522    // time
    6520     psListIterator *iter = psListIteratorAlloc(exp_tag_list, 0, false);
     6523    psListIterator *iter = psListIteratorAlloc(exp_id_list, 0, false);
    65216524    psMetadataItem *mItem = NULL;
    6522     psArray *newInputExps = psArrayAllocEmpty(psListLength(exp_tag_list));
     6525    psArray *newInputExps = psArrayAllocEmpty(psListLength(exp_id_list));
    65236526    while ((mItem = psListGetAndIncrement(iter))) {
    6524         detInputExpRow *inputExp = psHashLookup(valid_exp_tags,
     6527        detInputExpRow *inputExp = psHashLookup(valid_exp_ids,
    65256528                (char *)mItem->data.V);
    65266529        if (!inputExp) {
     
    65296532                psError(PS_ERR_UNKNOWN, false, "database error");
    65306533            }
    6531             // invalid exp_tag
    6532             psError(PS_ERR_UNKNOWN, false, "exp_tag %s is invalid for det_id %s",
     6534            // invalid exp_id
     6535            psError(PS_ERR_UNKNOWN, false, "exp_id %s is invalid for det_id %s",
    65336536                    (char *)mItem->data.V, det_id);
    65346537            psFree(iter);
    6535             psFree(valid_exp_tags);
     6538            psFree(valid_exp_ids);
    65366539            return false;
    65376540        }
     
    65396542            (psS32)atol(det_id),
    65406543            newIteration,
    6541             inputExp->exp_tag,
     6544            inputExp->exp_id,
    65426545            true   // use
    65436546        );
     
    65466549    }
    65476550    psFree(iter);
    6548     psFree(valid_exp_tags);
     6551    psFree(valid_exp_ids);
    65496552
    65506553    for (long i = 0; i < psArrayLength(newInputExps); i++) {
Note: See TracChangeset for help on using the changeset viewer.