Exemplo n.º 1
0
def handleRow(row, id, eventCache, infoCache):
    obj = {"info": [], "events": []}
    cms_get_patient.handleRow(row, obj)
    eventCache.extend(
        filter(
            lambda e: e['time'] >= from_time and e['time'] <= to_time and e[
                'group'] not in ignore, obj["events"]))
    for info in obj["info"]:
        if info["id"] == "age":
            try:
                bin = (int(info["value"]) // age_bin) * age_bin
                infoCache.append("age_" + str(bin) + "_" + str(bin + age_bin))
            except ValueError:
                pass
        elif info["id"] == "born":
            try:
                if info["value"] != "N/A" and age_time is not None:
                    bin = (toAge(info["value"]) // age_bin) * age_bin
                    infoCache.append("age_" + str(bin) + "_" +
                                     str(bin + age_bin))
            except ValueError:
                pass
        elif info["id"] == "death" and info["value"] != "N/A":
            infoCache.append("dead")
        elif info["id"] == "gender":
            if info["value"] == "M":
                infoCache.append("sex_m")
            elif info["value"] == "F":
                infoCache.append("sex_f")
Exemplo n.º 2
0
def handleRow(row, id, eventCache, infoCache):
    obj = {
        "info": [],
        "events": []
    }
    cms_get_patient.handleRow(row, obj)
    eventCache.extend(filter(lambda e: e['time'] >= from_time and e['time'] <= to_time and e['group'] not in ignore, obj["events"]))
    for info in obj["info"]:
        if info["id"] == "age":
            try:
                bin = (int(info["value"]) // age_bin_count) * age_bin_count
                infoCache.append("age_" + str(bin) + "_" + str(bin + age_bin_count))
            except ValueError:
                pass
        elif info["id"] == "born":
            try:
                if info["value"] != "N/A" and age_time is not None:
                    bin = (util.toAge(info["value"], age_time) // age_bin_count) * age_bin_count
                    infoCache.append("age_" + str(bin) + "_" + str(bin + age_bin_count))
            except ValueError:
                pass
        elif info["id"] == "death" and info["value"] != "N/A":
            infoCache.append("dead")
        elif info["id"] == "gender":
            if info["value"] == "M":
                infoCache.append("sex_m")
            elif info["value"] == "F":
                infoCache.append("sex_f")
Exemplo n.º 3
0
def handleRow(row, id, eventCache, infoCache):
    obj = {
        "info": [],
        "events": []
    }
    cms_get_patient.handleRow(row, obj)
    eventCache.extend(obj["events"])
    """ FIXME no info handling yet