updated how data is exported to flat_cohort_table