Exemplo n.º 1
0
def protocol():
    diagnosis_col = "12"
    num_diagnosis_cols = 13

    left_diagnosis_cols = [
        defCol(str(i), "INTEGER", 1) for i in range(num_diagnosis_cols)
    ]
    left_diagnosis = cc.create("left_diagnosis", left_diagnosis_cols, {1})

    right_diagnosis_cols = [
        defCol(str(i), "INTEGER", 2) for i in range(num_diagnosis_cols)
    ]
    right_diagnosis = cc.create("right_diagnosis", right_diagnosis_cols, {2})

    cohort = cc.concat([left_diagnosis, right_diagnosis], "cohort")
    counts = cc.aggregate_count(cohort, "counts", [diagnosis_col], "total")
    cc.collect(cc.sort_by(counts, "actual", "total"), 1)

    return {left_diagnosis, right_diagnosis}
Exemplo n.º 2
0
        def protocol():
            pid_col = "8"
            diagnosis_col = "16"

            cols_to_skip = 8
            num_diagnosis_cols = 13

            left_diagnosis_cols = [
                defCol(str(i + cols_to_skip), "INTEGER", 1)
                for i in range(num_diagnosis_cols)
            ]
            left_diagnosis = cc.create("left_diagnosis", left_diagnosis_cols,
                                       {1})

            left_cohort = cc.create("left_cohort",
                                    [defCol("pid", "INTEGER", 1)], {1})

            left_selected = cc.filter_by(left_diagnosis, "left_selected",
                                         pid_col, left_cohort)

            right_diagnosis_cols = [
                defCol(str(i + cols_to_skip), "INTEGER", 2)
                for i in range(num_diagnosis_cols)
            ]
            right_diagnosis = cc.create("right_diagnosis",
                                        right_diagnosis_cols, {2})

            right_cohort = cc.create("right_cohort",
                                     [defCol("pid", "INTEGER", 2)], {2})

            right_selected = cc.filter_by(right_diagnosis, "right_selected",
                                          pid_col, right_cohort)

            cohort = cc.concat([left_selected, right_selected], "cohort")
            counts = cc.aggregate_count(cohort, "counts", [diagnosis_col],
                                        "total")
            cc.collect(cc.sort_by(counts, "actual", "total"), 1)

            return {left_diagnosis, left_cohort, right_diagnosis, right_cohort}