示例#1
0
文件: api.py 项目: gberriz/hmslincs
 def dehydrate(self, bundle):
     # TODO: the following call executes the query *just* to get the column names
     _facility_id =str(bundle.data['facility_id'])
     visibleColumns = get_visible_columns(views.DataSetManager(bundle.obj).get_table())
     bundle.data = get_detail_bundle(bundle.obj, ['dataset',''])
     # TODO: this is a kludge to deal with issue #103 db: api: URI for datasetdata is incorrect
     bundle.data['endpointFile'] = {'uri':'http://lincs.hms.harvard.edu/db/api/v1/datasetdata/'+ _facility_id + "/?format=csv",
                                    'noCols':len(visibleColumns),
                                    'cols':visibleColumns.values()
                                    }
     return bundle
示例#2
0
 def dehydrate(self, bundle):
     # TODO: the following call executes the query *just* to get the column names
     _facility_id =str(bundle.data['facility_id'])
     visibleColumns = get_visible_columns(views.DataSetManager(bundle.obj).get_table())
     bundle.data = get_detail_bundle(bundle.obj, ['dataset',''])
     saf_uri = self.absolute_uri.replace('dataset','datasetdata')
     saf_uri = saf_uri.replace('json','csv');
     bundle.data['datapointFile'] = {'uri': saf_uri,
                                    'noCols':len(visibleColumns),
                                    'cols':visibleColumns.values()
                                    }
     return bundle