def process(x): baseType = checkBaseType(x) semanticType = "Latitude" if x == "": return (x, "{}\t{}\tNULL".format(baseType, semanticType)) elif isIntOrNot(x) or isFloatOrNot(x): return (x, "{}\t{}\tValid".format(baseType, semanticType)) else: return (x, "{}\t{}\tInvalid".format(baseType, semanticType))
def checkBaseType(x): if isIntOrNot(x): return "INT" elif isFloatOrNot(x): return "DECIMAL" elif re.match(r"^(0?[1-9]|1[012])/(0?[1-9]|[12][0-9]|3[01])/\d{4}$", x) \ or re.match(r"^(0?[1-9]|1[0-9]|2[0-3]):(0?[1-9]|[1-5][0-9]):(0?[1-9]|[1-5][0-9])$", x): return "DATETIME" else: return "TEXT"