def get_main_data():
    """ Get data in main collection in JSON serialized form. """
    search = _add_search_filter()
    cols = {'Publication': 1, 'Format': 1, 'Chemistry': 1, 'Electrolyte': 1,
            'SOC': 1, '_id': 0}
    results = find(collection=MAIN_COLLECTION, search=search, projection=cols)
    data = json.dumps(list(results))
    return data
def entry_table(tab):
    """ Render data table. """
    if tab == "view-data":
        data = list(find(MAIN_COLLECTION, projection={'_id': 0}))
        for dct in data:
            dct.pop('Author')
            dct.pop('Year')
            gases = dct.pop('Gases')
            for gas, value in gases.items():
                dct[gas] = value
        columns = [{"name": i, "id": i} for i in data[0].keys()]

        return columns, data

    raise PreventUpdate
def get_flammability_data(experiment):
    """ Get flammability data for a selected experiment. """
    id = make_unique_id(experiment)
    results = list(find(collection=FLAMMABILITY_COLLECTION,
                        search={'_id': id}))
    return results[0]