def addIndicatorFeatures(allClinDict):

    magicStrings = ["patient", "person", "vital", "surviv", "race", "ethnic",
                    "prior", "gender", "age_at", "ageat", "radiation", "chemo",
                    "therapy", "treat", "performance", "days_to_", "daysto",
                    "year_of", "yearof", "surgical", "recurrence", "pregnancies"]

    keyList = allClinDict.keys()
    keyList.sort()

    for aKey in keyList:
        if (aKey == "bcr_patient_barcode"):
            continue
        (keyType, nCount, nNA, nCard, labelList,
         labelCount) = miscClin.lookAtKey(allClinDict[aKey])

        if (keyType == "NOMINAL"):
            if (nCard > 2 and nCard < 27):

                print " "
                print " "
                print " in addIndicatorFeatures ... ", aKey, keyType, nCard, labelList, labelCount

                for aLabel in labelList:

                    # sometimes even though we have a "categorical" feature, some of the
                    # categories appear to be integers or floating point values
                    # ...
                    if (type(aLabel) is float):
                        print " we seem to have a floating point value ??? ", aLabel
                        iVal = int(aLabel + 0.001)
                        xVal = float(aLabel) - iVal
                        print iVal, xVal
                        if (abs(xVal) < 0.001):
                            aLabel = "%d" % iVal
                        else:
                            aLabel = str(aLabel)
                    elif (type(aLabel) is int):
                        iVal = int(aLabel)
                        aLabel = "%d" % iVal

                    print " "
                    ## print aKey, aLabel
                    try:
                        # 012345678901234567890123456789...
                        # C:CLIN:<label>
                        # C:CLIN:<label>:a:b:c:d:e
                        if (aKey[1] == ":" and aKey[6] == ":"):
                            # if this feature name already has a prefix (eg
                            # "C:CLIN:")
                            featType = aKey[2:7]
                            i1 = aKey[7:].find(':')
                            if (i1 < 0):
                                # if there are no further ':'
                                firstName = aKey[7:]
                                secondName = ":::::"
                            else:
                                # if there are ...
                                firstName = aKey[7:7 + i1]
                                secondName = aKey[7 + i1 + 1:]
                            print " (a) got to here ... ", featType, aLabel, firstName, secondName
                            newLabel = "B:" + featType + \
                                "I(" + aLabel + "|" + firstName + ")" + \
                                secondName
                            print " (b) got to here ... ", newLabel
                            if (newLabel.find("|):") > 0):
                                print " (a) BAILING !!!! ", newLabel
                                sys.exit(-1)
                        else:
                            # here we really need to have some way to guess whether this
                            # should be a CLIN or a SAMP feature ...
                            typeString = "UNK"
                            for aString in magicStrings:
                                if (aKey.find(aString) >= 0):
                                    typeString = "CLIN"
                            if (typeString == "UNK"):
                                print " defaulting to type SAMP for this feature : <%s> " % (aKey)
                                typeString = "SAMP"

                            print " (c) got to here ... ", typeString, aLabel

                            newLabel = "B:" + typeString + ":" + \
                                "I(" + aLabel + "|" + aKey + ")"
                    except:
                        print " (b) BAILING !!! "
                        print " ERROR in addIndicatorFeatures ??? ", aLabel, aKey
                        sys.exit(-1)

                    # make sure there are no blanks ...
                    newLabel = tsvIO.replaceBlanks(newLabel, "_")

                    if (newLabel in allClinDict.keys()):
                        print " this indicator variable already exists so I will not make a new one ... ", newLabel
                        continue

                    curV = allClinDict[aKey]
                    numClin = len(curV)
                    tmpV = [0] * numClin
                    print "     ... looping over %d values ... default new value is zero " % (numClin)
                    for kk in range(numClin):
                        print kk, allClinDict[aKey][kk], aLabel, type(allClinDict[aKey][kk]), type(aLabel)
                        if (allClinDict[aKey][kk] == "NA"):
                            tmpV[kk] = "NA"
                        elif (str(allClinDict[aKey][kk]).lower() == str(aLabel).lower()):
                            tmpV[kk] = 1
                    print " adding new feature : ", newLabel
                    allClinDict[newLabel] = tmpV

    return (allClinDict)