def generate_copo_samples_data(profile_id): # This method generates the 'json' for building the UI table s = Sample(profile_id) src = Source(profile_id) samples = s.get_all_samples() columns = [] dataSet = [] # headers for el in src.schema: if not hasattr(el, 'show_in_table') or el.show_in_table == 'true': columns.append({"title": el.label}) for el in s.schema: if not hasattr(el, 'show_in_table') or el.show_in_table == 'true': columns.append({"title": el.label}) columns.append({"title": " "}) # extra 'blank' header for record actions column # data for sm in samples: source = Source(profile_id).get_source_from_sample_id(sm['source_id']) src_row = get_record_data(source, src.schema) src_row.pop() sm_row = get_record_data(sm, s.schema) dataSet.append(src_row + sm_row) return {"columns": columns, "dataSet": dataSet, "table_id": "sample_table"}